net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops

The get/set_rxfh ethtool ops currently takes the rxfh (RSS) parameters
as direct function arguments. This will force us to change the API (and
all drivers' functions) every time some new parameters are added.

This is part 1/2 of the fix, as suggested in [1]:

- First simplify the code by always providing a pointer to all params
   (indir, key and func); the fact that some of them may be NULL seems
   like a weird historic thing or a premature optimization.
   It will simplify the drivers if all pointers are always present.

 - Then make the functions take a dev pointer, and a pointer to a
   single struct wrapping all arguments. The set_* should also take
   an extack.

Link: https://lore.kernel.org/netdev/20231121152906.2dd5f487@kernel.org/ [1]
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Suggested-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
Link: https://lore.kernel.org/r/20231213003321.605376-2-ahmed.zaki@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Ahmed Zaki 2023-12-12 17:33:14 -07:00 committed by Jakub Kicinski
parent c3f687d8df
commit fb6e30a725
48 changed files with 827 additions and 730 deletions

View File

@ -802,15 +802,15 @@ static int ena_indirection_table_get(struct ena_adapter *adapter, u32 *indir)
return rc; return rc;
} }
static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int ena_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct ena_adapter *adapter = netdev_priv(netdev); struct ena_adapter *adapter = netdev_priv(netdev);
enum ena_admin_hash_functions ena_func; enum ena_admin_hash_functions ena_func;
u8 func; u8 func;
int rc; int rc;
rc = ena_indirection_table_get(adapter, indir); rc = ena_indirection_table_get(adapter, rxfh->indir);
if (rc) if (rc)
return rc; return rc;
@ -825,7 +825,7 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
return rc; return rc;
} }
rc = ena_com_get_hash_key(adapter->ena_dev, key); rc = ena_com_get_hash_key(adapter->ena_dev, rxfh->key);
if (rc) if (rc)
return rc; return rc;
@ -842,27 +842,27 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (hfunc) rxfh->hfunc = func;
*hfunc = func;
return 0; return 0;
} }
static int ena_set_rxfh(struct net_device *netdev, const u32 *indir, static int ena_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct ena_adapter *adapter = netdev_priv(netdev); struct ena_adapter *adapter = netdev_priv(netdev);
struct ena_com_dev *ena_dev = adapter->ena_dev; struct ena_com_dev *ena_dev = adapter->ena_dev;
enum ena_admin_hash_functions func = 0; enum ena_admin_hash_functions func = 0;
int rc; int rc;
if (indir) { if (rxfh->indir) {
rc = ena_indirection_table_set(adapter, indir); rc = ena_indirection_table_set(adapter, rxfh->indir);
if (rc) if (rc)
return rc; return rc;
} }
switch (hfunc) { switch (rxfh->hfunc) {
case ETH_RSS_HASH_NO_CHANGE: case ETH_RSS_HASH_NO_CHANGE:
func = ena_com_get_current_hash_function(ena_dev); func = ena_com_get_current_hash_function(ena_dev);
break; break;
@ -874,12 +874,12 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,
break; break;
default: default:
netif_err(adapter, drv, netdev, "Unsupported hfunc %d\n", netif_err(adapter, drv, netdev, "Unsupported hfunc %d\n",
hfunc); rxfh->hfunc);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (key || func) { if (rxfh->key || func) {
rc = ena_com_fill_hash_function(ena_dev, func, key, rc = ena_com_fill_hash_function(ena_dev, func, rxfh->key,
ENA_HASH_KEY_SIZE, ENA_HASH_KEY_SIZE,
0xFFFFFFFF); 0xFFFFFFFF);
if (unlikely(rc)) { if (unlikely(rc)) {

View File

@ -527,47 +527,48 @@ static u32 xgbe_get_rxfh_indir_size(struct net_device *netdev)
return ARRAY_SIZE(pdata->rss_table); return ARRAY_SIZE(pdata->rss_table);
} }
static int xgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int xgbe_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct xgbe_prv_data *pdata = netdev_priv(netdev); struct xgbe_prv_data *pdata = netdev_priv(netdev);
unsigned int i; unsigned int i;
if (indir) { if (rxfh->indir) {
for (i = 0; i < ARRAY_SIZE(pdata->rss_table); i++) for (i = 0; i < ARRAY_SIZE(pdata->rss_table); i++)
indir[i] = XGMAC_GET_BITS(pdata->rss_table[i], rxfh->indir[i] = XGMAC_GET_BITS(pdata->rss_table[i],
MAC_RSSDR, DMCH); MAC_RSSDR, DMCH);
} }
if (key) if (rxfh->key)
memcpy(key, pdata->rss_key, sizeof(pdata->rss_key)); memcpy(rxfh->key, pdata->rss_key, sizeof(pdata->rss_key));
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
return 0; return 0;
} }
static int xgbe_set_rxfh(struct net_device *netdev, const u32 *indir, static int xgbe_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct xgbe_prv_data *pdata = netdev_priv(netdev); struct xgbe_prv_data *pdata = netdev_priv(netdev);
struct xgbe_hw_if *hw_if = &pdata->hw_if; struct xgbe_hw_if *hw_if = &pdata->hw_if;
unsigned int ret; unsigned int ret;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) { if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP) {
netdev_err(netdev, "unsupported hash function\n"); netdev_err(netdev, "unsupported hash function\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (indir) { if (rxfh->indir) {
ret = hw_if->set_rss_lookup_table(pdata, indir); ret = hw_if->set_rss_lookup_table(pdata, rxfh->indir);
if (ret) if (ret)
return ret; return ret;
} }
if (key) { if (rxfh->key) {
ret = hw_if->set_rss_hash_key(pdata, key); ret = hw_if->set_rss_hash_key(pdata, rxfh->key);
if (ret) if (ret)
return ret; return ret;
} }

View File

@ -447,8 +447,8 @@ static u32 aq_ethtool_get_rss_key_size(struct net_device *ndev)
return sizeof(cfg->aq_rss.hash_secret_key); return sizeof(cfg->aq_rss.hash_secret_key);
} }
static int aq_ethtool_get_rss(struct net_device *ndev, u32 *indir, u8 *key, static int aq_ethtool_get_rss(struct net_device *ndev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct aq_nic_s *aq_nic = netdev_priv(ndev); struct aq_nic_s *aq_nic = netdev_priv(ndev);
struct aq_nic_cfg_s *cfg; struct aq_nic_cfg_s *cfg;
@ -456,21 +456,21 @@ static int aq_ethtool_get_rss(struct net_device *ndev, u32 *indir, u8 *key,
cfg = aq_nic_get_cfg(aq_nic); cfg = aq_nic_get_cfg(aq_nic);
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP; /* Toeplitz */
*hfunc = ETH_RSS_HASH_TOP; /* Toeplitz */ if (rxfh->indir) {
if (indir) {
for (i = 0; i < AQ_CFG_RSS_INDIRECTION_TABLE_MAX; i++) for (i = 0; i < AQ_CFG_RSS_INDIRECTION_TABLE_MAX; i++)
indir[i] = cfg->aq_rss.indirection_table[i]; rxfh->indir[i] = cfg->aq_rss.indirection_table[i];
} }
if (key) if (rxfh->key)
memcpy(key, cfg->aq_rss.hash_secret_key, memcpy(rxfh->key, cfg->aq_rss.hash_secret_key,
sizeof(cfg->aq_rss.hash_secret_key)); sizeof(cfg->aq_rss.hash_secret_key));
return 0; return 0;
} }
static int aq_ethtool_set_rss(struct net_device *netdev, const u32 *indir, static int aq_ethtool_set_rss(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct aq_nic_s *aq_nic = netdev_priv(netdev); struct aq_nic_s *aq_nic = netdev_priv(netdev);
struct aq_nic_cfg_s *cfg; struct aq_nic_cfg_s *cfg;
@ -482,16 +482,17 @@ static int aq_ethtool_set_rss(struct net_device *netdev, const u32 *indir,
rss_entries = cfg->aq_rss.indirection_table_size; rss_entries = cfg->aq_rss.indirection_table_size;
/* We do not allow change in unsupported parameters */ /* We do not allow change in unsupported parameters */
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* Fill out the redirection table */ /* Fill out the redirection table */
if (indir) if (rxfh->indir)
for (i = 0; i < rss_entries; i++) for (i = 0; i < rss_entries; i++)
cfg->aq_rss.indirection_table[i] = indir[i]; cfg->aq_rss.indirection_table[i] = rxfh->indir[i];
/* Fill out the rss hash key */ /* Fill out the rss hash key */
if (key) { if (rxfh->key) {
memcpy(cfg->aq_rss.hash_secret_key, key, memcpy(cfg->aq_rss.hash_secret_key, rxfh->key,
sizeof(cfg->aq_rss.hash_secret_key)); sizeof(cfg->aq_rss.hash_secret_key));
err = aq_nic->aq_hw_ops->hw_rss_hash_set(aq_nic->aq_hw, err = aq_nic->aq_hw_ops->hw_rss_hash_set(aq_nic->aq_hw,
&cfg->aq_rss); &cfg->aq_rss);

View File

@ -3486,16 +3486,15 @@ static u32 bnx2x_get_rxfh_indir_size(struct net_device *dev)
return T_ETH_INDIRECTION_TABLE_SIZE; return T_ETH_INDIRECTION_TABLE_SIZE;
} }
static int bnx2x_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, static int bnx2x_get_rxfh(struct net_device *dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE] = {0}; u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE] = {0};
size_t i; size_t i;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (!rxfh->indir)
if (!indir)
return 0; return 0;
/* Get the current configuration of the RSS indirection table */ /* Get the current configuration of the RSS indirection table */
@ -3511,13 +3510,14 @@ static int bnx2x_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
* queue. * queue.
*/ */
for (i = 0; i < T_ETH_INDIRECTION_TABLE_SIZE; i++) for (i = 0; i < T_ETH_INDIRECTION_TABLE_SIZE; i++)
indir[i] = ind_table[i] - bp->fp->cl_id; rxfh->indir[i] = ind_table[i] - bp->fp->cl_id;
return 0; return 0;
} }
static int bnx2x_set_rxfh(struct net_device *dev, const u32 *indir, static int bnx2x_set_rxfh(struct net_device *dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
size_t i; size_t i;
@ -3525,11 +3525,12 @@ static int bnx2x_set_rxfh(struct net_device *dev, const u32 *indir,
/* We require at least one supported parameter to be changed and no /* We require at least one supported parameter to be changed and no
* change in any of the unsupported parameters * change in any of the unsupported parameters
*/ */
if (key || if (rxfh->key ||
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
for (i = 0; i < T_ETH_INDIRECTION_TABLE_SIZE; i++) { for (i = 0; i < T_ETH_INDIRECTION_TABLE_SIZE; i++) {
@ -3542,7 +3543,7 @@ static int bnx2x_set_rxfh(struct net_device *dev, const u32 *indir,
* align the received table to the Client ID of the leading RSS * align the received table to the Client ID of the leading RSS
* queue * queue
*/ */
bp->rss_conf_obj.ind_table[i] = indir[i] + bp->fp->cl_id; bp->rss_conf_obj.ind_table[i] = rxfh->indir[i] + bp->fp->cl_id;
} }
if (bp->state == BNX2X_STATE_OPEN) if (bp->state == BNX2X_STATE_OPEN)

View File

@ -1333,49 +1333,49 @@ static u32 bnxt_get_rxfh_key_size(struct net_device *dev)
return HW_HASH_KEY_SIZE; return HW_HASH_KEY_SIZE;
} }
static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, static int bnxt_get_rxfh(struct net_device *dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
struct bnxt_vnic_info *vnic; struct bnxt_vnic_info *vnic;
u32 i, tbl_size; u32 i, tbl_size;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (!bp->vnic_info) if (!bp->vnic_info)
return 0; return 0;
vnic = &bp->vnic_info[0]; vnic = &bp->vnic_info[0];
if (indir && bp->rss_indir_tbl) { if (rxfh->indir && bp->rss_indir_tbl) {
tbl_size = bnxt_get_rxfh_indir_size(dev); tbl_size = bnxt_get_rxfh_indir_size(dev);
for (i = 0; i < tbl_size; i++) for (i = 0; i < tbl_size; i++)
indir[i] = bp->rss_indir_tbl[i]; rxfh->indir[i] = bp->rss_indir_tbl[i];
} }
if (key && vnic->rss_hash_key) if (rxfh->key && vnic->rss_hash_key)
memcpy(key, vnic->rss_hash_key, HW_HASH_KEY_SIZE); memcpy(rxfh->key, vnic->rss_hash_key, HW_HASH_KEY_SIZE);
return 0; return 0;
} }
static int bnxt_set_rxfh(struct net_device *dev, const u32 *indir, static int bnxt_set_rxfh(struct net_device *dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
int rc = 0; int rc = 0;
if (hfunc && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc && rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (key) if (rxfh->key)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) { if (rxfh->indir) {
u32 i, pad, tbl_size = bnxt_get_rxfh_indir_size(dev); u32 i, pad, tbl_size = bnxt_get_rxfh_indir_size(dev);
for (i = 0; i < tbl_size; i++) for (i = 0; i < tbl_size; i++)
bp->rss_indir_tbl[i] = indir[i]; bp->rss_indir_tbl[i] = rxfh->indir[i];
pad = bp->rss_indir_tbl_entries - tbl_size; pad = bp->rss_indir_tbl_entries - tbl_size;
if (pad) if (pad)
memset(&bp->rss_indir_tbl[i], 0, pad * sizeof(u16)); memset(&bp->rss_indir_tbl[i], 0, pad * sizeof(u16));

View File

@ -12745,24 +12745,23 @@ static u32 tg3_get_rxfh_indir_size(struct net_device *dev)
return size; return size;
} }
static int tg3_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, u8 *hfunc) static int tg3_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh)
{ {
struct tg3 *tp = netdev_priv(dev); struct tg3 *tp = netdev_priv(dev);
int i; int i;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (!rxfh->indir)
if (!indir)
return 0; return 0;
for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++) for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++)
indir[i] = tp->rss_ind_tbl[i]; rxfh->indir[i] = tp->rss_ind_tbl[i];
return 0; return 0;
} }
static int tg3_set_rxfh(struct net_device *dev, const u32 *indir, const u8 *key, static int tg3_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
const u8 hfunc) struct netlink_ext_ack *extack)
{ {
struct tg3 *tp = netdev_priv(dev); struct tg3 *tp = netdev_priv(dev);
size_t i; size_t i;
@ -12770,15 +12769,16 @@ static int tg3_set_rxfh(struct net_device *dev, const u32 *indir, const u8 *key,
/* We require at least one supported parameter to be changed and no /* We require at least one supported parameter to be changed and no
* change in any of the unsupported parameters * change in any of the unsupported parameters
*/ */
if (key || if (rxfh->key ||
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++) for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++)
tp->rss_ind_tbl[i] = indir[i]; tp->rss_ind_tbl[i] = rxfh->indir[i];
if (!netif_running(dev) || !tg3_flag(tp, ENABLE_RSS)) if (!netif_running(dev) || !tg3_flag(tp, ENABLE_RSS))
return 0; return 0;

View File

@ -653,35 +653,36 @@ static u32 nicvf_get_rxfh_indir_size(struct net_device *dev)
return nic->rss_info.rss_size; return nic->rss_info.rss_size;
} }
static int nicvf_get_rxfh(struct net_device *dev, u32 *indir, u8 *hkey, static int nicvf_get_rxfh(struct net_device *dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct nicvf *nic = netdev_priv(dev); struct nicvf *nic = netdev_priv(dev);
struct nicvf_rss_info *rss = &nic->rss_info; struct nicvf_rss_info *rss = &nic->rss_info;
int idx; int idx;
if (indir) { if (rxfh->indir) {
for (idx = 0; idx < rss->rss_size; idx++) for (idx = 0; idx < rss->rss_size; idx++)
indir[idx] = rss->ind_tbl[idx]; rxfh->indir[idx] = rss->ind_tbl[idx];
} }
if (hkey) if (rxfh->key)
memcpy(hkey, rss->key, RSS_HASH_KEY_SIZE * sizeof(u64)); memcpy(rxfh->key, rss->key, RSS_HASH_KEY_SIZE * sizeof(u64));
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
return 0; return 0;
} }
static int nicvf_set_rxfh(struct net_device *dev, const u32 *indir, static int nicvf_set_rxfh(struct net_device *dev,
const u8 *hkey, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct nicvf *nic = netdev_priv(dev); struct nicvf *nic = netdev_priv(dev);
struct nicvf_rss_info *rss = &nic->rss_info; struct nicvf_rss_info *rss = &nic->rss_info;
int idx; int idx;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!rss->enable) { if (!rss->enable) {
@ -690,13 +691,13 @@ static int nicvf_set_rxfh(struct net_device *dev, const u32 *indir,
return -EIO; return -EIO;
} }
if (indir) { if (rxfh->indir) {
for (idx = 0; idx < rss->rss_size; idx++) for (idx = 0; idx < rss->rss_size; idx++)
rss->ind_tbl[idx] = indir[idx]; rss->ind_tbl[idx] = rxfh->indir[idx];
} }
if (hkey) { if (rxfh->key) {
memcpy(rss->key, hkey, RSS_HASH_KEY_SIZE * sizeof(u64)); memcpy(rss->key, rxfh->key, RSS_HASH_KEY_SIZE * sizeof(u64));
nicvf_set_rss_key(nic); nicvf_set_rss_key(nic);
} }

View File

@ -1588,22 +1588,23 @@ static u32 get_rss_table_size(struct net_device *dev)
return pi->rss_size; return pi->rss_size;
} }
static int get_rss_table(struct net_device *dev, u32 *p, u8 *key, u8 *hfunc) static int get_rss_table(struct net_device *dev,
struct ethtool_rxfh_param *rxfh)
{ {
const struct port_info *pi = netdev_priv(dev); const struct port_info *pi = netdev_priv(dev);
unsigned int n = pi->rss_size; unsigned int n = pi->rss_size;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (!rxfh->indir)
if (!p)
return 0; return 0;
while (n--) while (n--)
p[n] = pi->rss[n]; rxfh->indir[n] = pi->rss[n];
return 0; return 0;
} }
static int set_rss_table(struct net_device *dev, const u32 *p, const u8 *key, static int set_rss_table(struct net_device *dev,
const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
unsigned int i; unsigned int i;
struct port_info *pi = netdev_priv(dev); struct port_info *pi = netdev_priv(dev);
@ -1611,16 +1612,17 @@ static int set_rss_table(struct net_device *dev, const u32 *p, const u8 *key,
/* We require at least one supported parameter to be changed and no /* We require at least one supported parameter to be changed and no
* change in any of the unsupported parameters * change in any of the unsupported parameters
*/ */
if (key || if (rxfh->key ||
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!p) if (!rxfh->indir)
return 0; return 0;
/* Interface must be brought up atleast once */ /* Interface must be brought up atleast once */
if (pi->adapter->flags & CXGB4_FULL_INIT_DONE) { if (pi->adapter->flags & CXGB4_FULL_INIT_DONE) {
for (i = 0; i < pi->rss_size; i++) for (i = 0; i < pi->rss_size; i++)
pi->rss[i] = p[i]; pi->rss[i] = rxfh->indir[i];
return cxgb4_write_rss(pi, pi->rss); return cxgb4_write_rss(pi, pi->rss);
} }

View File

@ -568,31 +568,32 @@ static u32 enic_get_rxfh_key_size(struct net_device *netdev)
return ENIC_RSS_LEN; return ENIC_RSS_LEN;
} }
static int enic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *hkey, static int enic_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct enic *enic = netdev_priv(netdev); struct enic *enic = netdev_priv(netdev);
if (hkey) if (rxfh->key)
memcpy(hkey, enic->rss_key, ENIC_RSS_LEN); memcpy(rxfh->key, enic->rss_key, ENIC_RSS_LEN);
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
return 0; return 0;
} }
static int enic_set_rxfh(struct net_device *netdev, const u32 *indir, static int enic_set_rxfh(struct net_device *netdev,
const u8 *hkey, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct enic *enic = netdev_priv(netdev); struct enic *enic = netdev_priv(netdev);
if ((hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) || if (rxfh->indir ||
indir) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EINVAL; return -EINVAL;
if (hkey) if (rxfh->key)
memcpy(enic->rss_key, hkey, ENIC_RSS_LEN); memcpy(enic->rss_key, rxfh->key, ENIC_RSS_LEN);
return __enic_set_rsskey(enic); return __enic_set_rsskey(enic);
} }

View File

@ -1271,43 +1271,45 @@ static u32 be_get_rxfh_key_size(struct net_device *netdev)
return RSS_HASH_KEY_LEN; return RSS_HASH_KEY_LEN;
} }
static int be_get_rxfh(struct net_device *netdev, u32 *indir, u8 *hkey, static int be_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int i; int i;
struct rss_info *rss = &adapter->rss_info; struct rss_info *rss = &adapter->rss_info;
if (indir) { if (rxfh->indir) {
for (i = 0; i < RSS_INDIR_TABLE_LEN; i++) for (i = 0; i < RSS_INDIR_TABLE_LEN; i++)
indir[i] = rss->rss_queue[i]; rxfh->indir[i] = rss->rss_queue[i];
} }
if (hkey) if (rxfh->key)
memcpy(hkey, rss->rss_hkey, RSS_HASH_KEY_LEN); memcpy(rxfh->key, rss->rss_hkey, RSS_HASH_KEY_LEN);
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
return 0; return 0;
} }
static int be_set_rxfh(struct net_device *netdev, const u32 *indir, static int be_set_rxfh(struct net_device *netdev,
const u8 *hkey, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
int rc = 0, i, j; int rc = 0, i, j;
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
u8 *hkey = rxfh->key;
u8 rsstable[RSS_INDIR_TABLE_LEN]; u8 rsstable[RSS_INDIR_TABLE_LEN];
/* We do not allow change in unsupported parameters */ /* We do not allow change in unsupported parameters */
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) { if (rxfh->indir) {
struct be_rx_obj *rxo; struct be_rx_obj *rxo;
for (i = 0; i < RSS_INDIR_TABLE_LEN; i++) { for (i = 0; i < RSS_INDIR_TABLE_LEN; i++) {
j = indir[i]; j = rxfh->indir[i];
rxo = &adapter->rx_obj[j]; rxo = &adapter->rx_obj[j];
rsstable[i] = rxo->rss_id; rsstable[i] = rxo->rss_id;
adapter->rss_info.rss_queue[i] = j; adapter->rss_info.rss_queue[i] = j;

View File

@ -690,25 +690,26 @@ static u32 enetc_get_rxfh_indir_size(struct net_device *ndev)
return priv->si->num_rss; return priv->si->num_rss;
} }
static int enetc_get_rxfh(struct net_device *ndev, u32 *indir, u8 *key, static int enetc_get_rxfh(struct net_device *ndev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_hw *hw = &priv->si->hw; struct enetc_hw *hw = &priv->si->hw;
int err = 0, i; int err = 0, i;
/* return hash function */ /* return hash function */
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
/* return hash key */ /* return hash key */
if (key && hw->port) if (rxfh->key && hw->port)
for (i = 0; i < ENETC_RSSHASH_KEY_SIZE / 4; i++) for (i = 0; i < ENETC_RSSHASH_KEY_SIZE / 4; i++)
((u32 *)key)[i] = enetc_port_rd(hw, ENETC_PRSSK(i)); ((u32 *)rxfh->key)[i] = enetc_port_rd(hw,
ENETC_PRSSK(i));
/* return RSS table */ /* return RSS table */
if (indir) if (rxfh->indir)
err = enetc_get_rss_table(priv->si, indir, priv->si->num_rss); err = enetc_get_rss_table(priv->si, rxfh->indir,
priv->si->num_rss);
return err; return err;
} }
@ -722,20 +723,22 @@ void enetc_set_rss_key(struct enetc_hw *hw, const u8 *bytes)
} }
EXPORT_SYMBOL_GPL(enetc_set_rss_key); EXPORT_SYMBOL_GPL(enetc_set_rss_key);
static int enetc_set_rxfh(struct net_device *ndev, const u32 *indir, static int enetc_set_rxfh(struct net_device *ndev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_hw *hw = &priv->si->hw; struct enetc_hw *hw = &priv->si->hw;
int err = 0; int err = 0;
/* set hash key, if PF */ /* set hash key, if PF */
if (key && hw->port) if (rxfh->key && hw->port)
enetc_set_rss_key(hw, key); enetc_set_rss_key(hw, rxfh->key);
/* set RSS table */ /* set RSS table */
if (indir) if (rxfh->indir)
err = enetc_set_rss_table(priv->si, indir, priv->si->num_rss); err = enetc_set_rss_table(priv->si, rxfh->indir,
priv->si->num_rss);
return err; return err;
} }

View File

@ -977,44 +977,44 @@ static u32 fun_get_rxfh_key_size(struct net_device *netdev)
return sizeof(fp->rss_key); return sizeof(fp->rss_key);
} }
static int fun_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int fun_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
const struct funeth_priv *fp = netdev_priv(netdev); const struct funeth_priv *fp = netdev_priv(netdev);
if (!fp->rss_cfg) if (!fp->rss_cfg)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) if (rxfh->indir)
memcpy(indir, fp->indir_table, memcpy(rxfh->indir, fp->indir_table,
sizeof(u32) * fp->indir_table_nentries); sizeof(u32) * fp->indir_table_nentries);
if (key) if (rxfh->key)
memcpy(key, fp->rss_key, sizeof(fp->rss_key)); memcpy(rxfh->key, fp->rss_key, sizeof(fp->rss_key));
if (hfunc) rxfh->hfunc = fp->hash_algo == FUN_ETH_RSS_ALG_TOEPLITZ ?
*hfunc = fp->hash_algo == FUN_ETH_RSS_ALG_TOEPLITZ ?
ETH_RSS_HASH_TOP : ETH_RSS_HASH_CRC32; ETH_RSS_HASH_TOP : ETH_RSS_HASH_CRC32;
return 0; return 0;
} }
static int fun_set_rxfh(struct net_device *netdev, const u32 *indir, static int fun_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct funeth_priv *fp = netdev_priv(netdev); struct funeth_priv *fp = netdev_priv(netdev);
const u32 *rss_indir = indir ? indir : fp->indir_table; const u32 *rss_indir = rxfh->indir ? rxfh->indir : fp->indir_table;
const u8 *rss_key = key ? key : fp->rss_key; const u8 *rss_key = rxfh->key ? rxfh->key : fp->rss_key;
enum fun_eth_hash_alg algo; enum fun_eth_hash_alg algo;
if (!fp->rss_cfg) if (!fp->rss_cfg)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (hfunc == ETH_RSS_HASH_NO_CHANGE) if (rxfh->hfunc == ETH_RSS_HASH_NO_CHANGE)
algo = fp->hash_algo; algo = fp->hash_algo;
else if (hfunc == ETH_RSS_HASH_CRC32) else if (rxfh->hfunc == ETH_RSS_HASH_CRC32)
algo = FUN_ETH_RSS_ALG_CRC32; algo = FUN_ETH_RSS_ALG_CRC32;
else if (hfunc == ETH_RSS_HASH_TOP) else if (rxfh->hfunc == ETH_RSS_HASH_TOP)
algo = FUN_ETH_RSS_ALG_TOEPLITZ; algo = FUN_ETH_RSS_ALG_TOEPLITZ;
else else
return -EINVAL; return -EINVAL;
@ -1031,10 +1031,10 @@ static int fun_set_rxfh(struct net_device *netdev, const u32 *indir,
} }
fp->hash_algo = algo; fp->hash_algo = algo;
if (key) if (rxfh->key)
memcpy(fp->rss_key, key, sizeof(fp->rss_key)); memcpy(fp->rss_key, rxfh->key, sizeof(fp->rss_key));
if (indir) if (rxfh->indir)
memcpy(fp->indir_table, indir, memcpy(fp->indir_table, rxfh->indir,
sizeof(u32) * fp->indir_table_nentries); sizeof(u32) * fp->indir_table_nentries);
return 0; return 0;
} }

