From bd3240ba0cec7c89d44dd78e9b3dd566ae223140 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Wed, 30 Oct 2013 18:17:13 +0900 Subject: [PATCH] ofproto: Break out resubmit resource checking Break out resubmit resource checking into a helper function xlate_resubmit_resource_check() and use this new function. This is to allow the check to be re-used by a subsequent patch. Suggested-by: Ben Pfaff Signed-off-by: Simon Horman Signed-off-by: Ben Pfaff --- ofproto/ofproto-dpif-xlate.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index ae6f6380d..d300ec5af 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -1715,9 +1715,8 @@ xlate_recursively(struct xlate_ctx *ctx, struct rule_dpif *rule) ctx->recurse--; } -static void -xlate_table_action(struct xlate_ctx *ctx, - ofp_port_t in_port, uint8_t table_id, bool may_packet_in) +static bool +xlate_resubmit_resource_check(struct xlate_ctx *ctx) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); @@ -1731,6 +1730,17 @@ xlate_table_action(struct xlate_ctx *ctx, } else if (ctx->stack.size >= 65536) { VLOG_ERR_RL(&rl, "resubmits yielded over 64 kB of stack"); } else { + return true; + } + + return false; +} + +static void +xlate_table_action(struct xlate_ctx *ctx, + ofp_port_t in_port, uint8_t table_id, bool may_packet_in) +{ + if (xlate_resubmit_resource_check(ctx)) { struct rule_dpif *rule; ofp_port_t old_in_port = ctx->xin->flow.in_port.ofp_port; uint8_t old_table_id = ctx->table_id; -- 2.47.0