i40evf: add new fields to store user configuration of RSS
This patch adds new fields to i40e_vsi to store user configured RSS config data and code to use it. Change-ID: Ic5d3db8d9df52182b560248f8cdca9c5c7546879 Signed-off-by: Helin Zhang <helin.zhang@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>hifive-unleashed-5.1
parent
90b02b4392
commit
66f9af855a
|
@ -67,6 +67,8 @@ struct i40e_vsi {
|
||||||
u16 rx_itr_setting;
|
u16 rx_itr_setting;
|
||||||
u16 tx_itr_setting;
|
u16 tx_itr_setting;
|
||||||
u16 qs_handle;
|
u16 qs_handle;
|
||||||
|
u8 *rss_hkey_user; /* User configured hash keys */
|
||||||
|
u8 *rss_lut_user; /* User configured lookup table entries */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* How many Rx Buffers do we bundle into one write to the hardware ? */
|
/* How many Rx Buffers do we bundle into one write to the hardware ? */
|
||||||
|
|
|
@ -678,9 +678,7 @@ static int i40evf_set_rxfh(struct net_device *netdev, const u32 *indir,
|
||||||
{
|
{
|
||||||
struct i40evf_adapter *adapter = netdev_priv(netdev);
|
struct i40evf_adapter *adapter = netdev_priv(netdev);
|
||||||
struct i40e_vsi *vsi = &adapter->vsi;
|
struct i40e_vsi *vsi = &adapter->vsi;
|
||||||
u8 seed_def[I40EVF_HKEY_ARRAY_SIZE];
|
u8 *seed = NULL;
|
||||||
u8 *seed = NULL, *lut;
|
|
||||||
int ret;
|
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
/* We do not allow change in unsupported parameters */
|
/* We do not allow change in unsupported parameters */
|
||||||
|
@ -691,21 +689,28 @@ static int i40evf_set_rxfh(struct net_device *netdev, const u32 *indir,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
memcpy(seed_def, key, I40EVF_HKEY_ARRAY_SIZE);
|
if (!vsi->rss_hkey_user) {
|
||||||
seed = seed_def;
|
vsi->rss_hkey_user = kzalloc(I40EVF_HKEY_ARRAY_SIZE,
|
||||||
|
GFP_KERNEL);
|
||||||
|
if (!vsi->rss_hkey_user)
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
memcpy(vsi->rss_hkey_user, key, I40EVF_HKEY_ARRAY_SIZE);
|
||||||
|
seed = vsi->rss_hkey_user;
|
||||||
|
}
|
||||||
|
if (!vsi->rss_lut_user) {
|
||||||
|
vsi->rss_lut_user = kzalloc(I40EVF_HLUT_ARRAY_SIZE,
|
||||||
|
GFP_KERNEL);
|
||||||
|
if (!vsi->rss_lut_user)
|
||||||
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
lut = kzalloc(I40EVF_HLUT_ARRAY_SIZE, GFP_KERNEL);
|
|
||||||
if (!lut)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
/* 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 < I40EVF_HLUT_ARRAY_SIZE; i++)
|
for (i = 0; i < I40EVF_HLUT_ARRAY_SIZE; i++)
|
||||||
lut[i] = (u8)(indir[i]);
|
vsi->rss_lut_user[i] = (u8)(indir[i]);
|
||||||
|
|
||||||
ret = i40evf_config_rss(vsi, seed, lut, I40EVF_HLUT_ARRAY_SIZE);
|
return i40evf_config_rss(vsi, seed, vsi->rss_lut_user,
|
||||||
kfree(lut);
|
I40EVF_HLUT_ARRAY_SIZE);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct ethtool_ops i40evf_ethtool_ops = {
|
static const struct ethtool_ops i40evf_ethtool_ops = {
|
||||||
|
|
|
@ -1453,9 +1453,21 @@ static int i40evf_init_rss(struct i40evf_adapter *adapter)
|
||||||
lut = kzalloc(I40EVF_HLUT_ARRAY_SIZE, GFP_KERNEL);
|
lut = kzalloc(I40EVF_HLUT_ARRAY_SIZE, GFP_KERNEL);
|
||||||
if (!lut)
|
if (!lut)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
i40evf_fill_rss_lut(lut, I40EVF_HLUT_ARRAY_SIZE,
|
|
||||||
adapter->num_active_queues);
|
/* Use user configured lut if there is one, otherwise use default */
|
||||||
netdev_rss_key_fill((void *)seed, I40EVF_HKEY_ARRAY_SIZE);
|
if (vsi->rss_lut_user)
|
||||||
|
memcpy(lut, vsi->rss_lut_user, I40EVF_HLUT_ARRAY_SIZE);
|
||||||
|
else
|
||||||
|
i40evf_fill_rss_lut(lut, I40EVF_HLUT_ARRAY_SIZE,
|
||||||
|
adapter->num_active_queues);
|
||||||
|
|
||||||
|
/* Use user configured hash key if there is one, otherwise
|
||||||
|
* user default.
|
||||||
|
*/
|
||||||
|
if (vsi->rss_hkey_user)
|
||||||
|
memcpy(seed, vsi->rss_hkey_user, I40EVF_HKEY_ARRAY_SIZE);
|
||||||
|
else
|
||||||
|
netdev_rss_key_fill((void *)seed, I40EVF_HKEY_ARRAY_SIZE);
|
||||||
ret = i40evf_config_rss(vsi, seed, lut, I40EVF_HLUT_ARRAY_SIZE);
|
ret = i40evf_config_rss(vsi, seed, lut, I40EVF_HLUT_ARRAY_SIZE);
|
||||||
kfree(lut);
|
kfree(lut);
|
||||||
|
|
||||||
|
@ -1582,6 +1594,22 @@ err_set_interrupt:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* i40evf_clear_rss_config_user - Clear user configurations of RSS
|
||||||
|
* @vsi: Pointer to VSI structure
|
||||||
|
**/
|
||||||
|
static void i40evf_clear_rss_config_user(struct i40e_vsi *vsi)
|
||||||
|
{
|
||||||
|
if (!vsi)
|
||||||
|
return;
|
||||||
|
|
||||||
|
kfree(vsi->rss_hkey_user);
|
||||||
|
vsi->rss_hkey_user = NULL;
|
||||||
|
|
||||||
|
kfree(vsi->rss_lut_user);
|
||||||
|
vsi->rss_lut_user = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* i40evf_watchdog_timer - Periodic call-back timer
|
* i40evf_watchdog_timer - Periodic call-back timer
|
||||||
* @data: pointer to adapter disguised as unsigned long
|
* @data: pointer to adapter disguised as unsigned long
|
||||||
|
@ -2770,6 +2798,9 @@ static void i40evf_remove(struct pci_dev *pdev)
|
||||||
|
|
||||||
flush_scheduled_work();
|
flush_scheduled_work();
|
||||||
|
|
||||||
|
/* Clear user configurations for RSS */
|
||||||
|
i40evf_clear_rss_config_user(&adapter->vsi);
|
||||||
|
|
||||||
if (hw->aq.asq.count)
|
if (hw->aq.asq.count)
|
||||||
i40evf_shutdown_adminq(hw);
|
i40evf_shutdown_adminq(hw);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue