ixgbe: Add the appropriate ethtool ops to query RSS indirection table and key
authorVlad Zolotarov <vladz@cloudius-systems.com>
Mon, 30 Mar 2015 18:18:58 +0000 (21:18 +0300)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sat, 11 Apr 2015 04:47:53 +0000 (21:47 -0700)
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.

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>
drivers/net/ethernet/intel/ixgbe/ixgbe.h
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

index d13ab87dfc3a7c44890174d71eb8720890e816d7..d3d27ec86ad2e39661949662ae6079403f04e7aa 100644 (file)
@@ -964,4 +964,5 @@ void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter);
 netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
                                  struct ixgbe_adapter *adapter,
                                  struct ixgbe_ring *tx_ring);
+u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter);
 #endif /* _IXGBE_H_ */
index ccaecb1b86194823ae7f0b62212295adc7ce7cdb..eafa9ec802bab921fee1fc28b927d02e7d48bcae 100644 (file)
@@ -2853,6 +2853,45 @@ static int ixgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
        return ret;
 }
 
+static u32 ixgbe_get_rxfh_key_size(struct net_device *netdev)
+{
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
+
+       return sizeof(adapter->rss_key);
+}
+
+static u32 ixgbe_rss_indir_size(struct net_device *netdev)
+{
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
+
+       return ixgbe_rss_indir_tbl_entries(adapter);
+}
+
+static void ixgbe_get_reta(struct ixgbe_adapter *adapter, u32 *indir)
+{
+       int i, reta_size = ixgbe_rss_indir_tbl_entries(adapter);
+
+       for (i = 0; i < reta_size; i++)
+               indir[i] = adapter->rss_indir_tbl[i];
+}
+
+static int ixgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
+                         u8 *hfunc)
+{
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
+
+       if (hfunc)
+               *hfunc = ETH_RSS_HASH_TOP;
+
+       if (indir)
+               ixgbe_get_reta(adapter, indir);
+
+       if (key)
+               memcpy(key, adapter->rss_key, ixgbe_get_rxfh_key_size(netdev));
+
+       return 0;
+}
+
 static int ixgbe_get_ts_info(struct net_device *dev,
                             struct ethtool_ts_info *info)
 {
@@ -3110,6 +3149,9 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
        .set_coalesce           = ixgbe_set_coalesce,
        .get_rxnfc              = ixgbe_get_rxnfc,
        .set_rxnfc              = ixgbe_set_rxnfc,
+       .get_rxfh_indir_size    = ixgbe_rss_indir_size,
+       .get_rxfh_key_size      = ixgbe_get_rxfh_key_size,
+       .get_rxfh               = ixgbe_get_rxfh,
        .get_channels           = ixgbe_get_channels,
        .set_channels           = ixgbe_set_channels,
        .get_ts_info            = ixgbe_get_ts_info,
index 57a3ec459ef739c473c81dacd0a657524997c055..fb096dd7b773033f958fb50bf3044c0ef3d3ba4b 100644 (file)
@@ -3237,7 +3237,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
  *  - X550(non-SRIOV mode): 512
  *  - X550(SRIOV mode):     64
  */
-static u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter)
+u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter)
 {
        if (adapter->hw.mac.type < ixgbe_mac_X550)
                return 128;