Skip to content

Commit 713b3c9

Browse files
jbrandebJeff Kirsher
authored andcommitted
e1000e: flush all writebacks before unload
The driver was not flushing all writebacks before unloading, possibly causing memory to be written by the hardware after the driver had reinitialized the rings. This adds missing functionality to flush any pending writebacks and is called in all spots where descriptors should be completed before the driver begins processing. Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Reviewed-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 615b32a commit 713b3c9

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

drivers/net/e1000e/netdev.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3344,6 +3344,21 @@ int e1000e_up(struct e1000_adapter *adapter)
33443344
return 0;
33453345
}
33463346

3347+
static void e1000e_flush_descriptors(struct e1000_adapter *adapter)
3348+
{
3349+
struct e1000_hw *hw = &adapter->hw;
3350+
3351+
if (!(adapter->flags2 & FLAG2_DMA_BURST))
3352+
return;
3353+
3354+
/* flush pending descriptor writebacks to memory */
3355+
ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
3356+
ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD);
3357+
3358+
/* execute the writes immediately */
3359+
e1e_flush();
3360+
}
3361+
33473362
void e1000e_down(struct e1000_adapter *adapter)
33483363
{
33493364
struct net_device *netdev = adapter->netdev;
@@ -3383,6 +3398,9 @@ void e1000e_down(struct e1000_adapter *adapter)
33833398

33843399
if (!pci_channel_offline(adapter->pdev))
33853400
e1000e_reset(adapter);
3401+
3402+
e1000e_flush_descriptors(adapter);
3403+
33863404
e1000_clean_tx_ring(adapter);
33873405
e1000_clean_rx_ring(adapter);
33883406

@@ -4354,19 +4372,12 @@ static void e1000_watchdog_task(struct work_struct *work)
43544372
else
43554373
ew32(ICS, E1000_ICS_RXDMT0);
43564374

4375+
/* flush pending descriptors to memory before detecting Tx hang */
4376+
e1000e_flush_descriptors(adapter);
4377+
43574378
/* Force detection of hung controller every watchdog period */
43584379
adapter->detect_tx_hung = 1;
43594380

4360-
/* flush partial descriptors to memory before detecting Tx hang */
4361-
if (adapter->flags2 & FLAG2_DMA_BURST) {
4362-
ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
4363-
ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD);
4364-
/*
4365-
* no need to flush the writes because the timeout code does
4366-
* an er32 first thing
4367-
*/
4368-
}
4369-
43704381
/*
43714382
* With 82571 controllers, LAA may be overwritten due to controller
43724383
* reset from the other port. Set the appropriate LAA in RAR[0]

0 commit comments

Comments
 (0)