View File

@ -1186,7 +1186,7 @@ hns_get_rss_indir_size(struct net_device *netdev)
} }
static int static int
hns_get_rss(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc) hns_get_rss(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
{ {
struct hns_nic_priv *priv = netdev_priv(netdev); struct hns_nic_priv *priv = netdev_priv(netdev);
struct hnae_ae_ops *ops; struct hnae_ae_ops *ops;
@ -1199,15 +1199,16 @@ hns_get_rss(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
ops = priv->ae_handle->dev->ops; ops = priv->ae_handle->dev->ops;
if (!indir) if (!rxfh->indir)
return 0; return 0;
return ops->get_rss(priv->ae_handle, indir, key, hfunc); return ops->get_rss(priv->ae_handle,
rxfh->indir, rxfh->key, &rxfh->hfunc);
} }
static int static int
hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key, hns_set_rss(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
const u8 hfunc) struct netlink_ext_ack *extack)
{ {
struct hns_nic_priv *priv = netdev_priv(netdev); struct hns_nic_priv *priv = netdev_priv(netdev);
struct hnae_ae_ops *ops; struct hnae_ae_ops *ops;
@ -1220,12 +1221,14 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key,
ops = priv->ae_handle->dev->ops; ops = priv->ae_handle->dev->ops;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) { if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP) {
netdev_err(netdev, "Invalid hfunc!\n"); netdev_err(netdev, "Invalid hfunc!\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return ops->set_rss(priv->ae_handle, indir, key, hfunc); return ops->set_rss(priv->ae_handle,
rxfh->indir, rxfh->key, rxfh->hfunc);
} }
static int hns_get_rxnfc(struct net_device *netdev, static int hns_get_rxnfc(struct net_device *netdev,

View File

@ -941,19 +941,21 @@ static u32 hns3_get_rss_indir_size(struct net_device *netdev)
return ae_dev->dev_specs.rss_ind_tbl_size; return ae_dev->dev_specs.rss_ind_tbl_size;
} }
static int hns3_get_rss(struct net_device *netdev, u32 *indir, u8 *key, static int hns3_get_rss(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct hnae3_handle *h = hns3_get_handle(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
if (!h->ae_algo->ops->get_rss) if (!h->ae_algo->ops->get_rss)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return h->ae_algo->ops->get_rss(h, indir, key, hfunc); return h->ae_algo->ops->get_rss(h, rxfh->indir, rxfh->key,
&rxfh->hfunc);
} }
static int hns3_set_rss(struct net_device *netdev, const u32 *indir, static int hns3_set_rss(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct hnae3_handle *h = hns3_get_handle(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(h->pdev); struct hnae3_ae_dev *ae_dev = pci_get_drvdata(h->pdev);
@ -962,19 +964,22 @@ static int hns3_set_rss(struct net_device *netdev, const u32 *indir,
return -EOPNOTSUPP; return -EOPNOTSUPP;
if ((ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2 && if ((ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2 &&
hfunc != ETH_RSS_HASH_TOP) || (hfunc != ETH_RSS_HASH_NO_CHANGE && rxfh->hfunc != ETH_RSS_HASH_TOP) ||
hfunc != ETH_RSS_HASH_TOP && hfunc != ETH_RSS_HASH_XOR)) { (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP &&
rxfh->hfunc != ETH_RSS_HASH_XOR)) {
netdev_err(netdev, "hash func not supported\n"); netdev_err(netdev, "hash func not supported\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (!indir) { if (!rxfh->indir) {
netdev_err(netdev, netdev_err(netdev,
"set rss failed for indir is empty\n"); "set rss failed for indir is empty\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return h->ae_algo->ops->set_rss(h, indir, key, hfunc); return h->ae_algo->ops->set_rss(h, rxfh->indir, rxfh->key,
rxfh->hfunc);
} }
static int hns3_get_rxnfc(struct net_device *netdev, static int hns3_get_rxnfc(struct net_device *netdev,

View File

@ -1137,7 +1137,7 @@ static int hinic_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
} }
static int hinic_get_rxfh(struct net_device *netdev, static int hinic_get_rxfh(struct net_device *netdev,
u32 *indir, u8 *key, u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct hinic_dev *nic_dev = netdev_priv(netdev); struct hinic_dev *nic_dev = netdev_priv(netdev);
u8 hash_engine_type = 0; u8 hash_engine_type = 0;
@ -1146,32 +1146,33 @@ static int hinic_get_rxfh(struct net_device *netdev,
if (!(nic_dev->flags & HINIC_RSS_ENABLE)) if (!(nic_dev->flags & HINIC_RSS_ENABLE))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (hfunc) {
err = hinic_rss_get_hash_engine(nic_dev, err = hinic_rss_get_hash_engine(nic_dev,
nic_dev->rss_tmpl_idx, nic_dev->rss_tmpl_idx,
&hash_engine_type); &hash_engine_type);
if (err) if (err)
return -EFAULT; return -EFAULT;
*hfunc = hash_engine_type ? ETH_RSS_HASH_TOP : ETH_RSS_HASH_XOR; rxfh->hfunc = hash_engine_type ? ETH_RSS_HASH_TOP : ETH_RSS_HASH_XOR;
}
if (indir) { if (rxfh->indir) {
err = hinic_rss_get_indir_tbl(nic_dev, err = hinic_rss_get_indir_tbl(nic_dev,
nic_dev->rss_tmpl_idx, indir); nic_dev->rss_tmpl_idx,
rxfh->indir);
if (err) if (err)
return -EFAULT; return -EFAULT;
} }
if (key) if (rxfh->key)
err = hinic_rss_get_template_tbl(nic_dev, err = hinic_rss_get_template_tbl(nic_dev,
nic_dev->rss_tmpl_idx, key); nic_dev->rss_tmpl_idx,
rxfh->key);
return err; return err;
} }
static int hinic_set_rxfh(struct net_device *netdev, const u32 *indir, static int hinic_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct hinic_dev *nic_dev = netdev_priv(netdev); struct hinic_dev *nic_dev = netdev_priv(netdev);
int err = 0; int err = 0;
@ -1179,11 +1180,12 @@ static int hinic_set_rxfh(struct net_device *netdev, const u32 *indir,
if (!(nic_dev->flags & HINIC_RSS_ENABLE)) if (!(nic_dev->flags & HINIC_RSS_ENABLE))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (hfunc != ETH_RSS_HASH_NO_CHANGE) { if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE) {
if (hfunc != ETH_RSS_HASH_TOP && hfunc != ETH_RSS_HASH_XOR) if (rxfh->hfunc != ETH_RSS_HASH_TOP &&
rxfh->hfunc != ETH_RSS_HASH_XOR)
return -EOPNOTSUPP; return -EOPNOTSUPP;
nic_dev->rss_hash_engine = (hfunc == ETH_RSS_HASH_XOR) ? nic_dev->rss_hash_engine = (rxfh->hfunc == ETH_RSS_HASH_XOR) ?
HINIC_RSS_HASH_ENGINE_TYPE_XOR : HINIC_RSS_HASH_ENGINE_TYPE_XOR :
HINIC_RSS_HASH_ENGINE_TYPE_TOEP; HINIC_RSS_HASH_ENGINE_TYPE_TOEP;
err = hinic_rss_set_hash_engine err = hinic_rss_set_hash_engine
@ -1193,7 +1195,7 @@ static int hinic_set_rxfh(struct net_device *netdev, const u32 *indir,
return -EFAULT; return -EFAULT;
} }
err = __set_rss_rxfh(netdev, indir, key); err = __set_rss_rxfh(netdev, rxfh->indir, rxfh->key);
return err; return err;
} }

View File

@ -1057,16 +1057,16 @@ static u32 fm10k_get_rssrk_size(struct net_device __always_unused *netdev)
return FM10K_RSSRK_SIZE * FM10K_RSSRK_ENTRIES_PER_REG; return FM10K_RSSRK_SIZE * FM10K_RSSRK_ENTRIES_PER_REG;
} }
static int fm10k_get_rssh(struct net_device *netdev, u32 *indir, u8 *key, static int fm10k_get_rssh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct fm10k_intfc *interface = netdev_priv(netdev); struct fm10k_intfc *interface = netdev_priv(netdev);
u8 *key = rxfh->key;
int i, err; int i, err;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
err = fm10k_get_reta(netdev, indir); err = fm10k_get_reta(netdev, rxfh->indir);
if (err || !key) if (err || !key)
return err; return err;
@ -1076,23 +1076,25 @@ static int fm10k_get_rssh(struct net_device *netdev, u32 *indir, u8 *key,
return 0; return 0;
} }
static int fm10k_set_rssh(struct net_device *netdev, const u32 *indir, static int fm10k_set_rssh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct fm10k_intfc *interface = netdev_priv(netdev); struct fm10k_intfc *interface = netdev_priv(netdev);
struct fm10k_hw *hw = &interface->hw; struct fm10k_hw *hw = &interface->hw;
int i, err; int i, err;
/* We do not allow change in unsupported parameters */ /* We do not allow change in unsupported parameters */
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
err = fm10k_set_reta(netdev, indir); err = fm10k_set_reta(netdev, rxfh->indir);
if (err || !key) if (err || !rxfh->key)
return err; return err;
for (i = 0; i < FM10K_RSSRK_SIZE; i++, key += 4) { for (i = 0; i < FM10K_RSSRK_SIZE; i++, rxfh->key += 4) {
u32 rssrk = le32_to_cpu(*(__le32 *)key); u32 rssrk = le32_to_cpu(*(__le32 *)rxfh->key);
if (interface->rssrk[i] == rssrk) if (interface->rssrk[i] == rssrk)
continue; continue;

View File

@ -5120,15 +5120,13 @@ static u32 i40e_get_rxfh_indir_size(struct net_device *netdev)
/** /**
* i40e_get_rxfh - get the rx flow hash indirection table * i40e_get_rxfh - get the rx flow hash indirection table
* @netdev: network interface device structure * @netdev: network interface device structure
* @indir: indirection table * @rxfh: pointer to param struct (indir, key, hfunc)
* @key: hash key
* @hfunc: hash function
* *
* Reads the indirection table directly from the hardware. Returns 0 on * Reads the indirection table directly from the hardware. Returns 0 on
* success. * success.
**/ **/
static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int i40e_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_vsi *vsi = np->vsi; struct i40e_vsi *vsi = np->vsi;
@ -5136,13 +5134,12 @@ static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
int ret; int ret;
u16 i; u16 i;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
seed = key; seed = rxfh->key;
lut = kzalloc(I40E_HLUT_ARRAY_SIZE, GFP_KERNEL); lut = kzalloc(I40E_HLUT_ARRAY_SIZE, GFP_KERNEL);
if (!lut) if (!lut)
return -ENOMEM; return -ENOMEM;
@ -5150,7 +5147,7 @@ static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
if (ret) if (ret)
goto out; goto out;
for (i = 0; i < I40E_HLUT_ARRAY_SIZE; i++) for (i = 0; i < I40E_HLUT_ARRAY_SIZE; i++)
indir[i] = (u32)(lut[i]); rxfh->indir[i] = (u32)(lut[i]);
out: out:
kfree(lut); kfree(lut);
@ -5161,15 +5158,15 @@ out:
/** /**
* i40e_set_rxfh - set the rx flow hash indirection table * i40e_set_rxfh - set the rx flow hash indirection table
* @netdev: network interface device structure * @netdev: network interface device structure
* @indir: indirection table * @rxfh: pointer to param struct (indir, key, hfunc)
* @key: hash key * @extack: extended ACK from the Netlink message
* @hfunc: hash function to use
* *
* Returns -EINVAL if the table specifies an invalid queue id, otherwise * Returns -EINVAL if the table specifies an invalid queue id, otherwise
* returns 0 after programming the table. * returns 0 after programming the table.
**/ **/
static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir, static int i40e_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_vsi *vsi = np->vsi; struct i40e_vsi *vsi = np->vsi;
@ -5177,17 +5174,18 @@ static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,
u8 *seed = NULL; u8 *seed = NULL;
u16 i; u16 i;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (key) { if (rxfh->key) {
if (!vsi->rss_hkey_user) { if (!vsi->rss_hkey_user) {
vsi->rss_hkey_user = kzalloc(I40E_HKEY_ARRAY_SIZE, vsi->rss_hkey_user = kzalloc(I40E_HKEY_ARRAY_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (!vsi->rss_hkey_user) if (!vsi->rss_hkey_user)
return -ENOMEM; return -ENOMEM;
} }
memcpy(vsi->rss_hkey_user, key, I40E_HKEY_ARRAY_SIZE); memcpy(vsi->rss_hkey_user, rxfh->key, I40E_HKEY_ARRAY_SIZE);
seed = vsi->rss_hkey_user; seed = vsi->rss_hkey_user;
} }
if (!vsi->rss_lut_user) { if (!vsi->rss_lut_user) {
@ -5197,9 +5195,9 @@ static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,
} }
/* Each 32 bits pointed by 'indir' is stored with a lut entry */ /* Each 32 bits pointed by 'indir' is stored with a lut entry */
if (indir) if (rxfh->indir)
for (i = 0; i < I40E_HLUT_ARRAY_SIZE; i++) for (i = 0; i < I40E_HLUT_ARRAY_SIZE; i++)
vsi->rss_lut_user[i] = (u8)(indir[i]); vsi->rss_lut_user[i] = (u8)(rxfh->indir[i]);
else else
i40e_fill_rss_lut(pf, vsi->rss_lut_user, I40E_HLUT_ARRAY_SIZE, i40e_fill_rss_lut(pf, vsi->rss_lut_user, I40E_HLUT_ARRAY_SIZE,
vsi->rss_size); vsi->rss_size);

View File

@ -1894,27 +1894,24 @@ static u32 iavf_get_rxfh_indir_size(struct net_device *netdev)
/** /**
* iavf_get_rxfh - get the rx flow hash indirection table * iavf_get_rxfh - get the rx flow hash indirection table
* @netdev: network interface device structure * @netdev: network interface device structure
* @indir: indirection table * @rxfh: pointer to param struct (indir, key, hfunc)
* @key: hash key
* @hfunc: hash function in use
* *
* Reads the indirection table directly from the hardware. Always returns 0. * Reads the indirection table directly from the hardware. Always returns 0.
**/ **/
static int iavf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int iavf_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct iavf_adapter *adapter = netdev_priv(netdev); struct iavf_adapter *adapter = netdev_priv(netdev);
u16 i; u16 i;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (rxfh->key)
if (key) memcpy(rxfh->key, adapter->rss_key, adapter->rss_key_size);
memcpy(key, adapter->rss_key, adapter->rss_key_size);
if (indir) if (rxfh->indir)
/* Each 32 bits pointed by 'indir' is stored with a lut entry */ /* Each 32 bits pointed by 'indir' is stored with a lut entry */
for (i = 0; i < adapter->rss_lut_size; i++) for (i = 0; i < adapter->rss_lut_size; i++)
indir[i] = (u32)adapter->rss_lut[i]; rxfh->indir[i] = (u32)adapter->rss_lut[i];
return 0; return 0;
} }
@ -1922,33 +1919,34 @@ static int iavf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
/** /**
* iavf_set_rxfh - set the rx flow hash indirection table * iavf_set_rxfh - set the rx flow hash indirection table
* @netdev: network interface device structure * @netdev: network interface device structure
* @indir: indirection table * @rxfh: pointer to param struct (indir, key, hfunc)
* @key: hash key * @extack: extended ACK from the Netlink message
* @hfunc: hash function to use
* *
* Returns -EINVAL if the table specifies an invalid queue id, otherwise * Returns -EINVAL if the table specifies an invalid queue id, otherwise
* returns 0 after programming the table. * returns 0 after programming the table.
**/ **/
static int iavf_set_rxfh(struct net_device *netdev, const u32 *indir, static int iavf_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct iavf_adapter *adapter = netdev_priv(netdev); struct iavf_adapter *adapter = netdev_priv(netdev);
u16 i; u16 i;
/* Only support toeplitz hash function */ /* Only support toeplitz hash function */
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!key && !indir) if (!rxfh->key && !rxfh->indir)
return 0; return 0;
if (key) if (rxfh->key)
memcpy(adapter->rss_key, key, adapter->rss_key_size); memcpy(adapter->rss_key, rxfh->key, adapter->rss_key_size);
if (indir) { if (rxfh->indir) {
/* Each 32 bits pointed by 'indir' is stored with a lut entry */ /* Each 32 bits pointed by 'indir' is stored with a lut entry */
for (i = 0; i < adapter->rss_lut_size; i++) for (i = 0; i < adapter->rss_lut_size; i++)
adapter->rss_lut[i] = (u8)(indir[i]); adapter->rss_lut[i] = (u8)(rxfh->indir[i]);
} }
return iavf_config_rss(adapter); return iavf_config_rss(adapter);

View File

@ -3196,8 +3196,8 @@ static u32 ice_get_rxfh_indir_size(struct net_device *netdev)
} }
static int static int
ice_get_rxfh_context(struct net_device *netdev, u32 *indir, ice_get_rxfh_context(struct net_device *netdev,
u8 *key, u8 *hfunc, u32 rss_context) struct ethtool_rxfh_param *rxfh, u32 rss_context)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
@ -3230,17 +3230,16 @@ ice_get_rxfh_context(struct net_device *netdev, u32 *indir,
vsi = vsi->tc_map_vsi[rss_context]; vsi = vsi->tc_map_vsi[rss_context];
} }
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
lut = kzalloc(vsi->rss_table_size, GFP_KERNEL); lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
if (!lut) if (!lut)
return -ENOMEM; return -ENOMEM;
err = ice_get_rss_key(vsi, key); err = ice_get_rss_key(vsi, rxfh->key);
if (err) if (err)
goto out; goto out;
@ -3250,12 +3249,12 @@ ice_get_rxfh_context(struct net_device *netdev, u32 *indir,
if (ice_is_adq_active(pf)) { if (ice_is_adq_active(pf)) {
for (i = 0; i < vsi->rss_table_size; i++) for (i = 0; i < vsi->rss_table_size; i++)
indir[i] = offset + lut[i] % qcount; rxfh->indir[i] = offset + lut[i] % qcount;
goto out; goto out;
} }
for (i = 0; i < vsi->rss_table_size; i++) for (i = 0; i < vsi->rss_table_size; i++)
indir[i] = lut[i]; rxfh->indir[i] = lut[i];
out: out:
kfree(lut); kfree(lut);
@ -3265,31 +3264,28 @@ out:
/** /**
* ice_get_rxfh - get the Rx flow hash indirection table * ice_get_rxfh - get the Rx flow hash indirection table
* @netdev: network interface device structure * @netdev: network interface device structure
* @indir: indirection table * @rxfh: pointer to param struct (indir, key, hfunc)
* @key: hash key
* @hfunc: hash function
* *
* Reads the indirection table directly from the hardware. * Reads the indirection table directly from the hardware.
*/ */
static int static int
ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc) ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
{ {
return ice_get_rxfh_context(netdev, indir, key, hfunc, 0); return ice_get_rxfh_context(netdev, rxfh, 0);
} }
/** /**
* ice_set_rxfh - set the Rx flow hash indirection table * ice_set_rxfh - set the Rx flow hash indirection table
* @netdev: network interface device structure * @netdev: network interface device structure
* @indir: indirection table * @rxfh: pointer to param struct (indir, key, hfunc)
* @key: hash key * @extack: extended ACK from the Netlink message
* @hfunc: hash function
* *
* Returns -EINVAL if the table specifies an invalid queue ID, otherwise * Returns -EINVAL if the table specifies an invalid queue ID, otherwise
* returns 0 after programming the table. * returns 0 after programming the table.
*/ */
static int static int
ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
const u8 hfunc) struct netlink_ext_ack *extack)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
@ -3298,7 +3294,8 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
int err; int err;
dev = ice_pf_to_dev(pf); dev = ice_pf_to_dev(pf);
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) { if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
@ -3312,7 +3309,7 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (key) { if (rxfh->key) {
if (!vsi->rss_hkey_user) { if (!vsi->rss_hkey_user) {
vsi->rss_hkey_user = vsi->rss_hkey_user =
devm_kzalloc(dev, ICE_VSIQF_HKEY_ARRAY_SIZE, devm_kzalloc(dev, ICE_VSIQF_HKEY_ARRAY_SIZE,
@ -3320,7 +3317,8 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
if (!vsi->rss_hkey_user) if (!vsi->rss_hkey_user)
return -ENOMEM; return -ENOMEM;
} }
memcpy(vsi->rss_hkey_user, key, ICE_VSIQF_HKEY_ARRAY_SIZE); memcpy(vsi->rss_hkey_user, rxfh->key,
ICE_VSIQF_HKEY_ARRAY_SIZE);
err = ice_set_rss_key(vsi, vsi->rss_hkey_user); err = ice_set_rss_key(vsi, vsi->rss_hkey_user);
if (err) if (err)
@ -3335,11 +3333,11 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
} }
/* Each 32 bits pointed by 'indir' is stored with a lut entry */ /* Each 32 bits pointed by 'indir' is stored with a lut entry */
if (indir) { if (rxfh->indir) {
int i; int i;
for (i = 0; i < vsi->rss_table_size; i++) for (i = 0; i < vsi->rss_table_size; i++)
vsi->rss_lut_user[i] = (u8)(indir[i]); vsi->rss_lut_user[i] = (u8)(rxfh->indir[i]);
} else { } else {
ice_fill_rss_lut(vsi->rss_lut_user, vsi->rss_table_size, ice_fill_rss_lut(vsi->rss_lut_user, vsi->rss_table_size,
vsi->rss_size); vsi->rss_size);

View File

@ -75,14 +75,12 @@ static u32 idpf_get_rxfh_indir_size(struct net_device *netdev)
/** /**
* idpf_get_rxfh - get the rx flow hash indirection table * idpf_get_rxfh - get the rx flow hash indirection table
* @netdev: network interface device structure * @netdev: network interface device structure
* @indir: indirection table * @rxfh: pointer to param struct (indir, key, hfunc)
* @key: hash key
* @hfunc: hash function in use
* *
* Reads the indirection table directly from the hardware. Always returns 0. * Reads the indirection table directly from the hardware. Always returns 0.
*/ */
static int idpf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int idpf_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct idpf_netdev_priv *np = netdev_priv(netdev); struct idpf_netdev_priv *np = netdev_priv(netdev);
struct idpf_rss_data *rss_data; struct idpf_rss_data *rss_data;
@ -103,15 +101,14 @@ static int idpf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
if (np->state != __IDPF_VPORT_UP) if (np->state != __IDPF_VPORT_UP)
goto unlock_mutex; goto unlock_mutex;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (key) if (rxfh->key)
memcpy(key, rss_data->rss_key, rss_data->rss_key_size); memcpy(rxfh->key, rss_data->rss_key, rss_data->rss_key_size);
if (indir) { if (rxfh->indir) {
for (i = 0; i < rss_data->rss_lut_size; i++) for (i = 0; i < rss_data->rss_lut_size; i++)
indir[i] = rss_data->rss_lut[i]; rxfh->indir[i] = rss_data->rss_lut[i];
} }
unlock_mutex: unlock_mutex:
@ -123,15 +120,15 @@ unlock_mutex:
/** /**
* idpf_set_rxfh - set the rx flow hash indirection table * idpf_set_rxfh - set the rx flow hash indirection table
* @netdev: network interface device structure * @netdev: network interface device structure
* @indir: indirection table * @rxfh: pointer to param struct (indir, key, hfunc)
* @key: hash key * @extack: extended ACK from the Netlink message
* @hfunc: hash function to use
* *
* Returns -EINVAL if the table specifies an invalid queue id, otherwise * Returns -EINVAL if the table specifies an invalid queue id, otherwise
* returns 0 after programming the table. * returns 0 after programming the table.
*/ */
static int idpf_set_rxfh(struct net_device *netdev, const u32 *indir, static int idpf_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct idpf_netdev_priv *np = netdev_priv(netdev); struct idpf_netdev_priv *np = netdev_priv(netdev);
struct idpf_rss_data *rss_data; struct idpf_rss_data *rss_data;
@ -154,17 +151,18 @@ static int idpf_set_rxfh(struct net_device *netdev, const u32 *indir,
if (np->state != __IDPF_VPORT_UP) if (np->state != __IDPF_VPORT_UP)
goto unlock_mutex; goto unlock_mutex;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) { if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto unlock_mutex; goto unlock_mutex;
} }
if (key) if (rxfh->key)
memcpy(rss_data->rss_key, key, rss_data->rss_key_size); memcpy(rss_data->rss_key, rxfh->key, rss_data->rss_key_size);
if (indir) { if (rxfh->indir) {
for (lut = 0; lut < rss_data->rss_lut_size; lut++) for (lut = 0; lut < rss_data->rss_lut_size; lut++)
rss_data->rss_lut[lut] = indir[lut]; rss_data->rss_lut[lut] = rxfh->indir[lut];
} }
err = idpf_config_rss(vport); err = idpf_config_rss(vport);

View File

@ -3280,18 +3280,17 @@ static u32 igb_get_rxfh_indir_size(struct net_device *netdev)
return IGB_RETA_SIZE; return IGB_RETA_SIZE;
} }
static int igb_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int igb_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
int i; int i;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (!rxfh->indir)
if (!indir)
return 0; return 0;
for (i = 0; i < IGB_RETA_SIZE; i++) for (i = 0; i < IGB_RETA_SIZE; i++)
indir[i] = adapter->rss_indir_tbl[i]; rxfh->indir[i] = adapter->rss_indir_tbl[i];
return 0; return 0;
} }
@ -3331,8 +3330,9 @@ void igb_write_rss_indir_tbl(struct igb_adapter *adapter)
} }
} }
static int igb_set_rxfh(struct net_device *netdev, const u32 *indir, static int igb_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
@ -3340,10 +3340,11 @@ static int igb_set_rxfh(struct net_device *netdev, const u32 *indir,
u32 num_queues; u32 num_queues;
/* We do not allow change in unsupported parameters */ /* We do not allow change in unsupported parameters */
if (key || if (rxfh->key ||
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
num_queues = adapter->rss_queues; num_queues = adapter->rss_queues;
@ -3360,12 +3361,12 @@ static int igb_set_rxfh(struct net_device *netdev, const u32 *indir,
/* Verify user input. */ /* Verify user input. */
for (i = 0; i < IGB_RETA_SIZE; i++) for (i = 0; i < IGB_RETA_SIZE; i++)
if (indir[i] >= num_queues) if (rxfh->indir[i] >= num_queues)
return -EINVAL; return -EINVAL;
for (i = 0; i < IGB_RETA_SIZE; i++) for (i = 0; i < IGB_RETA_SIZE; i++)
adapter->rss_indir_tbl[i] = indir[i]; adapter->rss_indir_tbl[i] = rxfh->indir[i];
igb_write_rss_indir_tbl(adapter); igb_write_rss_indir_tbl(adapter);

View File

@ -1426,45 +1426,46 @@ static u32 igc_ethtool_get_rxfh_indir_size(struct net_device *netdev)
return IGC_RETA_SIZE; return IGC_RETA_SIZE;
} }
static int igc_ethtool_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int igc_ethtool_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct igc_adapter *adapter = netdev_priv(netdev); struct igc_adapter *adapter = netdev_priv(netdev);
int i; int i;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (!rxfh->indir)
if (!indir)
return 0; return 0;
for (i = 0; i < IGC_RETA_SIZE; i++) for (i = 0; i < IGC_RETA_SIZE; i++)
indir[i] = adapter->rss_indir_tbl[i]; rxfh->indir[i] = adapter->rss_indir_tbl[i];
return 0; return 0;
} }
static int igc_ethtool_set_rxfh(struct net_device *netdev, const u32 *indir, static int igc_ethtool_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct igc_adapter *adapter = netdev_priv(netdev); struct igc_adapter *adapter = netdev_priv(netdev);
u32 num_queues; u32 num_queues;
int i; int i;
/* We do not allow change in unsupported parameters */ /* We do not allow change in unsupported parameters */
if (key || if (rxfh->key ||
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
num_queues = adapter->rss_queues; num_queues = adapter->rss_queues;
/* Verify user input. */ /* Verify user input. */
for (i = 0; i < IGC_RETA_SIZE; i++) for (i = 0; i < IGC_RETA_SIZE; i++)
if (indir[i] >= num_queues) if (rxfh->indir[i] >= num_queues)
return -EINVAL; return -EINVAL;
for (i = 0; i < IGC_RETA_SIZE; i++) for (i = 0; i < IGC_RETA_SIZE; i++)
adapter->rss_indir_tbl[i] = indir[i]; adapter->rss_indir_tbl[i] = rxfh->indir[i];
igc_write_rss_indir_tbl(adapter); igc_write_rss_indir_tbl(adapter);

View File

@ -3107,35 +3107,37 @@ static void ixgbe_get_reta(struct ixgbe_adapter *adapter, u32 *indir)
indir[i] = adapter->rss_indir_tbl[i] & rss_m; indir[i] = adapter->rss_indir_tbl[i] & rss_m;
} }
static int ixgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int ixgbe_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (indir) if (rxfh->indir)
ixgbe_get_reta(adapter, indir); ixgbe_get_reta(adapter, rxfh->indir);
if (key) if (rxfh->key)
memcpy(key, adapter->rss_key, ixgbe_get_rxfh_key_size(netdev)); memcpy(rxfh->key, adapter->rss_key,
ixgbe_get_rxfh_key_size(netdev));
return 0; return 0;
} }
static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir, static int ixgbe_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
int i; int i;
u32 reta_entries = ixgbe_rss_indir_tbl_entries(adapter); u32 reta_entries = ixgbe_rss_indir_tbl_entries(adapter);
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* Fill out the redirection table */ /* Fill out the redirection table */
if (indir) { if (rxfh->indir) {
int max_queues = min_t(int, adapter->num_rx_queues, int max_queues = min_t(int, adapter->num_rx_queues,
ixgbe_rss_indir_tbl_max(adapter)); ixgbe_rss_indir_tbl_max(adapter));
@ -3146,18 +3148,19 @@ static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir,
/* Verify user input. */ /* Verify user input. */
for (i = 0; i < reta_entries; i++) for (i = 0; i < reta_entries; i++)
if (indir[i] >= max_queues) if (rxfh->indir[i] >= max_queues)
return -EINVAL; return -EINVAL;
for (i = 0; i < reta_entries; i++) for (i = 0; i < reta_entries; i++)
adapter->rss_indir_tbl[i] = indir[i]; adapter->rss_indir_tbl[i] = rxfh->indir[i];
ixgbe_store_reta(adapter); ixgbe_store_reta(adapter);
} }
/* Fill out the rss hash key */ /* Fill out the rss hash key */
if (key) { if (rxfh->key) {
memcpy(adapter->rss_key, key, ixgbe_get_rxfh_key_size(netdev)); memcpy(adapter->rss_key, rxfh->key,
ixgbe_get_rxfh_key_size(netdev));
ixgbe_store_key(adapter); ixgbe_store_key(adapter);
} }

