From patchwork Wed Oct 16 08:37:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1177681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46tQgJ6s87z9sCJ for ; Wed, 16 Oct 2019 19:38:35 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D2C9940B; Wed, 16 Oct 2019 08:38:32 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D7233408 for ; Wed, 16 Oct 2019 08:38:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id D6C5B13A for ; Wed, 16 Oct 2019 08:38:30 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from roid@mellanox.com) with ESMTPS (AES256-SHA encrypted); 16 Oct 2019 10:38:24 +0200 Received: from mtr-vdi-191.wap.labs.mlnx. (mtr-vdi-191.wap.labs.mlnx [10.209.100.28]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x9G8cOPB021244; Wed, 16 Oct 2019 11:38:24 +0300 From: Roi Dayan To: dev@openvswitch.org Date: Wed, 16 Oct 2019 11:37:14 +0300 Message-Id: <20191016083714.104447-1-roid@mellanox.com> X-Mailer: git-send-email 2.8.4 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] tc: Limit the max action number to 16 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Chris Mi 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 --- 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 6814390eab2f..f6d1abb2e695 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1360,8 +1360,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 316a0ee5dc7c..d5487097d8ec 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -1458,7 +1458,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); @@ -1477,8 +1477,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 f4213579a2fd..f4073c6c47e6 100644 --- a/lib/tc.h +++ b/lib/tc.h @@ -208,6 +208,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; @@ -216,7 +218,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;