Skip to contentSkip to conversation

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

PATCH Superseded Shimoda, Yoshihiro 1 participant 1 message May 14, 2012

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 3/6 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.

---
about v3:
- this patch is the same as v2

 drivers/net/ethernet/renesas/sh_eth.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +5 -3
index 10f2a89..906e410 100644
@@ -1098,8 +1098,12 @@ static int sh_eth_rx(struct net_device *ndev)
 
 	/* Restart Rx engine if stopped. */
 	/* If we don't need to check status, don't. -KDU */
-	if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R))
+	if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) {
+		/* fix the values for the next receiving */
+		mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) -
+					       sh_eth_read(ndev, RDLAR)) >> 4;
 		sh_eth_write(ndev, EDRRR_R, EDRRR);
+	}
 
 	return 0;
 }
@@ -1196,8 +1200,6 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
 		/* Receive Descriptor Empty int */
 		ndev->stats.rx_over_errors++;
 
-		if (sh_eth_read(ndev, EDRRR) ^ EDRRR_R)
-			sh_eth_write(ndev, EDRRR_R, EDRRR);
 		if (netif_msg_rx_err(mdp))
 			dev_err(&ndev->dev, "Receive Descriptor Empty\n");
 	}
Signature · 1 line
1.7.1