DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ
@ 2021-09-28 11:08 nipun.gupta
  2021-09-28 11:08 ` [dpdk-dev] [PATCH] app/testpmd: update raw flow to take hex input nipun.gupta
  2021-09-30 13:45 ` [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ Ferruh Yigit
  0 siblings, 2 replies; 5+ messages in thread
From: nipun.gupta @ 2021-09-28 11:08 UTC (permalink / raw)
  To: dev; +Cc: xiaoyun.li, orika, thomas, ferruh.yigit, hemant.agrawal, Jun Yang

From: Jun Yang <jun.yang@nxp.com>

The existing forwarding mode configures the total number of
queues as the minimum of rxq and txq, so eventually the number
of txq are same as rxq.
However in some scenarios, specially for flow control the
number of rxq and txq can be different.
This patch makes the txq and function of rxq for all such
scenario instead of keeping 1:1 relationship between the two.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
---
 app/test-pmd/config.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index f5765b34f7..7e17f233ba 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3000,8 +3000,6 @@ rss_fwd_config_setup(void)
 	int end;
 
 	nb_q = nb_rxq;
-	if (nb_q > nb_txq)
-		nb_q = nb_txq;
 	cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
 	cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
 	cur_fwd_config.nb_fwd_streams =
@@ -3038,7 +3036,7 @@ rss_fwd_config_setup(void)
 		fs->rx_port = fwd_ports_ids[rxp];
 		fs->rx_queue = rxq;
 		fs->tx_port = fwd_ports_ids[txp];
-		fs->tx_queue = rxq;
+		fs->tx_queue = (rxq % nb_txq);
 		fs->peer_addr = fs->tx_port;
 		fs->retry_enabled = retry_enabled;
 		rxp++;
@@ -3253,7 +3251,7 @@ fwd_config_setup(void)
 		return;
 	}
 
