From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C540EA0A02; Thu, 14 Jan 2021 08:25:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04911140FAF; Thu, 14 Jan 2021 08:25:00 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id A4294140F9A for ; Thu, 14 Jan 2021 08:24:54 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from jiaweiw@nvidia.com) with SMTP; 14 Jan 2021 09:24:48 +0200 Received: from nvidia.com (gen-l-vrt-281.mtl.labs.mlnx [10.237.44.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 10E7OmcV001294; Thu, 14 Jan 2021 09:24:48 +0200 From: Jiawei Wang To: ferruh.yigit@intel.com, viacheslavo@nvidia.com, matan@nvidia.com, orika@nvidia.com Cc: dev@dpdk.org, rasland@nvidia.com Date: Thu, 14 Jan 2021 09:24:45 +0200 Message-Id: <1610609088-204833-2-git-send-email-jiaweiw@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1610609088-204833-1-git-send-email-jiaweiw@nvidia.com> References: <1610445689-389472-1-git-send-email-jiaweiw@nvidia.com> <1610609088-204833-1-git-send-email-jiaweiw@nvidia.com> Subject: [dpdk-dev] [PATCH v3 1/4] app/testpmd: add RSS support in sample action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Support rss action in the sample sub-actions list. The examples for the sample flow use case and result as below: set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index 0 / jump group 2 / end This flow will result in all the matched ingress packets will be jumped to next table, and the each packet will be marked with 0x12 and duplicated to rss queues of the control application. Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko --- app/test-pmd/cmdline_flow.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 585cab9..28c3a1b 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -560,6 +560,7 @@ struct raw_sample_conf { struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM]; struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM]; struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM]; +struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM]; /** Maximum number of subsequent tokens and arguments on the stack. */ #define CTX_STACK_SIZE 16 @@ -1548,6 +1549,7 @@ struct parse_action_priv { static const enum index next_action_sample[] = { ACTION_QUEUE, + ACTION_RSS, ACTION_MARK, ACTION_COUNT, ACTION_PORT_ID, @@ -7515,6 +7517,7 @@ static int comp_set_sample_index(struct context *, const struct token *, uint32_t i = 0; struct rte_flow_action *action = NULL; struct rte_flow_action *data = NULL; + const struct rte_flow_action_rss *rss = NULL; size_t size = 0; uint16_t idx = in->port; /* We borrow port field as index */ uint32_t max_size = sizeof(struct rte_flow_action) * @@ -7546,6 +7549,29 @@ static int comp_set_sample_index(struct context *, const struct token *, (const void *)action->conf, size); action->conf = &sample_queue[idx]; break; + case RTE_FLOW_ACTION_TYPE_RSS: + size = sizeof(struct rte_flow_action_rss); + rss = action->conf; + rte_memcpy(&sample_rss_data[idx].conf, + (const void *)rss, size); + if (rss->key_len) { + sample_rss_data[idx].conf.key = + sample_rss_data[idx].key; + rte_memcpy((void *)((uintptr_t) + sample_rss_data[idx].conf.key), + (const void *)rss->key, + sizeof(uint8_t) * rss->key_len); + } + if (rss->queue_num) { + sample_rss_data[idx].conf.queue = + sample_rss_data[idx].queue; + rte_memcpy((void *)((uintptr_t) + sample_rss_data[idx].conf.queue), + (const void *)rss->queue, + sizeof(uint16_t) * rss->queue_num); + } + action->conf = &sample_rss_data[idx].conf; + break; case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: size = sizeof(struct rte_flow_action_raw_encap); rte_memcpy(&sample_encap[idx], -- 1.8.3.1