View File

@ -897,40 +897,41 @@ static u32 ixgbevf_get_rxfh_key_size(struct net_device *netdev)
return IXGBEVF_RSS_HASH_KEY_SIZE; return IXGBEVF_RSS_HASH_KEY_SIZE;
} }
static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int ixgbevf_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct ixgbevf_adapter *adapter = netdev_priv(netdev); struct ixgbevf_adapter *adapter = netdev_priv(netdev);
int err = 0; int err = 0;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (adapter->hw.mac.type >= ixgbe_mac_X550_vf) { if (adapter->hw.mac.type >= ixgbe_mac_X550_vf) {
if (key) if (rxfh->key)
memcpy(key, adapter->rss_key, memcpy(rxfh->key, adapter->rss_key,
ixgbevf_get_rxfh_key_size(netdev)); ixgbevf_get_rxfh_key_size(netdev));
if (indir) { if (rxfh->indir) {
int i; int i;
for (i = 0; i < IXGBEVF_X550_VFRETA_SIZE; i++) for (i = 0; i < IXGBEVF_X550_VFRETA_SIZE; i++)
indir[i] = adapter->rss_indir_tbl[i]; rxfh->indir[i] = adapter->rss_indir_tbl[i];
} }
} else { } else {
/* If neither indirection table nor hash key was requested /* If neither indirection table nor hash key was requested
* - just return a success avoiding taking any locks. * - just return a success avoiding taking any locks.
*/ */
if (!indir && !key) if (!rxfh->indir && !rxfh->key)
return 0; return 0;
spin_lock_bh(&adapter->mbx_lock); spin_lock_bh(&adapter->mbx_lock);
if (indir) if (rxfh->indir)
err = ixgbevf_get_reta_locked(&adapter->hw, indir, err = ixgbevf_get_reta_locked(&adapter->hw,
rxfh->indir,
adapter->num_rx_queues); adapter->num_rx_queues);
if (!err && key) if (!err && rxfh->key)
err = ixgbevf_get_rss_key_locked(&adapter->hw, key); err = ixgbevf_get_rss_key_locked(&adapter->hw,
rxfh->key);
spin_unlock_bh(&adapter->mbx_lock); spin_unlock_bh(&adapter->mbx_lock);
} }

