app/testpmd: add flag to enable RSS for single-queue
PATCH 1/1 app/testpmd: add flag to enable RSS for single-queue
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.
--- 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(-)
app/test-pmd/parameters.c +13 -0
@@ -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 ;
app/test-pmd/testpmd.c +2 -1
@@ -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;
app/test-pmd/testpmd.h +1 -0
@@ -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;
Signature · 1 line
2.48.1
Quoted 6 lines · On Tue, 15 Jul 2025 12:53:30 +0000 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 <[email protected]>---
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.
Quoted 7 lines · Stephen Hemminger
Quoted 4 lines · On Tue, 15 Jul 2025 12:53:30 +0000 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.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Bruce Richardson <[email protected]>---
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.
Quoted 4 lines
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
Stephen Hemminger
AppliedQuoted 6 lines · On Tue, 15 Jul 2025 12:53:30 +0000 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 <[email protected]>---
Applied to next-net.
Does it need release note? or other documentation changes?
Quoted 7 lines · Stephen Hemminger
Quoted 4 lines · On Tue, 15 Jul 2025 12:53:30 +0000 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.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Bruce Richardson <[email protected]>---
Applied to next-net.
Does it need release note? or other documentation changes?
I don't consider it a big enough change to need release note. Just the testpmd doc command-line guide is enough - a patch which I will now do up and send because I see I forgot that in this patch. :-(
PATCH 1/1 doc/testpmd: add missing entry for enable-rss flag
In reply to Stephen HemmingerAdd a one-line description about the new flag.
---
FYI: fix should be merged into commit f5da751 on next-net tree.
--- doc/guides/testpmd_app_ug/run_app.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/testpmd_app_ug/run_app.rst +4 -0
@@ -206,6 +206,10 @@ The command line options are: Enable per-queue packet drop for packets with no descriptors. +* ``--enable-rss`` + + Enable RSS (Receive Side Scaling) even in case of a single-queue configuration. + * ``--disable-rss`` Disable RSS (Receive Side Scaling).
Signature · 1 line
2.48.1