[dpdk-dev,02/18] app/testpmd: support flow RSS level parsing

Message ID 20180226150947.107179-3-xuemingl@mellanox.com
State Superseded, archived
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Xueming(Steven) Li Feb. 26, 2018, 3:09 p.m.
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 <xuemingl@mellanox.com>
---
 app/test-pmd/cmdline_flow.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

Comments

Ferruh Yigit Feb. 27, 2018, 1:10 p.m. | #1
On 2/26/2018 3:09 PM, Xueming Li wrote:
> 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 <xuemingl@mellanox.com>
> ---
>  app/test-pmd/cmdline_flow.c | 27 +++++++++++++++++++++++++--

Isn't there any document file to update for this new parameter?
Xueming(Steven) Li March 5, 2018, 10:36 a.m. | #2
Thanks for reminding, I'll update in next version.

> -----Original Message-----

> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]

> Sent: Tuesday, February 27, 2018 9:10 PM

> To: Xueming(Steven) Li <xuemingl@mellanox.com>; Wenzhuo Lu

> <wenzhuo.lu@intel.com>; Jingjing Wu <jingjing.wu@intel.com>; Thomas

> Monjalon <thomas@monjalon.net>; Nélio Laranjeiro

> <nelio.laranjeiro@6wind.com>; Adrien Mazarguil

> <adrien.mazarguil@6wind.com>; Shahaf Shuler <shahafs@mellanox.com>

> Cc: dev@dpdk.org

> Subject: Re: [dpdk-dev] [PATCH 02/18] app/testpmd: support flow RSS level

> parsing

> 

> On 2/26/2018 3:09 PM, Xueming Li wrote:

> > 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 <xuemingl@mellanox.com>

> > ---

> >  app/test-pmd/cmdline_flow.c | 27 +++++++++++++++++++++++++--

> 

> Isn't there any document file to update for this new parameter?

Patch

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;