View File

@ -5030,8 +5030,9 @@ static int mvneta_config_rss(struct mvneta_port *pp)
return 0; return 0;
} }
static int mvneta_ethtool_set_rxfh(struct net_device *dev, const u32 *indir, static int mvneta_ethtool_set_rxfh(struct net_device *dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct mvneta_port *pp = netdev_priv(dev); struct mvneta_port *pp = netdev_priv(dev);
@ -5042,20 +5043,21 @@ static int mvneta_ethtool_set_rxfh(struct net_device *dev, const u32 *indir,
/* We require at least one supported parameter to be changed /* We require at least one supported parameter to be changed
* and no change in any of the unsupported parameters * and no change in any of the unsupported parameters
*/ */
if (key || if (rxfh->key ||
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
memcpy(pp->indir, indir, MVNETA_RSS_LU_TABLE_SIZE); memcpy(pp->indir, rxfh->indir, MVNETA_RSS_LU_TABLE_SIZE);
return mvneta_config_rss(pp); return mvneta_config_rss(pp);
} }
static int mvneta_ethtool_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, static int mvneta_ethtool_get_rxfh(struct net_device *dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct mvneta_port *pp = netdev_priv(dev); struct mvneta_port *pp = netdev_priv(dev);
@ -5063,13 +5065,12 @@ static int mvneta_ethtool_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
if (pp->neta_armada3700) if (pp->neta_armada3700)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
memcpy(indir, pp->indir, MVNETA_RSS_LU_TABLE_SIZE); memcpy(rxfh->indir, pp->indir, MVNETA_RSS_LU_TABLE_SIZE);
return 0; return 0;
} }

View File

@ -5634,8 +5634,8 @@ static u32 mvpp2_ethtool_get_rxfh_indir_size(struct net_device *dev)
return mvpp22_rss_is_supported(port) ? MVPP22_RSS_TABLE_ENTRIES : 0; return mvpp22_rss_is_supported(port) ? MVPP22_RSS_TABLE_ENTRIES : 0;
} }
static int mvpp2_ethtool_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, static int mvpp2_ethtool_get_rxfh(struct net_device *dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct mvpp2_port *port = netdev_priv(dev); struct mvpp2_port *port = netdev_priv(dev);
int ret = 0; int ret = 0;
@ -5643,17 +5643,17 @@ static int mvpp2_ethtool_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
if (!mvpp22_rss_is_supported(port)) if (!mvpp22_rss_is_supported(port))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) if (rxfh->indir)
ret = mvpp22_port_rss_ctx_indir_get(port, 0, indir); ret = mvpp22_port_rss_ctx_indir_get(port, 0, rxfh->indir);
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_CRC32;
*hfunc = ETH_RSS_HASH_CRC32;
return ret; return ret;
} }
static int mvpp2_ethtool_set_rxfh(struct net_device *dev, const u32 *indir, static int mvpp2_ethtool_set_rxfh(struct net_device *dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct mvpp2_port *port = netdev_priv(dev); struct mvpp2_port *port = netdev_priv(dev);
int ret = 0; int ret = 0;
@ -5661,20 +5661,22 @@ static int mvpp2_ethtool_set_rxfh(struct net_device *dev, const u32 *indir,
if (!mvpp22_rss_is_supported(port)) if (!mvpp22_rss_is_supported(port))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_CRC32) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_CRC32)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (key) if (rxfh->key)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) if (rxfh->indir)
ret = mvpp22_port_rss_ctx_indir_set(port, 0, indir); ret = mvpp22_port_rss_ctx_indir_set(port, 0, rxfh->indir);
return ret; return ret;
} }
static int mvpp2_ethtool_get_rxfh_context(struct net_device *dev, u32 *indir, static int mvpp2_ethtool_get_rxfh_context(struct net_device *dev,
u8 *key, u8 *hfunc, u32 rss_context) struct ethtool_rxfh_param *rxfh,
u32 rss_context)
{ {
struct mvpp2_port *port = netdev_priv(dev); struct mvpp2_port *port = netdev_priv(dev);
int ret = 0; int ret = 0;
@ -5684,19 +5686,18 @@ static int mvpp2_ethtool_get_rxfh_context(struct net_device *dev, u32 *indir,
if (rss_context >= MVPP22_N_RSS_TABLES) if (rss_context >= MVPP22_N_RSS_TABLES)
return -EINVAL; return -EINVAL;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_CRC32;
*hfunc = ETH_RSS_HASH_CRC32;
if (indir) if (rxfh->indir)
ret = mvpp22_port_rss_ctx_indir_get(port, rss_context, indir); ret = mvpp22_port_rss_ctx_indir_get(port, rss_context,
rxfh->indir);
return ret; return ret;
} }
static int mvpp2_ethtool_set_rxfh_context(struct net_device *dev, static int mvpp2_ethtool_set_rxfh_context(struct net_device *dev,
const u32 *indir, const u8 *key, struct ethtool_rxfh_param *rxfh,
const u8 hfunc, u32 *rss_context, u32 *rss_context, bool delete)
bool delete)
{ {
struct mvpp2_port *port = netdev_priv(dev); struct mvpp2_port *port = netdev_priv(dev);
int ret; int ret;
@ -5704,10 +5705,11 @@ static int mvpp2_ethtool_set_rxfh_context(struct net_device *dev,
if (!mvpp22_rss_is_supported(port)) if (!mvpp22_rss_is_supported(port))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_CRC32) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_CRC32)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (key) if (rxfh->key)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (delete) if (delete)
@ -5719,7 +5721,7 @@ static int mvpp2_ethtool_set_rxfh_context(struct net_device *dev,
return ret; return ret;
} }
return mvpp22_port_rss_ctx_indir_set(port, *rss_context, indir); return mvpp22_port_rss_ctx_indir_set(port, *rss_context, rxfh->indir);
} }
/* Device ops */ /* Device ops */

