Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: sh_eth: fix the rxdesc pointer when rx descriptor empty happens

When Receive Descriptor Empty happens, rxdesc pointer of the driver
and actual next descriptor of the controller may be mismatch.
This patch fixes it.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Yoshihiro Shimoda and committed by
David S. Miller
79fba9f5 9dae3100

+5 -3
+5 -3
drivers/net/ethernet/renesas/sh_eth.c
··· 1101 1101 1102 1102 /* Restart Rx engine if stopped. */ 1103 1103 /* If we don't need to check status, don't. -KDU */ 1104 - if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) 1104 + if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { 1105 + /* fix the values for the next receiving */ 1106 + mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) - 1107 + sh_eth_read(ndev, RDLAR)) >> 4; 1105 1108 sh_eth_write(ndev, EDRRR_R, EDRRR); 1109 + } 1106 1110 1107 1111 return 0; 1108 1112 } ··· 1203 1199 /* Receive Descriptor Empty int */ 1204 1200 ndev->stats.rx_over_errors++; 1205 1201 1206 - if (sh_eth_read(ndev, EDRRR) ^ EDRRR_R) 1207 - sh_eth_write(ndev, EDRRR_R, EDRRR); 1208 1202 if (netif_msg_rx_err(mdp)) 1209 1203 dev_err(&ndev->dev, "Receive Descriptor Empty\n"); 1210 1204 }