Skip to content

Commit

Permalink
ixgbevf: Add the appropriate ethtool ops to query RSS indirection tab…
Browse files Browse the repository at this point in the history
…le 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 <vladz@cloudius-systems.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Vlad Zolotarov authored and Jeff Kirsher committed Apr 11, 2015
1 parent ad1431e commit b641173
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions drivers/net/ethernet/intel/ixgbevf/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,71 @@ static int ixgbevf_set_coalesce(struct net_device *netdev,
return 0;
}

static int ixgbevf_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
u32 *rules __always_unused)
{
struct ixgbevf_adapter *adapter = netdev_priv(dev);

switch (info->cmd) {
case ETHTOOL_GRXRINGS:
info->data = adapter->num_rx_queues;
return 0;
default:
hw_dbg(&adapter->hw, "Command parameters not supported\n");
return -EOPNOTSUPP;
}
}

static u32 ixgbevf_get_rxfh_indir_size(struct net_device *netdev)
{
struct ixgbevf_adapter *adapter = netdev_priv(netdev);

/* We support this operation only for 82599 and x540 at the moment */
if (adapter->hw.mac.type < ixgbe_mac_X550_vf)
return IXGBEVF_82599_RETA_SIZE;

return 0;
}

static u32 ixgbevf_get_rxfh_key_size(struct net_device *netdev)
{
struct ixgbevf_adapter *adapter = netdev_priv(netdev);

/* We support this operation only for 82599 and x540 at the moment */
if (adapter->hw.mac.type < ixgbe_mac_X550_vf)
return IXGBEVF_RSS_HASH_KEY_SIZE;

return 0;
}

static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
u8 *hfunc)
{
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
int err = 0;

if (hfunc)
*hfunc = ETH_RSS_HASH_TOP;

/* If neither indirection table nor hash key was requested - just
* return a success avoiding taking any locks.
*/
if (!indir && !key)
return 0;

spin_lock_bh(&adapter->mbx_lock);
if (indir)
err = ixgbevf_get_reta_locked(&adapter->hw, indir,
adapter->num_rx_queues);

if (!err && key)
err = ixgbevf_get_rss_key_locked(&adapter->hw, key);

spin_unlock_bh(&adapter->mbx_lock);

return err;
}

static const struct ethtool_ops ixgbevf_ethtool_ops = {
.get_settings = ixgbevf_get_settings,
.get_drvinfo = ixgbevf_get_drvinfo,
Expand All @@ -811,6 +876,10 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = {
.get_ethtool_stats = ixgbevf_get_ethtool_stats,
.get_coalesce = ixgbevf_get_coalesce,
.set_coalesce = ixgbevf_set_coalesce,
.get_rxnfc = ixgbevf_get_rxnfc,
.get_rxfh_indir_size = ixgbevf_get_rxfh_indir_size,
.get_rxfh_key_size = ixgbevf_get_rxfh_key_size,
.get_rxfh = ixgbevf_get_rxfh,
};

void ixgbevf_set_ethtool_ops(struct net_device *netdev)
Expand Down

0 comments on commit b641173

Please sign in to comment.