net/ice: fix default RSS key configuration

Message ID 20200721090258.65715-1-xiao.w.wang@intel.com (mailing list archive)
State Rejected, archived
Delegated to: Qi Zhang
Headers
Series net/ice: fix default RSS key configuration |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Xiao Wang July 21, 2020, 9:02 a.m. UTC
  There's chance that rte_rand() doesn't provision suitable values for
RSS hash, an extreme example could be a key with a lot of 0s in it.

This patch adds a default RSS key which has been used in ixgbe driver
and fm10k driver.

Fixes: 50370662b727 ("net/ice: support device and queue ops")
Cc: stable@dpdk.org

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
  

Comments

Qi Zhang July 22, 2020, 5:25 a.m. UTC | #1
> -----Original Message-----
> From: Wang, Xiao W <xiao.w.wang@intel.com>
> Sent: Tuesday, July 21, 2020 5:03 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Yao, Lei A
> <lei.a.yao@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/ice: fix default RSS key configuration
> 
> There's chance that rte_rand() doesn't provision suitable values for RSS hash, an
> extreme example could be a key with a lot of 0s in it.
> 
> This patch adds a default RSS key which has been used in ixgbe driver and fm10k
> driver.
> 
> Fixes: 50370662b727 ("net/ice: support device and queue ops")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  
Qi Zhang July 23, 2020, 10:25 a.m. UTC | #2
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, July 22, 2020 1:26 PM
> To: Wang, Xiao W <xiao.w.wang@intel.com>
> Cc: dev@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Yao, Lei A
> <lei.a.yao@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH] net/ice: fix default RSS key configuration
> 
> 
> 
> > -----Original Message-----
> > From: Wang, Xiao W <xiao.w.wang@intel.com>
> > Sent: Tuesday, July 21, 2020 5:03 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Yao, Lei A
> > <lei.a.yao@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Wang,
> > Xiao W <xiao.w.wang@intel.com>; stable@dpdk.org
> > Subject: [PATCH] net/ice: fix default RSS key configuration
> >
> > There's chance that rte_rand() doesn't provision suitable values for
> > RSS hash, an extreme example could be a key with a lot of 0s in it.
> >
> > This patch adds a default RSS key which has been used in ixgbe driver
> > and fm10k driver.
> >
> > Fixes: 50370662b727 ("net/ice: support device and queue ops")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> 
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
> 
> Applied to dpdk-next-net-intel.

After some internal discussion, we decide to keep the random key as default, and user can use rte_eth_dev_rss_hash_update to update a new key.
So the patch has been removed from dpdk-next-net-intel.


> 
> Thanks
> Qi
  

Patch

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 3534d18..74d37c7 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2628,11 +2628,20 @@  static int ice_init_rss(struct ice_pf *pf)
 		vsi->rss_lut = rte_zmalloc(NULL,
 					   vsi->rss_lut_size, 0);
 
+#define RSS_KEY_SIZE ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE
+	static uint8_t rss_intel_key[RSS_KEY_SIZE] = {
+		0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2,
+		0x41, 0x67, 0x25, 0x3D, 0x43, 0xA3, 0x8F, 0xB0,
+		0xD0, 0xCA, 0x2B, 0xCB, 0xAE, 0x7B, 0x30, 0xB4,
+		0x77, 0xCB, 0x2D, 0xA3, 0x80, 0x30, 0xF2, 0x0C,
+		0x6A, 0x42, 0xB7, 0x3B, 0xBE, 0xAC, 0x01, 0xFA,
+	};
+
 	/* configure RSS key */
 	if (!rss_conf->rss_key) {
 		/* Calculate the default hash key */
 		for (i = 0; i <= vsi->rss_key_size; i++)
-			vsi->rss_key[i] = (uint8_t)rte_rand();
+			vsi->rss_key[i] = rss_intel_key[i];
 	} else {
 		rte_memcpy(vsi->rss_key, rss_conf->rss_key,
 			   RTE_MIN(rss_conf->rss_key_len,