DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawei Wang <jiaweiw@nvidia.com>
To: ferruh.yigit@intel.com, viacheslavo@nvidia.com, matan@nvidia.com,
	orika@nvidia.com
Cc: dev@dpdk.org, rasland@nvidia.com
Subject: [dpdk-dev] [PATCH v2 1/4] app/testpmd: add RSS support in sample action
Date: Tue, 12 Jan 2021 12:01:26 +0200	[thread overview]
Message-ID: <1610445689-389472-2-git-send-email-jiaweiw@nvidia.com> (raw)
In-Reply-To: <1610445689-389472-1-git-send-email-jiaweiw@nvidia.com>

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 <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 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


  reply	other threads:[~2021-01-12 10:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10  9:10 [dpdk-dev] [PATCH 0/3] Add RSS action support in the sample sub-actions list Jiawei Wang
2021-01-10  9:10 ` [dpdk-dev] [PATCH 1/3] app/testpmd: add RSS support in sample action Jiawei Wang
2021-01-10  9:10 ` [dpdk-dev] [PATCH 2/3] net/mlx5: handle the RSS action in the sample Jiawei Wang
2021-01-10  9:10 ` [dpdk-dev] [PATCH 3/3] doc: update RSS support in sample action Jiawei Wang
2021-01-12 10:01 ` [dpdk-dev] [PATCH v2 0/4] Add RSS action support in the sample sub-actions list Jiawei Wang
2021-01-12 10:01   ` Jiawei Wang [this message]
2021-01-12 10:01   ` [dpdk-dev] [PATCH v2 2/4] net/mlx5: fix the unnecessary checking for RSS action Jiawei Wang
2021-01-12 10:01   ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: handle the RSS action in the sample Jiawei Wang
2021-01-12 10:01   ` [dpdk-dev] [PATCH v2 4/4] doc: update RSS support in sample action Jiawei Wang
2021-01-19 13:13     ` Ferruh Yigit
2021-01-14  7:24   ` [dpdk-dev] [PATCH v3 0/4] Add RSS action support in the sample sub-actions list Jiawei Wang
2021-01-14  7:24     ` [dpdk-dev] [PATCH v3 1/4] app/testpmd: add RSS support in sample action Jiawei Wang
2021-01-14  7:24     ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: fix the unnecessary checking for RSS action Jiawei Wang
2021-01-14  7:24     ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: handle the RSS action in the sample Jiawei Wang
2021-01-14  7:24     ` [dpdk-dev] [PATCH v3 4/4] doc: update RSS support in sample action Jiawei Wang
2021-01-18 20:30     ` [dpdk-dev] [PATCH v3 0/4] Add RSS action support in the sample sub-actions list Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1610445689-389472-2-git-send-email-jiaweiw@nvidia.com \
    --to=jiaweiw@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).