ice: Fix persistent failure in ice_get_rxfh
Subsystems (3)
v2 cover ice: Fix persistent failure in ice_get_rxfh
Hey all,
This is a small bug fix for an issue I found when testing some e810 NICs on kernel 6.16.5-200.fc42.x86_64. I originally reported the bug in
https://lore.kernel.org/intel-wired-lan/CAH7f-UKkJV8MLY7zCdgCrGE55whRhbGAXvgkDnwgiZ9gUZT7_w@mail.gmail.com/
User Impact of the Bug
----------------------
In the current in-tree ice driver, if a user tries to get the indirection table using the SIOCETHTOOL command and the ETHTOOL_GRXFHINDIR subcommand the subsequent function call with always fail with -EINVAL.
Cause of the Bug
----------------
When a user gets the indirection table using SIOCETHTOOL and ETHTOOL_GRXFHINDIR ethtool_get_rxfh_indir is called. This function will end up calling ice_get_rxfh which then calls ice_get_rss_key. The function ice_get_rss_key expects its *seed parameter to never be null. This *seed parameter is the key field in ethtool_rxfh_param. Neither ice_get_rxfh nor ethtool_get_rxfh_indir set this value, so it will always be null. This causes the *seed parameter for ice_get_rss_key to always be null, ultimately causing ice_get_rss_key to always return -EINVAL.
Fix for the Bug
---------------
To fix this, I went ahead and implemented ice_get_rss which checks if the rss_key is not null before calling ice_key_rss_key. This follows suit with the i40e driver's implementation.
Cody Haas (1):
ice: Fix persistent failure in ice_get_rxfh
drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 +---- drivers/net/ethernet/intel/ice/ice_main.c | 28 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-)
base-commit: 67181985211850332c8ff942815c1961fd7058b9
Signature · 1 line
2.51.1
v2 cover ice: Fix persistent failure in ice_get_rxfh
Several ioctl functions have the ability to call ice_get_rxfh, however all of these ioctl functions do not provide all of the expected information in ethtool_rxfh_param. For example, ethtool_get_rxfh_indir does not provide an rss_key. This previously caused ethtool_get_rxfh_indir to always fail with -EINVAL.
This change draws inspiration from i40e_get_rss to handle this situation, by only calling the appropriate rss helpers when the necessary information has been provided via ethtool_rxfh_param.
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 +---- drivers/net/ethernet/intel/ice/ice_main.c | 28 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -953,6 +953,7 @@ void ice_map_xdp_rings(struct ice_vsi *vsi);int ice_xdp_xmit (struct net_device *dev,int n,struct xdp_frame **frames,u32 flags); +int ice_get_rss (struct ice_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size);int ice_set_rss_lut (struct ice_vsi *vsi,u8 *lut,u16 lut_size);int ice_get_rss_lut (struct ice_vsi *vsi,u8 *lut,u16 lut_size);int ice_set_rss_key (struct ice_vsi *vsi,u8 *seed);
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -5
@@ -3649,11 +3649,7 @@ ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)if (!lut)return -ENOMEM ; - err =ice_get_rss_key (vsi, rxfh->key); -if (err) - goto out; - - err =ice_get_rss_lut (vsi, lut, vsi->rss_table_size); + err =ice_get_rss (vsi, rxfh->key, lut, vsi->rss_table_size);if (err) goto out;
drivers/net/ethernet/intel/ice/ice_main.c +28 -0
@@ -8072,6 +8072,34 @@ int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed)return status; } +/** +* ice_get_rss - Get RSS LUT and/or key +* @vsi: Pointer to VSI structure +* @seed: Buffer to store the key in +* @lut: Buffer to store the lookup table entries +* @lut_size: Size of buffer to store the lookup table entries +* +* Returns 0 on success, negative on failure +*/ +int ice_get_rss (struct ice_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size) +{ +int err; + +if (seed) { + err =ice_get_rss_key (vsi, seed); +if (err) +return err; + } + +if (lut) { + err =ice_get_rss_lut (vsi, lut, lut_size); +if (err) +return err; + } + +return 0 ; +} +/** * ice_set_rss_hfunc - Set RSS HASH function * @vsi: Pointer to VSI structure
Signature · 1 line
2.51.1
Quoted 109 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Cody Haas
Sent: Saturday, December 13, 2025 1:22 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haas, Cody <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net v2 0/1] ice: Fix persistent failure inice_get_rxfhSeveral ioctl functions have the ability to call
ice_get_rxfh, however all of these ioctl functions do not provide all of the expected information inethtool_rxfh_param. For example,ethtool_get_rxfh_indirdoes not provide anrss_key. This previously causedethtool_get_rxfh_indirto always fail with-EINVAL.This change draws inspiration from
i40e_get_rssto handle this situation, by only calling the appropriate rss helpers when the necessary information has been provided viaethtool_rxfh_param.Fixes b66a972abb6b ("ice: Refactor ice_set/get_rss into LUT and keyspecific functions")
Signed-off-by Cody Haas <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 +---- drivers/net/ethernet/intel/ice/ice_main.c | 28 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-)drivers/net/ethernet/intel/ice/ice.h +1
-0@@ -953,6 +953,7 @@ void ice_map_xdp_rings(struct ice_vsi *vsi); int ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, u32 flags); +int ice_get_rss (struct ice_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size);int ice_set_rss_lut (struct ice_vsi *vsi,u8 *lut,u16 lut_size);int
ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size); intice_set_rss_key(struct ice_vsi *vsi, u8 *seed); diff --gita/drivers/net/ethernet/intel/ice/ice_ethtool.cb/drivers/net/ethernet/intel/ice/ice_ethtool.c
indexb0805704834d..a5c139cc536d100644drivers/net/ethernet/intel/ice/ice_ethtool.c +1
-5@@ -3649,11 +3649,7 @@ ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)if (!lut)return -ENOMEM ; - err =ice_get_rss_key (vsi, rxfh->key); -if (err) - goto out; - - err =ice_get_rss_lut (vsi, lut, vsi->rss_table_size); + err =ice_get_rss (vsi, rxfh->key, lut, vsi->rss_table_size);if (err) goto out;drivers/net/ethernet/intel/ice/ice_main.c +8
-0@@ -8072,6 +8072,34 @@ int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed)return status; } +/** +* ice_get_rss - Get RSS LUT and/or key +* @vsi: Pointer to VSI structure +* @seed: Buffer to store the key in +* @lut: Buffer to store the lookup table entries +* @lut_size: Size of buffer to store the lookup table entries +* +* Returns 0 on success, negative on failure */ int ice_get_rss(struct
drivers/net/ethernet/intel/ice/ice_main.c +18
-1+ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) { +int err; + +if (seed) { + err =ice_get_rss_key (vsi, seed); +if (err) +return err; + } + +if (lut) { + err =ice_get_rss_lut (vsi, lut, lut_size); +if (err) +return err; + } + +return 0 ; +} +/** * ice_set_rss_hfunc - Set RSS HASH function * @vsi: Pointer to VSI structure --
Quoted 1 line
2.51.1
Quoted 6 lines · Cody Haas
Several ioctl functions have the ability to call
ice_get_rxfh, however all of these ioctl functions do not provide all of the expected information inethtool_rxfh_param. For example,ethtool_get_rxfh_indirdoes not provide anrss_key. This previously causedethtool_get_rxfh_indirto always fail with-EINVAL.
Quoted 7 lines
This change draws inspiration from
i40e_get_rssto handle this situation, by only calling the appropriate rss helpers when the necessary information has been provided viaethtool_rxfh_param.Fixes b66a972abb6b ("ice: Refactor ice_set/get_rss into LUT and key specific functions")Signed-off-by Cody Haas <[email protected]>
thank you for the fix,
next time please do link to the previous revision and add a changelog (no need to respin just for that!)
Quoted 74 lines
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 +---- drivers/net/ethernet/intel/ice/ice_main.c | 28 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-)drivers/net/ethernet/intel/ice/ice.h +1
-0@@ -953,6 +953,7 @@ void ice_map_xdp_rings(struct ice_vsi *vsi);int ice_xdp_xmit (struct net_device *dev,int n,struct xdp_frame **frames,u32 flags); +int ice_get_rss (struct ice_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size);int ice_set_rss_lut (struct ice_vsi *vsi,u8 *lut,u16 lut_size);int ice_get_rss_lut (struct ice_vsi *vsi,u8 *lut,u16 lut_size);int ice_set_rss_key (struct ice_vsi *vsi,u8 *seed);drivers/net/ethernet/intel/ice/ice_ethtool.c +1
-5@@ -3649,11 +3649,7 @@ ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)if (!lut)return -ENOMEM ; - err =ice_get_rss_key (vsi, rxfh->key); -if (err) - goto out; - - err =ice_get_rss_lut (vsi, lut, vsi->rss_table_size); + err =ice_get_rss (vsi, rxfh->key, lut, vsi->rss_table_size);if (err) goto out;drivers/net/ethernet/intel/ice/ice_main.c +28
-0@@ -8072,6 +8072,34 @@ int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed)return status; } +/** +* ice_get_rss - Get RSS LUT and/or key +* @vsi: Pointer to VSI structure +* @seed: Buffer to store the key in +* @lut: Buffer to store the lookup table entries +* @lut_size: Size of buffer to store the lookup table entries +* +* Returns 0 on success, negative on failure +*/ +int ice_get_rss (struct ice_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size) +{ +int err; + +if (seed) { + err =ice_get_rss_key (vsi, seed); +if (err) +return err; + } + +if (lut) { + err =ice_get_rss_lut (vsi, lut, lut_size); +if (err) +return err; + } + +return 0 ; +} +/** * ice_set_rss_hfunc - Set RSS HASH function * @vsi: Pointer to VSI structure
Quoted 2 lines · Przemek Kitszel
thank you for the fix,
Reviewed-by Przemek Kitszel <[email protected]>
Thank you for the review!
Quoted 1 line
next time please do link to the previous revision and add a changelog
I'll take note and make sure to add it next time! Thank you for the feedback
Cody
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Cody Haas
Sent: 13 December 2025 05:52
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haas, Cody <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net v2 0/1] ice: Fix persistent failure inice_get_rxfhSeveral ioctl functions have the ability to call
ice_get_rxfh, however all of these ioctl functions do not provide all of the expected information inethtool_rxfh_param. For example,ethtool_get_rxfh_indirdoes not provide anrss_key. This previously causedethtool_get_rxfh_indirto always fail with-EINVAL.This change draws inspiration from
i40e_get_rssto handle this situation, by only calling the appropriate rss helpers when the necessary information has been provided viaethtool_rxfh_param.
Quoted 9 lines
Fixes b66a972abb6b ("ice: Refactor ice_set/get_rss into LUT and key specific functions")Signed-off-by Cody Haas <[email protected]>---
drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 +---- drivers/net/ethernet/intel/ice/ice_main.c | 28 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-)