[ovs-dev] [PATCH/RFC v18 3/6] Break out rule_dpif_choose_miss_rule

Simon Horman horms at verge.net.au
Wed Feb 12 08:05:09 UTC 2014


Signed-off-by: Simon Horman <horms at verge.net.au>
---
 ofproto/ofproto-dpif.c | 26 +++++++++++++++++---------
 ofproto/ofproto-dpif.h |  4 ++++
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 7b3e1eb..8606226 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -3031,27 +3031,35 @@ rule_dpif_get_actions(const struct rule_dpif *rule)
     return rule_get_actions(&rule->up);
 }
 
-/* Lookup 'flow' in 'ofproto''s classifier.  If 'wc' is non-null, sets
- * the fields that were relevant as part of the lookup. */
+/* Choose the miss rule for 'in_port' in 'ofproto'. */
 void
-rule_dpif_lookup(struct ofproto_dpif *ofproto, const struct flow *flow,
-                 struct flow_wildcards *wc, struct rule_dpif **rule)
+rule_dpif_choose_miss_rule(struct ofproto_dpif *ofproto, ofp_port_t in_port,
+                           struct rule_dpif **rule)
 {
     struct ofport_dpif *port;
 
-    if (rule_dpif_lookup_in_table(ofproto, flow, wc, 0, rule)) {
-        return;
-    }
-    port = get_ofp_port(ofproto, flow->in_port.ofp_port);
+    port = get_ofp_port(ofproto, in_port);
     if (!port) {
         VLOG_WARN_RL(&rl, "packet-in on unknown OpenFlow port %"PRIu16,
-                     flow->in_port.ofp_port);
+                     in_port);
     }
 
     choose_miss_rule(port ? port->up.pp.config : 0, ofproto->miss_rule,
                      ofproto->no_packet_in_rule, rule);
 }
 
+/* Lookup 'flow' in 'ofproto''s classifier.  If 'wc' is non-null, sets
+ * the fields that were relevant as part of the lookup. */
+void
+rule_dpif_lookup(struct ofproto_dpif *ofproto, const struct flow *flow,
+                 struct flow_wildcards *wc, struct rule_dpif **rule)
+{
+    if (rule_dpif_lookup_in_table(ofproto, flow, wc, 0, rule)) {
+        return;
+    }
+    rule_dpif_choose_miss_rule(ofproto, flow->in_port.ofp_port, rule);
+}
+
 bool
 rule_dpif_lookup_in_table(struct ofproto_dpif *ofproto,
                           const struct flow *flow, struct flow_wildcards *wc,
diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h
index d09e285..c0fedee 100644
--- a/ofproto/ofproto-dpif.h
+++ b/ofproto/ofproto-dpif.h
@@ -67,6 +67,10 @@ extern struct ovs_rwlock xlate_rwlock;
 
 size_t ofproto_dpif_get_max_mpls_depth(const struct ofproto_dpif *);
 
+void
+rule_dpif_choose_miss_rule(struct ofproto_dpif *ofproto, ofp_port_t in_port,
+                           struct rule_dpif **rule);
+
 void rule_dpif_lookup(struct ofproto_dpif *, const struct flow *,
                       struct flow_wildcards *, struct rule_dpif **rule);
 
-- 
1.8.5.2




More information about the dev mailing list