Skip to content

Commit 1c7cf07

Browse files
Tom BarbetteJeff Kirsher
authored andcommitted
ixgbe: support for ethtool set_rxfh
Allows to change the rxfh indirection table and/or key using ethtool interface. Signed-off-by: Tom Barbette <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent ae8140a commit 1c7cf07

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,4 +973,5 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
973973
struct ixgbe_adapter *adapter,
974974
struct ixgbe_ring *tx_ring);
975975
u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter);
976+
void ixgbe_store_reta(struct ixgbe_adapter *adapter);
976977
#endif /* _IXGBE_H_ */

drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,6 +2868,14 @@ static int ixgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
28682868
return ret;
28692869
}
28702870

2871+
static int ixgbe_rss_indir_tbl_max(struct ixgbe_adapter *adapter)
2872+
{
2873+
if (adapter->hw.mac.type < ixgbe_mac_X550)
2874+
return 16;
2875+
else
2876+
return 64;
2877+
}
2878+
28712879
static u32 ixgbe_get_rxfh_key_size(struct net_device *netdev)
28722880
{
28732881
struct ixgbe_adapter *adapter = netdev_priv(netdev);
@@ -2907,6 +2915,44 @@ static int ixgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
29072915
return 0;
29082916
}
29092917

2918+
static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir,
2919+
const u8 *key, const u8 hfunc)
2920+
{
2921+
struct ixgbe_adapter *adapter = netdev_priv(netdev);
2922+
int i;
2923+
u32 reta_entries = ixgbe_rss_indir_tbl_entries(adapter);
2924+
2925+
if (hfunc)
2926+
return -EINVAL;
2927+
2928+
/* Fill out the redirection table */
2929+
if (indir) {
2930+
int max_queues = min_t(int, adapter->num_rx_queues,
2931+
ixgbe_rss_indir_tbl_max(adapter));
2932+
2933+
/*Allow at least 2 queues w/ SR-IOV.*/
2934+
if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) &&
2935+
(max_queues < 2))
2936+
max_queues = 2;
2937+
2938+
/* Verify user input. */
2939+
for (i = 0; i < reta_entries; i++)
2940+
if (indir[i] >= max_queues)
2941+
return -EINVAL;
2942+
2943+
for (i = 0; i < reta_entries; i++)
2944+
adapter->rss_indir_tbl[i] = indir[i];
2945+
}
2946+
2947+
/* Fill out the rss hash key */
2948+
if (key)
2949+
memcpy(adapter->rss_key, key, ixgbe_get_rxfh_key_size(netdev));
2950+
2951+
ixgbe_store_reta(adapter);
2952+
2953+
return 0;
2954+
}
2955+
29102956
static int ixgbe_get_ts_info(struct net_device *dev,
29112957
struct ethtool_ts_info *info)
29122958
{
@@ -3159,6 +3205,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
31593205
.get_rxfh_indir_size = ixgbe_rss_indir_size,
31603206
.get_rxfh_key_size = ixgbe_get_rxfh_key_size,
31613207
.get_rxfh = ixgbe_get_rxfh,
3208+
.set_rxfh = ixgbe_set_rxfh,
31623209
.get_channels = ixgbe_get_channels,
31633210
.set_channels = ixgbe_set_channels,
31643211
.get_ts_info = ixgbe_get_ts_info,

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3313,7 +3313,7 @@ u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter)
33133313
*
33143314
* Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.
33153315
*/
3316-
static void ixgbe_store_reta(struct ixgbe_adapter *adapter)
3316+
void ixgbe_store_reta(struct ixgbe_adapter *adapter)
33173317
{
33183318
u32 i, reta_entries = ixgbe_rss_indir_tbl_entries(adapter);
33193319
struct ixgbe_hw *hw = &adapter->hw;

0 commit comments

Comments
 (0)