/* Kernel datapath information. */
struct dpif dpif; /* Kernel datapath. */
- int dp_idx; /* Kernel datapath index. */
struct port_array ifaces; /* Indexed by kernel datapath port number. */
/* Bridge ports. */
&& strcmp(p->devname, br->name)) {
int retval = dpif_port_del(&br->dpif, p->port);
if (retval) {
- VLOG_ERR("failed to remove %s interface from nl:%d: %s",
- p->devname, br->dp_idx, strerror(retval));
+ VLOG_ERR("failed to remove %s interface from dp%u: %s",
+ p->devname, dpif_id(&br->dpif), strerror(retval));
}
}
}
int error = dpif_port_add(&br->dpif, if_name, next_port_no++);
if (error != EEXIST) {
if (next_port_no >= 256) {
- VLOG_ERR("ran out of valid port numbers on nl:%d",
- br->dp_idx);
+ VLOG_ERR("ran out of valid port numbers on dp%u",
+ dpif_id(&br->dpif));
goto out;
}
if (error) {
- VLOG_ERR("failed to add %s interface to nl:%d: %s",
- if_name, br->dp_idx, strerror(error));
+ VLOG_ERR("failed to add %s interface to dp%u: %s",
+ if_name, dpif_id(&br->dpif), strerror(error));
}
break;
}
for (j = 0; j < port->n_ifaces; ) {
struct iface *iface = port->ifaces[j];
if (iface->dp_ifidx < 0) {
- VLOG_ERR("%s interface not in nl:%d, dropping",
- iface->name, br->dp_idx);
+ VLOG_ERR("%s interface not in dp%u, dropping",
+ iface->name, dpif_id(&br->dpif));
iface_destroy(iface);
} else {
- VLOG_DBG("datapath nl:%d has interface %s on port %d",
- br->dp_idx, iface->name, iface->dp_ifidx);
+ VLOG_DBG("dp%u has interface %s on port %d",
+ dpif_id(&br->dpif), iface->name, iface->dp_ifidx);
j++;
}
if (!strcmp(iface->name, br->name)) {
list_push_back(&all_bridges, &br->node);
- br->dp_idx = br->dpif.minor;
- VLOG_INFO("created bridge %s with dp_idx %d", br->name, br->dp_idx);
+ VLOG_INFO("created bridge %s on dp%u", br->name, dpif_id(&br->dpif));
return br;
}
bridge_destroy(struct bridge *br)
{
if (br) {
+ int error;
+
while (br->n_ports > 0) {
port_destroy(br->ports[br->n_ports - 1]);
}
list_remove(&br->node);
- if (br->dp_idx >= 0) {
- int retval = dpif_delete(&br->dpif);
- if (retval && retval != ENOENT) {
- VLOG_ERR("failed to delete datapath nl:%d: %s",
- br->dp_idx, strerror(retval));
- }
- dpif_close(&br->dpif);
+ error = dpif_delete(&br->dpif);
+ if (error && error != ENOENT) {
+ VLOG_ERR("failed to delete dp%u: %s",
+ dpif_id(&br->dpif), strerror(error));
}
+ dpif_close(&br->dpif);
ofproto_destroy(br->ofproto);
rconn_destroy(br->rconn);
rconn_packet_counter_destroy(br->txqlen);
struct iface *iface = iface_lookup(br, p->devname);
if (iface) {
if (iface->dp_ifidx >= 0) {
- VLOG_WARN("datapath nl:%d reported interface %s twice",
- br->dp_idx, p->devname);
+ VLOG_WARN("dp%u reported interface %s twice",
+ dpif_id(&br->dpif), p->devname);
} else if (iface_from_dp_ifidx(br, p->port)) {
- VLOG_WARN("datapath nl:%d reported interface %"PRIu16" twice",
- br->dp_idx, p->port);
+ VLOG_WARN("dp%u reported interface %"PRIu16" twice",
+ dpif_id(&br->dpif), p->port);
} else {
uint16_t ofp_port = p->port == ODPP_LOCAL ? OFPP_LOCAL : p->port;
port_array_set(&br->ifaces, ofp_port, iface);