[v2] app/test-pipeline: relax RSS hash requirement

Message ID 20230714082751.3958269-1-feifei.wang2@arm.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] app/test-pipeline: relax RSS hash requirement |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-unit-testing fail Testing issues
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Feifei Wang July 14, 2023, 8:27 a.m. UTC
  For some drivers which can not support the configured RSS hash functions,
the thread reports 'invalid rss_hf' when doing device configure.

For example, i40e driver can not support 'RTE_ETH_RSS_IPV4',
'RTE_ETH_RSS_IPV6' and 'RTE_ETH_RSS_NONFRAG_IPV6_OTHER', thus it can not
run successfully in test-pipeline with XL710 NIC and reports the issue:
-------------------------------------------------------------
Ethdev port_id=0 invalid rss_hf: 0xa38c, valid value: 0x7ef8
PANIC in app_init_ports():
Cannot init NIC port 0 (-22)
-------------------------------------------------------------

To fix this, referring to l3fwd operation, adjust the 'rss_hf' based on
device capability and just report a warning.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Trevor Tao <trevor.tao@arm.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
---
 app/test-pipeline/init.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
  

Patch

diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c
index d146c44be0..558f0e428d 100644
--- a/app/test-pipeline/init.c
+++ b/app/test-pipeline/init.c
@@ -188,21 +188,40 @@  static void
 app_init_ports(void)
 {
 	uint32_t i;
+	struct rte_eth_dev_info dev_info;
 
 	/* Init NIC ports, then start the ports */
 	for (i = 0; i < app.n_ports; i++) {
 		uint16_t port;
 		int ret;
+		struct rte_eth_conf local_port_conf = port_conf;
 
 		port = app.ports[i];
 		RTE_LOG(INFO, USER1, "Initializing NIC port %u ...\n", port);
 
+		ret = rte_eth_dev_info_get(port, &dev_info);
+		if (ret != 0)
+			rte_panic("Error during getting device (port %u) info: %s\n",
+					port, rte_strerror(-ret));
+
 		/* Init port */
+		local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
+			dev_info.flow_type_rss_offloads;
+		if (local_port_conf.rx_adv_conf.rss_conf.rss_hf !=
+				port_conf.rx_adv_conf.rss_conf.rss_hf) {
+			printf("Warning:"
+				"Port %u modified RSS hash function based on hardware support,"
+				"requested:%#"PRIx64" configured:%#"PRIx64"\n",
+				port,
+				port_conf.rx_adv_conf.rss_conf.rss_hf,
+				local_port_conf.rx_adv_conf.rss_conf.rss_hf);
+		}
+
 		ret = rte_eth_dev_configure(
 			port,
 			1,
 			1,
-			&port_conf);
+			&local_port_conf);
 		if (ret < 0)
 			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);