#include "vlog.h"
#define THIS_MODULE VLM_dpif
+/* A datapath interface. */
+struct dpif {
+ char *name;
+ unsigned int minor;
+ int fd;
+};
+
/* Rate limit for individual messages going to or from the datapath, output at
* DBG level. This is very high because, if these are enabled, it is because
* we really need to see them. */
static int get_minor_from_name(const char *name, unsigned int *minor);
static int name_to_minor(const char *name, unsigned int *minor);
static int lookup_minor(const char *name, unsigned int *minor);
-static int open_by_minor(unsigned int minor, struct dpif *);
+static int open_by_minor(unsigned int minor, struct dpif **dpifp);
static int make_openvswitch_device(unsigned int minor, char **fnp);
static void check_rw_odp_flow(struct odp_flow *);
int
-dpif_open(const char *name, struct dpif *dpif)
+dpif_open(const char *name, struct dpif **dpifp)
{
+ struct dpif *dpif;
+ unsigned int minor;
int listen_mask;
int error;
- dpif->fd = -1;
+ *dpifp = NULL;
- error = name_to_minor(name, &dpif->minor);
+ error = name_to_minor(name, &minor);
if (error) {
return error;
}
- error = open_by_minor(dpif->minor, dpif);
+ error = open_by_minor(minor, &dpif);
if (error) {
return error;
}
dpif_close(dpif);
return error;
}
+ *dpifp = dpif;
return 0;
}
{
if (dpif) {
free(dpif->name);
- dpif->name = NULL;
close(dpif->fd);
- dpif->fd = -1;
+ free(dpif);
}
}
}
int
-dpif_create(const char *name, struct dpif *dpif)
+dpif_create(const char *name, struct dpif **dpifp)
{
unsigned int minor;
int error;
+ *dpifp = NULL;
if (!get_minor_from_name(name, &minor)) {
/* Minor was specified in 'name', go ahead and create it. */
- error = open_by_minor(minor, dpif);
+ struct dpif *dpif;
+
+ error = open_by_minor(minor, &dpif);
if (error) {
return error;
}
} else {
error = ioctl(dpif->fd, ODP_DP_CREATE, name) < 0 ? errno : 0;
}
- if (error) {
+ if (!error) {
+ *dpifp = dpif;
+ } else {
dpif_close(dpif);
}
return error;
} else {
for (minor = 0; minor < ODP_MAX; minor++) {
- error = open_by_minor(minor, dpif);
+ struct dpif *dpif;
+
+ error = open_by_minor(minor, &dpif);
if (error) {
return error;
}
error = ioctl(dpif->fd, ODP_DP_CREATE, name) < 0 ? errno : 0;
if (!error) {
+ *dpifp = dpif;
return 0;
}
dpif_close(dpif);
}
\f
struct dpifmon {
- struct dpif dpif;
+ struct dpif *dpif;
struct nl_sock *sock;
int local_ifindex;
};
if (error) {
goto error;
}
- error = dpif_port_get_name(&mon->dpif, ODPP_LOCAL,
+ error = dpif_port_get_name(mon->dpif, ODPP_LOCAL,
local_name, sizeof local_name);
if (error) {
goto error_close_dpif;
return 0;
error_close_dpif:
- dpif_close(&mon->dpif);
+ dpif_close(mon->dpif);
error:
free(mon);
*monp = NULL;
dpifmon_destroy(struct dpifmon *mon)
{
if (mon) {
- dpif_close(&mon->dpif);
+ dpif_close(mon->dpif);
nl_sock_destroy(mon->sock);
}
}
}
static int
-open_by_minor(unsigned int minor, struct dpif *dpif)
+open_by_minor(unsigned int minor, struct dpif **dpifp)
{
+ struct dpif *dpif;
int error;
char *fn;
int fd;
- dpif->minor = -1;
- dpif->fd = -1;
+ *dpifp = NULL;
error = make_openvswitch_device(minor, &fn);
if (error) {
return error;
free(fn);
return error;
}
-
free(fn);
+
+ dpif = xmalloc(sizeof *dpif);
dpif->name = xasprintf("dp%u", dpif->minor);
dpif->minor = minor;
dpif->fd = fd;
+ *dpifp = dpif;
return 0;
}
\f
#include <stddef.h>
#include <stdint.h>
+struct dpif;
struct ofpbuf;
-/* A datapath interface. Opaque. */
-struct dpif {
- char *name;
- unsigned int minor;
- int fd;
-};
-
-int dpif_open(const char *name, struct dpif *);
-int dpif_create(const char *name, struct dpif *);
+int dpif_open(const char *name, struct dpif **);
+int dpif_create(const char *name, struct dpif **);
void dpif_close(struct dpif *);
const char *dpif_name(const struct dpif *);
char *serial; /* Serial number. */
/* Datapath. */
- struct dpif dpif;
+ struct dpif *dpif;
struct dpifmon *dpifmon;
struct port_array ports; /* Index is ODP port nr; ofport->opp.port_no is
* OFP port nr. */
struct dpifmon *dpifmon;
struct odp_stats stats;
struct ofproto *p;
- struct dpif dpif;
+ struct dpif *dpif;
int error;
*ofprotop = NULL;
VLOG_ERR("failed to open datapath %s: %s", datapath, strerror(error));
return error;
}
- error = dpif_get_dp_stats(&dpif, &stats);
+ error = dpif_get_dp_stats(dpif, &stats);
if (error) {
VLOG_ERR("failed to obtain stats for datapath %s: %s",
datapath, strerror(error));
- dpif_close(&dpif);
+ dpif_close(dpif);
return error;
}
- error = dpif_set_listen_mask(&dpif, ODPL_MISS | ODPL_ACTION);
+ error = dpif_set_listen_mask(dpif, ODPL_MISS | ODPL_ACTION);
if (error) {
VLOG_ERR("failed to listen on datapath %s: %s",
datapath, strerror(error));
- dpif_close(&dpif);
+ dpif_close(dpif);
return error;
}
- dpif_flow_flush(&dpif);
- dpif_purge(&dpif);
+ dpif_flow_flush(dpif);
+ dpif_purge(dpif);
/* Start monitoring datapath ports for status changes. */
error = dpifmon_create(datapath, &dpifmon);
if (error) {
VLOG_ERR("failed to starting monitoring datapath %s: %s",
datapath, strerror(error));
- dpif_close(&dpif);
+ dpif_close(dpif);
return error;
}
/* Initialize settings. */
p = xcalloc(1, sizeof *p);
p->fallback_dpid = pick_fallback_dpid();
- p->datapath_id = pick_datapath_id(&dpif, p->fallback_dpid);
+ p->datapath_id = pick_datapath_id(dpif, p->fallback_dpid);
VLOG_INFO("using datapath ID %012"PRIx64, p->datapath_id);
p->manufacturer = xstrdup("Nicira Networks, Inc.");
p->hardware = xstrdup("Reference Implementation");
uint64_t old_dpid = p->datapath_id;
p->datapath_id = (datapath_id
? datapath_id
- : pick_datapath_id(&p->dpif, p->fallback_dpid));
+ : pick_datapath_id(p->dpif, p->fallback_dpid));
if (p->datapath_id != old_dpid) {
VLOG_INFO("datapath ID changed to %012"PRIx64, p->datapath_id);
rconn_reconnect(p->controller->rconn);
{
if (in_band != (p->in_band != NULL)) {
if (in_band) {
- return in_band_create(p, &p->dpif, p->switch_status,
+ return in_band_create(p, p->dpif, p->switch_status,
p->controller->rconn, &p->in_band);
} else {
ofproto_set_discovery(p, false, NULL, true);
return error;
}
error = discovery_create(re, update_resolv_conf,
- &p->dpif, p->switch_status,
+ p->dpif, p->switch_status,
&p->discovery);
if (error) {
return error;
ofconn_destroy(ofconn, p);
}
- dpif_close(&p->dpif);
+ dpif_close(p->dpif);
dpifmon_destroy(p->dpifmon);
PORT_ARRAY_FOR_EACH (ofport, &p->ports, port_no) {
ofport_free(ofport);
struct ofpbuf *buf;
int error;
- error = dpif_recv(&p->dpif, &buf);
+ error = dpif_recv(p->dpif, &buf);
if (error) {
if (error == ENODEV) {
/* Someone destroyed the datapath behind our back. The caller
* spin from here on out. */
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
VLOG_ERR_RL(&rl, "%s: datapath was destroyed externally",
- dpif_name(&p->dpif));
+ dpif_name(p->dpif));
return ENODEV;
}
break;
struct ofconn *ofconn;
size_t i;
- dpif_recv_wait(&p->dpif);
+ dpif_recv_wait(p->dpif);
dpifmon_wait(p->dpifmon);
LIST_FOR_EACH (ofconn, struct ofconn, node, &p->all_conns) {
ofconn_wait(ofconn);
/* XXX Should we translate the dpif_execute() errno value into an OpenFlow
* error code? */
- dpif_execute(&p->dpif, flow->in_port, odp_actions.actions,
+ dpif_execute(p->dpif, flow->in_port, odp_actions.actions,
odp_actions.n_actions, packet);
return 0;
}
{
COVERAGE_INC(ofproto_flush);
classifier_for_each(&ofproto->cls, CLS_INC_ALL, destroy_rule, ofproto);
- dpif_flow_flush(&ofproto->dpif);
+ dpif_flow_flush(ofproto->dpif);
if (ofproto->in_band) {
in_band_flushed(ofproto->in_band);
}
PORT_ARRAY_FOR_EACH (ofport, &p->ports, port_no) {
svec_add (&devnames, (char *) ofport->opp.name);
}
- dpif_port_list(&p->dpif, &odp_ports, &n_odp_ports);
+ dpif_port_list(p->dpif, &odp_ports, &n_odp_ports);
for (i = 0; i < n_odp_ports; i++) {
svec_add (&devnames, odp_ports[i].devname);
}
ports[n_ports++] = port_no;
}
}
- dpif_port_group_set(&p->dpif, group, ports, n_ports);
+ dpif_port_group_set(p->dpif, group, ports, n_ports);
free(ports);
}
COVERAGE_INC(ofproto_update_port);
ofport = shash_find_data(&p->port_by_name, devname);
- error = dpif_port_query_by_name(&p->dpif, devname, &odp_port);
+ error = dpif_port_query_by_name(p->dpif, devname, &odp_port);
if (!error) {
if (!ofport) {
/* New port. */
size_t i;
int error;
- error = dpif_port_list(&p->dpif, &ports, &n_ports);
+ error = dpif_port_list(p->dpif, &ports, &n_ports);
if (error) {
return error;
}
}
/* Execute the ODP actions. */
- if (!dpif_execute(&ofproto->dpif, flow->in_port,
+ if (!dpif_execute(ofproto->dpif, flow->in_port,
actions, n_actions, packet)) {
struct odp_flow_stats stats;
flow_extract_stats(flow, packet, &stats);
put->flow.actions = rule->odp_actions;
put->flow.n_actions = rule->n_odp_actions;
put->flags = flags;
- return dpif_flow_put(&ofproto->dpif, put);
+ return dpif_flow_put(ofproto->dpif, put);
}
static void
odp_flow.key = rule->cr.flow;
odp_flow.actions = NULL;
odp_flow.n_actions = 0;
- if (!dpif_flow_del(&p->dpif, &odp_flow)) {
+ if (!dpif_flow_del(p->dpif, &odp_flow)) {
update_stats(rule, &odp_flow.stats);
}
rule->installed = false;
bool drop_frags;
/* Figure out flags. */
- dpif_get_drop_frags(&p->dpif, &drop_frags);
+ dpif_get_drop_frags(p->dpif, &drop_frags);
flags = drop_frags ? OFPC_FRAG_DROP : OFPC_FRAG_NORMAL;
if (ofconn->send_flow_exp) {
flags |= OFPC_SEND_FLOW_EXP;
if (ofconn == p->controller) {
switch (flags & OFPC_FRAG_MASK) {
case OFPC_FRAG_NORMAL:
- dpif_set_drop_frags(&p->dpif, false);
+ dpif_set_drop_frags(p->dpif, false);
break;
case OFPC_FRAG_DROP:
- dpif_set_drop_frags(&p->dpif, true);
+ dpif_set_drop_frags(p->dpif, true);
break;
default:
VLOG_WARN_RL(&rl, "requested bad fragment mode (flags=%"PRIx16")",
return error;
}
- dpif_execute(&p->dpif, flow.in_port, actions.actions, actions.n_actions,
+ dpif_execute(p->dpif, flow.in_port, actions.actions, actions.n_actions,
&payload);
ofpbuf_delete(buffer);
n_wild = classifier_count(&p->cls) - classifier_count_exact(&p->cls);
/* Hash table. */
- dpif_get_dp_stats(&p->dpif, &dpstats);
+ dpif_get_dp_stats(p->dpif, &dpstats);
ots = append_stats_reply(sizeof *ots, ofconn, &msg);
memset(ots, 0, sizeof *ots);
ots->table_id = TABLEID_HASH;
packet_count = rule->packet_count;
byte_count = rule->byte_count;
- if (!dpif_flow_get_multiple(&p->dpif, odp_flows, n_odp_flows)) {
+ if (!dpif_flow_get_multiple(p->dpif, odp_flows, n_odp_flows)) {
size_t i;
for (i = 0; i < n_odp_flows; i++) {
struct odp_flow *odp_flow = &odp_flows[i];
size_t i;
int error;
- error = dpif_flow_list_all(&p->dpif, &flows, &n_flows);
+ error = dpif_flow_list_all(p->dpif, &flows, &n_flows);
if (error) {
return;
}
classifier_find_rule_exactly(&p->cls, &f->key, 0, UINT16_MAX));
if (!rule || !rule->installed) {
COVERAGE_INC(ofproto_unexpected_rule);
- dpif_flow_del(&p->dpif, f);
+ dpif_flow_del(p->dpif, f);
continue;
}
static void
do_add_dp(int argc UNUSED, char *argv[])
{
- struct dpif dpif;
+ struct dpif *dpif;
run(dpif_create(argv[1], &dpif), "add_dp");
- dpif_close(&dpif);
+ dpif_close(dpif);
if (argc > 2) {
do_add_if(argc, argv);
}
static void
do_del_dp(int argc UNUSED, char *argv[])
{
- struct dpif dpif;
+ struct dpif *dpif;
run(dpif_open(argv[1], &dpif), "opening datapath");
- run(dpif_delete(&dpif), "del_dp");
- dpif_close(&dpif);
+ run(dpif_delete(dpif), "del_dp");
+ dpif_close(dpif);
}
static int
do_add_if(int argc UNUSED, char *argv[])
{
bool failure = false;
- struct dpif dpif;
+ struct dpif *dpif;
int i;
run(dpif_open(argv[1], &dpif), "opening datapath");
}
}
if (port < 0) {
- port = get_free_port(&dpif);
+ port = get_free_port(dpif);
}
- error = dpif_port_add(&dpif, devname, port, flags);
+ error = dpif_port_add(dpif, devname, port, flags);
if (error) {
ovs_error(error, "adding %s as port %"PRIu16" of %s failed",
devname, port, argv[1]);
failure = true;
}
}
- dpif_close(&dpif);
+ dpif_close(dpif);
if (failure) {
exit(EXIT_FAILURE);
}
do_del_if(int argc UNUSED, char *argv[])
{
bool failure = false;
- struct dpif dpif;
+ struct dpif *dpif;
int i;
run(dpif_open(argv[1], &dpif), "opening datapath");
if (!name[strspn(name, "0123456789")]) {
port = atoi(name);
- } else if (!get_port_number(&dpif, name, &port)) {
+ } else if (!get_port_number(dpif, name, &port)) {
failure = true;
continue;
}
- error = dpif_port_del(&dpif, port);
+ error = dpif_port_del(dpif, port);
if (error) {
ovs_error(error, "deleting port %s from %s failed", name, argv[1]);
failure = true;
}
}
- dpif_close(&dpif);
+ dpif_close(dpif);
if (failure) {
exit(EXIT_FAILURE);
}
int i;
for (i = 1; i < argc; i++) {
const char *name = argv[i];
- struct dpif dpif;
+ struct dpif *dpif;
int error;
error = dpif_open(name, &dpif);
if (!error) {
- show_dpif(&dpif);
+ show_dpif(dpif);
} else {
ovs_error(error, "opening datapath %s failed", name);
failure = true;
unsigned int i;
for (i = 0; i < ODP_MAX; i++) {
char name[128];
- struct dpif dpif;
+ struct dpif *dpif;
int error;
sprintf(name, "dp%u", i);
error = dpif_open(name, &dpif);
if (!error) {
- show_dpif(&dpif);
+ show_dpif(dpif);
} else if (error != ENODEV) {
ovs_error(error, "opening datapath %s failed", name);
failure = true;
do_dump_flows(int argc UNUSED, char *argv[])
{
struct odp_flow *flows;
- struct dpif dpif;
+ struct dpif *dpif;
size_t n_flows;
struct ds ds;
size_t i;
run(dpif_open(argv[1], &dpif), "opening datapath");
- run(dpif_flow_list_all(&dpif, &flows, &n_flows), "listing all flows");
+ run(dpif_flow_list_all(dpif, &flows, &n_flows), "listing all flows");
ds_init(&ds);
for (i = 0; i < n_flows; i++) {
f->actions = actions;
f->n_actions = MAX_ACTIONS;
- dpif_flow_get(&dpif, f);
+ dpif_flow_get(dpif, f);
ds_clear(&ds);
format_odp_flow(&ds, f);
printf("%s\n", ds_cstr(&ds));
}
ds_destroy(&ds);
- dpif_close(&dpif);
+ dpif_close(dpif);
}
static void
do_del_flows(int argc UNUSED, char *argv[])
{
- struct dpif dpif;
+ struct dpif *dpif;
run(dpif_open(argv[1], &dpif), "opening datapath");
- run(dpif_flow_flush(&dpif), "deleting all flows");
- dpif_close(&dpif);
+ run(dpif_flow_flush(dpif), "deleting all flows");
+ dpif_close(dpif);
}
static void
do_dump_groups(int argc UNUSED, char *argv[])
{
struct odp_stats stats;
- struct dpif dpif;
+ struct dpif *dpif;
unsigned int i;
run(dpif_open(argv[1], &dpif), "opening datapath");
- run(dpif_get_dp_stats(&dpif, &stats), "get datapath stats");
+ run(dpif_get_dp_stats(dpif, &stats), "get datapath stats");
for (i = 0; i < stats.max_groups; i++) {
uint16_t ports[UINT16_MAX];
size_t n_ports;
- if (!dpif_port_group_get(&dpif, i, ports,
+ if (!dpif_port_group_get(dpif, i, ports,
ARRAY_SIZE(ports), &n_ports) && n_ports) {
size_t j;
printf("\n");
}
}
- dpif_close(&dpif);
+ dpif_close(dpif);
}
static void
static void
open_vconn(const char *name, struct vconn **vconnp)
{
- struct dpif dpif;
+ struct dpif *dpif;
struct stat s;
if (strstr(name, ":")) {
char *socket_name;
char *vconn_name;
- run(dpif_port_get_name(&dpif, ODPP_LOCAL, dpif_name, sizeof dpif_name),
+ run(dpif_port_get_name(dpif, ODPP_LOCAL, dpif_name, sizeof dpif_name),
"obtaining name of %s", dpif_name);
- dpif_close(&dpif);
+ dpif_close(dpif);
if (strcmp(dpif_name, name)) {
VLOG_INFO("datapath %s is named %s", name, dpif_name);
}
struct ofproto *ofproto; /* OpenFlow switch. */
/* Kernel datapath information. */
- struct dpif dpif; /* Kernel datapath. */
+ struct dpif *dpif; /* Datapath. */
struct port_array ifaces; /* Indexed by kernel datapath port number. */
/* Bridge ports. */
struct iface *iface = port->ifaces[j];
if (iface->dp_ifidx < 0) {
VLOG_ERR("%s interface not in datapath %s, ignoring",
- iface->name, dpif_name(&br->dpif));
+ iface->name, dpif_name(br->dpif));
} else {
if (iface->dp_ifidx != ODPP_LOCAL) {
svec_add(svec, iface->name);
bond_init();
for (i = 0; i < DP_MAX; i++) {
- struct dpif dpif;
+ struct dpif *dpif;
char devname[16];
sprintf(devname, "dp%d", i);
retval = dpif_open(devname, &dpif);
if (!retval) {
char dpif_name[IF_NAMESIZE];
- if (dpif_port_get_name(&dpif, ODPP_LOCAL,
+ if (dpif_port_get_name(dpif, ODPP_LOCAL,
dpif_name, sizeof dpif_name)
|| !cfg_has("bridge.%s.port", dpif_name)) {
- dpif_delete(&dpif);
+ dpif_delete(dpif);
}
- dpif_close(&dpif);
+ dpif_close(dpif);
} else if (retval != ENODEV) {
VLOG_ERR("failed to delete datapath dp%d: %s",
i, strerror(retval));
size_t n_dpif_ports;
struct svec want_ifaces;
- dpif_port_list(&br->dpif, &dpif_ports, &n_dpif_ports);
+ dpif_port_list(br->dpif, &dpif_ports, &n_dpif_ports);
bridge_get_all_ifaces(br, &want_ifaces);
for (i = 0; i < n_dpif_ports; i++) {
const struct odp_port *p = &dpif_ports[i];
if (!svec_contains(&want_ifaces, p->devname)
&& strcmp(p->devname, br->name)) {
- int retval = dpif_port_del(&br->dpif, p->port);
+ int retval = dpif_port_del(br->dpif, p->port);
if (retval) {
VLOG_ERR("failed to remove %s interface from %s: %s",
- p->devname, dpif_name(&br->dpif),
+ p->devname, dpif_name(br->dpif),
strerror(retval));
}
}
struct svec cur_ifaces, want_ifaces, add_ifaces;
int next_port_no;
- dpif_port_list(&br->dpif, &dpif_ports, &n_dpif_ports);
+ dpif_port_list(br->dpif, &dpif_ports, &n_dpif_ports);
svec_init(&cur_ifaces);
for (i = 0; i < n_dpif_ports; i++) {
svec_add(&cur_ifaces, dpif_ports[i].devname);
const char *if_name = add_ifaces.names[i];
for (;;) {
int internal = cfg_get_bool(0, "iface.%s.internal", if_name);
- int error = dpif_port_add(&br->dpif, if_name, next_port_no++,
+ int error = dpif_port_add(br->dpif, if_name, next_port_no++,
internal ? ODP_PORT_INTERNAL : 0);
if (error != EEXIST) {
if (next_port_no >= 256) {
VLOG_ERR("ran out of valid port numbers on %s",
- dpif_name(&br->dpif));
+ dpif_name(br->dpif));
goto out;
}
if (error) {
VLOG_ERR("failed to add %s interface to %s: %s",
- if_name, dpif_name(&br->dpif),
+ if_name, dpif_name(br->dpif),
strerror(error));
}
break;
struct iface *iface = port->ifaces[j];
if (iface->dp_ifidx < 0) {
VLOG_ERR("%s interface not in %s, dropping",
- iface->name, dpif_name(&br->dpif));
+ iface->name, dpif_name(br->dpif));
iface_destroy(iface);
} else {
if (iface->dp_ifidx == ODPP_LOCAL) {
local_iface = iface;
}
VLOG_DBG("%s has interface %s on port %d",
- dpif_name(&br->dpif),
+ dpif_name(br->dpif),
iface->name, iface->dp_ifidx);
j++;
}
ofproto_set_datapath_id(br->ofproto, dpid);
/* Set NetFlow configuration on this bridge. */
- dpif_get_netflow_ids(&br->dpif, &engine_type, &engine_id);
+ dpif_get_netflow_ids(br->dpif, &engine_type, &engine_id);
if (cfg_has("netflow.%s.engine-type", br->name)) {
engine_type = cfg_get_int(0, "netflow.%s.engine-type",
br->name);
free(br);
return NULL;
}
- dpif_flow_flush(&br->dpif);
+ dpif_flow_flush(br->dpif);
} else if (error) {
VLOG_ERR("failed to create datapath %s: %s", name, strerror(error));
free(br);
error = ofproto_create(name, &bridge_ofhooks, br, &br->ofproto);
if (error) {
VLOG_ERR("failed to create switch %s: %s", name, strerror(error));
- dpif_delete(&br->dpif);
- dpif_close(&br->dpif);
+ dpif_delete(br->dpif);
+ dpif_close(br->dpif);
free(br);
return NULL;
}
list_push_back(&all_bridges, &br->node);
- VLOG_INFO("created bridge %s on %s", br->name, dpif_name(&br->dpif));
+ VLOG_INFO("created bridge %s on %s", br->name, dpif_name(br->dpif));
return br;
}
port_destroy(br->ports[br->n_ports - 1]);
}
list_remove(&br->node);
- error = dpif_delete(&br->dpif);
+ error = dpif_delete(br->dpif);
if (error && error != ENOENT) {
VLOG_ERR("failed to delete %s: %s",
- dpif_name(&br->dpif), strerror(error));
+ dpif_name(br->dpif), strerror(error));
}
- dpif_close(&br->dpif);
+ dpif_close(br->dpif);
ofproto_destroy(br->ofproto);
free(br->controller);
mac_learning_destroy(br->ml);
}
port_array_clear(&br->ifaces);
- dpif_port_list(&br->dpif, &dpif_ports, &n_dpif_ports);
+ dpif_port_list(br->dpif, &dpif_ports, &n_dpif_ports);
for (i = 0; i < n_dpif_ports; i++) {
struct odp_port *p = &dpif_ports[i];
struct iface *iface = iface_lookup(br, p->devname);
if (iface) {
if (iface->dp_ifidx >= 0) {
VLOG_WARN("%s reported interface %s twice",
- dpif_name(&br->dpif), p->devname);
+ dpif_name(br->dpif), p->devname);
} else if (iface_from_dp_ifidx(br, p->port)) {
VLOG_WARN("%s reported interface %"PRIu16" twice",
- dpif_name(&br->dpif), p->port);
+ dpif_name(br->dpif), p->port);
} else {
port_array_set(&br->ifaces, p->port, iface);
iface->dp_ifidx = p->port;