From 92f6c44a92cc3247db94fd5fe86bf7e5cb896a91 Mon Sep 17 00:00:00 2001 From: Chris Mi Date: Wed, 16 Oct 2019 11:37:14 +0300 Subject: tc: Limit the max action number to 16 Currently, ovs supports to offload max TCA_ACT_MAX_PRIO(32) actions. But net sched api has a limit of 4K message size which is not enough for 32 actions when echo flag is set. After a lot of testing, we find that 16 actions is a reasonable number. So in this commit, we introduced a new define to limit the max actions. Fixes: 0c70132cd288("tc: Make the actions order consistent") Signed-off-by: Chris Mi Reviewed-by: Roi Dayan Signed-off-by: Simon Horman --- lib/netdev-offload-tc.c | 4 ++-- lib/tc.c | 6 +++--- lib/tc.h | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 4cc044b4b..ad637b48c 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1303,8 +1303,8 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, } NL_ATTR_FOR_EACH(nla, left, actions, actions_len) { - if (flower.action_count >= TCA_ACT_MAX_PRIO) { - VLOG_DBG_RL(&rl, "Can only support %d actions", flower.action_count); + if (flower.action_count >= TCA_ACT_MAX_NUM) { + VLOG_DBG_RL(&rl, "Can only support %d actions", TCA_ACT_MAX_NUM); return EOPNOTSUPP; } action = &flower.actions[flower.action_count]; diff --git a/lib/tc.c b/lib/tc.c index 1eca35620..71418b3f3 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -1362,7 +1362,7 @@ static int nl_parse_flower_actions(struct nlattr **attrs, struct tc_flower *flower) { const struct nlattr *actions = attrs[TCA_FLOWER_ACT]; - static struct nl_policy actions_orders_policy[TCA_ACT_MAX_PRIO + 1] = {}; + static struct nl_policy actions_orders_policy[TCA_ACT_MAX_NUM + 1] = {}; struct nlattr *actions_orders[ARRAY_SIZE(actions_orders_policy)]; const int max_size = ARRAY_SIZE(actions_orders_policy); @@ -1381,8 +1381,8 @@ nl_parse_flower_actions(struct nlattr **attrs, struct tc_flower *flower) if (actions_orders[i]) { int err; - if (flower->action_count >= TCA_ACT_MAX_PRIO) { - VLOG_DBG_RL(&error_rl, "Can only support %d actions", flower->action_count); + if (flower->action_count >= TCA_ACT_MAX_NUM) { + VLOG_DBG_RL(&error_rl, "Can only support %d actions", TCA_ACT_MAX_NUM); return EOPNOTSUPP; } err = nl_parse_single_action(actions_orders[i], flower); diff --git a/lib/tc.h b/lib/tc.h index 2e0f5e37a..b7c977a14 100644 --- a/lib/tc.h +++ b/lib/tc.h @@ -197,6 +197,8 @@ enum tc_offloaded_state { TC_OFFLOADED_STATE_NOT_IN_HW, }; +#define TCA_ACT_MAX_NUM 16 + struct tc_flower { uint32_t handle; uint32_t prio; @@ -205,7 +207,7 @@ struct tc_flower { struct tc_flower_key mask; int action_count; - struct tc_action actions[TCA_ACT_MAX_PRIO]; + struct tc_action actions[TCA_ACT_MAX_NUM]; struct ovs_flow_stats stats; uint64_t lastused; -- 2.14.1