Skip to content

Commit 2097db7

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
ixgbe: Perform reinit any time number of VFs change
If the number of VFs are changed we need to reinitialize the part since the offset for the device and the number of pools will be incorrect. Without this change we can end up seeing Tx hangs and dropped Rx frames for incoming traffic. In addition we should drop the code that is arbitrarily changing the default pool and queue configuration. Instead we should wait until the port is reset and reconfigured via ixgbe_sriov_reinit. Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 361b534 commit 2097db7

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, unsigned int max_vfs)
227227
int ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
228228
{
229229
unsigned int num_vfs = adapter->num_vfs, vf;
230-
struct ixgbe_hw *hw = &adapter->hw;
231-
u32 gpie;
232-
u32 vmdctl;
233230
int rss;
234231

235232
/* set num VFs to 0 to prevent access to vfinfo */
@@ -271,18 +268,6 @@ int ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
271268
pci_disable_sriov(adapter->pdev);
272269
#endif
273270

274-
/* turn off device IOV mode */
275-
IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, 0);
276-
gpie = IXGBE_READ_REG(hw, IXGBE_GPIE);
277-
gpie &= ~IXGBE_GPIE_VTMODE_MASK;
278-
IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
279-
280-
/* set default pool back to 0 */
281-
vmdctl = IXGBE_READ_REG(hw, IXGBE_VT_CTL);
282-
vmdctl &= ~IXGBE_VT_CTL_POOL_MASK;
283-
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl);
284-
IXGBE_WRITE_FLUSH(hw);
285-
286271
/* Disable VMDq flag so device will be set in VM mode */
287272
if (adapter->ring_feature[RING_F_VMDQ].limit == 1) {
288273
adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED;
@@ -378,13 +363,15 @@ static int ixgbe_pci_sriov_disable(struct pci_dev *dev)
378363
int err;
379364
#ifdef CONFIG_PCI_IOV
380365
u32 current_flags = adapter->flags;
366+
int prev_num_vf = pci_num_vf(dev);
381367
#endif
382368

383369
err = ixgbe_disable_sriov(adapter);
384370

385371
/* Only reinit if no error and state changed */
386372
#ifdef CONFIG_PCI_IOV
387-
if (!err && current_flags != adapter->flags)
373+
if (!err && (current_flags != adapter->flags ||
374+
prev_num_vf != pci_num_vf(dev)))
388375
ixgbe_sriov_reinit(adapter);
389376
#endif
390377

0 commit comments

Comments
 (0)