Skip to content

Commit b641173

Browse files
Vlad ZolotarovJeff Kirsher
authored andcommitted
ixgbevf: Add the appropriate ethtool ops to query RSS indirection table and key
Added get_rxfh_indir_size, get_rxfh_key_size and get_rxfh ethtool_ops callbacks implementations. This enables the ethtool's "-x" and "--show-rxfh[-indir]" options for VF devices. This patch adds the support for 82599 and x540 devices only. Support for other devices will be added later. Signed-off-by: Vlad Zolotarov <[email protected]> Tested-by: Phil Schmitt <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent ad1431e commit b641173

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

drivers/net/ethernet/intel/ixgbevf/ethtool.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,71 @@ static int ixgbevf_set_coalesce(struct net_device *netdev,
794794
return 0;
795795
}
796796

797+
static int ixgbevf_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
798+
u32 *rules __always_unused)
799+
{
800+
struct ixgbevf_adapter *adapter = netdev_priv(dev);
801+
802+
switch (info->cmd) {
803+
case ETHTOOL_GRXRINGS:
804+
info->data = adapter->num_rx_queues;
805+
return 0;
806+
default:
807+
hw_dbg(&adapter->hw, "Command parameters not supported\n");
808+
return -EOPNOTSUPP;
809+
}
810+
}
811+
812+
static u32 ixgbevf_get_rxfh_indir_size(struct net_device *netdev)
813+
{
814+
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
815+
816+
/* We support this operation only for 82599 and x540 at the moment */
817+
if (adapter->hw.mac.type < ixgbe_mac_X550_vf)
818+
return IXGBEVF_82599_RETA_SIZE;
819+
820+
return 0;
821+
}
822+
823+
static u32 ixgbevf_get_rxfh_key_size(struct net_device *netdev)
824+
{
825+
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
826+
827+
/* We support this operation only for 82599 and x540 at the moment */
828+
if (adapter->hw.mac.type < ixgbe_mac_X550_vf)
829+
return IXGBEVF_RSS_HASH_KEY_SIZE;
830+
831+
return 0;
832+
}
833+
834+
static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
835+
u8 *hfunc)
836+
{
837+
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
838+
int err = 0;
839+
840+
if (hfunc)
841+
*hfunc = ETH_RSS_HASH_TOP;
842+
843+
/* If neither indirection table nor hash key was requested - just
844+
* return a success avoiding taking any locks.
845+
*/
846+
if (!indir && !key)
847+
return 0;
848+
849+
spin_lock_bh(&adapter->mbx_lock);
850+
if (indir)
851+
err = ixgbevf_get_reta_locked(&adapter->hw, indir,
852+
adapter->num_rx_queues);
853+
854+
if (!err && key)
855+
err = ixgbevf_get_rss_key_locked(&adapter->hw, key);
856+
857+
spin_unlock_bh(&adapter->mbx_lock);
858+
859+
return err;
860+
}
861+
797862
static const struct ethtool_ops ixgbevf_ethtool_ops = {
798863
.get_settings = ixgbevf_get_settings,
799864
.get_drvinfo = ixgbevf_get_drvinfo,
@@ -811,6 +876,10 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = {
811876
.get_ethtool_stats = ixgbevf_get_ethtool_stats,
812877
.get_coalesce = ixgbevf_get_coalesce,
813878
.set_coalesce = ixgbevf_set_coalesce,
879+
.get_rxnfc = ixgbevf_get_rxnfc,
880+
.get_rxfh_indir_size = ixgbevf_get_rxfh_indir_size,
881+
.get_rxfh_key_size = ixgbevf_get_rxfh_key_size,
882+
.get_rxfh = ixgbevf_get_rxfh,
814883
};
815884

816885
void ixgbevf_set_ethtool_ops(struct net_device *netdev)

0 commit comments

Comments
 (0)