Skip to content

Commit 79fba9f

Browse files
shimodaydavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9dae310 commit 79fba9f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,8 +1101,12 @@ static int sh_eth_rx(struct net_device *ndev)
11011101

11021102
/* Restart Rx engine if stopped. */
11031103
/* 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;
11051108
sh_eth_write(ndev, EDRRR_R, EDRRR);
1109+
}
11061110

11071111
return 0;
11081112
}
@@ -1199,8 +1203,6 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
11991203
/* Receive Descriptor Empty int */
12001204
ndev->stats.rx_over_errors++;
12011205

1202-
if (sh_eth_read(ndev, EDRRR) ^ EDRRR_R)
1203-
sh_eth_write(ndev, EDRRR_R, EDRRR);
12041206
if (netif_msg_rx_err(mdp))
12051207
dev_err(&ndev->dev, "Receive Descriptor Empty\n");
12061208
}

0 commit comments

Comments
 (0)