Skip to content

Commit a78e936

Browse files
Francois Romieudavem330
authored andcommitted
r8169: fix memory corruption on retrieval of hardware statistics.
Hardware statistics retrieval hurts in tight invocation loops. Avoid extraneous write and enforce strict ordering of writes targeted to the tally counters dump area address registers. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Tested-by: Oliver Freyermuth <o.freyermuth@googlemail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f15ca72 commit a78e936

File tree

1 file changed

+2
-7
lines changed
  • drivers/net/ethernet/realtek

1 file changed

+2
-7
lines changed

drivers/net/ethernet/realtek/r8169.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,19 +2244,14 @@ static bool rtl8169_do_counters(struct net_device *dev, u32 counter_cmd)
22442244
void __iomem *ioaddr = tp->mmio_addr;
22452245
dma_addr_t paddr = tp->counters_phys_addr;
22462246
u32 cmd;
2247-
bool ret;
22482247

22492248
RTL_W32(CounterAddrHigh, (u64)paddr >> 32);
2249+
RTL_R32(CounterAddrHigh);
22502250
cmd = (u64)paddr & DMA_BIT_MASK(32);
22512251
RTL_W32(CounterAddrLow, cmd);
22522252
RTL_W32(CounterAddrLow, cmd | counter_cmd);
22532253

2254-
ret = rtl_udelay_loop_wait_low(tp, &rtl_counters_cond, 10, 1000);
2255-
2256-
RTL_W32(CounterAddrLow, 0);
2257-
RTL_W32(CounterAddrHigh, 0);
2258-
2259-
return ret;
2254+
return rtl_udelay_loop_wait_low(tp, &rtl_counters_cond, 10, 1000);
22602255
}
22612256

22622257
static bool rtl8169_reset_counters(struct net_device *dev)

0 commit comments

Comments
 (0)