[ovs-dev] [next 06/35] bridge: Avoid extra iteration through all "struct iface"s.

Ben Pfaff blp at nicira.com
Tue Apr 26 16:24:32 UTC 2011


There's no reason to do these separately as far as I can see.
---
 vswitchd/bridge.c |   27 +++++++--------------------
 1 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 9e9566c..d5b44c6 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -439,23 +439,6 @@ check_iface(struct bridge *br, struct iface *iface, void *aux OVS_UNUSED)
     return true;
 }
 
-/* Callback for iterate_and_prune_ifaces(). */
-static bool
-set_iface_properties(struct bridge *br OVS_UNUSED, struct iface *iface,
-                     void *aux OVS_UNUSED)
-{
-    /* Set policing attributes. */
-    netdev_set_policing(iface->netdev,
-                        iface->cfg->ingress_policing_rate,
-                        iface->cfg->ingress_policing_burst);
-
-    /* Set MAC address of internal interfaces other than the local
-     * interface. */
-    iface_set_mac(iface);
-
-    return true;
-}
-
 /* Calls 'cb' for each interfaces in 'br', passing along the 'aux' argument.
  * Deletes from 'br' all the interfaces for which 'cb' returns false, and then
  * deletes from 'br' any ports that no longer have any interfaces. */
@@ -904,12 +887,16 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
 
             LIST_FOR_EACH (iface, port_elem, &port->ifaces) {
                 iface_update_qos(iface, port->cfg->qos);
+                netdev_set_policing(iface->netdev,
+                                    iface->cfg->ingress_policing_rate,
+                                    iface->cfg->ingress_policing_burst);
+                if (iface->dp_ifidx != ODPP_LOCAL
+                    && !strcmp(iface->type, "internal")) {
+                    iface_set_mac(iface);
+                }
             }
         }
     }
-    LIST_FOR_EACH (br, node, &all_bridges) {
-        iterate_and_prune_ifaces(br, set_iface_properties, NULL);
-    }
 
     /* Some reconfiguration operations require the bridge to have been run at
      * least once.  */
-- 
1.7.4.4




More information about the dev mailing list