bond: Stop using tags.
[sliver-openvswitch.git] / ofproto / ofproto-dpif.c
index 66a7b49..4fc90c6 100644 (file)
@@ -86,6 +86,8 @@ static struct rule_dpif *rule_dpif_lookup(struct ofproto_dpif *,
 
 static void rule_get_stats(struct rule *, uint64_t *packets, uint64_t *bytes);
 static void rule_invalidate(const struct rule_dpif *);
+static tag_type rule_calculate_tag(const struct flow *,
+                                   const struct minimask *, uint32_t secret);
 
 struct ofbundle {
     struct hmap_node hmap_node; /* In struct ofproto's "bundles" hmap. */
@@ -388,14 +390,18 @@ struct table_dpif {
 enum revalidate_reason {
     REV_RECONFIGURE = 1,       /* Switch configuration changed. */
     REV_STP,                   /* Spanning tree protocol port status change. */
+    REV_BOND,                  /* Bonding changed. */
     REV_PORT_TOGGLED,          /* Port enabled or disabled by CFM, LACP, ...*/
     REV_FLOW_TABLE,            /* Flow table changed. */
+    REV_MAC_LEARNING,          /* Mac learning changed. */
     REV_INCONSISTENCY          /* Facet self-check failed. */
 };
 COVERAGE_DEFINE(rev_reconfigure);
 COVERAGE_DEFINE(rev_stp);
+COVERAGE_DEFINE(rev_bond);
 COVERAGE_DEFINE(rev_port_toggled);
 COVERAGE_DEFINE(rev_flow_table);
+COVERAGE_DEFINE(rev_mac_learning);
 COVERAGE_DEFINE(rev_inconsistency);
 
 /* Drop keys are odp flow keys which have drop flows installed in the kernel.
@@ -764,8 +770,10 @@ type_run(const char *type)
         switch (backer->need_revalidate) {
         case REV_RECONFIGURE:   COVERAGE_INC(rev_reconfigure);   break;
         case REV_STP:           COVERAGE_INC(rev_stp);           break;
+        case REV_BOND:          COVERAGE_INC(rev_bond);          break;
         case REV_PORT_TOGGLED:  COVERAGE_INC(rev_port_toggled);  break;
         case REV_FLOW_TABLE:    COVERAGE_INC(rev_flow_table);    break;
+        case REV_MAC_LEARNING:  COVERAGE_INC(rev_mac_learning);  break;
         case REV_INCONSISTENCY: COVERAGE_INC(rev_inconsistency); break;
         }
 
@@ -1498,7 +1506,7 @@ run(struct ofproto *ofproto_)
     if (mbridge_need_revalidate(ofproto->mbridge)) {
         ofproto->backer->need_revalidate = REV_RECONFIGURE;
         ovs_rwlock_wrlock(&ofproto->ml->rwlock);
-        mac_learning_flush(ofproto->ml, NULL);
+        mac_learning_flush(ofproto->ml);
         ovs_rwlock_unlock(&ofproto->ml->rwlock);
     }
 
@@ -1531,7 +1539,9 @@ run(struct ofproto *ofproto_)
 
     stp_run(ofproto);
     ovs_rwlock_wrlock(&ofproto->ml->rwlock);
-    mac_learning_run(ofproto->ml, &ofproto->backer->revalidate_set);
+    if (mac_learning_run(ofproto->ml)) {
+        ofproto->backer->need_revalidate = REV_MAC_LEARNING;
+    }
     ovs_rwlock_unlock(&ofproto->ml->rwlock);
 
     /* Check the consistency of a random facet, to aid debugging. */
@@ -2095,8 +2105,7 @@ update_stp_port_state(struct ofport_dpif *ofport)
                 != stp_learn_in_state(state)) {
             /* xxx Learning action flows should also be flushed. */
             ovs_rwlock_wrlock(&ofproto->ml->rwlock);
-            mac_learning_flush(ofproto->ml,
-                               &ofproto->backer->revalidate_set);
+            mac_learning_flush(ofproto->ml);
             ovs_rwlock_unlock(&ofproto->ml->rwlock);
         }
         fwd_change = stp_forward_in_state(ofport->stp_state)
@@ -2203,7 +2212,7 @@ stp_run(struct ofproto_dpif *ofproto)
 
         if (stp_check_and_reset_fdb_flush(ofproto->stp)) {
             ovs_rwlock_wrlock(&ofproto->ml->rwlock);
-            mac_learning_flush(ofproto->ml, &ofproto->backer->revalidate_set);
+            mac_learning_flush(ofproto->ml);
             ovs_rwlock_unlock(&ofproto->ml->rwlock);
         }
     }
@@ -2372,8 +2381,7 @@ bundle_flush_macs(struct ofbundle *bundle, bool all_ofprotos)
                         struct mac_entry *e;
 
                         ovs_rwlock_wrlock(&o->ml->rwlock);
-                        e = mac_learning_lookup(o->ml, mac->mac, mac->vlan,
-                                                NULL);
+                        e = mac_learning_lookup(o->ml, mac->mac, mac->vlan);
                         if (e) {
                             mac_learning_expire(o->ml, e);
                         }
@@ -2778,8 +2786,10 @@ bundle_run(struct ofbundle *bundle)
             bond_slave_set_may_enable(bundle->bond, port, port->may_enable);
         }
 
