[dpdk-dev,v3,2/2] app/testpmd: add API for configuration of queue region

Message ID 1505445188-70251-3-git-send-email-wei.zhao1@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

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

Commit Message

Zhao1, Wei Sept. 15, 2017, 3:13 a.m. UTC
  This patch add a API configuration of queue region in rss.
It can parse the parameters of region index, queue number,
queue start index, user priority, traffic classes and so on.
According to commands from command line, it will call i40e
private API and start the process of set or flush queue region
configure. As this feature is specific for i40e, so private API
will be used.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 app/test-pmd/cmdline.c | 328 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 328 insertions(+)
  

Comments

Ferruh Yigit Sept. 20, 2017, 10:45 a.m. UTC | #1
On 9/15/2017 4:13 AM, Wei Zhao wrote:
> This patch add a API configuration of queue region in rss.
> It can parse the parameters of region index, queue number,
> queue start index, user priority, traffic classes and so on.
> According to commands from command line, it will call i40e
> private API and start the process of set or flush queue region
> configure. As this feature is specific for i40e, so private API
> will be used.
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  app/test-pmd/cmdline.c | 328 +++++++++++++++++++++++++++++++++++++++++++++++++

Testpmd documentation also needs to be updated.

>  1 file changed, 328 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 0144191..060fcb1 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void *parsed_result,
>  			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
>  			"    Update a ptype mapping item on a port\n\n"
>  
> +			"queue-region set port (port_id) region_id (value) "
> +			"queue_start_index (value) queue_num (value)\n"
> +			"    Set a queue region on a port\n\n"
> +
> +			"queue-region set (pf|vf) port (port_id) region_id (value) "
> +			"flowtype (value)\n"
> +			"    Set a flowtype region index on a port\n\n"
> +
> +			"queue-region set port (port_id) UP (value) region_id (value)\n"
> +			"    Set the mapping of User Priority to "
> +			"queue region on a port\n\n"
> +
> +			"queue-region flush (on|off) port (port_id)\n"
> +			"    flush all queue region related configuration\n\n"

I keep doing same comment but I will do it again...

Each patch adding a new feature looking from its own context and adding
a new root level command and this is making overall testpmd confusing.

Since this is to set an option of the port, what do you think making
this command part of existing commands, like:
"port config #P queue-region ...."
OR
"set port #P queue-region ..." ?

> +
>  			, list_pkt_forwarding_modes()
>  		);
>  	}
> @@ -8224,6 +8239,315 @@ cmdline_parse_inst_t cmd_syn_filter = {
>  		NULL,
>  	},
>  };
> +/* *** queue region set *** */
> +struct cmd_queue_region_result {
> +	cmdline_fixed_string_t cmd;
> +	cmdline_fixed_string_t set;
> +	cmdline_fixed_string_t port;
> +	uint8_t  port_id;
> +	cmdline_fixed_string_t region;
> +	uint8_t  region_id;
> +	cmdline_fixed_string_t queue_start_index;
> +	uint8_t  queue_id;
> +	cmdline_fixed_string_t queue_num;
> +	uint8_t  queue_num_value;
> +};
> +
> +static void
> +cmd_queue_region_parsed(void *parsed_result,
> +			__attribute__((unused)) struct cmdline *cl,
> +			__attribute__((unused)) void *data)
> +{
> +	struct cmd_queue_region_result *res = parsed_result;
> +	struct rte_i40e_rss_region_conf region_conf;
> +	int ret = 0;
> +
> +	memset(&region_conf, 0, sizeof(region_conf));
> +	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
> +	region_conf.region_id = res->region_id;
> +	region_conf.queue_num = res->queue_num_value;
> +	region_conf.queue_start_index = res->queue_id;
> +
> +	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);

It is not safe to directly call PMD specific APIs from testpmd? What if
that PMD is not enabled? There are samples how to do this, can you
please check them?

<...>
  
Zhao1, Wei Sept. 25, 2017, 9:25 a.m. UTC | #2
Hi, Ferruh

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

> From: Yigit, Ferruh

> Sent: Wednesday, September 20, 2017 6:46 PM

> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org; Wu, Jingjing

> <jingjing.wu@intel.com>

> Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add API for

> configuration of queue region

> 

> On 9/15/2017 4:13 AM, Wei Zhao wrote:

> > This patch add a API configuration of queue region in rss.

> > It can parse the parameters of region index, queue number, queue start

> > index, user priority, traffic classes and so on.

> > According to commands from command line, it will call i40e private API

> > and start the process of set or flush queue region configure. As this

> > feature is specific for i40e, so private API will be used.

> >

> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

> > ---

> >  app/test-pmd/cmdline.c | 328

> > +++++++++++++++++++++++++++++++++++++++++++++++++

> 

> Testpmd documentation also needs to be updated.


Do you mean the following doc or others?
dpdk\doc\guides\testpmd_app_ug.rst


> 

> >  1 file changed, 328 insertions(+)

> >

> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index

> > 0144191..060fcb1 100644

> > --- a/app/test-pmd/cmdline.c

> > +++ b/app/test-pmd/cmdline.c

> > @@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void

> *parsed_result,

> >  			"ptype mapping update (port_id) (hw_ptype)

> (sw_ptype)\n"

> >  			"    Update a ptype mapping item on a port\n\n"

> >

> > +			"queue-region set port (port_id) region_id (value) "

> > +			"queue_start_index (value) queue_num (value)\n"

> > +			"    Set a queue region on a port\n\n"

> > +

> > +			"queue-region set (pf|vf) port (port_id) region_id

> (value) "

> > +			"flowtype (value)\n"

> > +			"    Set a flowtype region index on a port\n\n"

> > +

> > +			"queue-region set port (port_id) UP (value)

> region_id (value)\n"

> > +			"    Set the mapping of User Priority to "

> > +			"queue region on a port\n\n"

> > +

> > +			"queue-region flush (on|off) port (port_id)\n"

> > +			"    flush all queue region related configuration\n\n"

> 

> I keep doing same comment but I will do it again...

> 

> Each patch adding a new feature looking from its own context and adding a

> new root level command and this is making overall testpmd confusing.

> 

> Since this is to set an option of the port, what do you think making this

> command part of existing commands, like:

> "port config #P queue-region ...."

> OR

> "set port #P queue-region ..." ?


What you said is very meaningful, but other feature liake ptype mapping use the same mode  and so on.
maybe we should do a whole work to make CLI command style consistent.


> 

> > +

> >  			, list_pkt_forwarding_modes()

> >  		);

> >  	}

> > @@ -8224,6 +8239,315 @@ cmdline_parse_inst_t cmd_syn_filter = {

> >  		NULL,

> >  	},

> >  };

> > +/* *** queue region set *** */

> > +struct cmd_queue_region_result {

> > +	cmdline_fixed_string_t cmd;

> > +	cmdline_fixed_string_t set;

> > +	cmdline_fixed_string_t port;

> > +	uint8_t  port_id;

> > +	cmdline_fixed_string_t region;

> > +	uint8_t  region_id;

> > +	cmdline_fixed_string_t queue_start_index;

> > +	uint8_t  queue_id;

> > +	cmdline_fixed_string_t queue_num;

> > +	uint8_t  queue_num_value;

> > +};

> > +

> > +static void

