Commit e60ae003 authored by Tony Nguyen's avatar Tony Nguyen Committed by Jeff Kirsher

ixgbevf: Check for RSS key before setting value

The RSS key is being repopulated every time the interface is brought up
regardless of whether there is an existing value. If the user sets the RSS
key and the interface is brought up (e.g. reset), the user specified RSS
key will be overwritten.

This patch changes the rss_key to a pointer so we can check to see if the
key has been populated and preserve it accordingly.
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 82fb670c
...@@ -855,7 +855,8 @@ static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, ...@@ -855,7 +855,8 @@ static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
if (adapter->hw.mac.type >= ixgbe_mac_X550_vf) { if (adapter->hw.mac.type >= ixgbe_mac_X550_vf) {
if (key) if (key)
memcpy(key, adapter->rss_key, sizeof(adapter->rss_key)); memcpy(key, adapter->rss_key,
ixgbevf_get_rxfh_key_size(netdev));
if (indir) { if (indir) {
int i; int i;
......
...@@ -319,7 +319,7 @@ struct ixgbevf_adapter { ...@@ -319,7 +319,7 @@ struct ixgbevf_adapter {
spinlock_t mbx_lock; spinlock_t mbx_lock;
unsigned long last_reset; unsigned long last_reset;
u32 rss_key[IXGBEVF_VFRSSRK_REGS]; u32 *rss_key;
u8 rss_indir_tbl[IXGBEVF_X550_VFRETA_SIZE]; u8 rss_indir_tbl[IXGBEVF_X550_VFRETA_SIZE];
}; };
......
...@@ -1660,6 +1660,28 @@ static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter, ...@@ -1660,6 +1660,28 @@ static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter,
reg_idx); reg_idx);
} }
/**
* ixgbevf_init_rss_key - Initialize adapter RSS key
* @adapter: device handle
*
* Allocates and initializes the RSS key if it is not allocated.
**/
static inline int ixgbevf_init_rss_key(struct ixgbevf_adapter *adapter)
{
u32 *rss_key;
if (!adapter->rss_key) {
rss_key = kzalloc(IXGBEVF_RSS_HASH_KEY_SIZE, GFP_KERNEL);
if (unlikely(!rss_key))
return -ENOMEM;
netdev_rss_key_fill(rss_key, IXGBEVF_RSS_HASH_KEY_SIZE);
adapter->rss_key = rss_key;
}
return 0;
}
static void ixgbevf_setup_vfmrqc(struct ixgbevf_adapter *adapter) static void ixgbevf_setup_vfmrqc(struct ixgbevf_adapter *adapter)
{ {
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
...@@ -1668,9 +1690,8 @@ static void ixgbevf_setup_vfmrqc(struct ixgbevf_adapter *adapter) ...@@ -1668,9 +1690,8 @@ static void ixgbevf_setup_vfmrqc(struct ixgbevf_adapter *adapter)
u8 i, j; u8 i, j;
/* Fill out hash function seeds */ /* Fill out hash function seeds */
netdev_rss_key_fill(adapter->rss_key, sizeof(adapter->rss_key));
for (i = 0; i < IXGBEVF_VFRSSRK_REGS; i++) for (i = 0; i < IXGBEVF_VFRSSRK_REGS; i++)
IXGBE_WRITE_REG(hw, IXGBE_VFRSSRK(i), adapter->rss_key[i]); IXGBE_WRITE_REG(hw, IXGBE_VFRSSRK(i), *(adapter->rss_key + i));
for (i = 0, j = 0; i < IXGBEVF_X550_VFRETA_SIZE; i++, j++) { for (i = 0, j = 0; i < IXGBEVF_X550_VFRETA_SIZE; i++, j++) {
if (j == rss_i) if (j == rss_i)
...@@ -2611,6 +2632,12 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter) ...@@ -2611,6 +2632,12 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
hw->mbx.ops.init_params(hw); hw->mbx.ops.init_params(hw);
if (hw->mac.type >= ixgbe_mac_X550_vf) {
err = ixgbevf_init_rss_key(adapter);
if (err)
goto out;
}
/* assume legacy case in which PF would only give VF 2 queues */ /* assume legacy case in which PF would only give VF 2 queues */
hw->mac.max_tx_queues = 2; hw->mac.max_tx_queues = 2;
hw->mac.max_rx_queues = 2; hw->mac.max_rx_queues = 2;
...@@ -4127,6 +4154,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -4127,6 +4154,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err_sw_init: err_sw_init:
ixgbevf_reset_interrupt_capability(adapter); ixgbevf_reset_interrupt_capability(adapter);
iounmap(adapter->io_addr); iounmap(adapter->io_addr);
kfree(adapter->rss_key);
err_ioremap: err_ioremap:
disable_dev = !test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state); disable_dev = !test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state);
free_netdev(netdev); free_netdev(netdev);
...@@ -4173,6 +4201,7 @@ static void ixgbevf_remove(struct pci_dev *pdev) ...@@ -4173,6 +4201,7 @@ static void ixgbevf_remove(struct pci_dev *pdev)
hw_dbg(&adapter->hw, "Remove complete\n"); hw_dbg(&adapter->hw, "Remove complete\n");
kfree(adapter->rss_key);
disable_dev = !test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state); disable_dev = !test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state);
free_netdev(netdev); free_netdev(netdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment