[ovs-dev] [PATCH 6/8] ofproto-dpif-xlate: Do not add more MPLS LSEs than the datapath can handle

Simon Horman horms at verge.net.au
Wed Jan 15 07:13:23 UTC 2014


This is an proposed enhancement to
"Implement OpenFlow support for MPLS, for up to 3 labels."

This makes the conservative assumption that the datapath should
not be asked to apply MPLS push actions such that the resulting
packet will have an MPLS label stack depth greater than the
datapath can accept in a match.

In future it may be possible to use recirculation to handle
such cases.

Signed-off-by: Simon Horman <horms at verge.net.au>
---
 ofproto/ofproto-dpif-xlate.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 9cc7dad..f14f308 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -2127,17 +2127,22 @@ compose_mpls_push_action(struct xlate_ctx *ctx, struct ofpact_push_mpls *mpls)
         ctx->xout->slow |= commit_odp_actions(flow, &ctx->base_flow,
                                               &ctx->xout->odp_actions,
                                               &ctx->xout->wc);
-    } else if (n >= ARRAY_SIZE(flow->mpls_lse)) {
-        if (ctx->xin->packet != NULL) {
-            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
-            VLOG_WARN_RL(&rl, "bridge %s: dropping packet which after an "
-                         "MPLS push action will have more MPLS LSEs than "
-                         "the %"PRIuSIZE" that can be handled.",
-                         ctx->xbridge->name, ARRAY_SIZE(flow->mpls_lse));
+    } else {
+        size_t max_stack = MIN(ARRAY_SIZE(flow->mpls_lse),
+                               ctx->xbridge->max_mpls_depth);
+
+        if (n >= max_stack) {
+            if (ctx->xin->packet != NULL) {
+                static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+                VLOG_WARN_RL(&rl, "bridge %s: dropping packet which after an "
+                            "MPLS push action will have more MPLS LSEs than "
+                            "the %"PRIuSIZE" that can be handled.",
+                            ctx->xbridge->name, max_stack);
+            }
+            ctx->exit = true;
+            ofpbuf_clear(&ctx->xout->odp_actions);
+            return;
         }
-        ctx->exit = true;
-        ofpbuf_clear(&ctx->xout->odp_actions);
-        return;
     }
 
     flow_push_mpls(flow, mpls->ethertype, wc);
-- 
1.8.4




More information about the dev mailing list