From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id A7C414C8C for ; Mon, 26 Feb 2018 16:10:20 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 26 Feb 2018 17:10:37 +0200 Received: from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx [10.12.205.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w1QFAIMp021355; Mon, 26 Feb 2018 17:10:19 +0200 Received: from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id w1QFAI03107257; Mon, 26 Feb 2018 23:10:18 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id w1QFAIQ1107256; Mon, 26 Feb 2018 23:10:18 +0800 From: Xueming Li To: Wenzhuo Lu , Jingjing Wu , Thomas Monjalon , Nelio Laranjeiro , Adrien Mazarguil , Shahaf Shuler Cc: Xueming Li , dev@dpdk.org Date: Mon, 26 Feb 2018 23:09:31 +0800 Message-Id: <20180226150947.107179-3-xuemingl@mellanox.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20180226150947.107179-1-xuemingl@mellanox.com> References: <20180226150947.107179-1-xuemingl@mellanox.com> Subject: [dpdk-dev] [PATCH 02/18] app/testpmd: support flow RSS level parsing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Feb 2018 15:10:21 -0000 Support new flow RSS level parameter to select inner or outer RSS fields. Example: flow create 0 ingress pattern eth / ipv4 / udp dst is 4789 / vxlan / end actions rss queues 1 2 end level 1 / end Signed-off-by: Xueming Li --- app/test-pmd/cmdline_flow.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index a5cf84f..921220d 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -169,6 +169,7 @@ enum index { ACTION_RSS, ACTION_RSS_QUEUES, ACTION_RSS_QUEUE, + ACTION_RSS_LEVEL, ACTION_PF, ACTION_VF, ACTION_VF_ORIGINAL, @@ -190,7 +191,8 @@ enum index { /** Storage size for struct rte_flow_action_rss including queues. */ #define ACTION_RSS_SIZE \ (offsetof(struct rte_flow_action_rss, queue) + \ - sizeof(*((struct rte_flow_action_rss *)0)->queue) * ACTION_RSS_NUM) + sizeof(*((struct rte_flow_action_rss *)0)->queue) * ACTION_RSS_NUM + \ + sizeof(struct rte_eth_rss_conf)) /** Maximum number of subsequent tokens and arguments on the stack. */ #define CTX_STACK_SIZE 16 @@ -623,6 +625,7 @@ struct parse_action_priv { static const enum index action_rss[] = { ACTION_RSS_QUEUES, + ACTION_RSS_LEVEL, ACTION_NEXT, ZERO, }; @@ -640,6 +643,12 @@ struct parse_action_priv { ZERO, }; +static struct arg rss_level_arg = { + .offset = ACTION_RSS_SIZE - sizeof(struct rte_eth_rss_conf) + + offsetof(struct rte_eth_rss_conf, rss_level), + .size = sizeof(((struct rte_eth_rss_conf *)0)->rss_level), +}; + static int parse_init(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -1589,6 +1598,13 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, .call = parse_vc_action_rss_queue, .comp = comp_vc_action_rss_queue, }, + [ACTION_RSS_LEVEL] = { + .name = "level", + .help = "rss on tunnel level", + .next = NEXT(action_rss, NEXT_ENTRY(UNSIGNED)), + .args = ARGS(&rss_level_arg), + .call = parse_vc_conf, + }, [ACTION_PF] = { .name = "pf", .help = "redirect packets to physical device function", @@ -1890,6 +1906,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, sizeof(double)); if ((uint8_t *)item + sizeof(*item) > data) return -1; + memset(data, 0, data_size); *item = (struct rte_flow_item){ .type = priv->type, }; @@ -1907,14 +1924,20 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, sizeof(double)); if ((uint8_t *)action + sizeof(*action) > data) return -1; + memset(data, 0, data_size); *action = (struct rte_flow_action){ .type = priv->type, }; + if (ctx->curr == ACTION_RSS) { + struct rte_flow_action_rss *rss = (void *)data; + + rss->rss_conf = RTE_PTR_ADD(rss, data_size - + sizeof(*rss->rss_conf)); + } ++out->args.vc.actions_n; ctx->object = action; ctx->objmask = NULL; } - memset(data, 0, data_size); out->args.vc.data = data; ctx->objdata = data_size; return len; -- 1.8.3.1