From a9b2f79070f1b8917ec7b948715cc7ac76d051cb Mon Sep 17 00:00:00 2001 From: Lukas Sismis Date: Thu, 25 May 2023 13:57:57 +0200 Subject: [PATCH] dpdk: refactor i40e RSS hash function Setting rss_conf->rss_key to NULL and rss_key_len to zero avoids warnings about register changes when setting up RSS configuration through RTE flows. --- src/runmode-dpdk.c | 2 +- src/util-dpdk-i40e.c | 17 ++++++++++------- src/util-dpdk-i40e.h | 4 +++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/runmode-dpdk.c b/src/runmode-dpdk.c index 52364b3d76..d1c22105cc 100644 --- a/src/runmode-dpdk.c +++ b/src/runmode-dpdk.c @@ -765,7 +765,7 @@ static void DeviceSetPMDSpecificRSS(struct rte_eth_rss_conf *rss_conf, const cha { // RSS is configured in a specific way for a driver i40e and DPDK version <= 19.xx if (strcmp(driver_name, "net_i40e") == 0) - i40eDeviceSetRSSHashFunction(&rss_conf->rss_hf); + i40eDeviceSetRSSConf(rss_conf); if (strcmp(driver_name, "net_ice") == 0) iceDeviceSetRSSHashFunction(&rss_conf->rss_hf); if (strcmp(driver_name, "net_ixgbe") == 0) diff --git a/src/util-dpdk-i40e.c b/src/util-dpdk-i40e.c index 4191b7750c..9122577a7e 100644 --- a/src/util-dpdk-i40e.c +++ b/src/util-dpdk-i40e.c @@ -372,16 +372,19 @@ int i40eDeviceSetRSS(int port_id, int nb_rx_queues) return 0; } -void i40eDeviceSetRSSHashFunction(uint64_t *rss_hf) +void i40eDeviceSetRSSConf(struct rte_eth_rss_conf *rss_conf) { #if RTE_VERSION >= RTE_VERSION_NUM(20, 0, 0, 0) - *rss_hf = RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_FRAG_IPV6 | - RTE_ETH_RSS_NONFRAG_IPV6_OTHER; + rss_conf->rss_hf = RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER | + RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_NONFRAG_IPV6_OTHER; + rss_conf->rss_key = NULL; + rss_conf->rss_key_len = 0; #else - *rss_hf = RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_NONFRAG_IPV4_UDP | - RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_NONFRAG_IPV4_OTHER | - RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_NONFRAG_IPV6_UDP | - RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_SCTP; + rss_conf->rss_hf = + RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_NONFRAG_IPV4_UDP | + RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_FRAG_IPV6 | + RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_NONFRAG_IPV6_UDP | + RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_SCTP; #endif } diff --git a/src/util-dpdk-i40e.h b/src/util-dpdk-i40e.h index 6b1eb7fd13..6133aed5d7 100644 --- a/src/util-dpdk-i40e.h +++ b/src/util-dpdk-i40e.h @@ -28,8 +28,10 @@ #ifdef HAVE_DPDK +#include "util-dpdk.h" + int i40eDeviceSetRSS(int port_id, int nb_rx_queues); -void i40eDeviceSetRSSHashFunction(uint64_t *rss_conf); +void i40eDeviceSetRSSConf(struct rte_eth_rss_conf *rss_conf); #endif /* HAVE_DPDK */ -- 2.47.2