-static void
-process_port_change(struct ofproto *ofproto, int error, char *devname)
-{
- if (error == ENOBUFS) {
- reinit_ports(ofproto);
- } else if (!error) {
- update_port(ofproto, devname);
- free(devname);
- }
-}
-
-/* Returns a "preference level" for snooping 'ofconn'. A higher return value
- * means that 'ofconn' is more interesting for monitoring than a lower return
- * value. */
-static int
-snoop_preference(const struct ofconn *ofconn)
-{
- switch (ofconn->role) {
- case NX_ROLE_MASTER:
- return 3;
- case NX_ROLE_OTHER:
- return 2;
- case NX_ROLE_SLAVE:
- return 1;
- default:
- /* Shouldn't happen. */
- return 0;
- }
-}
-
-/* One of ofproto's "snoop" pvconns has accepted a new connection on 'vconn'.
- * Connects this vconn to a controller. */
-static void
-add_snooper(struct ofproto *ofproto, struct vconn *vconn)
-{
- struct ofconn *ofconn, *best;
-
- /* Pick a controller for monitoring. */
- best = NULL;
- LIST_FOR_EACH (ofconn, node, &ofproto->all_conns) {
- if (ofconn->type == OFCONN_PRIMARY
- && (!best || snoop_preference(ofconn) > snoop_preference(best))) {
- best = ofconn;
- }
- }
-
- if (best) {
- rconn_add_monitor(best->rconn, vconn);
- } else {
- VLOG_INFO_RL(&rl, "no controller connection to snoop");
- vconn_close(vconn);
- }
-}
-
-int
-ofproto_run1(struct ofproto *p)
-{
- struct ofconn *ofconn, *next_ofconn;
- struct ofservice *ofservice;
- char *devname;
- int error;
- int i;
-
- if (shash_is_empty(&p->port_by_name)) {
- init_ports(p);
- }
-
- for (i = 0; i < 50; i++) {
- struct ofpbuf *buf;
-
- error = dpif_recv(p->dpif, &buf);
- if (error) {
- if (error == ENODEV) {
- /* Someone destroyed the datapath behind our back. The caller
- * better destroy us and give up, because we're just going to
- * spin from here on out. */
- static struct vlog_rate_limit rl2 = VLOG_RATE_LIMIT_INIT(1, 5);
- VLOG_ERR_RL(&rl2, "%s: datapath was destroyed externally",
- dpif_name(p->dpif));
- return ENODEV;
- }
- break;
- }
-
- handle_odp_msg(p, buf);
- }
-
- while ((error = dpif_port_poll(p->dpif, &devname)) != EAGAIN) {
- process_port_change(p, error, devname);
- }
- while ((error = netdev_monitor_poll(p->netdev_monitor,
- &devname)) != EAGAIN) {
- process_port_change(p, error, devname);
- }
-
- if (p->in_band) {
- if (time_msec() >= p->next_in_band_update) {
- update_in_band_remotes(p);
- }
- in_band_run(p->in_band);
- }
-
- LIST_FOR_EACH_SAFE (ofconn, next_ofconn, node, &p->all_conns) {
- ofconn_run(ofconn);
- }
-
- /* Fail-open maintenance. Do this after processing the ofconns since
- * fail-open checks the status of the controller rconn. */
- if (p->fail_open) {
- fail_open_run(p->fail_open);
- }
-
- HMAP_FOR_EACH (ofservice, node, &p->services) {
- struct vconn *vconn;
- int retval;
-
- retval = pvconn_accept(ofservice->pvconn, OFP_VERSION, &vconn);
- if (!retval) {
- struct rconn *rconn;
- char *name;
-
- rconn = rconn_create(ofservice->probe_interval, 0);
- name = ofconn_make_name(p, vconn_get_name(vconn));
- rconn_connect_unreliably(rconn, vconn, name);
- free(name);
-
- ofconn = ofconn_create(p, rconn, OFCONN_SERVICE);
- ofconn_set_rate_limit(ofconn, ofservice->rate_limit,
- ofservice->burst_limit);
- } else if (retval != EAGAIN) {
- VLOG_WARN_RL(&rl, "accept failed (%s)", strerror(retval));
- }
- }
-
- for (i = 0; i < p->n_snoops; i++) {
- struct vconn *vconn;
- int retval;
-
- retval = pvconn_accept(p->snoops[i], OFP_VERSION, &vconn);
- if (!retval) {
- add_snooper(p, vconn);
- } else if (retval != EAGAIN) {
- VLOG_WARN_RL(&rl, "accept failed (%s)", strerror(retval));
- }
- }
-
- if (time_msec() >= p->next_expiration) {
- int delay = ofproto_expire(p);
- p->next_expiration = time_msec() + delay;
- COVERAGE_INC(ofproto_expiration);
- }
-
- if (p->netflow) {
- netflow_run(p->netflow);
- }
- if (p->sflow) {
- ofproto_sflow_run(p->sflow);
- }
-
- return 0;
-}
-
-struct revalidate_cbdata {
- struct ofproto *ofproto;
- bool revalidate_all; /* Revalidate all exact-match rules? */
- bool revalidate_subrules; /* Revalidate all exact-match subrules? */
- struct tag_set revalidate_set; /* Set of tags to revalidate. */
-};
-
-int
-ofproto_run2(struct ofproto *p, bool revalidate_all)
-{
- if (p->need_revalidate || revalidate_all
- || !tag_set_is_empty(&p->revalidate_set)) {
- struct revalidate_cbdata cbdata;
- cbdata.ofproto = p;
- cbdata.revalidate_all = revalidate_all;
- cbdata.revalidate_subrules = p->need_revalidate;
- cbdata.revalidate_set = p->revalidate_set;
- tag_set_init(&p->revalidate_set);
- COVERAGE_INC(ofproto_revalidate);
- classifier_for_each(&p->cls, CLS_INC_EXACT, revalidate_cb, &cbdata);
- p->need_revalidate = false;
- }
-
- return 0;
-}
-
-void
-ofproto_wait(struct ofproto *p)
-{
- struct ofservice *ofservice;
- struct ofconn *ofconn;
- size_t i;
-
- dpif_recv_wait(p->dpif);
- dpif_port_poll_wait(p->dpif);
- netdev_monitor_poll_wait(p->netdev_monitor);
- LIST_FOR_EACH (ofconn, node, &p->all_conns) {
- ofconn_wait(ofconn);
- }
- if (p->in_band) {
- poll_timer_wait_until(p->next_in_band_update);
- in_band_wait(p->in_band);
- }
- if (p->fail_open) {
- fail_open_wait(p->fail_open);
- }
- if (p->sflow) {
- ofproto_sflow_wait(p->sflow);
- }
- if (!tag_set_is_empty(&p->revalidate_set)) {
- poll_immediate_wake();
- }
- if (p->need_revalidate) {
- /* Shouldn't happen, but if it does just go around again. */
- VLOG_DBG_RL(&rl, "need revalidate in ofproto_wait_cb()");
- poll_immediate_wake();
- } else if (p->next_expiration != LLONG_MAX) {
- poll_timer_wait_until(p->next_expiration);
- }
- HMAP_FOR_EACH (ofservice, node, &p->services) {
- pvconn_wait(ofservice->pvconn);
- }
- for (i = 0; i < p->n_snoops; i++) {
- pvconn_wait(p->snoops[i]);
- }
-}
-
-void
-ofproto_revalidate(struct ofproto *ofproto, tag_type tag)
-{
- tag_set_add(&ofproto->revalidate_set, tag);
-}
-
-struct tag_set *
-ofproto_get_revalidate_set(struct ofproto *ofproto)
-{
- return &ofproto->revalidate_set;
-}
-
-bool
-ofproto_is_alive(const struct ofproto *p)
-{
- return !hmap_is_empty(&p->controllers);
-}
-
-/* Deletes port number 'odp_port' from the datapath for 'ofproto'.
- *
- * This is almost the same as calling dpif_port_del() directly on the
- * datapath, but it also makes 'ofproto' close its open netdev for the port
- * (if any). This makes it possible to create a new netdev of a different
- * type under the same name, which otherwise the netdev library would refuse
- * to do because of the conflict. (The netdev would eventually get closed on
- * the next trip through ofproto_run(), but this interface is more direct.)
- *
- * Returns 0 if successful, otherwise a positive errno. */
-int
-ofproto_port_del(struct ofproto *ofproto, uint16_t odp_port)
-{
- struct ofport *ofport = get_port(ofproto, odp_port);
- const char *name = ofport ? (char *) ofport->opp.name : "<unknown>";
- int error;
-
- error = dpif_port_del(ofproto->dpif, odp_port);
- if (error) {
- VLOG_ERR("%s: failed to remove port %"PRIu16" (%s) interface (%s)",
- dpif_name(ofproto->dpif), odp_port, name, strerror(error));
- } else if (ofport) {
- /* 'name' is ofport->opp.name and update_port() is going to destroy
- * 'ofport'. Just in case update_port() refers to 'name' after it
- * destroys 'ofport', make a copy of it around the update_port()
- * call. */
- char *devname = xstrdup(name);
- update_port(ofproto, devname);
- free(devname);
- }
- return error;
-}
-
-/* Checks if 'ofproto' thinks 'odp_port' should be included in floods. Returns
- * true if 'odp_port' exists and should be included, false otherwise. */
-bool
-ofproto_port_is_floodable(struct ofproto *ofproto, uint16_t odp_port)
-{
- struct ofport *ofport = get_port(ofproto, odp_port);
- return ofport && !(ofport->opp.config & OFPPC_NO_FLOOD);
-}
-
-int
-ofproto_send_packet(struct ofproto *p, const struct flow *flow,
- const union ofp_action *actions, size_t n_actions,
- const struct ofpbuf *packet)
-{
- struct odp_actions odp_actions;
- int error;
-
- error = xlate_actions(actions, n_actions, flow, p, packet, &odp_actions,
- NULL, NULL, NULL);
- if (error) {
- return error;
- }
-
- /* XXX Should we translate the dpif_execute() errno value into an OpenFlow
- * error code? */
- dpif_execute(p->dpif, odp_actions.actions, odp_actions.n_actions, packet);
- return 0;
-}
-
-void
-ofproto_add_flow(struct ofproto *p, const struct flow *flow,
- uint32_t wildcards, unsigned int priority,
- const union ofp_action *actions, size_t n_actions,
- int idle_timeout)
-{
- struct rule *rule;
- rule = rule_create(p, NULL, actions, n_actions,
- idle_timeout >= 0 ? idle_timeout : 5 /* XXX */,
- 0, 0, false);
- cls_rule_from_flow(flow, wildcards, priority, &rule->cr);
- rule_insert(p, rule, NULL, 0);
-}
-
-void
-ofproto_delete_flow(struct ofproto *ofproto, const struct flow *flow,
- uint32_t wildcards, unsigned int priority)
-{
- struct cls_rule target;
- struct rule *rule;
-
- cls_rule_from_flow(flow, wildcards, priority, &target);
- rule = rule_from_cls_rule(classifier_find_rule_exactly(&ofproto->cls,
- &target));
- if (rule) {
- rule_remove(ofproto, rule);
- }
-}
-
-static void
-destroy_rule(struct cls_rule *rule_, void *ofproto_)
-{
- struct rule *rule = rule_from_cls_rule(rule_);
- struct ofproto *ofproto = ofproto_;
-
- /* Mark the flow as not installed, even though it might really be
- * installed, so that rule_remove() doesn't bother trying to uninstall it.
- * There is no point in uninstalling it individually since we are about to
- * blow away all the flows with dpif_flow_flush(). */
- rule->installed = false;
-
- rule_remove(ofproto, rule);
-}
-
-void
-ofproto_flush_flows(struct ofproto *ofproto)
-{
- COVERAGE_INC(ofproto_flush);
- classifier_for_each(&ofproto->cls, CLS_INC_ALL, destroy_rule, ofproto);
- dpif_flow_flush(ofproto->dpif);
- if (ofproto->in_band) {
- in_band_flushed(ofproto->in_band);
- }
- if (ofproto->fail_open) {
- fail_open_flushed(ofproto->fail_open);
- }
-}
-\f
-static void
-reinit_ports(struct ofproto *p)
-{
- struct svec devnames;
- struct ofport *ofport;
- struct odp_port *odp_ports;
- size_t n_odp_ports;
- size_t i;
-
- COVERAGE_INC(ofproto_reinit_ports);
-
- svec_init(&devnames);
- HMAP_FOR_EACH (ofport, hmap_node, &p->ports) {
- svec_add (&devnames, (char *) ofport->opp.name);
- }
- 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);
- }
- free(odp_ports);
-
- svec_sort_unique(&devnames);
- for (i = 0; i < devnames.n; i++) {
- update_port(p, devnames.names[i]);
- }
- svec_destroy(&devnames);
-}
-
-static struct ofport *
-make_ofport(const struct odp_port *odp_port)
-{
- struct netdev_options netdev_options;
- enum netdev_flags flags;
- struct ofport *ofport;
- struct netdev *netdev;
- int error;
-
- memset(&netdev_options, 0, sizeof netdev_options);
- netdev_options.name = odp_port->devname;
- netdev_options.ethertype = NETDEV_ETH_TYPE_NONE;
-
- error = netdev_open(&netdev_options, &netdev);
- if (error) {
- VLOG_WARN_RL(&rl, "ignoring port %s (%"PRIu16") because netdev %s "
- "cannot be opened (%s)",
- odp_port->devname, odp_port->port,
- odp_port->devname, strerror(error));
- return NULL;
- }
-
- ofport = xmalloc(sizeof *ofport);
- ofport->netdev = netdev;
- ofport->odp_port = odp_port->port;
- ofport->opp.port_no = odp_port_to_ofp_port(odp_port->port);
- netdev_get_etheraddr(netdev, ofport->opp.hw_addr);
- memcpy(ofport->opp.name, odp_port->devname,
- MIN(sizeof ofport->opp.name, sizeof odp_port->devname));
- ofport->opp.name[sizeof ofport->opp.name - 1] = '\0';
-
- netdev_get_flags(netdev, &flags);
- ofport->opp.config = flags & NETDEV_UP ? 0 : OFPPC_PORT_DOWN;
-
- ofport->opp.state = netdev_get_carrier(netdev) ? 0 : OFPPS_LINK_DOWN;
-
- netdev_get_features(netdev,
- &ofport->opp.curr, &ofport->opp.advertised,
- &ofport->opp.supported, &ofport->opp.peer);
- return ofport;
-}
-
-static bool
-ofport_conflicts(const struct ofproto *p, const struct odp_port *odp_port)
-{
- if (get_port(p, odp_port->port)) {
- VLOG_WARN_RL(&rl, "ignoring duplicate port %"PRIu16" in datapath",
- odp_port->port);
- return true;
- } else if (shash_find(&p->port_by_name, odp_port->devname)) {
- VLOG_WARN_RL(&rl, "ignoring duplicate device %s in datapath",
- odp_port->devname);
- return true;
- } else {
- return false;
- }
-}
-
-static int
-ofport_equal(const struct ofport *a_, const struct ofport *b_)
-{
- const struct ofp_phy_port *a = &a_->opp;
- const struct ofp_phy_port *b = &b_->opp;
-
- BUILD_ASSERT_DECL(sizeof *a == 48); /* Detect ofp_phy_port changes. */
- return (a->port_no == b->port_no
- && !memcmp(a->hw_addr, b->hw_addr, sizeof a->hw_addr)
- && !strcmp((char *) a->name, (char *) b->name)
- && a->state == b->state
- && a->config == b->config
- && a->curr == b->curr
- && a->advertised == b->advertised
- && a->supported == b->supported
- && a->peer == b->peer);
-}
-
-static void
-send_port_status(struct ofproto *p, const struct ofport *ofport,
- uint8_t reason)
-{
- /* XXX Should limit the number of queued port status change messages. */
- struct ofconn *ofconn;
- LIST_FOR_EACH (ofconn, node, &p->all_conns) {
- struct ofp_port_status *ops;
- struct ofpbuf *b;
-
- if (!ofconn_receives_async_msgs(ofconn)) {
- continue;
- }
-
- ops = make_openflow_xid(sizeof *ops, OFPT_PORT_STATUS, 0, &b);
- ops->reason = reason;
- ops->desc = ofport->opp;
- hton_ofp_phy_port(&ops->desc);
- queue_tx(b, ofconn, NULL);
- }
-}
-
-static void
-ofport_install(struct ofproto *p, struct ofport *ofport)
-{
- const char *netdev_name = (const char *) ofport->opp.name;
-
- netdev_monitor_add(p->netdev_monitor, ofport->netdev);
- hmap_insert(&p->ports, &ofport->hmap_node, hash_int(ofport->odp_port, 0));
- shash_add(&p->port_by_name, netdev_name, ofport);
- if (p->sflow) {
- ofproto_sflow_add_port(p->sflow, ofport->odp_port, netdev_name);
- }
-}
-
-static void
-ofport_remove(struct ofproto *p, struct ofport *ofport)
-{
- netdev_monitor_remove(p->netdev_monitor, ofport->netdev);
- hmap_remove(&p->ports, &ofport->hmap_node);
- shash_delete(&p->port_by_name,
- shash_find(&p->port_by_name, (char *) ofport->opp.name));
- if (p->sflow) {
- ofproto_sflow_del_port(p->sflow, ofport->odp_port);
- }
-}
-
-static void
-ofport_free(struct ofport *ofport)
-{
- if (ofport) {
- netdev_close(ofport->netdev);
- free(ofport);
- }
-}
-
-static struct ofport *
-get_port(const struct ofproto *ofproto, uint16_t odp_port)
-{
- struct ofport *port;
-
- HMAP_FOR_EACH_IN_BUCKET (port, hmap_node,
- hash_int(odp_port, 0), &ofproto->ports) {
- if (port->odp_port == odp_port) {
- return port;
- }
- }
- return NULL;
-}
-
-static void
-update_port(struct ofproto *p, const char *devname)
-{
- struct odp_port odp_port;
- struct ofport *old_ofport;
- struct ofport *new_ofport;
- int error;
-
- COVERAGE_INC(ofproto_update_port);
-
- /* Query the datapath for port information. */
- error = dpif_port_query_by_name(p->dpif, devname, &odp_port);
-
- /* Find the old ofport. */
- old_ofport = shash_find_data(&p->port_by_name, devname);
- if (!error) {
- if (!old_ofport) {
- /* There's no port named 'devname' but there might be a port with
- * the same port number. This could happen if a port is deleted
- * and then a new one added in its place very quickly, or if a port
- * is renamed. In the former case we want to send an OFPPR_DELETE
- * and an OFPPR_ADD, and in the latter case we want to send a
- * single OFPPR_MODIFY. We can distinguish the cases by comparing
- * the old port's ifindex against the new port, or perhaps less
- * reliably but more portably by comparing the old port's MAC
- * against the new port's MAC. However, this code isn't that smart
- * and always sends an OFPPR_MODIFY (XXX). */
- old_ofport = get_port(p, odp_port.port);
- }
- } else if (error != ENOENT && error != ENODEV) {
- VLOG_WARN_RL(&rl, "dpif_port_query_by_name returned unexpected error "
- "%s", strerror(error));
- return;
- }
-
- /* Create a new ofport. */
- new_ofport = !error ? make_ofport(&odp_port) : NULL;
-
- /* Eliminate a few pathological cases. */
- if (!old_ofport && !new_ofport) {
- return;
- } else if (old_ofport && new_ofport) {
- /* Most of the 'config' bits are OpenFlow soft state, but
- * OFPPC_PORT_DOWN is maintained the kernel. So transfer the OpenFlow
- * bits from old_ofport. (make_ofport() only sets OFPPC_PORT_DOWN and
- * leaves the other bits 0.) */
- new_ofport->opp.config |= old_ofport->opp.config & ~OFPPC_PORT_DOWN;
-
- if (ofport_equal(old_ofport, new_ofport)) {
- /* False alarm--no change. */
- ofport_free(new_ofport);
- return;
- }
- }
-
- /* Now deal with the normal cases. */
- if (old_ofport) {
- ofport_remove(p, old_ofport);
- }
- if (new_ofport) {
- ofport_install(p, new_ofport);
- }
- send_port_status(p, new_ofport ? new_ofport : old_ofport,
- (!old_ofport ? OFPPR_ADD
- : !new_ofport ? OFPPR_DELETE
- : OFPPR_MODIFY));
- ofport_free(old_ofport);
-}
-
-static int
-init_ports(struct ofproto *p)
-{
- struct odp_port *ports;
- size_t n_ports;
- size_t i;
- int error;
-
- error = dpif_port_list(p->dpif, &ports, &n_ports);
- if (error) {
- return error;
- }
-
- for (i = 0; i < n_ports; i++) {
- const struct odp_port *odp_port = &ports[i];
- if (!ofport_conflicts(p, odp_port)) {
- struct ofport *ofport = make_ofport(odp_port);
- if (ofport) {
- ofport_install(p, ofport);
- }
- }
- }
- free(ports);
- return 0;
-}
-\f
-static struct ofconn *
-ofconn_create(struct ofproto *p, struct rconn *rconn, enum ofconn_type type)
-{
- struct ofconn *ofconn = xzalloc(sizeof *ofconn);
- ofconn->ofproto = p;
- list_push_back(&p->all_conns, &ofconn->node);
- ofconn->rconn = rconn;
- ofconn->type = type;
- ofconn->flow_format = NXFF_OPENFLOW10;
- ofconn->role = NX_ROLE_OTHER;
- ofconn->packet_in_counter = rconn_packet_counter_create ();
- ofconn->pktbuf = NULL;
- ofconn->miss_send_len = 0;
- ofconn->reply_counter = rconn_packet_counter_create ();
- return ofconn;
-}
-
-static void
-ofconn_destroy(struct ofconn *ofconn)
-{
- if (ofconn->type == OFCONN_PRIMARY) {
- hmap_remove(&ofconn->ofproto->controllers, &ofconn->hmap_node);
- }
- discovery_destroy(ofconn->discovery);
-
- list_remove(&ofconn->node);
- switch_status_unregister(ofconn->ss);
- rconn_destroy(ofconn->rconn);
- rconn_packet_counter_destroy(ofconn->packet_in_counter);
- rconn_packet_counter_destroy(ofconn->reply_counter);
- pktbuf_destroy(ofconn->pktbuf);
- free(ofconn);
-}
-
-static void
-ofconn_run(struct ofconn *ofconn)
-{
- struct ofproto *p = ofconn->ofproto;
- int iteration;
- size_t i;
-
- if (ofconn->discovery) {
- char *controller_name;
- if (rconn_is_connectivity_questionable(ofconn->rconn)) {
- discovery_question_connectivity(ofconn->discovery);
- }
- if (discovery_run(ofconn->discovery, &controller_name)) {
- if (controller_name) {
- char *ofconn_name = ofconn_make_name(p, controller_name);
- rconn_connect(ofconn->rconn, controller_name, ofconn_name);
- free(ofconn_name);
- } else {
- rconn_disconnect(ofconn->rconn);
- }
- }
- }
-
- for (i = 0; i < N_SCHEDULERS; i++) {
- pinsched_run(ofconn->schedulers[i], do_send_packet_in, ofconn);
- }
-
- rconn_run(ofconn->rconn);
-
- if (rconn_packet_counter_read (ofconn->reply_counter) < OFCONN_REPLY_MAX) {
- /* Limit the number of iterations to prevent other tasks from
- * starving. */
- for (iteration = 0; iteration < 50; iteration++) {
- struct ofpbuf *of_msg = rconn_recv(ofconn->rconn);
- if (!of_msg) {
- break;
- }
- if (p->fail_open) {
- fail_open_maybe_recover(p->fail_open);
- }
- handle_openflow(ofconn, of_msg);
- ofpbuf_delete(of_msg);
- }
- }
-
- if (!ofconn->discovery && !rconn_is_alive(ofconn->rconn)) {
- ofconn_destroy(ofconn);
- }
-}
-
-static void
-ofconn_wait(struct ofconn *ofconn)
-{
- int i;
-
- if (ofconn->discovery) {
- discovery_wait(ofconn->discovery);
- }
- for (i = 0; i < N_SCHEDULERS; i++) {
- pinsched_wait(ofconn->schedulers[i]);
- }
- rconn_run_wait(ofconn->rconn);
- if (rconn_packet_counter_read (ofconn->reply_counter) < OFCONN_REPLY_MAX) {
- rconn_recv_wait(ofconn->rconn);
- } else {
- COVERAGE_INC(ofproto_ofconn_stuck);
- }
-}
-
-/* Returns true if 'ofconn' should receive asynchronous messages. */
-static bool
-ofconn_receives_async_msgs(const struct ofconn *ofconn)
-{
- if (ofconn->type == OFCONN_PRIMARY) {
- /* Primary controllers always get asynchronous messages unless they
- * have configured themselves as "slaves". */
- return ofconn->role != NX_ROLE_SLAVE;
- } else {
- /* Service connections don't get asynchronous messages unless they have
- * explicitly asked for them by setting a nonzero miss send length. */
- return ofconn->miss_send_len > 0;
- }
-}
-
-/* Returns a human-readable name for an OpenFlow connection between 'ofproto'
- * and 'target', suitable for use in log messages for identifying the
- * connection.