cfm: Reduce missed CCM detection time.
[openvswitch] / vswitchd / bridge.c
index f3432f260accd2cad6d5fb9b0a9848edb376b6b5..96e4cf1a47db4ceabeac5bfabf100e61b8997bf2 100644 (file)
@@ -1220,55 +1220,6 @@ iface_refresh_cfm_stats(struct iface *iface)
         ovsrec_maintenance_point_set_fault(mp, &rmp->fault, 1);
     }
 
-    if (hmap_is_empty(&cfm->x_remote_mps)) {
-        ovsrec_monitor_set_unexpected_remote_mpids(mon, NULL, 0);
-    } else {
-        size_t length;
-        struct remote_mp *rmp;
-        int64_t *x_remote_mps;
-
-        length = hmap_count(&cfm->x_remote_mps);
-        x_remote_mps = xzalloc(length * sizeof *x_remote_mps);
-
-        i = 0;
-        HMAP_FOR_EACH (rmp, node, &cfm->x_remote_mps) {
-            x_remote_mps[i++] = rmp->mpid;
-        }
-
-        ovsrec_monitor_set_unexpected_remote_mpids(mon, x_remote_mps, length);
-        free(x_remote_mps);
-    }
-
-    if (hmap_is_empty(&cfm->x_remote_maids)) {
-        ovsrec_monitor_set_unexpected_remote_maids(mon, NULL, 0);
-    } else {
-        size_t length;
-        char **x_remote_maids;
-        struct remote_maid *rmaid;
-
-        length = hmap_count(&cfm->x_remote_maids);
-        x_remote_maids = xzalloc(length * sizeof *x_remote_maids);
-
-        i = 0;
-        HMAP_FOR_EACH (rmaid, node, &cfm->x_remote_maids) {
-            size_t j;
-
-            x_remote_maids[i] = xzalloc(CCM_MAID_LEN * 2 + 1);
-
-            for (j = 0; j < CCM_MAID_LEN; j++) {
-                 snprintf(&x_remote_maids[i][j * 2], 3, "%02hhx",
-                          rmaid->maid[j]);
-            }
-            i++;
-        }
-        ovsrec_monitor_set_unexpected_remote_maids(mon, x_remote_maids, length);
-
-        for (i = 0; i < length; i++) {
-            free(x_remote_maids[i]);
-        }
-        free(x_remote_maids);
-    }
-
     ovsrec_monitor_set_fault(mon, &cfm->fault, 1);
 }
 
@@ -2921,7 +2872,7 @@ process_flow(struct bridge *br, const struct flow *flow,
     /* Determine output port. */
     mac = mac_learning_lookup(br->ml, flow->dl_dst, vlan, tags);
     if (mac) {
-        mac = mac->port.p;
+        out_port = mac->port.p;
     } else if (!packet && !eth_addr_is_multicast(flow->dl_dst)) {
         /* If we are revalidating but don't have a learning entry then
          * eject the flow.  Installing a flow that floods packets opens
@@ -3811,9 +3762,12 @@ lacp_send_pdu_cb(void *aux, const struct lacp_pdu *pdu)
     error = netdev_get_etheraddr(iface->netdev, ea);
     if (!error) {
         struct ofpbuf packet;
+        struct lacp_pdu *packet_pdu;
 
-        ofpbuf_init(&packet, ETH_HEADER_LEN + LACP_PDU_LEN);
-        compose_lacp_packet(&packet, ea, pdu);
+        ofpbuf_init(&packet, 0);
+        packet_pdu = compose_packet(&packet, eth_addr_lacp, ea, ETH_TYPE_LACP,
+                                    sizeof *packet_pdu);
+        memcpy(packet_pdu, pdu, sizeof *packet_pdu);
         ofproto_send_packet(iface->port->bridge->ofproto,
                             iface->dp_ifidx, 0, &packet);
         ofpbuf_uninit(&packet);
@@ -4205,8 +4159,10 @@ port_destroy(struct port *port)
 
         port_flush_macs(port);
 
+        lacp_destroy(port->lacp);
         netdev_monitor_destroy(port->monitor);
         bitmap_free(port->trunks);
+        free(port->bond_hash);
         free(port->name);
         free(port);
     }
@@ -4580,7 +4536,7 @@ iface_update_cfm(struct iface *iface)
     struct cfm cfm;
     uint16_t *remote_mps;
     struct ovsrec_monitor *mon;
-    uint8_t ea[ETH_ADDR_LEN], maid[CCM_MAID_LEN];
+    uint8_t maid[CCM_MAID_LEN];
 
     mon = iface->cfg->monitor;
 
@@ -4589,12 +4545,6 @@ iface_update_cfm(struct iface *iface)
         return;
     }
 
-    if (netdev_get_etheraddr(iface->netdev, ea)) {
-        VLOG_WARN("interface %s: Failed to get ethernet address. "
-                  "Skipping Monitor.", iface->name);
-        return;
-    }
-
     if (!cfm_generate_maid(mon->md_name, mon->ma_name, maid)) {
         VLOG_WARN("interface %s: Failed to generate MAID.", iface->name);
         return;
@@ -4603,7 +4553,6 @@ iface_update_cfm(struct iface *iface)
     cfm.mpid     = mon->mpid;
     cfm.interval = mon->interval ? *mon->interval : 1000;
 
-    memcpy(cfm.eth_src, ea, sizeof cfm.eth_src);
     memcpy(cfm.maid, maid, sizeof cfm.maid);
 
     remote_mps = xzalloc(mon->n_remote_mps * sizeof *remote_mps);