> > +cmd_queue_region_parsed(void *parsed_result,

> > +			__attribute__((unused)) struct cmdline *cl,

> > +			__attribute__((unused)) void *data) {

> > +	struct cmd_queue_region_result *res = parsed_result;

> > +	struct rte_i40e_rss_region_conf region_conf;

> > +	int ret = 0;

> > +

> > +	memset(&region_conf, 0, sizeof(region_conf));

> > +	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;

> > +	region_conf.region_id = res->region_id;

> > +	region_conf.queue_num = res->queue_num_value;

> > +	region_conf.queue_start_index = res->queue_id;

> > +

> > +	ret = rte_pmd_i40e_queue_region_conf(res->port_id,

> &region_conf);

> 

> It is not safe to directly call PMD specific APIs from testpmd? What if that

> PMD is not enabled? There are samples how to do this, can you please check

> them?

> 


Good idea, I will add check code in PMD code to make sure RSS is enable.
If not, code will return fail.


> <...>
  
Ferruh Yigit Sept. 25, 2017, 9:43 a.m. UTC | #3
On 9/25/2017 10:25 AM, Zhao1, Wei wrote:
> Hi, Ferruh
> 
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Wednesday, September 20, 2017 6:46 PM
>> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org; Wu, Jingjing
>> <jingjing.wu@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add API for
>> configuration of queue region
>>
>> On 9/15/2017 4:13 AM, Wei Zhao wrote:
>>> This patch add a API configuration of queue region in rss.
>>> It can parse the parameters of region index, queue number, queue start
>>> index, user priority, traffic classes and so on.
>>> According to commands from command line, it will call i40e private API
>>> and start the process of set or flush queue region configure. As this
>>> feature is specific for i40e, so private API will be used.
>>>
>>> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
>>> ---
>>>  app/test-pmd/cmdline.c | 328
>>> +++++++++++++++++++++++++++++++++++++++++++++++++
>>
>> Testpmd documentation also needs to be updated.
> 
> Do you mean the following doc or others?
> dpdk\doc\guides\testpmd_app_ug.rst

Yes this one, thanks.

> 
> 
>>
>>>  1 file changed, 328 insertions(+)
>>>
>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
>>> 0144191..060fcb1 100644
>>> --- a/app/test-pmd/cmdline.c
>>> +++ b/app/test-pmd/cmdline.c
>>> @@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void
>> *parsed_result,
>>>  			"ptype mapping update (port_id) (hw_ptype)
>> (sw_ptype)\n"
>>>  			"    Update a ptype mapping item on a port\n\n"
>>>
>>> +			"queue-region set port (port_id) region_id (value) "
>>> +			"queue_start_index (value) queue_num (value)\n"
>>> +			"    Set a queue region on a port\n\n"
>>> +
>>> +			"queue-region set (pf|vf) port (port_id) region_id
>> (value) "
>>> +			"flowtype (value)\n"
>>> +			"    Set a flowtype region index on a port\n\n"
>>> +
>>> +			"queue-region set port (port_id) UP (value)
>> region_id (value)\n"
>>> +			"    Set the mapping of User Priority to "
>>> +			"queue region on a port\n\n"
>>> +
>>> +			"queue-region flush (on|off) port (port_id)\n"
>>> +			"    flush all queue region related configuration\n\n"
>>
>> I keep doing same comment but I will do it again...
>>
>> Each patch adding a new feature looking from its own context and adding a
>> new root level command and this is making overall testpmd confusing.
>>
>> Since this is to set an option of the port, what do you think making this
>> command part of existing commands, like:
>> "port config #P queue-region ...."
>> OR
>> "set port #P queue-region ..." ?
> 
> What you said is very meaningful, but other feature liake ptype mapping use the same mode  and so on.
> maybe we should do a whole work to make CLI command style consistent.

Yes ptype does it, is seems it is one of the missed ones. Although we
can do a whole work for CLI commands, meanwhile I think new ones can be
added properly.

This may be good opportunity to remember broken window theory [1] :)

[1]
https://blog.codinghorror.com/the-broken-window-theory/

<...>
  
Zhao1, Wei Sept. 26, 2017, 5:30 a.m. UTC | #4
Hi,Ferruh

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

> From: Yigit, Ferruh

> Sent: Monday, September 25, 2017 5:43 PM

> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org; Wu, Jingjing

> <jingjing.wu@intel.com>

> Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add API for

> configuration of queue region

> 

> On 9/25/2017 10:25 AM, Zhao1, Wei wrote:

> > Hi, Ferruh

> >

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

> >> From: Yigit, Ferruh

> >> Sent: Wednesday, September 20, 2017 6:46 PM

> >> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org; Wu, Jingjing

> >> <jingjing.wu@intel.com>

> >> Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add API for

> >> configuration of queue region

> >>

> >> On 9/15/2017 4:13 AM, Wei Zhao wrote:

> >>> This patch add a API configuration of queue region in rss.

> >>> It can parse the parameters of region index, queue number, queue

> >>> start index, user priority, traffic classes and so on.

> >>> According to commands from command line, it will call i40e private

> >>> API and start the process of set or flush queue region configure. As

> >>> this feature is specific for i40e, so private API will be used.

