[ovs-dev] [PATCH] ofproto: Fix remaining incorrect users of OVSP_LOCAL.

Justin Pettit jpettit at nicira.com
Wed Jan 9 00:49:11 UTC 2013


In the switch to a single datapath, the simple mapping between
OFPP_LOCAL and OVSP_LOCAL was broken.  Unfortunately, a couple of
translations were missed, so this commit fixes them.

Reported-by: Jesse Gross <jesse at nicira.com>
Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 ofproto/connmgr.c      |    4 +++-
 ofproto/connmgr.h      |    1 +
 ofproto/in-band.c      |    4 ++--
 ofproto/in-band.h      |    2 +-
 ofproto/ofproto-dpif.c |    5 ++++-
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 1dc9082..2226bc3 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1638,10 +1638,12 @@ connmgr_msg_in_hook(struct connmgr *mgr, const struct flow *flow,
 
 bool
 connmgr_may_set_up_flow(struct connmgr *mgr, const struct flow *flow,
+                        uint32_t local_odp_port,
                         const struct nlattr *odp_actions,
                         size_t actions_len)
 {
-    return !mgr->in_band || in_band_rule_check(flow, odp_actions, actions_len);
+    return !mgr->in_band || in_band_rule_check(flow, local_odp_port,
+                                               odp_actions, actions_len);
 }
 
 /* Fail-open and in-band implementation. */
diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h
index a2f7d5a..6ce413e 100644
--- a/ofproto/connmgr.h
+++ b/ofproto/connmgr.h
@@ -158,6 +158,7 @@ void connmgr_set_in_band_queue(struct connmgr *, int queue_id);
 bool connmgr_msg_in_hook(struct connmgr *, const struct flow *,
                          const struct ofpbuf *packet);
 bool connmgr_may_set_up_flow(struct connmgr *, const struct flow *,
+                             uint32_t local_odp_port,
                              const struct nlattr *odp_actions,
                              size_t actions_len);
 
diff --git a/ofproto/in-band.c b/ofproto/in-band.c
index 81b330d..3b98005 100644
--- a/ofproto/in-band.c
+++ b/ofproto/in-band.c
@@ -256,7 +256,7 @@ in_band_msg_in_hook(struct in_band *in_band, const struct flow *flow,
 /* Returns true if the rule that would match 'flow' with 'actions' is
  * allowed to be set up in the datapath. */
 bool
-in_band_rule_check(const struct flow *flow,
+in_band_rule_check(const struct flow *flow, uint32_t local_odp_port,
                    const struct nlattr *actions, size_t actions_len)
 {
     /* Don't allow flows that would prevent DHCP replies from being seen
@@ -270,7 +270,7 @@ in_band_rule_check(const struct flow *flow,
 
         NL_ATTR_FOR_EACH_UNSAFE (a, left, actions, actions_len) {
             if (nl_attr_type(a) == OVS_ACTION_ATTR_OUTPUT
-                && nl_attr_get_u32(a) == OVSP_LOCAL) {
+                && nl_attr_get_u32(a) == local_odp_port) {
                 return true;
             }
         }
diff --git a/ofproto/in-band.h b/ofproto/in-band.h
index 7b610cb..71de6ff 100644
--- a/ofproto/in-band.h
+++ b/ofproto/in-band.h
@@ -41,7 +41,7 @@ void in_band_wait(struct in_band *);
 
 bool in_band_msg_in_hook(struct in_band *, const struct flow *,
                          const struct ofpbuf *packet);
-bool in_band_rule_check(const struct flow *,
+bool in_band_rule_check(const struct flow *, uint32_t local_odp_port,
                         const struct nlattr *odp_actions, size_t actions_len);
 
 #endif /* in-band.h */
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 186f0a7..350dad2 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -2929,7 +2929,7 @@ port_get_stats(const struct ofport *ofport_, struct netdev_stats *stats)
 
     error = netdev_get_stats(ofport->up.netdev, stats);
 
-    if (!error && ofport->odp_port == OVSP_LOCAL) {
+    if (!error && ofport_->ofp_port == OFPP_LOCAL) {
         struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofport->up.ofproto);
 
         /* ofproto->stats.tx_packets represents packets that we created
@@ -6179,6 +6179,7 @@ xlate_actions(struct action_xlate_ctx *ctx,
     } else {
         static struct vlog_rate_limit trace_rl = VLOG_RATE_LIMIT_INIT(1, 1);
         ovs_be16 initial_tci = ctx->base_flow.vlan_tci;
+        uint32_t local_odp_port;
 
         add_sflow_action(ctx);
         do_xlate_actions(ofpacts, ofpacts_len, ctx);
@@ -6199,7 +6200,9 @@ xlate_actions(struct action_xlate_ctx *ctx,
             }
         }
 
+        local_odp_port = ofp_port_to_odp_port(ctx->ofproto, OFPP_LOCAL);
         if (!connmgr_may_set_up_flow(ctx->ofproto->up.connmgr, &ctx->flow,
+                                     local_odp_port,
                                      ctx->odp_actions->data,
                                      ctx->odp_actions->size)) {
             ctx->slow |= SLOW_IN_BAND;
-- 
1.7.5.4




More information about the dev mailing list