View File

@ -836,8 +836,8 @@ static int otx2_rss_ctx_create(struct otx2_nic *pfvf,
} }
/* RSS context configuration */ /* RSS context configuration */
static int otx2_set_rxfh_context(struct net_device *dev, const u32 *indir, static int otx2_set_rxfh_context(struct net_device *dev,
const u8 *hkey, const u8 hfunc, struct ethtool_rxfh_param *rxfh,
u32 *rss_context, bool delete) u32 *rss_context, bool delete)
{ {
struct otx2_nic *pfvf = netdev_priv(dev); struct otx2_nic *pfvf = netdev_priv(dev);
@ -845,7 +845,8 @@ static int otx2_set_rxfh_context(struct net_device *dev, const u32 *indir,
struct otx2_rss_info *rss; struct otx2_rss_info *rss;
int ret, idx; int ret, idx;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (*rss_context != ETH_RXFH_CONTEXT_ALLOC && if (*rss_context != ETH_RXFH_CONTEXT_ALLOC &&
@ -859,8 +860,8 @@ static int otx2_set_rxfh_context(struct net_device *dev, const u32 *indir,
return -EIO; return -EIO;
} }
if (hkey) { if (rxfh->key) {
memcpy(rss->key, hkey, sizeof(rss->key)); memcpy(rss->key, rxfh->key, sizeof(rss->key));
otx2_set_rss_key(pfvf); otx2_set_rss_key(pfvf);
} }
if (delete) if (delete)
@ -871,28 +872,29 @@ static int otx2_set_rxfh_context(struct net_device *dev, const u32 *indir,
if (ret) if (ret)
return ret; return ret;
} }
if (indir) { if (rxfh->indir) {
rss_ctx = rss->rss_ctx[*rss_context]; rss_ctx = rss->rss_ctx[*rss_context];
for (idx = 0; idx < rss->rss_size; idx++) for (idx = 0; idx < rss->rss_size; idx++)
rss_ctx->ind_tbl[idx] = indir[idx]; rss_ctx->ind_tbl[idx] = rxfh->indir[idx];
} }
otx2_set_rss_table(pfvf, *rss_context); otx2_set_rss_table(pfvf, *rss_context);
return 0; return 0;
} }
static int otx2_get_rxfh_context(struct net_device *dev, u32 *indir, static int otx2_get_rxfh_context(struct net_device *dev,
u8 *hkey, u8 *hfunc, u32 rss_context) struct ethtool_rxfh_param *rxfh,
u32 rss_context)
{ {
struct otx2_nic *pfvf = netdev_priv(dev); struct otx2_nic *pfvf = netdev_priv(dev);
struct otx2_rss_ctx *rss_ctx; struct otx2_rss_ctx *rss_ctx;
struct otx2_rss_info *rss; struct otx2_rss_info *rss;
u32 *indir = rxfh->indir;
int idx, rx_queues; int idx, rx_queues;
rss = &pfvf->hw.rss_info; rss = &pfvf->hw.rss_info;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (!indir) if (!indir)
return 0; return 0;
@ -914,28 +916,29 @@ static int otx2_get_rxfh_context(struct net_device *dev, u32 *indir,
for (idx = 0; idx < rss->rss_size; idx++) for (idx = 0; idx < rss->rss_size; idx++)
indir[idx] = rss_ctx->ind_tbl[idx]; indir[idx] = rss_ctx->ind_tbl[idx];
} }
if (hkey) if (rxfh->key)
memcpy(hkey, rss->key, sizeof(rss->key)); memcpy(rxfh->key, rss->key, sizeof(rss->key));
return 0; return 0;
} }
/* Get RSS configuration */ /* Get RSS configuration */
static int otx2_get_rxfh(struct net_device *dev, u32 *indir, static int otx2_get_rxfh(struct net_device *dev,
u8 *hkey, u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
return otx2_get_rxfh_context(dev, indir, hkey, hfunc, return otx2_get_rxfh_context(dev, rxfh,
DEFAULT_RSS_CONTEXT_GROUP); DEFAULT_RSS_CONTEXT_GROUP);
} }
/* Configure RSS table and hash key */ /* Configure RSS table and hash key */
static int otx2_set_rxfh(struct net_device *dev, const u32 *indir, static int otx2_set_rxfh(struct net_device *dev,
const u8 *hkey, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
u32 rss_context = DEFAULT_RSS_CONTEXT_GROUP; u32 rss_context = DEFAULT_RSS_CONTEXT_GROUP;
return otx2_set_rxfh_context(dev, indir, hkey, hfunc, &rss_context, 0); return otx2_set_rxfh_context(dev, rxfh, &rss_context, 0);
} }
static u32 otx2_get_msglevel(struct net_device *netdev) static u32 otx2_get_msglevel(struct net_device *netdev)

View File

@ -1258,8 +1258,8 @@ static int mlx4_en_check_rxfh_func(struct net_device *dev, u8 hfunc)
return -EINVAL; return -EINVAL;
} }
static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key, static int mlx4_en_get_rxfh(struct net_device *dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_priv *priv = netdev_priv(dev);
u32 n = mlx4_en_get_rxfh_indir_size(dev); u32 n = mlx4_en_get_rxfh_indir_size(dev);
@ -1269,19 +1269,19 @@ static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key,
rss_rings = rounddown_pow_of_two(rss_rings); rss_rings = rounddown_pow_of_two(rss_rings);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (!ring_index) if (!rxfh->indir)
break; break;
ring_index[i] = i % rss_rings; rxfh->indir[i] = i % rss_rings;
} }
if (key) if (rxfh->key)
memcpy(key, priv->rss_key, MLX4_EN_RSS_KEY_SIZE); memcpy(rxfh->key, priv->rss_key, MLX4_EN_RSS_KEY_SIZE);
if (hfunc) rxfh->hfunc = priv->rss_hash_fn;
*hfunc = priv->rss_hash_fn;
return 0; return 0;
} }
static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index, static int mlx4_en_set_rxfh(struct net_device *dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_priv *priv = netdev_priv(dev);
u32 n = mlx4_en_get_rxfh_indir_size(dev); u32 n = mlx4_en_get_rxfh_indir_size(dev);
@ -1295,12 +1295,12 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
* between rings * between rings
*/ */
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (!ring_index) if (!rxfh->indir)
break; break;
if (i > 0 && !ring_index[i] && !rss_rings) if (i > 0 && !rxfh->indir[i] && !rss_rings)
rss_rings = i; rss_rings = i;
if (ring_index[i] != (i % (rss_rings ?: n))) if (rxfh->indir[i] != (i % (rss_rings ?: n)))
return -EINVAL; return -EINVAL;
} }
@ -1311,8 +1311,8 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
if (!is_power_of_2(rss_rings)) if (!is_power_of_2(rss_rings))
return -EINVAL; return -EINVAL;
if (hfunc != ETH_RSS_HASH_NO_CHANGE) { if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE) {
err = mlx4_en_check_rxfh_func(dev, hfunc); err = mlx4_en_check_rxfh_func(dev, rxfh->hfunc);
if (err) if (err)
return err; return err;
} }
@ -1323,12 +1323,12 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
mlx4_en_stop_port(dev, 1); mlx4_en_stop_port(dev, 1);
} }
if (ring_index) if (rxfh->indir)
priv->prof->rss_rings = rss_rings; priv->prof->rss_rings = rss_rings;
if (key) if (rxfh->key)
memcpy(priv->rss_key, key, MLX4_EN_RSS_KEY_SIZE); memcpy(priv->rss_key, rxfh->key, MLX4_EN_RSS_KEY_SIZE);
if (hfunc != ETH_RSS_HASH_NO_CHANGE) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE)
priv->rss_hash_fn = hfunc; priv->rss_hash_fn = rxfh->hfunc;
if (port_up) { if (port_up) {
err = mlx4_en_start_port(dev); err = mlx4_en_start_port(dev);

View File

@ -1175,9 +1175,9 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
struct ethtool_link_ksettings *link_ksettings); struct ethtool_link_ksettings *link_ksettings);
int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
const struct ethtool_link_ksettings *link_ksettings); const struct ethtool_link_ksettings *link_ksettings);
int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc); int mlx5e_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh);
int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, const u8 *key, int mlx5e_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
const u8 hfunc); struct netlink_ext_ack *extack);
u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv); u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv);
u32 mlx5e_ethtool_get_rxfh_indir_size(struct mlx5e_priv *priv); u32 mlx5e_ethtool_get_rxfh_indir_size(struct mlx5e_priv *priv);
int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv, int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,

View File

@ -1262,23 +1262,26 @@ static u32 mlx5e_get_rxfh_indir_size(struct net_device *netdev)
return mlx5e_ethtool_get_rxfh_indir_size(priv); return mlx5e_ethtool_get_rxfh_indir_size(priv);
} }
static int mlx5e_get_rxfh_context(struct net_device *dev, u32 *indir, static int mlx5e_get_rxfh_context(struct net_device *dev,
u8 *key, u8 *hfunc, u32 rss_context) struct ethtool_rxfh_param *rxfh,
u32 rss_context)
{ {
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
int err; int err;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
err = mlx5e_rx_res_rss_get_rxfh(priv->rx_res, rss_context, indir, key, hfunc); err = mlx5e_rx_res_rss_get_rxfh(priv->rx_res, rss_context,
rxfh->indir, rxfh->key, &rxfh->hfunc);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return err; return err;
} }
static int mlx5e_set_rxfh_context(struct net_device *dev, const u32 *indir, static int mlx5e_set_rxfh_context(struct net_device *dev,
const u8 *key, const u8 hfunc, struct ethtool_rxfh_param *rxfh,
u32 *rss_context, bool delete) u32 *rss_context, bool delete)
{ {
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
u8 hfunc = rxfh->hfunc;
int err; int err;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
@ -1295,7 +1298,8 @@ static int mlx5e_set_rxfh_context(struct net_device *dev, const u32 *indir,
goto unlock; goto unlock;
} }
err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, *rss_context, indir, key, err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, *rss_context,
rxfh->indir, rxfh->key,
hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc); hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc);
unlock: unlock:
@ -1303,20 +1307,20 @@ unlock:
return err; return err;
} }
int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, int mlx5e_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
u8 *hfunc)
{ {
return mlx5e_get_rxfh_context(netdev, indir, key, hfunc, 0); return mlx5e_get_rxfh_context(netdev, rxfh, 0);
} }
int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, int mlx5e_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
const u8 *key, const u8 hfunc) struct netlink_ext_ack *extack)
{ {
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
u8 hfunc = rxfh->hfunc;
int err; int err;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, 0, indir, key, err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, 0, rxfh->indir, rxfh->key,
hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc); hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return err; return err;

View File

@ -934,11 +934,11 @@ static u32 lan743x_ethtool_get_rxfh_indir_size(struct net_device *netdev)
} }
static int lan743x_ethtool_get_rxfh(struct net_device *netdev, static int lan743x_ethtool_get_rxfh(struct net_device *netdev,
u32 *indir, u8 *key, u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct lan743x_adapter *adapter = netdev_priv(netdev); struct lan743x_adapter *adapter = netdev_priv(netdev);
if (indir) { if (rxfh->indir) {
int dw_index; int dw_index;
int byte_index = 0; int byte_index = 0;
@ -947,17 +947,17 @@ static int lan743x_ethtool_get_rxfh(struct net_device *netdev,
lan743x_csr_read(adapter, RFE_INDX(dw_index)); lan743x_csr_read(adapter, RFE_INDX(dw_index));
byte_index = dw_index << 2; byte_index = dw_index << 2;
indir[byte_index + 0] = rxfh->indir[byte_index + 0] =
((four_entries >> 0) & 0x000000FF); ((four_entries >> 0) & 0x000000FF);
indir[byte_index + 1] = rxfh->indir[byte_index + 1] =
((four_entries >> 8) & 0x000000FF); ((four_entries >> 8) & 0x000000FF);
indir[byte_index + 2] = rxfh->indir[byte_index + 2] =
((four_entries >> 16) & 0x000000FF); ((four_entries >> 16) & 0x000000FF);
indir[byte_index + 3] = rxfh->indir[byte_index + 3] =
((four_entries >> 24) & 0x000000FF); ((four_entries >> 24) & 0x000000FF);
} }
} }
if (key) { if (rxfh->key) {
int dword_index; int dword_index;
int byte_index = 0; int byte_index = 0;
@ -967,28 +967,30 @@ static int lan743x_ethtool_get_rxfh(struct net_device *netdev,
RFE_HASH_KEY(dword_index)); RFE_HASH_KEY(dword_index));
byte_index = dword_index << 2; byte_index = dword_index << 2;
key[byte_index + 0] = rxfh->key[byte_index + 0] =
((four_entries >> 0) & 0x000000FF); ((four_entries >> 0) & 0x000000FF);
key[byte_index + 1] = rxfh->key[byte_index + 1] =
((four_entries >> 8) & 0x000000FF); ((four_entries >> 8) & 0x000000FF);
key[byte_index + 2] = rxfh->key[byte_index + 2] =
((four_entries >> 16) & 0x000000FF); ((four_entries >> 16) & 0x000000FF);
key[byte_index + 3] = rxfh->key[byte_index + 3] =
((four_entries >> 24) & 0x000000FF); ((four_entries >> 24) & 0x000000FF);
} }
} }
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
(*hfunc) = ETH_RSS_HASH_TOP;
return 0; return 0;
} }
static int lan743x_ethtool_set_rxfh(struct net_device *netdev, static int lan743x_ethtool_set_rxfh(struct net_device *netdev,
const u32 *indir, const u8 *key, struct ethtool_rxfh_param *rxfh,
const u8 hfunc) struct netlink_ext_ack *extack)
{ {
struct lan743x_adapter *adapter = netdev_priv(netdev); struct lan743x_adapter *adapter = netdev_priv(netdev);
u32 *indir = rxfh->indir;
u8 *key = rxfh->key;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) { if (indir) {

View File

@ -248,28 +248,28 @@ static u32 mana_rss_indir_size(struct net_device *ndev)
return MANA_INDIRECT_TABLE_SIZE; return MANA_INDIRECT_TABLE_SIZE;
} }
static int mana_get_rxfh(struct net_device *ndev, u32 *indir, u8 *key, static int mana_get_rxfh(struct net_device *ndev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct mana_port_context *apc = netdev_priv(ndev); struct mana_port_context *apc = netdev_priv(ndev);
int i; int i;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP; /* Toeplitz */
*hfunc = ETH_RSS_HASH_TOP; /* Toeplitz */
if (indir) { if (rxfh->indir) {
for (i = 0; i < MANA_INDIRECT_TABLE_SIZE; i++) for (i = 0; i < MANA_INDIRECT_TABLE_SIZE; i++)
indir[i] = apc->indir_table[i]; rxfh->indir[i] = apc->indir_table[i];
} }
if (key) if (rxfh->key)
memcpy(key, apc->hashkey, MANA_HASH_KEY_SIZE); memcpy(rxfh->key, apc->hashkey, MANA_HASH_KEY_SIZE);
return 0; return 0;
} }
static int mana_set_rxfh(struct net_device *ndev, const u32 *indir, static int mana_set_rxfh(struct net_device *ndev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct mana_port_context *apc = netdev_priv(ndev); struct mana_port_context *apc = netdev_priv(ndev);
bool update_hash = false, update_table = false; bool update_hash = false, update_table = false;
@ -280,25 +280,26 @@ static int mana_set_rxfh(struct net_device *ndev, const u32 *indir,
if (!apc->port_is_up) if (!apc->port_is_up)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) { if (rxfh->indir) {
for (i = 0; i < MANA_INDIRECT_TABLE_SIZE; i++) for (i = 0; i < MANA_INDIRECT_TABLE_SIZE; i++)
if (indir[i] >= apc->num_queues) if (rxfh->indir[i] >= apc->num_queues)
return -EINVAL; return -EINVAL;
update_table = true; update_table = true;
for (i = 0; i < MANA_INDIRECT_TABLE_SIZE; i++) { for (i = 0; i < MANA_INDIRECT_TABLE_SIZE; i++) {
save_table[i] = apc->indir_table[i]; save_table[i] = apc->indir_table[i];
apc->indir_table[i] = indir[i]; apc->indir_table[i] = rxfh->indir[i];
} }
} }
if (key) { if (rxfh->key) {
update_hash = true; update_hash = true;
memcpy(save_key, apc->hashkey, MANA_HASH_KEY_SIZE); memcpy(save_key, apc->hashkey, MANA_HASH_KEY_SIZE);
memcpy(apc->hashkey, key, MANA_HASH_KEY_SIZE); memcpy(apc->hashkey, rxfh->key, MANA_HASH_KEY_SIZE);
} }
err = mana_config_rss(apc, TRI_STATE_TRUE, update_hash, update_table); err = mana_config_rss(apc, TRI_STATE_TRUE, update_hash, update_table);

View File

@ -1794,8 +1794,8 @@ static u32 nfp_net_get_rxfh_key_size(struct net_device *netdev)
return nfp_net_rss_key_sz(nn); return nfp_net_rss_key_sz(nn);
} }
static int nfp_net_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int nfp_net_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct nfp_net *nn = netdev_priv(netdev); struct nfp_net *nn = netdev_priv(netdev);
int i; int i;
@ -1803,41 +1803,41 @@ static int nfp_net_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
if (!(nn->cap & NFP_NET_CFG_CTRL_RSS_ANY)) if (!(nn->cap & NFP_NET_CFG_CTRL_RSS_ANY))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) if (rxfh->indir)
for (i = 0; i < ARRAY_SIZE(nn->rss_itbl); i++) for (i = 0; i < ARRAY_SIZE(nn->rss_itbl); i++)
indir[i] = nn->rss_itbl[i]; rxfh->indir[i] = nn->rss_itbl[i];
if (key) if (rxfh->key)
memcpy(key, nn->rss_key, nfp_net_rss_key_sz(nn)); memcpy(rxfh->key, nn->rss_key, nfp_net_rss_key_sz(nn));
if (hfunc) {
*hfunc = nn->rss_hfunc; rxfh->hfunc = nn->rss_hfunc;
if (*hfunc >= 1 << ETH_RSS_HASH_FUNCS_COUNT) if (rxfh->hfunc >= 1 << ETH_RSS_HASH_FUNCS_COUNT)
*hfunc = ETH_RSS_HASH_UNKNOWN; rxfh->hfunc = ETH_RSS_HASH_UNKNOWN;
}
return 0; return 0;
} }
static int nfp_net_set_rxfh(struct net_device *netdev, static int nfp_net_set_rxfh(struct net_device *netdev,
const u32 *indir, const u8 *key, struct ethtool_rxfh_param *rxfh,
const u8 hfunc) struct netlink_ext_ack *extack)
{ {
struct nfp_net *nn = netdev_priv(netdev); struct nfp_net *nn = netdev_priv(netdev);
int i; int i;
if (!(nn->cap & NFP_NET_CFG_CTRL_RSS_ANY) || if (!(nn->cap & NFP_NET_CFG_CTRL_RSS_ANY) ||
!(hfunc == ETH_RSS_HASH_NO_CHANGE || hfunc == nn->rss_hfunc)) !(rxfh->hfunc == ETH_RSS_HASH_NO_CHANGE ||
rxfh->hfunc == nn->rss_hfunc))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!key && !indir) if (!rxfh->key && !rxfh->indir)
return 0; return 0;
if (key) { if (rxfh->key) {
memcpy(nn->rss_key, key, nfp_net_rss_key_sz(nn)); memcpy(nn->rss_key, rxfh->key, nfp_net_rss_key_sz(nn));
nfp_net_rss_write_key(nn); nfp_net_rss_write_key(nn);
} }
if (indir) { if (rxfh->indir) {
for (i = 0; i < ARRAY_SIZE(nn->rss_itbl); i++) for (i = 0; i < ARRAY_SIZE(nn->rss_itbl); i++)
nn->rss_itbl[i] = indir[i]; nn->rss_itbl[i] = rxfh->indir[i];
nfp_net_rss_write_itbl(nn); nfp_net_rss_write_itbl(nn);
} }

View File

@ -823,36 +823,38 @@ static u32 ionic_get_rxfh_key_size(struct net_device *netdev)
return IONIC_RSS_HASH_KEY_SIZE; return IONIC_RSS_HASH_KEY_SIZE;
} }
static int ionic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, static int ionic_get_rxfh(struct net_device *netdev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct ionic_lif *lif = netdev_priv(netdev); struct ionic_lif *lif = netdev_priv(netdev);
unsigned int i, tbl_sz; unsigned int i, tbl_sz;
if (indir) { if (rxfh->indir) {
tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz); tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz);
for (i = 0; i < tbl_sz; i++) for (i = 0; i < tbl_sz; i++)
indir[i] = lif->rss_ind_tbl[i]; rxfh->indir[i] = lif->rss_ind_tbl[i];
} }
if (key) if (rxfh->key)
memcpy(key, lif->rss_hash_key, IONIC_RSS_HASH_KEY_SIZE); memcpy(rxfh->key, lif->rss_hash_key, IONIC_RSS_HASH_KEY_SIZE);
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
return 0; return 0;
} }
static int ionic_set_rxfh(struct net_device *netdev, const u32 *indir, static int ionic_set_rxfh(struct net_device *netdev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct ionic_lif *lif = netdev_priv(netdev); struct ionic_lif *lif = netdev_priv(netdev);
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ionic_lif_rss_config(lif, lif->rss_types, key, indir); return ionic_lif_rss_config(lif, lif->rss_types,
rxfh->key, rxfh->indir);
} }
static int ionic_set_tunable(struct net_device *dev, static int ionic_set_tunable(struct net_device *dev,

View File

@ -1370,28 +1370,29 @@ static u32 qede_get_rxfh_key_size(struct net_device *dev)
return sizeof(edev->rss_key); return sizeof(edev->rss_key);
} }
static int qede_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, u8 *hfunc) static int qede_get_rxfh(struct net_device *dev,
struct ethtool_rxfh_param *rxfh)
{ {
struct qede_dev *edev = netdev_priv(dev); struct qede_dev *edev = netdev_priv(dev);
int i; int i;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
for (i = 0; i < QED_RSS_IND_TABLE_SIZE; i++) for (i = 0; i < QED_RSS_IND_TABLE_SIZE; i++)
indir[i] = edev->rss_ind_table[i]; rxfh->indir[i] = edev->rss_ind_table[i];
if (key) if (rxfh->key)
memcpy(key, edev->rss_key, qede_get_rxfh_key_size(dev)); memcpy(rxfh->key, edev->rss_key, qede_get_rxfh_key_size(dev));
return 0; return 0;
} }
static int qede_set_rxfh(struct net_device *dev, const u32 *indir, static int qede_set_rxfh(struct net_device *dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct qed_update_vport_params *vport_update_params; struct qed_update_vport_params *vport_update_params;
struct qede_dev *edev = netdev_priv(dev); struct qede_dev *edev = netdev_priv(dev);
@ -1403,20 +1404,21 @@ static int qede_set_rxfh(struct net_device *dev, const u32 *indir,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir && !key) if (!rxfh->indir && !rxfh->key)
return 0; return 0;
if (indir) { if (rxfh->indir) {
for (i = 0; i < QED_RSS_IND_TABLE_SIZE; i++) for (i = 0; i < QED_RSS_IND_TABLE_SIZE; i++)
edev->rss_ind_table[i] = indir[i]; edev->rss_ind_table[i] = rxfh->indir[i];
edev->rss_params_inited |= QEDE_RSS_INDIR_INITED; edev->rss_params_inited |= QEDE_RSS_INDIR_INITED;
} }
if (key) { if (rxfh->key) {
memcpy(&edev->rss_key, key, qede_get_rxfh_key_size(dev)); memcpy(&edev->rss_key, rxfh->key, qede_get_rxfh_key_size(dev));
edev->rss_params_inited |= QEDE_RSS_KEY_INITED; edev->rss_params_inited |= QEDE_RSS_KEY_INITED;
} }

View File

@ -1163,8 +1163,8 @@ u32 efx_ethtool_get_rxfh_key_size(struct net_device *net_dev)
return efx->type->rx_hash_key_size; return efx->type->rx_hash_key_size;
} }
int efx_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, int efx_ethtool_get_rxfh(struct net_device *net_dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct efx_nic *efx = efx_netdev_priv(net_dev); struct efx_nic *efx = efx_netdev_priv(net_dev);
int rc; int rc;
@ -1173,24 +1173,27 @@ int efx_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key,
if (rc) if (rc)
return rc; return rc;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (rxfh->indir)
if (indir) memcpy(rxfh->indir, efx->rss_context.rx_indir_table,
memcpy(indir, efx->rss_context.rx_indir_table,
sizeof(efx->rss_context.rx_indir_table)); sizeof(efx->rss_context.rx_indir_table));
if (key) if (rxfh->key)
memcpy(key, efx->rss_context.rx_hash_key, memcpy(rxfh->key, efx->rss_context.rx_hash_key,
efx->type->rx_hash_key_size); efx->type->rx_hash_key_size);
return 0; return 0;
} }
int efx_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir, int efx_ethtool_set_rxfh(struct net_device *net_dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct efx_nic *efx = efx_netdev_priv(net_dev); struct efx_nic *efx = efx_netdev_priv(net_dev);
u32 *indir = rxfh->indir;
u8 *key = rxfh->key;
/* Hash function is Toeplitz, cannot be changed */ /* Hash function is Toeplitz, cannot be changed */
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir && !key) if (!indir && !key)
return 0; return 0;
@ -1203,8 +1206,9 @@ int efx_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir,
return efx->type->rx_push_rss_config(efx, true, indir, key); return efx->type->rx_push_rss_config(efx, true, indir, key);
} }
int efx_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, int efx_ethtool_get_rxfh_context(struct net_device *net_dev,
u8 *key, u8 *hfunc, u32 rss_context) struct ethtool_rxfh_param *rxfh,
u32 rss_context)
{ {
struct efx_nic *efx = efx_netdev_priv(net_dev); struct efx_nic *efx = efx_netdev_priv(net_dev);
struct efx_rss_context *ctx; struct efx_rss_context *ctx;
@ -1223,31 +1227,34 @@ int efx_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir,
if (rc) if (rc)
goto out_unlock; goto out_unlock;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (rxfh->indir)
if (indir) memcpy(rxfh->indir, ctx->rx_indir_table,
memcpy(indir, ctx->rx_indir_table, sizeof(ctx->rx_indir_table)); sizeof(ctx->rx_indir_table));
if (key) if (rxfh->key)
memcpy(key, ctx->rx_hash_key, efx->type->rx_hash_key_size); memcpy(rxfh->key, ctx->rx_hash_key,
efx->type->rx_hash_key_size);
out_unlock: out_unlock:
mutex_unlock(&efx->rss_lock); mutex_unlock(&efx->rss_lock);
return rc; return rc;
} }
int efx_ethtool_set_rxfh_context(struct net_device *net_dev, int efx_ethtool_set_rxfh_context(struct net_device *net_dev,
const u32 *indir, const u8 *key, struct ethtool_rxfh_param *rxfh,
const u8 hfunc, u32 *rss_context, u32 *rss_context, bool delete)
bool delete)
{ {
struct efx_nic *efx = efx_netdev_priv(net_dev); struct efx_nic *efx = efx_netdev_priv(net_dev);
struct efx_rss_context *ctx; struct efx_rss_context *ctx;
u32 *indir = rxfh->indir;
bool allocated = false; bool allocated = false;
u8 *key = rxfh->key;
int rc; int rc;
if (!efx->type->rx_push_rss_context_config) if (!efx->type->rx_push_rss_context_config)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* Hash function is Toeplitz, cannot be changed */ /* Hash function is Toeplitz, cannot be changed */
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
mutex_lock(&efx->rss_lock); mutex_lock(&efx->rss_lock);

View File

@ -44,16 +44,17 @@ int efx_ethtool_set_rxnfc(struct net_device *net_dev,
struct ethtool_rxnfc *info); struct ethtool_rxnfc *info);
u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev); u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev);
u32 efx_ethtool_get_rxfh_key_size(struct net_device *net_dev); u32 efx_ethtool_get_rxfh_key_size(struct net_device *net_dev);
int efx_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, int efx_ethtool_get_rxfh(struct net_device *net_dev,
u8 *hfunc); struct ethtool_rxfh_param *rxfh);
int efx_ethtool_set_rxfh(struct net_device *net_dev, int efx_ethtool_set_rxfh(struct net_device *net_dev,
const u32 *indir, const u8 *key, const u8 hfunc); struct ethtool_rxfh_param *rxfh,
int efx_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, struct netlink_ext_ack *extack);
u8 *key, u8 *hfunc, u32 rss_context); int efx_ethtool_get_rxfh_context(struct net_device *net_dev,
struct ethtool_rxfh_param *rxfh,
u32 rss_context);
int efx_ethtool_set_rxfh_context(struct net_device *net_dev, int efx_ethtool_set_rxfh_context(struct net_device *net_dev,
const u32 *indir, const u8 *key, struct ethtool_rxfh_param *rxfh,
const u8 hfunc, u32 *rss_context, u32 *rss_context, bool delete);
bool delete);
int efx_ethtool_reset(struct net_device *net_dev, u32 *flags); int efx_ethtool_reset(struct net_device *net_dev, u32 *flags);
int efx_ethtool_get_module_eeprom(struct net_device *net_dev, int efx_ethtool_get_module_eeprom(struct net_device *net_dev,
struct ethtool_eeprom *ee, struct ethtool_eeprom *ee,

View File

@ -1257,31 +1257,33 @@ static u32 ef4_ethtool_get_rxfh_indir_size(struct net_device *net_dev)
0 : ARRAY_SIZE(efx->rx_indir_table)); 0 : ARRAY_SIZE(efx->rx_indir_table));
} }
static int ef4_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, static int ef4_ethtool_get_rxfh(struct net_device *net_dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct ef4_nic *efx = netdev_priv(net_dev); struct ef4_nic *efx = netdev_priv(net_dev);
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (rxfh->indir)
if (indir) memcpy(rxfh->indir, efx->rx_indir_table,
memcpy(indir, efx->rx_indir_table, sizeof(efx->rx_indir_table)); sizeof(efx->rx_indir_table));
return 0; return 0;
} }
static int ef4_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir, static int ef4_ethtool_set_rxfh(struct net_device *net_dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct ef4_nic *efx = netdev_priv(net_dev); struct ef4_nic *efx = netdev_priv(net_dev);
/* We do not allow change in unsupported parameters */ /* We do not allow change in unsupported parameters */
if (key || if (rxfh->key ||
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir) if (!rxfh->indir)
return 0; return 0;
return efx->type->rx_push_rss_config(efx, true, indir); return efx->type->rx_push_rss_config(efx, true, rxfh->indir);
} }
static int ef4_ethtool_get_module_eeprom(struct net_device *net_dev, static int ef4_ethtool_get_module_eeprom(struct net_device *net_dev,

View File

@ -1164,8 +1164,8 @@ u32 efx_siena_ethtool_get_rxfh_key_size(struct net_device *net_dev)
return efx->type->rx_hash_key_size; return efx->type->rx_hash_key_size;
} }
int efx_siena_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, int efx_siena_ethtool_get_rxfh(struct net_device *net_dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
int rc; int rc;
@ -1174,24 +1174,27 @@ int efx_siena_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key,
if (rc) if (rc)
return rc; return rc;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (rxfh->indir)
if (indir) memcpy(rxfh->indir, efx->rss_context.rx_indir_table,
memcpy(indir, efx->rss_context.rx_indir_table,
sizeof(efx->rss_context.rx_indir_table)); sizeof(efx->rss_context.rx_indir_table));
if (key) if (rxfh->key)
memcpy(key, efx->rss_context.rx_hash_key, memcpy(rxfh->key, efx->rss_context.rx_hash_key,
efx->type->rx_hash_key_size); efx->type->rx_hash_key_size);
return 0; return 0;
} }
int efx_siena_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir, int efx_siena_ethtool_set_rxfh(struct net_device *net_dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
u32 *indir = rxfh->indir;
u8 *key = rxfh->key;
/* Hash function is Toeplitz, cannot be changed */ /* Hash function is Toeplitz, cannot be changed */
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir && !key) if (!indir && !key)
return 0; return 0;
@ -1204,8 +1207,9 @@ int efx_siena_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir,
return efx->type->rx_push_rss_config(efx, true, indir, key); return efx->type->rx_push_rss_config(efx, true, indir, key);
} }
int efx_siena_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, int efx_siena_ethtool_get_rxfh_context(struct net_device *net_dev,
u8 *key, u8 *hfunc, u32 rss_context) struct ethtool_rxfh_param *rxfh,
u32 rss_context)
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
struct efx_rss_context *ctx; struct efx_rss_context *ctx;
@ -1224,31 +1228,34 @@ int efx_siena_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir,
if (rc) if (rc)
goto out_unlock; goto out_unlock;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (rxfh->indir)
if (indir) memcpy(rxfh->indir, ctx->rx_indir_table,
memcpy(indir, ctx->rx_indir_table, sizeof(ctx->rx_indir_table)); sizeof(ctx->rx_indir_table));
if (key) if (rxfh->key)
memcpy(key, ctx->rx_hash_key, efx->type->rx_hash_key_size); memcpy(rxfh->key, ctx->rx_hash_key,
efx->type->rx_hash_key_size);
out_unlock: out_unlock:
mutex_unlock(&efx->rss_lock); mutex_unlock(&efx->rss_lock);
return rc; return rc;
} }
int efx_siena_ethtool_set_rxfh_context(struct net_device *net_dev, int efx_siena_ethtool_set_rxfh_context(struct net_device *net_dev,
const u32 *indir, const u8 *key, struct ethtool_rxfh_param *rxfh,
const u8 hfunc, u32 *rss_context, u32 *rss_context, bool delete)
bool delete)
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
struct efx_rss_context *ctx; struct efx_rss_context *ctx;
u32 *indir = rxfh->indir;
bool allocated = false; bool allocated = false;
u8 *key = rxfh->key;
int rc; int rc;
if (!efx->type->rx_push_rss_context_config) if (!efx->type->rx_push_rss_context_config)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* Hash function is Toeplitz, cannot be changed */ /* Hash function is Toeplitz, cannot be changed */
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
mutex_lock(&efx->rss_lock); mutex_lock(&efx->rss_lock);