> >>>

> >>> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

> >>> ---

> >>>  app/test-pmd/cmdline.c | 328

> >>> +++++++++++++++++++++++++++++++++++++++++++++++++

> >>

> >> Testpmd documentation also needs to be updated.

> >

> > Do you mean the following doc or others?

> > dpdk\doc\guides\testpmd_app_ug.rst

> 

> Yes this one, thanks.

> 

> >

> >

> >>

> >>>  1 file changed, 328 insertions(+)

> >>>

> >>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index

> >>> 0144191..060fcb1 100644

> >>> --- a/app/test-pmd/cmdline.c

> >>> +++ b/app/test-pmd/cmdline.c

> >>> @@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void

> >> *parsed_result,

> >>>  			"ptype mapping update (port_id) (hw_ptype)

> >> (sw_ptype)\n"

> >>>  			"    Update a ptype mapping item on a port\n\n"

> >>>

> >>> +			"queue-region set port (port_id) region_id (value) "

> >>> +			"queue_start_index (value) queue_num (value)\n"

> >>> +			"    Set a queue region on a port\n\n"

> >>> +

> >>> +			"queue-region set (pf|vf) port (port_id) region_id

> >> (value) "

> >>> +			"flowtype (value)\n"

> >>> +			"    Set a flowtype region index on a port\n\n"

> >>> +

> >>> +			"queue-region set port (port_id) UP (value)

> >> region_id (value)\n"

> >>> +			"    Set the mapping of User Priority to "

> >>> +			"queue region on a port\n\n"

> >>> +

> >>> +			"queue-region flush (on|off) port (port_id)\n"

> >>> +			"    flush all queue region related configuration\n\n"

> >>

> >> I keep doing same comment but I will do it again...

> >>

> >> Each patch adding a new feature looking from its own context and

> >> adding a new root level command and this is making overall testpmd

> confusing.

> >>

> >> Since this is to set an option of the port, what do you think making

> >> this command part of existing commands, like:

> >> "port config #P queue-region ...."

> >> OR

> >> "set port #P queue-region ..." ?

> >

> > What you said is very meaningful, but other feature liake ptype mapping

> use the same mode  and so on.

> > maybe we should do a whole work to make CLI command style consistent.

> 

> Yes ptype does it, is seems it is one of the missed ones. Although we can do a

> whole work for CLI commands, meanwhile I think new ones can be added

> properly.

> 

> This may be good opportunity to remember broken window theory [1] :)



But  this type of CLI for queue region has been discussion when this feature skype meeting
We have do a ppt, which  review by DPDK-ENG-TECH-COMMITTEE, they have support and approve this type of command for this feature.
I think we should respect their review wok and decision  of other committee member.
AND also, The minority is subordinate to the majority, do you think so ?
I do not want do hold a second meeting later to  persuade them accept the new type of CLI command.
They may not also not change their idea too.


> 

> [1]

> https://blog.codinghorror.com/the-broken-window-theory/

> 

