X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=vswitchd%2Fbridge.c;h=c7b0262d6609bb3af272d0cc8b278e8c7d96a2a7;hb=84c5d450;hp=f0ff91d92ee736b33608584f99a09e367a4a2e14;hpb=76ed83fc3f82f6d3074c4f87a38dd9ef164b6dc0;p=openvswitch diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index f0ff91d9..c7b0262d 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -164,7 +164,6 @@ static bool bridge_has_bond_fake_iface(const struct bridge *, const char *name); static bool port_is_bond_fake_iface(const struct port *); -static unixctl_cb_func cfm_unixctl_show; static unixctl_cb_func qos_unixctl_show; static struct port *port_create(struct bridge *, const struct ovsrec_port *); @@ -268,7 +267,6 @@ bridge_init(const char *remote) ovsdb_idl_omit(idl, &ovsrec_ssl_col_external_ids); /* Register unixctl commands. */ - unixctl_command_register("cfm/show", cfm_unixctl_show, NULL); unixctl_command_register("qos/show", qos_unixctl_show, NULL); unixctl_command_register("bridge/dump-flows", bridge_unixctl_dump_flows, NULL); @@ -276,6 +274,7 @@ bridge_init(const char *remote) NULL); lacp_init(); bond_init(); + cfm_init(); } void @@ -528,6 +527,10 @@ port_configure(struct port *port) } else { s.bond = NULL; s.bond_stable_ids = NULL; + + LIST_FOR_EACH (iface, port_elem, &port->ifaces) { + netdev_set_miimon_interval(iface->netdev, 0); + } } /* Register. */ @@ -791,7 +794,7 @@ iface_set_ofp_port(struct iface *iface, int ofp_port) assert(iface->ofp_port < 0 && ofp_port >= 0); iface->ofp_port = ofp_port; hmap_insert(&br->ifaces, &iface->ofp_port_node, hash_int(ofp_port, 0)); - + iface_set_ofport(iface->cfg, ofp_port); } static void @@ -927,7 +930,6 @@ bridge_add_ofproto_ports(struct bridge *br) /* Already exists, nothing to do. */ ofproto_port_destroy(&ofproto_port); } - ofproto_port_destroy(&ofproto_port); } } } @@ -1498,33 +1500,6 @@ bridge_wait(void) } } -/* CFM unixctl user interface functions. */ -static void -cfm_unixctl_show(struct unixctl_conn *conn, - const char *args, void *aux OVS_UNUSED) -{ - struct ds ds = DS_EMPTY_INITIALIZER; - struct iface *iface; - const struct cfm *cfm; - - iface = iface_find(args); - if (!iface) { - unixctl_command_reply(conn, 501, "no such interface"); - return; - } - - cfm = ofproto_port_get_cfm(iface->port->bridge->ofproto, iface->ofp_port); - - if (!cfm) { - unixctl_command_reply(conn, 501, "CFM not enabled"); - return; - } - - cfm_dump_ds(cfm, &ds); - unixctl_command_reply(conn, 200, ds_cstr(&ds)); - ds_destroy(&ds); -} - /* QoS unixctl user interface functions. */ struct qos_unixctl_show_cbdata { @@ -1630,7 +1605,11 @@ bridge_create(const struct ovsrec_bridge *br_cfg) br->name = xstrdup(br_cfg->name); br->type = xstrdup(ofproto_normalize_type(br_cfg->datapath_type)); br->cfg = br_cfg; - eth_addr_nicira_random(br->default_ea); + + /* Derive the default Ethernet address from the bridge's UUID. This should + * be unique and it will be stable between ovs-vswitchd runs. */ + memcpy(br->default_ea, &br_cfg->header_.uuid, ETH_ADDR_LEN); + eth_addr_mark_random(br->default_ea); hmap_init(&br->ports); hmap_init(&br->ifaces); @@ -2223,6 +2202,7 @@ port_configure_bond(struct port *port, struct bond_settings *s, { const char *detect_s; struct iface *iface; + int miimon_interval; size_t i; s->name = port->name; @@ -2234,18 +2214,19 @@ port_configure_bond(struct port *port, struct bond_settings *s, bond_mode_to_string(s->balance)); } - s->detect = BLSM_CARRIER; - detect_s = get_port_other_config(port->cfg, "bond-detect-mode", NULL); - if (detect_s && !bond_detect_mode_from_string(&s->detect, detect_s)) { - VLOG_WARN("port %s: unsupported bond-detect-mode %s, " - "defaulting to %s", - port->name, detect_s, bond_detect_mode_to_string(s->detect)); + miimon_interval = atoi(get_port_other_config(port->cfg, + "bond-miimon-interval", "0")); + if (miimon_interval <= 0) { + miimon_interval = 200; } - s->miimon_interval = atoi( - get_port_other_config(port->cfg, "bond-miimon-interval", "200")); - if (s->miimon_interval < 100) { - s->miimon_interval = 100; + detect_s = get_port_other_config(port->cfg, "bond-detect-mode", "carrier"); + if (!strcmp(detect_s, "carrier")) { + miimon_interval = 0; + } else if (strcmp(detect_s, "miimon")) { + VLOG_WARN("port %s: unsupported bond-detect-mode %s, " + "defaulting to carrier", port->name, detect_s); + miimon_interval = 0; } s->up_delay = MAX(0, port->cfg->bond_updelay); @@ -2269,6 +2250,8 @@ port_configure_bond(struct port *port, struct bond_settings *s, stable_id = iface->ofp_port; } bond_stable_ids[i++] = stable_id; + + netdev_set_miimon_interval(iface->netdev, miimon_interval); } } @@ -2522,7 +2505,6 @@ iface_configure_cfm(struct iface *iface) struct cfm cfm; uint16_t *remote_mps; struct ovsrec_monitor *mon; - uint8_t maid[CCM_MAID_LEN]; mon = iface->cfg->monitor; @@ -2531,15 +2513,9 @@ iface_configure_cfm(struct iface *iface) return; } - if (!cfm_generate_maid(mon->md_name, mon->ma_name, maid)) { - VLOG_WARN("interface %s: Failed to generate MAID.", iface->name); - return; - } - cfm.mpid = mon->mpid; cfm.interval = mon->interval ? *mon->interval : 1000; - - memcpy(cfm.maid, maid, sizeof cfm.maid); + cfm.name = iface->name; remote_mps = xzalloc(mon->n_remote_mps * sizeof *remote_mps); for(i = 0; i < mon->n_remote_mps; i++) {