-        bond_run(bundle->bond, &bundle->ofproto->backer->revalidate_set,
-                 lacp_status(bundle->lacp));
+        if (bond_run(bundle->bond, lacp_status(bundle->lacp))) {
+            bundle->ofproto->backer->need_revalidate = REV_BOND;
+        }
+
         if (bond_should_send_learning_packets(bundle->bond)) {
             bundle_send_learning_packets(bundle);
         }
@@ -2847,7 +2857,7 @@ set_flood_vlans(struct ofproto *ofproto_, unsigned long *flood_vlans)
     struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
     ovs_rwlock_wrlock(&ofproto->ml->rwlock);
     if (mac_learning_set_flood_vlans(ofproto->ml, flood_vlans)) {
-        mac_learning_flush(ofproto->ml, &ofproto->backer->revalidate_set);
+        mac_learning_flush(ofproto->ml);
     }
     ovs_rwlock_unlock(&ofproto->ml->rwlock);
     return 0;
@@ -4158,7 +4168,7 @@ expire(struct dpif_backer *backer)
 
             HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
                 if (bundle->bond) {
-                    bond_rebalance(bundle->bond, &backer->revalidate_set);
+                    bond_rebalance(bundle->bond);
                 }
             }
         }
@@ -5550,7 +5560,7 @@ calculate_flow_tag(struct ofproto_dpif *ofproto, const struct flow *flow,
 
 /* Calculates the tag to use for 'flow' and mask 'mask' when it is inserted
  * into an OpenFlow table with the given 'basis'. */
-tag_type
+static tag_type
 rule_calculate_tag(const struct flow *flow, const struct minimask *mask,
                    uint32_t secret)
 {
@@ -5783,12 +5793,12 @@ ofproto_unixctl_fdb_flush(struct unixctl_conn *conn, int argc,
             return;
         }
         ovs_rwlock_wrlock(&ofproto->ml->rwlock);
-        mac_learning_flush(ofproto->ml, &ofproto->backer->revalidate_set);
+        mac_learning_flush(ofproto->ml);
         ovs_rwlock_unlock(&ofproto->ml->rwlock);
     } else {
         HMAP_FOR_EACH (ofproto, all_ofproto_dpifs_node, &all_ofproto_dpifs) {
             ovs_rwlock_wrlock(&ofproto->ml->rwlock);
-            mac_learning_flush(ofproto->ml, &ofproto->backer->revalidate_set);
+            mac_learning_flush(ofproto->ml);
             ovs_rwlock_unlock(&ofproto->ml->rwlock);
         }
     }