Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Fixes: b66a972abb6b ("ice: Refactor ice_set/get_rss into LUT and key specific functions")
Signed-off-by: Cody Haas <chaas@riotgames.com>
Closes: https://lore.kernel.org/intel-wired-lan/CAH7f-UKkJV8MLY7zCdgCrGE55whRhbGAXvgkDnwgiZ9gUZT7_w@mail.gmail.com/
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>

authored by

Cody Haas and committed by
Tony Nguyen
f406220e b97d5eed

+30 -5
+1
drivers/net/ethernet/intel/ice/ice.h
··· 979 979 int 980 980 ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, 981 981 u32 flags); 982 + int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); 982 983 int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size); 983 984 int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size); 984 985 int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed);
+1 -5
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 3626 3626 if (!lut) 3627 3627 return -ENOMEM; 3628 3628 3629 - err = ice_get_rss_key(vsi, rxfh->key); 3630 - if (err) 3631 - goto out; 3632 - 3633 - err = ice_get_rss_lut(vsi, lut, vsi->rss_table_size); 3629 + err = ice_get_rss(vsi, rxfh->key, lut, vsi->rss_table_size); 3634 3630 if (err) 3635 3631 goto out; 3636 3632
+28
drivers/net/ethernet/intel/ice/ice_main.c
··· 7989 7989 } 7990 7990 7991 7991 /** 7992 + * ice_get_rss - Get RSS LUT and/or key 7993 + * @vsi: Pointer to VSI structure 7994 + * @seed: Buffer to store the key in 7995 + * @lut: Buffer to store the lookup table entries 7996 + * @lut_size: Size of buffer to store the lookup table entries 7997 + * 7998 + * Return: 0 on success, negative on failure 7999 + */ 8000 + int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) 8001 + { 8002 + int err; 8003 + 8004 + if (seed) { 8005 + err = ice_get_rss_key(vsi, seed); 8006 + if (err) 8007 + return err; 8008 + } 8009 + 8010 + if (lut) { 8011 + err = ice_get_rss_lut(vsi, lut, lut_size); 8012 + if (err) 8013 + return err; 8014 + } 8015 + 8016 + return 0; 8017 + } 8018 + 8019 + /** 7992 8020 * ice_set_rss_hfunc - Set RSS HASH function 7993 8021 * @vsi: Pointer to VSI structure 7994 8022 * @hfunc: hash function (ICE_AQ_VSI_Q_OPT_RSS_*)