Skip to content

Commit

Permalink
tc: Limit the max action number to 16
Browse files Browse the repository at this point in the history
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: 0c70132("tc: Make the actions order consistent")
Signed-off-by: Chris Mi <chrism@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
  • Loading branch information
mishuang2017 authored and shorman-netronome committed Oct 26, 2019
1 parent 590656a commit bcf0477
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/netdev-tc-offloads.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,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];
Expand Down
6 changes: 3 additions & 3 deletions lib/tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,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);

Expand All @@ -953,8 +953,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);
Expand Down
4 changes: 3 additions & 1 deletion lib/tc.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,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;
Expand All @@ -156,7 +158,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;
Expand Down

0 comments on commit bcf0477

Please sign in to comment.