Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe62d001 authored by Ben Hutchings's avatar Ben Hutchings
Browse files

ethtool: Replace ethtool_ops::{get,set}_rxfh_indir() with {get,set}_rxfh()



ETHTOOL_{G,S}RXFHINDIR and ETHTOOL_{G,S}RSSH should work for drivers
regardless of whether they expose the hash key, unless you try to
set a hash key for a driver that doesn't expose it.

Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Acked-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 33cb0fa7
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -3316,7 +3316,7 @@ static u32 bnx2x_get_rxfh_indir_size(struct net_device *dev)
	return T_ETH_INDIRECTION_TABLE_SIZE;
}

static int bnx2x_get_rxfh_indir(struct net_device *dev, u32 *indir)
static int bnx2x_get_rxfh(struct net_device *dev, u32 *indir, u8 *key)
{
	struct bnx2x *bp = netdev_priv(dev);
	u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE] = {0};
@@ -3340,14 +3340,15 @@ static int bnx2x_get_rxfh_indir(struct net_device *dev, u32 *indir)
	return 0;
}

static int bnx2x_set_rxfh_indir(struct net_device *dev, const u32 *indir)
static int bnx2x_set_rxfh(struct net_device *dev, const u32 *indir,
			  const u8 *key)
{
	struct bnx2x *bp = netdev_priv(dev);
	size_t i;

	for (i = 0; i < T_ETH_INDIRECTION_TABLE_SIZE; i++) {
		/*
		 * The same as in bnx2x_get_rxfh_indir: we can't use a memcpy()
		 * The same as in bnx2x_get_rxfh: we can't use a memcpy()
		 * as an internal storage of an indirection table is a u8 array
		 * while indir->ring_index points to an array of u32.
		 *
@@ -3471,8 +3472,8 @@ static const struct ethtool_ops bnx2x_ethtool_ops = {
	.get_rxnfc		= bnx2x_get_rxnfc,
	.set_rxnfc		= bnx2x_set_rxnfc,
	.get_rxfh_indir_size	= bnx2x_get_rxfh_indir_size,
	.get_rxfh_indir		= bnx2x_get_rxfh_indir,
	.set_rxfh_indir		= bnx2x_set_rxfh_indir,
	.get_rxfh		= bnx2x_get_rxfh,
	.set_rxfh		= bnx2x_set_rxfh,
	.get_channels		= bnx2x_get_channels,
	.set_channels		= bnx2x_set_channels,
	.get_module_info	= bnx2x_get_module_info,
@@ -3498,8 +3499,8 @@ static const struct ethtool_ops bnx2x_vf_ethtool_ops = {
	.get_rxnfc		= bnx2x_get_rxnfc,
	.set_rxnfc		= bnx2x_set_rxnfc,
	.get_rxfh_indir_size	= bnx2x_get_rxfh_indir_size,
	.get_rxfh_indir		= bnx2x_get_rxfh_indir,
	.set_rxfh_indir		= bnx2x_set_rxfh_indir,
	.get_rxfh		= bnx2x_get_rxfh,
	.set_rxfh		= bnx2x_set_rxfh,
	.get_channels		= bnx2x_get_channels,
	.set_channels		= bnx2x_set_channels,
};
+4 −4
Original line number Diff line number Diff line
@@ -12501,7 +12501,7 @@ static u32 tg3_get_rxfh_indir_size(struct net_device *dev)
	return size;
}

static int tg3_get_rxfh_indir(struct net_device *dev, u32 *indir)
static int tg3_get_rxfh(struct net_device *dev, u32 *indir, u8 *key)
{
	struct tg3 *tp = netdev_priv(dev);
	int i;
@@ -12512,7 +12512,7 @@ static int tg3_get_rxfh_indir(struct net_device *dev, u32 *indir)
	return 0;
}

static int tg3_set_rxfh_indir(struct net_device *dev, const u32 *indir)
static int tg3_set_rxfh(struct net_device *dev, const u32 *indir, const u8 *key)
{
	struct tg3 *tp = netdev_priv(dev);
	size_t i;
@@ -14044,8 +14044,8 @@ static const struct ethtool_ops tg3_ethtool_ops = {
	.get_sset_count		= tg3_get_sset_count,
	.get_rxnfc		= tg3_get_rxnfc,
	.get_rxfh_indir_size    = tg3_get_rxfh_indir_size,
	.get_rxfh_indir		= tg3_get_rxfh_indir,
	.set_rxfh_indir		= tg3_set_rxfh_indir,
	.get_rxfh		= tg3_get_rxfh,
	.set_rxfh		= tg3_set_rxfh,
	.get_channels		= tg3_get_channels,
	.set_channels		= tg3_set_channels,
	.get_ts_info		= tg3_get_ts_info,
+4 −4
Original line number Diff line number Diff line
@@ -2739,7 +2739,7 @@ static u32 get_rss_table_size(struct net_device *dev)
	return pi->rss_size;
}

static int get_rss_table(struct net_device *dev, u32 *p)
static int get_rss_table(struct net_device *dev, u32 *p, u8 *key)
{
	const struct port_info *pi = netdev_priv(dev);
	unsigned int n = pi->rss_size;
@@ -2749,7 +2749,7 @@ static int get_rss_table(struct net_device *dev, u32 *p)
	return 0;
}

static int set_rss_table(struct net_device *dev, const u32 *p)
static int set_rss_table(struct net_device *dev, const u32 *p, const u8 *key)
{
	unsigned int i;
	struct port_info *pi = netdev_priv(dev);
@@ -2851,8 +2851,8 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
	.set_wol           = set_wol,
	.get_rxnfc         = get_rxnfc,
	.get_rxfh_indir_size = get_rss_table_size,
	.get_rxfh_indir    = get_rss_table,
	.set_rxfh_indir    = set_rss_table,
	.get_rxfh	   = get_rss_table,
	.set_rxfh	   = set_rss_table,
	.flash_device      = set_flash,
};

+9 −6
Original line number Diff line number Diff line
@@ -626,13 +626,14 @@ static u32 i40evf_get_rxfh_indir_size(struct net_device *netdev)
}

/**
 * i40evf_get_rxfh_indir - get the rx flow hash indirection table
 * i40evf_get_rxfh - get the rx flow hash indirection table
 * @netdev: network interface device structure
 * @indir: indirection table
 * @key: hash key (will be %NULL until get_rxfh_key_size is implemented)
 *
 * Reads the indirection table directly from the hardware. Always returns 0.
 **/
static int i40evf_get_rxfh_indir(struct net_device *netdev, u32 *indir)
static int i40evf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
{
	struct i40evf_adapter *adapter = netdev_priv(netdev);
	struct i40e_hw *hw = &adapter->hw;
@@ -650,14 +651,16 @@ static int i40evf_get_rxfh_indir(struct net_device *netdev, u32 *indir)
}

/**
 * i40evf_set_rxfh_indir - set the rx flow hash indirection table
 * i40evf_set_rxfh - set the rx flow hash indirection table
 * @netdev: network interface device structure
 * @indir: indirection table
 * @key: hash key (will be %NULL until get_rxfh_key_size is implemented)
 *
 * Returns -EINVAL if the table specifies an inavlid queue id, otherwise
 * returns 0 after programming the table.
 **/
static int i40evf_set_rxfh_indir(struct net_device *netdev, const u32 *indir)
static int i40evf_set_rxfh(struct net_device *netdev, const u32 *indir,
			   const u8 *key)
{
	struct i40evf_adapter *adapter = netdev_priv(netdev);
	struct i40e_hw *hw = &adapter->hw;
@@ -691,8 +694,8 @@ static struct ethtool_ops i40evf_ethtool_ops = {
	.get_rxnfc		= i40evf_get_rxnfc,
	.set_rxnfc		= i40evf_set_rxnfc,
	.get_rxfh_indir_size	= i40evf_get_rxfh_indir_size,
	.get_rxfh_indir		= i40evf_get_rxfh_indir,
	.set_rxfh_indir		= i40evf_set_rxfh_indir,
	.get_rxfh		= i40evf_get_rxfh,
	.set_rxfh		= i40evf_set_rxfh,
	.get_channels		= i40evf_get_channels,
};

+5 −4
Original line number Diff line number Diff line
@@ -2830,7 +2830,7 @@ static u32 igb_get_rxfh_indir_size(struct net_device *netdev)
	return IGB_RETA_SIZE;
}

static int igb_get_rxfh_indir(struct net_device *netdev, u32 *indir)
static int igb_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
{
	struct igb_adapter *adapter = netdev_priv(netdev);
	int i;
@@ -2876,7 +2876,8 @@ void igb_write_rss_indir_tbl(struct igb_adapter *adapter)
	}
}

static int igb_set_rxfh_indir(struct net_device *netdev, const u32 *indir)
static int igb_set_rxfh(struct net_device *netdev, const u32 *indir,
			const u8 *key)
{
	struct igb_adapter *adapter = netdev_priv(netdev);
	struct e1000_hw *hw = &adapter->hw;
@@ -3025,8 +3026,8 @@ static const struct ethtool_ops igb_ethtool_ops = {
	.get_module_info	= igb_get_module_info,
	.get_module_eeprom	= igb_get_module_eeprom,
	.get_rxfh_indir_size	= igb_get_rxfh_indir_size,
	.get_rxfh_indir		= igb_get_rxfh_indir,
	.set_rxfh_indir		= igb_set_rxfh_indir,
	.get_rxfh		= igb_get_rxfh,
	.set_rxfh		= igb_set_rxfh,
	.get_channels		= igb_get_channels,
	.set_channels		= igb_set_channels,
	.begin			= igb_ethtool_begin,
Loading