View File

@ -41,16 +41,17 @@ int efx_siena_ethtool_set_rxnfc(struct net_device *net_dev,
struct ethtool_rxnfc *info); struct ethtool_rxnfc *info);
u32 efx_siena_ethtool_get_rxfh_indir_size(struct net_device *net_dev); u32 efx_siena_ethtool_get_rxfh_indir_size(struct net_device *net_dev);
u32 efx_siena_ethtool_get_rxfh_key_size(struct net_device *net_dev); u32 efx_siena_ethtool_get_rxfh_key_size(struct net_device *net_dev);
int efx_siena_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, int efx_siena_ethtool_get_rxfh(struct net_device *net_dev,
u8 *hfunc); struct ethtool_rxfh_param *rxfh);
int efx_siena_ethtool_set_rxfh(struct net_device *net_dev, int efx_siena_ethtool_set_rxfh(struct net_device *net_dev,
const u32 *indir, const u8 *key, const u8 hfunc); struct ethtool_rxfh_param *rxfh,
int efx_siena_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, struct netlink_ext_ack *extack);
u8 *key, u8 *hfunc, u32 rss_context); int efx_siena_ethtool_get_rxfh_context(struct net_device *net_dev,
struct ethtool_rxfh_param *rxfh,
u32 rss_context);
int efx_siena_ethtool_set_rxfh_context(struct net_device *net_dev, int efx_siena_ethtool_set_rxfh_context(struct net_device *net_dev,
const u32 *indir, const u8 *key, struct ethtool_rxfh_param *rxfh,
const u8 hfunc, u32 *rss_context, u32 *rss_context, bool delete);
bool delete);
int efx_siena_ethtool_reset(struct net_device *net_dev, u32 *flags); int efx_siena_ethtool_reset(struct net_device *net_dev, u32 *flags);
int efx_siena_ethtool_get_module_eeprom(struct net_device *net_dev, int efx_siena_ethtool_get_module_eeprom(struct net_device *net_dev,
struct ethtool_eeprom *ee, struct ethtool_eeprom *ee,

View File

@ -1087,41 +1087,42 @@ static u32 stmmac_get_rxfh_indir_size(struct net_device *dev)
return ARRAY_SIZE(priv->rss.table); return ARRAY_SIZE(priv->rss.table);
} }
static int stmmac_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, static int stmmac_get_rxfh(struct net_device *dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
int i; int i;
if (indir) { if (rxfh->indir) {
for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++) for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
indir[i] = priv->rss.table[i]; rxfh->indir[i] = priv->rss.table[i];
} }
if (key) if (rxfh->key)
memcpy(key, priv->rss.key, sizeof(priv->rss.key)); memcpy(rxfh->key, priv->rss.key, sizeof(priv->rss.key));
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
return 0; return 0;
} }
static int stmmac_set_rxfh(struct net_device *dev, const u32 *indir, static int stmmac_set_rxfh(struct net_device *dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
int i; int i;
if ((hfunc != ETH_RSS_HASH_NO_CHANGE) && (hfunc != ETH_RSS_HASH_TOP)) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) { if (rxfh->indir) {
for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++) for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
priv->rss.table[i] = indir[i]; priv->rss.table[i] = rxfh->indir[i];
} }
if (key) if (rxfh->key)
memcpy(priv->rss.key, key, sizeof(priv->rss.key)); memcpy(priv->rss.key, rxfh->key, sizeof(priv->rss.key));
return stmmac_rss_configure(priv, priv->hw, &priv->rss, return stmmac_rss_configure(priv, priv->hw, &priv->rss,
priv->plat->rx_queues_to_use); priv->plat->rx_queues_to_use);

View File

