diff options
| author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2012-06-20 11:26:34 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2012-06-23 00:50:37 -0400 |
| commit | a18e08bdcf845efb7344cea146e683df746bbfb4 (patch) | |
| tree | e539d0faac592762c2c196436fa516a395e5094f | |
| parent | eb2dc35d99028b698cdedba4f5522bc43e576bd2 (diff) | |
net: sh_eth: fix the condition to fix the cur_tx/dirty_rx
The following commit couldn't work if the RMCR is not set to 1.
"net: sh_eth: fix the rxdesc pointer when rx descriptor empty happens"
commit id 79fba9f51755c704c0a7d7b7f0df10874dc0a744
If RMCR is not set, the controller will clear the EDRRR after it received
a frame. In this case, the driver doesn't need to fix the value of
cur_rx/dirty_rx. The driver only needs it when the controll detects
receive descriptors are empty.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/renesas/sh_eth.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 667169b82526..79bf09b41971 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
| @@ -1011,7 +1011,7 @@ static int sh_eth_txfree(struct net_device *ndev) | |||
| 1011 | } | 1011 | } |
| 1012 | 1012 | ||
| 1013 | /* Packet receive function */ | 1013 | /* Packet receive function */ |
| 1014 | static int sh_eth_rx(struct net_device *ndev) | 1014 | static int sh_eth_rx(struct net_device *ndev, u32 intr_status) |
| 1015 | { | 1015 | { |
| 1016 | struct sh_eth_private *mdp = netdev_priv(ndev); | 1016 | struct sh_eth_private *mdp = netdev_priv(ndev); |
| 1017 | struct sh_eth_rxdesc *rxdesc; | 1017 | struct sh_eth_rxdesc *rxdesc; |
| @@ -1102,9 +1102,11 @@ static int sh_eth_rx(struct net_device *ndev) | |||
| 1102 | /* Restart Rx engine if stopped. */ | 1102 | /* Restart Rx engine if stopped. */ |
| 1103 | /* If we don't need to check status, don't. -KDU */ | 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 */ | 1105 | /* fix the values for the next receiving if RDE is set */ |
| 1106 | mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) - | 1106 | if (intr_status & EESR_RDE) |
| 1107 | sh_eth_read(ndev, RDLAR)) >> 4; | 1107 | mdp->cur_rx = mdp->dirty_rx = |
| 1108 | (sh_eth_read(ndev, RDFAR) - | ||
| 1109 | sh_eth_read(ndev, RDLAR)) >> 4; | ||
| 1108 | sh_eth_write(ndev, EDRRR_R, EDRRR); | 1110 | sh_eth_write(ndev, EDRRR_R, EDRRR); |
| 1109 | } | 1111 | } |
| 1110 | 1112 | ||
| @@ -1273,7 +1275,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
| 1273 | EESR_RTSF | /* short frame recv */ | 1275 | EESR_RTSF | /* short frame recv */ |
| 1274 | EESR_PRE | /* PHY-LSI recv error */ | 1276 | EESR_PRE | /* PHY-LSI recv error */ |
| 1275 | EESR_CERF)){ /* recv frame CRC error */ | 1277 | EESR_CERF)){ /* recv frame CRC error */ |
| 1276 | sh_eth_rx(ndev); | 1278 | sh_eth_rx(ndev, intr_status); |
| 1277 | } | 1279 | } |
| 1278 | 1280 | ||
| 1279 | /* Tx Check */ | 1281 | /* Tx Check */ |
