[ovs-dev] [PATCH 7/8] ofproto-dpif-xlate: Do not use of more MPLS LSEs than the datapath can supply
Simon Horman
horms at verge.net.au
Wed Jan 15 07:13:24 UTC 2014
This is an proposed enhancement to
"Implement OpenFlow support for MPLS, for up to 3 labels."
Signed-off-by: Simon Horman <horms at verge.net.au>
---
ofproto/ofproto-dpif-xlate.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index f14f308..57e8978 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -2155,18 +2155,22 @@ compose_mpls_pop_action(struct xlate_ctx *ctx, ovs_be16 eth_type)
struct flow_wildcards *wc = &ctx->xout->wc;
struct flow *flow = &ctx->xin->flow;
- if (!flow_pop_mpls(flow, eth_type, wc) &&
- flow_count_mpls_labels(flow, wc) >= 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 on which an "
- "MPLS pop action can't be performed as it has "
- "have more MPLS LSEs than the %"PRIuSIZE" "
- "that can be handled.",
- ctx->xbridge->name, ARRAY_SIZE(flow->mpls_lse));
+ if (!flow_pop_mpls(flow, eth_type, wc)) {
+ int n = flow_count_mpls_labels(flow, wc);
+ 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 on which an "
+ "MPLS pop action can't be performed as it has "
+ "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);
}
- ctx->exit = true;
- ofpbuf_clear(&ctx->xout->odp_actions);
}
}
--
1.8.4
More information about the dev
mailing list