[ovs-discuss] [ACLv2 08/19] ofproto: Add may install parameter to OpenFlow flows.

Jesse Gross jesse at nicira.com
Sat Aug 15 02:13:16 UTC 2009


This controls whether exact match flows can be installed to the
kernel for a given OpenFlow flow.  This can be used to prevent
flows from being installed that require userspace processing.
---
 ofproto/fail-open.c |    2 +-
 ofproto/in-band.c   |    2 +-
 ofproto/ofproto.c   |    5 +++--
 ofproto/ofproto.h   |    2 +-
 vswitchd/bridge.c   |    2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c
index 0e88729..ceace39 100644
--- a/ofproto/fail-open.c
+++ b/ofproto/fail-open.c
@@ -92,7 +92,7 @@ fail_open_flushed(struct fail_open *fo)
         action.output.port = htons(OFPP_NORMAL);
         memset(&flow, 0, sizeof flow);
         ofproto_add_flow(fo->ofproto, &flow, OFPFW_ALL, 70000,
-                         &action, 1, 0);
+                         &action, 1, 0, true);
     }
 }
 
diff --git a/ofproto/in-band.c b/ofproto/in-band.c
index a08af07..c5fc7e7 100644
--- a/ofproto/in-band.c
+++ b/ofproto/in-band.c
@@ -220,7 +220,7 @@ setup_flow(struct in_band *in_band, int rule_idx, const flow_t *flow,
         action.output.port = htons(out_port);
         action.output.max_len = htons(0);
         ofproto_add_flow(in_band->ofproto, &rule->flow, rule->wildcards,
-                         rule->priority, &action, 1, 0);
+                         rule->priority, &action, 1, 0, true);
     }
 }
 
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 26eb1f8..672bfe5 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -984,11 +984,12 @@ void
 ofproto_add_flow(struct ofproto *p,
                  const flow_t *flow, uint32_t wildcards, unsigned int priority,
                  const union ofp_action *actions, size_t n_actions,
-                 int idle_timeout)
+                 int idle_timeout, bool may_install)
 {
     struct rule *rule;
     rule = rule_create(NULL, actions, n_actions,
                        idle_timeout >= 0 ? idle_timeout : 5 /* XXX */, 0);
+    rule->may_install = may_install;
     cls_rule_from_flow(&rule->cr, flow, wildcards, priority);
     rule_insert(p, rule, NULL, 0);
 }
@@ -1631,7 +1632,7 @@ rule_install(struct ofproto *p, struct rule *rule, struct rule *displaced_rule)
 {
     assert(!rule->cr.wc.wildcards);
 
-    if (rule->may_install) {
+    if (rule->may_install && rule->super->may_install) {
         struct odp_flow_put put;
         if (!do_put_flow(p, rule,
                          ODPPF_CREATE | ODPPF_MODIFY | ODPPF_ZERO_STATS,
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index dae42dd..de76c98 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -94,7 +94,7 @@ int ofproto_send_packet(struct ofproto *, const flow_t *,
 void ofproto_add_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
                       unsigned int priority,
                       const union ofp_action *, size_t n_actions,
-                      int idle_timeout);
+                      int idle_timeout, bool may_install);
 bool ofproto_has_matching_flow(struct ofproto *, const flow_t *,
                                uint32_t wildcards);
 void ofproto_delete_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 018440b..89423b5 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1291,7 +1291,7 @@ bridge_reconfigure_controller(struct bridge *br)
         action.output.port = htons(OFPP_NORMAL);
         memset(&flow, 0, sizeof flow);
         ofproto_add_flow(br->ofproto, &flow, OFPFW_ALL, 0,
-                         &action, 1, 0);
+                         &action, 1, 0, true);
 
         ofproto_set_in_band(br->ofproto, false);
         ofproto_set_max_backoff(br->ofproto, 1);
-- 
1.6.0.4





More information about the discuss mailing list