DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: add flag to enable RSS for single-queue
@ 2025-07-15 12:53 Bruce Richardson
  2025-07-22 14:08 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2025-07-15 12:53 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

For testing purposes it can be desirable to enable RSS even when only a
single queue per port is in use. Add an "enable-rss" flag to testpmd to
match the existing "disable-rss" flag.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/parameters.c | 13 +++++++++++++
 app/test-pmd/testpmd.c    |  3 ++-
 app/test-pmd/testpmd.h    |  1 +
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 1132972913..80c6ecae54 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -121,6 +121,8 @@ enum {
 	TESTPMD_OPT_ENABLE_DROP_EN_NUM,
 #define TESTPMD_OPT_DISABLE_RSS "disable-rss"
 	TESTPMD_OPT_DISABLE_RSS_NUM,
+#define TESTPMD_OPT_ENABLE_RSS "enable-rss"
+	TESTPMD_OPT_ENABLE_RSS_NUM,
 #define TESTPMD_OPT_PORT_TOPOLOGY "port-topology"
 	TESTPMD_OPT_PORT_TOPOLOGY_NUM,
 #define TESTPMD_OPT_FORWARD_MODE "forward-mode"
@@ -310,6 +312,7 @@ static const struct option long_options[] = {
 	NO_ARG(TESTPMD_OPT_ENABLE_HW_QINQ_STRIP),
 	NO_ARG(TESTPMD_OPT_ENABLE_DROP_EN),
 	NO_ARG(TESTPMD_OPT_DISABLE_RSS),
+	NO_ARG(TESTPMD_OPT_ENABLE_RSS),
 	REQUIRED_ARG(TESTPMD_OPT_PORT_TOPOLOGY),
 	REQUIRED_ARG(TESTPMD_OPT_FORWARD_MODE),
 	NO_ARG(TESTPMD_OPT_RSS_IP),
@@ -454,6 +457,7 @@ usage(char* progname)
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
+	printf("  --enable-rss: Force rss even for single-queue operation.\n");
 	printf("  --port-topology=<paired|chained|loop>: set port topology (paired "
 	       "is default).\n");
 	printf("  --forward-mode=N: set forwarding mode (N: %s).\n",
@@ -1244,8 +1248,17 @@ launch_args_parse(int argc, char** argv)
 			rx_drop_en = 1;
 			break;
 		case TESTPMD_OPT_DISABLE_RSS_NUM:
+			if (force_rss)
+				rte_exit(EXIT_FAILURE, "Invalid option combination, %s and %s\n",
+						TESTPMD_OPT_DISABLE_RSS, TESTPMD_OPT_ENABLE_RSS);
 			rss_hf = 0;
 			break;
+		case TESTPMD_OPT_ENABLE_RSS_NUM:
+			if (rss_hf == 0)
+				rte_exit(EXIT_FAILURE, "Invalid option combination, %s and %s\n",
+						TESTPMD_OPT_DISABLE_RSS, TESTPMD_OPT_ENABLE_RSS);
+			force_rss = true;
+			break;
 		case TESTPMD_OPT_PORT_TOPOLOGY_NUM:
 			if (!strcmp(optarg, "paired"))
 				port_topology = PORT_TOPOLOGY_PAIRED;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index bb88555328..8bb4b1c762 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -382,6 +382,7 @@ uint64_t noisy_lkup_num_reads_writes;
  * Receive Side Scaling (RSS) configuration.
  */
 uint64_t rss_hf = RTE_ETH_RSS_IP; /* RSS IP by default. */
+bool force_rss;                   /* false == for single queue don't force rss */
 
 /*
  * Port topology configuration
@@ -4007,7 +4008,7 @@ init_port_config(void)
 		if (ret != 0)
 			return;
 
-		if (nb_rxq > 1) {
+		if (nb_rxq > 1 || force_rss) {
 			port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL;
 			port->dev_conf.rx_adv_conf.rss_conf.rss_hf =
 				rss_hf & port->dev_info.flow_type_rss_offloads;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e629edaa02..96ac88a29c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -576,6 +576,7 @@ extern struct rte_eth_rxmode rx_mode;
 extern struct rte_eth_txmode tx_mode;
 
 extern uint64_t rss_hf;
+extern bool force_rss;
 
 extern queueid_t nb_hairpinq;
 extern queueid_t nb_rxq;
-- 
2.48.1


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

* Re: [PATCH] app/testpmd: add flag to enable RSS for single-queue
  2025-07-15 12:53 [PATCH] app/testpmd: add flag to enable RSS for single-queue Bruce Richardson
@ 2025-07-22 14:08 ` Stephen Hemminger
  2025-07-22 15:09   ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2025-07-22 14:08 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Tue, 15 Jul 2025 12:53:30 +0000
Bruce Richardson <bruce.richardson@intel.com> wrote:

> For testing purposes it can be desirable to enable RSS even when only a
> single queue per port is in use. Add an "enable-rss" flag to testpmd to
> match the existing "disable-rss" flag.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Not sure about this.
It makes no sense to have RSS enabled with single queue.
Maybe you want the hash but no steering?

But the DPDK RSS flag doesn't require driver to produce HASH.

I would even argue that ethdev layer should warn application
trying to do single queue and RSS.

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

* Re: [PATCH] app/testpmd: add flag to enable RSS for single-queue
  2025-07-22 14:08 ` Stephen Hemminger
@ 2025-07-22 15:09   ` Bruce Richardson
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2025-07-22 15:09 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Tue, Jul 22, 2025 at 07:08:15AM -0700, Stephen Hemminger wrote:
> On Tue, 15 Jul 2025 12:53:30 +0000
> Bruce Richardson <bruce.richardson@intel.com> wrote:
> 
> > For testing purposes it can be desirable to enable RSS even when only a
> > single queue per port is in use. Add an "enable-rss" flag to testpmd to
> > match the existing "disable-rss" flag.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> 
> Not sure about this.
> It makes no sense to have RSS enabled with single queue.
> Maybe you want the hash but no steering?
> 

Yep, that is one scenario we have seen it being used in the past. Also,
it's a useful "harmless" offload that can be used to check that the offload
paths in the NIC are working correctly.

> But the DPDK RSS flag doesn't require driver to produce HASH.
> 
> I would even argue that ethdev layer should warn application
> trying to do single queue and RSS.

I definitely don't think it should warn about it, because there are
definitely usecases where you may want it enabled for single-queue case,
e.g. when using NIC that provides the hash. However, it should not be the
default, which is why this is a separate enabling flag.

Another reason it's good to have it, is to ensure that when testing single
queue vs multi-queue setups, we can test with the exact same configuration
between those two scenarios. Without the ability to enable RSS, then
multi-queue will always have a different NIC configuration to single queue.
In the case of some of our drivers, for example, the lack of any offloads
such as RSS causes a different faster RX path to be chosen in the
single-queue case, since no packet flags need to be handled.

/Bruce

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

end of thread, other threads:[~2025-07-22 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-15 12:53 [PATCH] app/testpmd: add flag to enable RSS for single-queue Bruce Richardson
2025-07-22 14:08 ` Stephen Hemminger
2025-07-22 15:09   ` Bruce Richardson

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