> <...>
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0144191..060fcb1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -637,6 +637,21 @@  static void cmd_help_long_parsed(void *parsed_result,
 			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set (pf|vf) port (port_id) region_id (value) "
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value) region_id (value)\n"
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8224,6 +8239,315 @@  cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_start_index;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_num_value;
+	region_conf.queue_start_index = res->queue_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				 cmd, "queue-region");
+cmdline_parse_token_string_t cmd_queue_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+		set, "set");
+cmdline_parse_token_string_t cmd_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port");
+cmdline_parse_token_num_t cmd_queue_region_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_id =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_queue_region_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_start_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_start_index, "queue_start_index");
+cmdline_parse_token_num_t cmd_queue_region_queue_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_num =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_num, "queue_num");
+cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_num_value, UINT8);
+
+cmdline_parse_inst_t cmd_queue_region = {
+	.f = cmd_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"queue_start_index <value> queue_num <value>: Set a queue region",
+	.tokens = {
+		(void *)&cmd_queue_region_cmd,
+		(void *)&cmd_queue_region_set,
+		(void *)&cmd_queue_region_port,
+		(void *)&cmd_queue_region_port_id,
+		(void *)&cmd_queue_region_id,
+		(void *)&cmd_queue_region_index,
+		(void *)&cmd_queue_region_queue_start_index,
+		(void *)&cmd_queue_region_queue_id,
+		(void *)&cmd_queue_region_queue_num,
+		(void *)&cmd_queue_region_queue_num_value,
+		NULL,
+	},
+};
+
+/* *** queue region and flowtype set *** */
+struct cmd_region_flowtype_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t flowtype;
+	uint8_t  flowtype_id;
+};
+
+static void
+cmd_region_flowtype_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_region_flowtype_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "pf") == 0)
+		region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET;
+	else
+		region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.hw_flowtype = res->flowtype_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("region flowtype config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_region_flowtype_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_region_flowtype_set =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_region_flowtype_what =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				what, "pf#vf");
+cmdline_parse_token_string_t cmd_region_flowtype_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_region_flowtype_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_region_flowtype_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype, "flowtype");
+cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype_id, UINT8);
+cmdline_parse_inst_t cmd_region_flowtype = {
+	.f = cmd_region_flowtype_parsed,
+	.data = NULL,
+	.help_str = "queue-region set pf|vf port <port_id> region_id <value> "
+		"flowtype <value>: Set a flowtype region index",
+	.tokens = {
+		(void *)&cmd_region_flowtype_cmd,
+		(void *)&cmd_region_flowtype_set,
+		(void *)&cmd_region_flowtype_what,
+		(void *)&cmd_region_flowtype_port,
+		(void *)&cmd_region_flowtype_port_index,
+		(void *)&cmd_region_flowtype_index,
+		(void *)&cmd_region_flowtype_id,
+		(void *)&cmd_region_flowtype_flow_index,
+		(void *)&cmd_region_flowtype_flow_id,
+		NULL,
+	},
+};
+
+/* *** User Priority (UP) to queue region (region_id) set *** */
+struct cmd_user_priority_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t user_priority;
+	uint8_t  user_priority_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+};
+
+static void
+cmd_user_priority_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_user_priority_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_UP_REGION_SET;
+	region_conf.user_priority = res->user_priority_id;
+	region_conf.region_id = res->region_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("user_priority region config programming "
+			"error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_user_priority_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_user_priority_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_user_priority_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_user_priority_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_UP =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority, "UP");
+cmdline_parse_token_num_t cmd_user_priority_region_UP_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_region =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_user_priority_region_region_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				region_id, UINT8);
+
+cmdline_parse_inst_t cmd_user_priority_region = {
+	.f = cmd_user_priority_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> UP <value> "
+		"region_id <value>: Set the mapping of User Priority (UP) "
+		"to queue region (region_id) ",
+	.tokens = {
+		(void *)&cmd_user_priority_region_cmd,
+		(void *)&cmd_user_priority_region_set,
+		(void *)&cmd_user_priority_region_port,
+		(void *)&cmd_user_priority_region_port_index,
+		(void *)&cmd_user_priority_region_UP,
+		(void *)&cmd_user_priority_region_UP_id,
+		(void *)&cmd_user_priority_region_region,
+		(void *)&cmd_user_priority_region_region_id,
+		NULL,
+	},
+};
+
+/* *** flush all queue region related configuration *** */
+struct cmd_flush_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_flush_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_flush_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "on") == 0)
+		region_conf.op = RTE_PMD_I40E_REGION_ALL_FLUSH_ON;
+	else
+		region_conf.op = RTE_PMD_I40E_REGION_ALL_FLUSH_OFF;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_flush_queue_region_flush =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+cmdline_parse_token_string_t cmd_flush_queue_region_what =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				what, "on#off");
+cmdline_parse_token_string_t cmd_flush_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_flush_queue_region = {
+	.f = cmd_flush_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region flush on|off port <port_id> "
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_what,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		NULL,
+	},
+};
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
@@ -14387,6 +14711,10 @@  cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
+	(cmdline_parse_inst_t *)&cmd_queue_region,
+	(cmdline_parse_inst_t *)&cmd_region_flowtype,
+	(cmdline_parse_inst_t *)&cmd_user_priority_region,
+	(cmdline_parse_inst_t *)&cmd_flush_queue_region,
 	NULL,
 };