-	if ((nb_rxq > 1) && (nb_txq > 1)){
+	if ((nb_rxq > 1) && (nb_txq > 1)) {
 		if (dcb_config) {
 			for (i = 0; i < nb_fwd_ports; i++) {
 				pt_id = fwd_ports_ids[i];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH] app/testpmd: update raw flow to take hex input
  2021-09-28 11:08 [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ nipun.gupta
@ 2021-09-28 11:08 ` nipun.gupta
  2021-09-28 11:51   ` Nipun Gupta
  2021-09-30 13:45 ` [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ Ferruh Yigit
  1 sibling, 1 reply; 5+ messages in thread
From: nipun.gupta @ 2021-09-28 11:08 UTC (permalink / raw)
  To: dev; +Cc: xiaoyun.li, orika, thomas, ferruh.yigit, hemant.agrawal, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

This patch enables method to provide key and mask for raw rules
to be provided as hexadecimal values. There is new parameter
pattern_mask added to support this.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 app/test-pmd/cmdline_flow.c                 | 15 +++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 +++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6cd99bf37f..a95b147d92 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -158,6 +158,7 @@ enum index {
 	ITEM_RAW_OFFSET,
 	ITEM_RAW_LIMIT,
 	ITEM_RAW_PATTERN,
+	ITEM_RAW_PATTERN_HEX,
 	ITEM_ETH,
 	ITEM_ETH_DST,
 	ITEM_ETH_SRC,
@@ -1046,6 +1047,7 @@ static const enum index item_raw[] = {
 	ITEM_RAW_OFFSET,
 	ITEM_RAW_LIMIT,
 	ITEM_RAW_PATTERN,
+	ITEM_RAW_PATTERN_HEX,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2487,6 +2489,19 @@ static const struct token token_list[] = {
 			     ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw),
 					    ITEM_RAW_PATTERN_SIZE)),
 	},
+	[ITEM_RAW_PATTERN_HEX] = {
+		.name = "pattern_hex",
+		.help = "hex string to look for",
+		.next = NEXT(item_raw,
+			     NEXT_ENTRY(HEX),
+			     NEXT_ENTRY(ITEM_PARAM_IS,
+					ITEM_PARAM_SPEC,
+					ITEM_PARAM_MASK)),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_raw, pattern),
+			     ARGS_ENTRY(struct rte_flow_item_raw, length),
+			     ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw),
+					    ITEM_RAW_PATTERN_SIZE)),
+	},
 	[ITEM_ETH] = {
 		.name = "eth",
 		.help = "match Ethernet header",
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 4f8751be1c..3a69d37037 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3637,6 +3637,7 @@ This section lists supported pattern items and their attributes, if any.
   - ``offset {integer}``: absolute or relative offset for pattern.
   - ``limit {unsigned}``: search area limit for start of pattern.
   - ``pattern {string}``: byte string to look for.
+  - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
 
 - ``eth``: match Ethernet header.
 
@@ -5036,6 +5037,18 @@ The meter policy action list: ``green -> green, yellow -> yellow, red -> red``.
    testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
    testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end
 
+Sample RAW rule
+~~~~~~~~~~~~~~~
+
+A RAW rule can be creted as following using ``pattern_hex`` key and mask.
+
+::
+
+    testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset
+             is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a
+             pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions
+             queue index 4 / end
+
 BPF Functions
 --------------
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: update raw flow to take hex input
  2021-09-28 11:08 ` [dpdk-dev] [PATCH] app/testpmd: update raw flow to take hex input nipun.gupta
@ 2021-09-28 11:51   ` Nipun Gupta
  0 siblings, 0 replies; 5+ messages in thread
From: Nipun Gupta @ 2021-09-28 11:51 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: xiaoyun.li, orika, thomas, ferruh.yigit, Hemant Agrawal

Please ignore this patch for now.

Regards,
Nipun

> -----Original Message-----
> From: nipun.gupta@nxp.com <nipun.gupta@nxp.com>
> Sent: Tuesday, September 28, 2021 4:39 PM
> To: dev@dpdk.org
> Cc: xiaoyun.li@intel.com; orika@nvidia.com; thomas@monjalon.net;
> ferruh.yigit@intel.com; Hemant Agrawal <hemant.agrawal@nxp.com>; Nipun
> Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH] app/testpmd: update raw flow to take hex input
> 
> From: Nipun Gupta <nipun.gupta@nxp.com>
> 
> This patch enables method to provide key and mask for raw rules
> to be provided as hexadecimal values. There is new parameter
> pattern_mask added to support this.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  app/test-pmd/cmdline_flow.c                 | 15 +++++++++++++++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 +++++++++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 6cd99bf37f..a95b147d92 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -158,6 +158,7 @@ enum index {
>  	ITEM_RAW_OFFSET,
>  	ITEM_RAW_LIMIT,
>  	ITEM_RAW_PATTERN,
> +	ITEM_RAW_PATTERN_HEX,
>  	ITEM_ETH,
>  	ITEM_ETH_DST,
>  	ITEM_ETH_SRC,
> @@ -1046,6 +1047,7 @@ static const enum index item_raw[] = {
>  	ITEM_RAW_OFFSET,
>  	ITEM_RAW_LIMIT,
>  	ITEM_RAW_PATTERN,
> +	ITEM_RAW_PATTERN_HEX,
>  	ITEM_NEXT,
>  	ZERO,
>  };
> @@ -2487,6 +2489,19 @@ static const struct token token_list[] = {
>  			     ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw),
>  					    ITEM_RAW_PATTERN_SIZE)),
>  	},
> +	[ITEM_RAW_PATTERN_HEX] = {
> +		.name = "pattern_hex",
> +		.help = "hex string to look for",
> +		.next = NEXT(item_raw,
> +			     NEXT_ENTRY(HEX),
> +			     NEXT_ENTRY(ITEM_PARAM_IS,
> +					ITEM_PARAM_SPEC,
> +					ITEM_PARAM_MASK)),
> +		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_raw, pattern),
> +			     ARGS_ENTRY(struct rte_flow_item_raw, length),
> +			     ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw),
> +					    ITEM_RAW_PATTERN_SIZE)),
> +	},
>  	[ITEM_ETH] = {
>  		.name = "eth",
>  		.help = "match Ethernet header",
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 4f8751be1c..3a69d37037 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3637,6 +3637,7 @@ This section lists supported pattern items and their
> attributes, if any.
>    - ``offset {integer}``: absolute or relative offset for pattern.
>    - ``limit {unsigned}``: search area limit for start of pattern.
>    - ``pattern {string}``: byte string to look for.
> +  - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
> 
>  - ``eth``: match Ethernet header.
> 
> @@ -5036,6 +5037,18 @@ The meter policy action list: ``green -> green, yellow
> -> yellow, red -> red``.
>     testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
>     testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions
> meter mtr_id 1 / end
> 
> +Sample RAW rule
> +~~~~~~~~~~~~~~~
> +
> +A RAW rule can be creted as following using ``pattern_hex`` key and mask.
> +
> +::
> +
> +    testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0
> search is 0 offset
> +             is 0 limit is 0 pattern_hex spec
> 00000000000000000000000000000000000000000000000000000a0a0a0a
> +             pattern_hex mask
> 0000000000000000000000000000000000000000000000000000ffffffff / end
> actions
> +             queue index 4 / end
> +
>  BPF Functions
>  --------------
> 
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ
  2021-09-28 11:08 [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ nipun.gupta
  2021-09-28 11:08 ` [dpdk-dev] [PATCH] app/testpmd: update raw flow to take hex input nipun.gupta
@ 2021-09-30 13:45 ` Ferruh Yigit
  2021-10-01  7:22   ` Nipun Gupta
  1 sibling, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2021-09-30 13:45 UTC (permalink / raw)
  To: nipun.gupta, dev; +Cc: xiaoyun.li, orika, thomas, hemant.agrawal, Jun Yang

On 9/28/2021 12:08 PM, nipun.gupta@nxp.com wrote:
> From: Jun Yang <jun.yang@nxp.com>
> 
> The existing forwarding mode configures the total number of
> queues as the minimum of rxq and txq, so eventually the number
> of txq are same as rxq.
> However in some scenarios, specially for flow control the
> number of rxq and txq can be different.
> This patch makes the txq and function of rxq for all such
> scenario instead of keeping 1:1 relationship between the two.
> 

Hi Nipun,

I expect more code exists that assumes Rx queue number and Tx queue number is
equal, did you able to test unequal queue numbers with below change?

And can you please describe your usecase more, is the device has uneven Rx/Tx
queues?

> Signed-off-by: Jun Yang <jun.yang@nxp.com>
> ---
>  app/test-pmd/config.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index f5765b34f7..7e17f233ba 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -3000,8 +3000,6 @@ rss_fwd_config_setup(void)
>  	int end;
>  
>  	nb_q = nb_rxq;
> -	if (nb_q > nb_txq)
> -		nb_q = nb_txq;
>  	cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
>  	cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
>  	cur_fwd_config.nb_fwd_streams =
> @@ -3038,7 +3036,7 @@ rss_fwd_config_setup(void)
>  		fs->rx_port = fwd_ports_ids[rxp];
>  		fs->rx_queue = rxq;
>  		fs->tx_port = fwd_ports_ids[txp];
> -		fs->tx_queue = rxq;
> +		fs->tx_queue = (rxq % nb_txq);

Is this assumes number of Rx queue is always more than number of Tx queue?

>  		fs->peer_addr = fs->tx_port;
>  		fs->retry_enabled = retry_enabled;
>  		rxp++;
> @@ -3253,7 +3251,7 @@ fwd_config_setup(void)
>  		return;
>  	}
>  
> -	if ((nb_rxq > 1) && (nb_txq > 1)){
> +	if ((nb_rxq > 1) && (nb_txq > 1)) {
>  		if (dcb_config) {
>  			for (i = 0; i < nb_fwd_ports; i++) {
>  				pt_id = fwd_ports_ids[i];
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ
  2021-09-30 13:45 ` [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ Ferruh Yigit
@ 2021-10-01  7:22   ` Nipun Gupta
  0 siblings, 0 replies; 5+ messages in thread
From: Nipun Gupta @ 2021-10-01  7:22 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: xiaoyun.li, orika, thomas, Hemant Agrawal, Jun Yang



> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Thursday, September 30, 2021 7:16 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org
> Cc: xiaoyun.li@intel.com; orika@nvidia.com; thomas@monjalon.net; Hemant
> Agrawal <hemant.agrawal@nxp.com>; Jun Yang <jun.yang@nxp.com>
> Subject: Re: [PATCH] app/testpmd: support unequal number of RXQ and TXQ
> 
> On 9/28/2021 12:08 PM, nipun.gupta@nxp.com wrote:
> > From: Jun Yang <jun.yang@nxp.com>
> >
> > The existing forwarding mode configures the total number of
> > queues as the minimum of rxq and txq, so eventually the number
> > of txq are same as rxq.
> > However in some scenarios, specially for flow control the
> > number of rxq and txq can be different.
> > This patch makes the txq and function of rxq for all such
> > scenario instead of keeping 1:1 relationship between the two.
> >
> 
> Hi Nipun,
> 
> I expect more code exists that assumes Rx queue number and Tx queue number
> is
> equal, did you able to test unequal queue numbers with below change?

Hi Ferruh,

Yes, this works with flow, but I will double check on latest code without using
flow too. Also, we will check for any other code which shall need change w.r.t.
this functionality.

> 
> And can you please describe your usecase more, is the device has uneven Rx/Tx
> queues?

Yes, you are correct. In our case, Rx queues which we can use can be much higher
than Tx queues, when rte flow is being used.

> 
> > Signed-off-by: Jun Yang <jun.yang@nxp.com>
> > ---
> >  app/test-pmd/config.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> > index f5765b34f7..7e17f233ba 100644
> > --- a/app/test-pmd/config.c
> > +++ b/app/test-pmd/config.c
> > @@ -3000,8 +3000,6 @@ rss_fwd_config_setup(void)
> >  	int end;
> >
> >  	nb_q = nb_rxq;
> > -	if (nb_q > nb_txq)
> > -		nb_q = nb_txq;
> >  	cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
> >  	cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
> >  	cur_fwd_config.nb_fwd_streams =
> > @@ -3038,7 +3036,7 @@ rss_fwd_config_setup(void)
> >  		fs->rx_port = fwd_ports_ids[rxp];
> >  		fs->rx_queue = rxq;
> >  		fs->tx_port = fwd_ports_ids[txp];
> > -		fs->tx_queue = rxq;
> > +		fs->tx_queue = (rxq % nb_txq);
> 
> Is this assumes number of Rx queue is always more than number of Tx queue?

Yes, but on re-thought as per your comment, we shall need to revisit this logic.
I will have a relook on this part too.

Thanks,
Nipun

> 
> >  		fs->peer_addr = fs->tx_port;
> >  		fs->retry_enabled = retry_enabled;
> >  		rxp++;
> > @@ -3253,7 +3251,7 @@ fwd_config_setup(void)
> >  		return;
> >  	}
> >
> > -	if ((nb_rxq > 1) && (nb_txq > 1)){
> > +	if ((nb_rxq > 1) && (nb_txq > 1)) {
> >  		if (dcb_config) {
> >  			for (i = 0; i < nb_fwd_ports; i++) {
> >  				pt_id = fwd_ports_ids[i];
> >


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-01  7:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 11:08 [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ nipun.gupta
2021-09-28 11:08 ` [dpdk-dev] [PATCH] app/testpmd: update raw flow to take hex input nipun.gupta
2021-09-28 11:51   ` Nipun Gupta
2021-09-30 13:45 ` [dpdk-dev] [PATCH] app/testpmd: support unequal number of RXQ and TXQ Ferruh Yigit
2021-10-01  7:22   ` Nipun Gupta

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).