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

Commit 014b2013 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ethtool-rssh-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/net-next



Ben Hutchings says:

====================
Pull request: Fixes for new ethtool RSS commands

This addresses several problems I previously identified with the new
ETHTOOL_{G,S}RSSH commands:

1. Missing validation of reserved parameters
2. Vague documentation
3. Use of unnamed magic number
4. No consolidation with existing driver operations

I don't currently have access to suitable network hardware, but have
tested these changes with a dummy driver that can support various
combinations of operations and sizes, together with (a) Debian's ethtool
3.13 (b) ethtool 3.14 with the submitted patch to use ETHTOOL_{G,S}RSSH
and minor adjustment for fixes 1 and 3.

v2: Update RSS operations in vmxnet3 too
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a68ab98e f062a384
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
@@ -12532,7 +12532,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;
@@ -12543,7 +12543,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;
@@ -14075,8 +14075,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,
};

+1 −1
Original line number Diff line number Diff line
@@ -2065,7 +2065,7 @@ int be_cmd_reset_function(struct be_adapter *adapter)
}

int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
		      u32 rss_hash_opts, u16 table_size, u8 *rss_hkey)
		      u32 rss_hash_opts, u16 table_size, const u8 *rss_hkey)
{
	struct be_mcc_wrb *wrb;
	struct be_cmd_req_rss_config *req;
+1 −1
Original line number Diff line number Diff line
@@ -2082,7 +2082,7 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
			u32 *function_mode, u32 *function_caps, u16 *asic_rev);
int be_cmd_reset_function(struct be_adapter *adapter);
int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
		      u32 rss_hash_opts, u16 table_size, u8 *rss_hkey);
		      u32 rss_hash_opts, u16 table_size, const u8 *rss_hkey);
int be_process_mcc(struct be_adapter *adapter);
int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon,
			    u8 status, u8 state);
Loading