/*
- * Copyright (c) 2008 Nicira Networks.
+ * Copyright (c) 2008, 2010 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
l3->l3[PORT_ARRAY_L3(idx)] = p;
}
+/* Sets 'pa' element numbered 'idx' to NULL. */
+void
+port_array_delete(struct port_array *pa, uint16_t idx)
+{
+ unsigned int l1_idx = PORT_ARRAY_L1(idx);
+ unsigned int l2_idx = PORT_ARRAY_L2(idx);
+ unsigned int l3_idx = PORT_ARRAY_L3(idx);
+
+ pa->l1[l1_idx]->l2[l2_idx]->l3[l3_idx] = NULL;
+}
+
static void *
next(const struct port_array *pa, unsigned int *idxp)
{
/*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void port_array_destroy(struct port_array *);
void port_array_clear(struct port_array *);
void port_array_set(struct port_array *, uint16_t idx, void *);
+void port_array_delete(struct port_array *, uint16_t idx);
void *port_array_first(const struct port_array *, unsigned int *);
void *port_array_next(const struct port_array *, unsigned int *);
unsigned int port_array_count(const struct port_array *);
}
netdev_close(osp->netdev);
free(osp);
- port_array_set(&os->ports, odp_port, NULL);
+ port_array_delete(&os->ports, odp_port);
}
}
uint16_t odp_port = ofp_port_to_odp_port(ofport->opp.port_no);
netdev_monitor_remove(p->netdev_monitor, ofport->netdev);
- port_array_set(&p->ports, odp_port, NULL);
+ port_array_delete(&p->ports, odp_port);
shash_delete(&p->port_by_name,
shash_find(&p->port_by_name, (char *) ofport->opp.name));
if (p->sflow) {
struct ofpbuf *packet = queue_pop_head(q);
if (!q->n) {
free(q);
- port_array_set(&ps->queues, port_no, NULL);
+ port_array_delete(&ps->queues, port_no);
}
ps->n_queued--;
return packet;