@ -1752,8 +1752,8 @@ static u32 netvsc_rss_indir_size(struct net_device *dev)
return ndc->rx_table_sz; return ndc->rx_table_sz;
} }
static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, static int netvsc_get_rxfh(struct net_device *dev,
u8 *hfunc) struct ethtool_rxfh_param *rxfh)
{ {
struct net_device_context *ndc = netdev_priv(dev); struct net_device_context *ndc = netdev_priv(dev);
struct netvsc_device *ndev = rtnl_dereference(ndc->nvdev); struct netvsc_device *ndev = rtnl_dereference(ndc->nvdev);
@ -1763,47 +1763,49 @@ static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
if (!ndev) if (!ndev)
return -ENODEV; return -ENODEV;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP; /* Toeplitz */
*hfunc = ETH_RSS_HASH_TOP; /* Toeplitz */
rndis_dev = ndev->extension; rndis_dev = ndev->extension;
if (indir) { if (rxfh->indir) {
for (i = 0; i < ndc->rx_table_sz; i++) for (i = 0; i < ndc->rx_table_sz; i++)
indir[i] = ndc->rx_table[i]; rxfh->indir[i] = ndc->rx_table[i];
} }
if (key) if (rxfh->key)
memcpy(key, rndis_dev->rss_key, NETVSC_HASH_KEYLEN); memcpy(rxfh->key, rndis_dev->rss_key, NETVSC_HASH_KEYLEN);
return 0; return 0;
} }
static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir, static int netvsc_set_rxfh(struct net_device *dev,
const u8 *key, const u8 hfunc) struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct net_device_context *ndc = netdev_priv(dev); struct net_device_context *ndc = netdev_priv(dev);
struct netvsc_device *ndev = rtnl_dereference(ndc->nvdev); struct netvsc_device *ndev = rtnl_dereference(ndc->nvdev);
struct rndis_device *rndis_dev; struct rndis_device *rndis_dev;
u8 *key = rxfh->key;
int i; int i;
if (!ndev) if (!ndev)
return -ENODEV; return -ENODEV;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
rndis_dev = ndev->extension; rndis_dev = ndev->extension;
if (indir) { if (rxfh->indir) {
for (i = 0; i < ndc->rx_table_sz; i++) for (i = 0; i < ndc->rx_table_sz; i++)
if (indir[i] >= ndev->num_chn) if (rxfh->indir[i] >= ndev->num_chn)
return -EINVAL; return -EINVAL;
for (i = 0; i < ndc->rx_table_sz; i++) for (i = 0; i < ndc->rx_table_sz; i++)
ndc->rx_table[i] = indir[i]; ndc->rx_table[i] = rxfh->indir[i];
} }
if (!key) { if (!key) {
if (!indir) if (!rxfh->indir)
return 0; return 0;
key = rndis_dev->rss_key; key = rndis_dev->rss_key;

View File

@ -3731,39 +3731,42 @@ static u32 virtnet_get_rxfh_indir_size(struct net_device *dev)
return ((struct virtnet_info *)netdev_priv(dev))->rss_indir_table_size; return ((struct virtnet_info *)netdev_priv(dev))->rss_indir_table_size;
} }
static int virtnet_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, u8 *hfunc) static int virtnet_get_rxfh(struct net_device *dev,
struct ethtool_rxfh_param *rxfh)
{ {
struct virtnet_info *vi = netdev_priv(dev); struct virtnet_info *vi = netdev_priv(dev);
int i; int i;
if (indir) { if (rxfh->indir) {
for (i = 0; i < vi->rss_indir_table_size; ++i) for (i = 0; i < vi->rss_indir_table_size; ++i)
indir[i] = vi->ctrl->rss.indirection_table[i]; rxfh->indir[i] = vi->ctrl->rss.indirection_table[i];
} }
if (key) if (rxfh->key)
memcpy(key, vi->ctrl->rss.key, vi->rss_key_size); memcpy(rxfh->key, vi->ctrl->rss.key, vi->rss_key_size);
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP;
return 0; return 0;
} }
static int virtnet_set_rxfh(struct net_device *dev, const u32 *indir, const u8 *key, const u8 hfunc) static int virtnet_set_rxfh(struct net_device *dev,
struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ {
struct virtnet_info *vi = netdev_priv(dev); struct virtnet_info *vi = netdev_priv(dev);
int i; int i;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (indir) { if (rxfh->indir) {
for (i = 0; i < vi->rss_indir_table_size; ++i) for (i = 0; i < vi->rss_indir_table_size; ++i)
vi->ctrl->rss.indirection_table[i] = indir[i]; vi->ctrl->rss.indirection_table[i] = rxfh->indir[i];
} }
if (key) if (rxfh->key)
memcpy(vi->ctrl->rss.key, key, vi->rss_key_size); memcpy(vi->ctrl->rss.key, rxfh->key, vi->rss_key_size);
virtnet_commit_rss_command(vi); virtnet_commit_rss_command(vi);

View File

@ -1136,27 +1136,26 @@ vmxnet3_get_rss_indir_size(struct net_device *netdev)
} }
static int static int
vmxnet3_get_rss(struct net_device *netdev, u32 *p, u8 *key, u8 *hfunc) vmxnet3_get_rss(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
{ {
struct vmxnet3_adapter *adapter = netdev_priv(netdev); struct vmxnet3_adapter *adapter = netdev_priv(netdev);
struct UPT1_RSSConf *rssConf = adapter->rss_conf; struct UPT1_RSSConf *rssConf = adapter->rss_conf;
unsigned int n = rssConf->indTableSize; unsigned int n = rssConf->indTableSize;
if (hfunc) rxfh->hfunc = ETH_RSS_HASH_TOP;
*hfunc = ETH_RSS_HASH_TOP; if (!rxfh->indir)
if (!p)
return 0; return 0;
if (n > UPT1_RSS_MAX_IND_TABLE_SIZE) if (n > UPT1_RSS_MAX_IND_TABLE_SIZE)
return 0; return 0;
while (n--) while (n--)
p[n] = rssConf->indTable[n]; rxfh->indir[n] = rssConf->indTable[n];
return 0; return 0;
} }
static int static int
vmxnet3_set_rss(struct net_device *netdev, const u32 *p, const u8 *key, vmxnet3_set_rss(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
const u8 hfunc) struct netlink_ext_ack *extack)
{ {
unsigned int i; unsigned int i;
unsigned long flags; unsigned long flags;
@ -1164,13 +1163,14 @@ vmxnet3_set_rss(struct net_device *netdev, const u32 *p, const u8 *key,
struct UPT1_RSSConf *rssConf = adapter->rss_conf; struct UPT1_RSSConf *rssConf = adapter->rss_conf;
/* We do not allow change in unsupported parameters */ /* We do not allow change in unsupported parameters */
if (key || if (rxfh->key ||
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!p) if (!rxfh->indir)
return 0; return 0;
for (i = 0; i < rssConf->indTableSize; i++) for (i = 0; i < rssConf->indTableSize; i++)
rssConf->indTable[i] = p[i]; rssConf->indTable[i] = rxfh->indir[i];
spin_lock_irqsave(&adapter->cmd_lock, flags); spin_lock_irqsave(&adapter->cmd_lock, flags);
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,

View File

@ -596,6 +596,28 @@ struct ethtool_mm_stats {
u64 MACMergeHoldCount; u64 MACMergeHoldCount;
}; };
/**
* struct ethtool_rxfh_param - RXFH (RSS) parameters
* @hfunc: Defines the current RSS hash function used by HW (or to be set to).
* Valid values are one of the %ETH_RSS_HASH_*.
* @indir_size: On SET, the array size of the user buffer for the
* indirection table, which may be zero, or
* %ETH_RXFH_INDIR_NO_CHANGE. On GET (read from the driver),
* the array size of the hardware indirection table.
* @indir: The indirection table of size @indir_size entries.
* @key_size: On SET, the array size of the user buffer for the hash key,
* which may be zero. On GET (read from the driver), the size of the
* hardware hash key.
* @key: The hash key of size @key_size bytes.
*/
struct ethtool_rxfh_param {
u8 hfunc;
u32 indir_size;
u32 *indir;
u32 key_size;
u8 *key;
};
/** /**
* struct ethtool_ops - optional netdev operations * struct ethtool_ops - optional netdev operations
* @cap_link_lanes_supported: indicates if the driver supports lanes * @cap_link_lanes_supported: indicates if the driver supports lanes
@ -846,14 +868,14 @@ struct ethtool_ops {
int (*reset)(struct net_device *, u32 *); int (*reset)(struct net_device *, u32 *);
u32 (*get_rxfh_key_size)(struct net_device *); u32 (*get_rxfh_key_size)(struct net_device *);
u32 (*get_rxfh_indir_size)(struct net_device *); u32 (*get_rxfh_indir_size)(struct net_device *);
int (*get_rxfh)(struct net_device *, u32 *indir, u8 *key, int (*get_rxfh)(struct net_device *, struct ethtool_rxfh_param *);
u8 *hfunc); int (*set_rxfh)(struct net_device *, struct ethtool_rxfh_param *,
int (*set_rxfh)(struct net_device *, const u32 *indir, struct netlink_ext_ack *extack);
const u8 *key, const u8 hfunc); int (*get_rxfh_context)(struct net_device *,
int (*get_rxfh_context)(struct net_device *, u32 *indir, u8 *key, struct ethtool_rxfh_param *,
u8 *hfunc, u32 rss_context); u32 rss_context);
int (*set_rxfh_context)(struct net_device *, const u32 *indir, int (*set_rxfh_context)(struct net_device *,
const u8 *key, const u8 hfunc, struct ethtool_rxfh_param *,
u32 *rss_context, bool delete); u32 *rss_context, bool delete);
void (*get_channels)(struct net_device *, struct ethtool_channels *); void (*get_channels)(struct net_device *, struct ethtool_channels *);
int (*set_channels)(struct net_device *, struct ethtool_channels *); int (*set_channels)(struct net_device *, struct ethtool_channels *);

View File

@ -589,8 +589,8 @@ err_free_info:
int ethtool_get_max_rxfh_channel(struct net_device *dev, u32 *max) int ethtool_get_max_rxfh_channel(struct net_device *dev, u32 *max)
{ {
struct ethtool_rxfh_param rxfh = {};
u32 dev_size, current_max = 0; u32 dev_size, current_max = 0;
u32 *indir;
int ret; int ret;
if (!dev->ethtool_ops->get_rxfh_indir_size || if (!dev->ethtool_ops->get_rxfh_indir_size ||
@ -600,21 +600,21 @@ int ethtool_get_max_rxfh_channel(struct net_device *dev, u32 *max)
if (dev_size == 0) if (dev_size == 0)
return -EOPNOTSUPP; return -EOPNOTSUPP;
indir = kcalloc(dev_size, sizeof(indir[0]), GFP_USER); rxfh.indir = kcalloc(dev_size, sizeof(rxfh.indir[0]), GFP_USER);
if (!indir) if (!rxfh.indir)
return -ENOMEM; return -ENOMEM;
ret = dev->ethtool_ops->get_rxfh(dev, indir, NULL, NULL); ret = dev->ethtool_ops->get_rxfh(dev, &rxfh);
if (ret) if (ret)
goto out; goto out;
while (dev_size--) while (dev_size--)
current_max = max(current_max, indir[dev_size]); current_max = max(current_max, rxfh.indir[dev_size]);
*max = current_max; *max = current_max;
out: out:
kfree(indir); kfree(rxfh.indir);
return ret; return ret;
} }

View File

@ -1061,15 +1061,15 @@ EXPORT_SYMBOL(netdev_rss_key_fill);
static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev, static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev,
void __user *useraddr) void __user *useraddr)
{ {
u32 user_size, dev_size; struct ethtool_rxfh_param rxfh = {};
u32 *indir; u32 user_size;
int ret; int ret;
if (!dev->ethtool_ops->get_rxfh_indir_size || if (!dev->ethtool_ops->get_rxfh_indir_size ||
!dev->ethtool_ops->get_rxfh) !dev->ethtool_ops->get_rxfh)
return -EOPNOTSUPP; return -EOPNOTSUPP;
dev_size = dev->ethtool_ops->get_rxfh_indir_size(dev); rxfh.indir_size = dev->ethtool_ops->get_rxfh_indir_size(dev);
if (dev_size == 0) if (rxfh.indir_size == 0)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (copy_from_user(&user_size, if (copy_from_user(&user_size,
@ -1078,41 +1078,41 @@ static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev,
return -EFAULT; return -EFAULT;
if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh_indir, size), if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh_indir, size),
&dev_size, sizeof(dev_size))) &rxfh.indir_size, sizeof(rxfh.indir_size)))
return -EFAULT; return -EFAULT;
/* If the user buffer size is 0, this is just a query for the /* If the user buffer size is 0, this is just a query for the
* device table size. Otherwise, if it's smaller than the * device table size. Otherwise, if it's smaller than the
* device table size it's an error. * device table size it's an error.
*/ */
if (user_size < dev_size) if (user_size < rxfh.indir_size)
return user_size == 0 ? 0 : -EINVAL; return user_size == 0 ? 0 : -EINVAL;
indir = kcalloc(dev_size, sizeof(indir[0]), GFP_USER); rxfh.indir = kcalloc(rxfh.indir_size, sizeof(rxfh.indir[0]), GFP_USER);
if (!indir) if (!rxfh.indir)
return -ENOMEM; return -ENOMEM;
ret = dev->ethtool_ops->get_rxfh(dev, indir, NULL, NULL); ret = dev->ethtool_ops->get_rxfh(dev, &rxfh);
if (ret) if (ret)
goto out; goto out;
if (copy_to_user(useraddr + if (copy_to_user(useraddr +
offsetof(struct ethtool_rxfh_indir, ring_index[0]), offsetof(struct ethtool_rxfh_indir, ring_index[0]),
indir, dev_size * sizeof(indir[0]))) rxfh.indir, rxfh.indir_size * sizeof(*rxfh.indir)))
ret = -EFAULT; ret = -EFAULT;
out: out:
kfree(indir); kfree(rxfh.indir);
return ret; return ret;
} }
static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev, static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev,
void __user *useraddr) void __user *useraddr)
{ {
struct ethtool_rxnfc rx_rings;
u32 user_size, dev_size, i;
u32 *indir;
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
struct ethtool_rxfh_param rxfh_dev = {};
struct netlink_ext_ack *extack = NULL;
struct ethtool_rxnfc rx_rings;
u32 user_size, i;
int ret; int ret;
u32 ringidx_offset = offsetof(struct ethtool_rxfh_indir, ring_index[0]); u32 ringidx_offset = offsetof(struct ethtool_rxfh_indir, ring_index[0]);
@ -1120,8 +1120,8 @@ static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev,
!ops->get_rxnfc) !ops->get_rxnfc)
return -EOPNOTSUPP; return -EOPNOTSUPP;
dev_size = ops->get_rxfh_indir_size(dev); rxfh_dev.indir_size = ops->get_rxfh_indir_size(dev);
if (dev_size == 0) if (rxfh_dev.indir_size == 0)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (copy_from_user(&user_size, if (copy_from_user(&user_size,
@ -1129,11 +1129,12 @@ static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev,
sizeof(user_size))) sizeof(user_size)))
return -EFAULT; return -EFAULT;
if (user_size != 0 && user_size != dev_size) if (user_size != 0 && user_size != rxfh_dev.indir_size)
return -EINVAL; return -EINVAL;
indir = kcalloc(dev_size, sizeof(indir[0]), GFP_USER); rxfh_dev.indir = kcalloc(rxfh_dev.indir_size,
if (!indir) sizeof(rxfh_dev.indir[0]), GFP_USER);
if (!rxfh_dev.indir)
return -ENOMEM; return -ENOMEM;
rx_rings.cmd = ETHTOOL_GRXRINGS; rx_rings.cmd = ETHTOOL_GRXRINGS;
@ -1142,18 +1143,21 @@ static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev,
goto out; goto out;
if (user_size == 0) { if (user_size == 0) {
for (i = 0; i < dev_size; i++) u32 *indir = rxfh_dev.indir;
for (i = 0; i < rxfh_dev.indir_size; i++)
indir[i] = ethtool_rxfh_indir_default(i, rx_rings.data); indir[i] = ethtool_rxfh_indir_default(i, rx_rings.data);
} else { } else {
ret = ethtool_copy_validate_indir(indir, ret = ethtool_copy_validate_indir(rxfh_dev.indir,
useraddr + ringidx_offset, useraddr + ringidx_offset,
&rx_rings, &rx_rings,
dev_size); rxfh_dev.indir_size);
if (ret) if (ret)
goto out; goto out;
} }
ret = ops->set_rxfh(dev, indir, NULL, ETH_RSS_HASH_NO_CHANGE); rxfh_dev.hfunc = ETH_RSS_HASH_NO_CHANGE;
ret = ops->set_rxfh(dev, &rxfh_dev, extack);
if (ret) if (ret)
goto out; goto out;
@ -1164,32 +1168,29 @@ static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev,
dev->priv_flags |= IFF_RXFH_CONFIGURED; dev->priv_flags |= IFF_RXFH_CONFIGURED;
out: out:
kfree(indir); kfree(rxfh_dev.indir);
return ret; return ret;
} }
static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev, static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev,
void __user *useraddr) void __user *useraddr)
{ {
int ret;
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
struct ethtool_rxfh_param rxfh_dev = {};
u32 user_indir_size, user_key_size; u32 user_indir_size, user_key_size;
u32 dev_indir_size = 0, dev_key_size = 0;
struct ethtool_rxfh rxfh; struct ethtool_rxfh rxfh;
u32 total_size;
u32 indir_bytes; u32 indir_bytes;
u32 *indir = NULL;
u8 dev_hfunc = 0;
u8 *hkey = NULL;
u8 *rss_config; u8 *rss_config;
u32 total_size;
int ret;
if (!ops->get_rxfh) if (!ops->get_rxfh)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (ops->get_rxfh_indir_size) if (ops->get_rxfh_indir_size)
dev_indir_size = ops->get_rxfh_indir_size(dev); rxfh_dev.indir_size = ops->get_rxfh_indir_size(dev);
if (ops->get_rxfh_key_size) if (ops->get_rxfh_key_size)
dev_key_size = ops->get_rxfh_key_size(dev); rxfh_dev.key_size = ops->get_rxfh_key_size(dev);
if (copy_from_user(&rxfh, useraddr, sizeof(rxfh))) if (copy_from_user(&rxfh, useraddr, sizeof(rxfh)))
return -EFAULT; return -EFAULT;
@ -1203,38 +1204,37 @@ static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev,
if (rxfh.rss_context && !ops->get_rxfh_context) if (rxfh.rss_context && !ops->get_rxfh_context)
return -EOPNOTSUPP; return -EOPNOTSUPP;
rxfh.indir_size = dev_indir_size; rxfh.indir_size = rxfh_dev.indir_size;
rxfh.key_size = dev_key_size; rxfh.key_size = rxfh_dev.key_size;
if (copy_to_user(useraddr, &rxfh, sizeof(rxfh))) if (copy_to_user(useraddr, &rxfh, sizeof(rxfh)))
return -EFAULT; return -EFAULT;
if ((user_indir_size && (user_indir_size != dev_indir_size)) || if ((user_indir_size && user_indir_size != rxfh_dev.indir_size) ||
(user_key_size && (user_key_size != dev_key_size))) (user_key_size && user_key_size != rxfh_dev.key_size))
return -EINVAL; return -EINVAL;
indir_bytes = user_indir_size * sizeof(indir[0]); indir_bytes = user_indir_size * sizeof(rxfh_dev.indir[0]);
total_size = indir_bytes + user_key_size; total_size = indir_bytes + user_key_size;
rss_config = kzalloc(total_size, GFP_USER); rss_config = kzalloc(total_size, GFP_USER);
if (!rss_config) if (!rss_config)
return -ENOMEM; return -ENOMEM;
if (user_indir_size) if (user_indir_size)
indir = (u32 *)rss_config; rxfh_dev.indir = (u32 *)rss_config;
if (user_key_size) if (user_key_size)
hkey = rss_config + indir_bytes; rxfh_dev.key = rss_config + indir_bytes;
if (rxfh.rss_context) if (rxfh.rss_context)
ret = dev->ethtool_ops->get_rxfh_context(dev, indir, hkey, ret = dev->ethtool_ops->get_rxfh_context(dev, &rxfh_dev,
&dev_hfunc,
rxfh.rss_context); rxfh.rss_context);
else else
ret = dev->ethtool_ops->get_rxfh(dev, indir, hkey, &dev_hfunc); ret = dev->ethtool_ops->get_rxfh(dev, &rxfh_dev);
if (ret) if (ret)
goto out; goto out;
if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, hfunc), if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, hfunc),
&dev_hfunc, sizeof(rxfh.hfunc))) { &rxfh_dev.hfunc, sizeof(rxfh.hfunc))) {
ret = -EFAULT; ret = -EFAULT;
} else if (copy_to_user(useraddr + } else if (copy_to_user(useraddr +
offsetof(struct ethtool_rxfh, rss_config[0]), offsetof(struct ethtool_rxfh, rss_config[0]),
@ -1250,16 +1250,17 @@ out:
static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
void __user *useraddr) void __user *useraddr)
{ {
int ret; u32 rss_cfg_offset = offsetof(struct ethtool_rxfh, rss_config[0]);
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
u32 dev_indir_size = 0, dev_key_size = 0, i;
struct ethtool_rxfh_param rxfh_dev = {};
struct netlink_ext_ack *extack = NULL;
struct ethtool_rxnfc rx_rings; struct ethtool_rxnfc rx_rings;
struct ethtool_rxfh rxfh; struct ethtool_rxfh rxfh;
u32 dev_indir_size = 0, dev_key_size = 0, i;
u32 *indir = NULL, indir_bytes = 0;
u8 *hkey = NULL;
u8 *rss_config;
u32 rss_cfg_offset = offsetof(struct ethtool_rxfh, rss_config[0]);
bool delete = false; bool delete = false;
u32 indir_bytes = 0;
u8 *rss_config;
int ret;
if (!ops->get_rxnfc || !ops->set_rxfh) if (!ops->get_rxnfc || !ops->set_rxfh)
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -1291,7 +1292,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
return -EINVAL; return -EINVAL;
if (rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE) if (rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE)
indir_bytes = dev_indir_size * sizeof(indir[0]); indir_bytes = dev_indir_size * sizeof(rxfh_dev.indir[0]);
rss_config = kzalloc(indir_bytes + rxfh.key_size, GFP_USER); rss_config = kzalloc(indir_bytes + rxfh.key_size, GFP_USER);
if (!rss_config) if (!rss_config)
@ -1308,8 +1309,9 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
*/ */
if (rxfh.indir_size && if (rxfh.indir_size &&
rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE) { rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE) {
indir = (u32 *)rss_config; rxfh_dev.indir = (u32 *)rss_config;
ret = ethtool_copy_validate_indir(indir, rxfh_dev.indir_size = dev_indir_size;
ret = ethtool_copy_validate_indir(rxfh_dev.indir,
useraddr + rss_cfg_offset, useraddr + rss_cfg_offset,
&rx_rings, &rx_rings,
rxfh.indir_size); rxfh.indir_size);
@ -1317,7 +1319,11 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
goto out; goto out;
} else if (rxfh.indir_size == 0) { } else if (rxfh.indir_size == 0) {
if (rxfh.rss_context == 0) { if (rxfh.rss_context == 0) {
indir = (u32 *)rss_config; u32 *indir;
rxfh_dev.indir = (u32 *)rss_config;
rxfh_dev.indir_size = dev_indir_size;
indir = rxfh_dev.indir;
for (i = 0; i < dev_indir_size; i++) for (i = 0; i < dev_indir_size; i++)
indir[i] = ethtool_rxfh_indir_default(i, rx_rings.data); indir[i] = ethtool_rxfh_indir_default(i, rx_rings.data);
} else { } else {
@ -1326,8 +1332,9 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
} }
if (rxfh.key_size) { if (rxfh.key_size) {
hkey = rss_config + indir_bytes; rxfh_dev.key_size = dev_key_size;
if (copy_from_user(hkey, rxfh_dev.key = rss_config + indir_bytes;
if (copy_from_user(rxfh_dev.key,
useraddr + rss_cfg_offset + indir_bytes, useraddr + rss_cfg_offset + indir_bytes,
rxfh.key_size)) { rxfh.key_size)) {
ret = -EFAULT; ret = -EFAULT;
@ -1335,11 +1342,14 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
} }
} }
rxfh_dev.hfunc = rxfh.hfunc;
if (rxfh.rss_context) if (rxfh.rss_context)
ret = ops->set_rxfh_context(dev, indir, hkey, rxfh.hfunc, ret = ops->set_rxfh_context(dev, &rxfh_dev,
&rxfh.rss_context, delete); &rxfh.rss_context, delete);
else else
ret = ops->set_rxfh(dev, indir, hkey, rxfh.hfunc); ret = ops->set_rxfh(dev, &rxfh_dev, extack);
if (ret) if (ret)
goto out; goto out;

View File

@ -48,9 +48,9 @@ rss_prepare_data(const struct ethnl_req_info *req_base,
struct rss_reply_data *data = RSS_REPDATA(reply_base); struct rss_reply_data *data = RSS_REPDATA(reply_base);
struct rss_req_info *request = RSS_REQINFO(req_base); struct rss_req_info *request = RSS_REQINFO(req_base);
struct net_device *dev = reply_base->dev; struct net_device *dev = reply_base->dev;
struct ethtool_rxfh_param rxfh = {};
const struct ethtool_ops *ops; const struct ethtool_ops *ops;
u32 total_size, indir_bytes; u32 total_size, indir_bytes;
u8 dev_hfunc = 0;
u8 *rss_config; u8 *rss_config;
int ret; int ret;
@ -83,21 +83,23 @@ rss_prepare_data(const struct ethnl_req_info *req_base,
if (data->indir_size) if (data->indir_size)
data->indir_table = (u32 *)rss_config; data->indir_table = (u32 *)rss_config;
if (data->hkey_size) if (data->hkey_size)
data->hkey = rss_config + indir_bytes; data->hkey = rss_config + indir_bytes;
rxfh.indir_size = data->indir_size;
rxfh.indir = data->indir_table;
rxfh.key_size = data->hkey_size;
rxfh.key = data->hkey;
if (request->rss_context) if (request->rss_context)
ret = ops->get_rxfh_context(dev, data->indir_table, data->hkey, ret = ops->get_rxfh_context(dev, &rxfh, request->rss_context);
&dev_hfunc, request->rss_context);
else else
ret = ops->get_rxfh(dev, data->indir_table, data->hkey, ret = ops->get_rxfh(dev, &rxfh);
&dev_hfunc);
if (ret) if (ret)
goto out_ops; goto out_ops;
data->hfunc = dev_hfunc; data->hfunc = rxfh.hfunc;
out_ops: out_ops:
ethnl_ops_complete(dev); ethnl_ops_complete(dev);
return ret; return ret;