Skip to content

Commit 096b1c1

Browse files
committed
Merge branch 'sh_eth'
Ben Hutchings says: ==================== Fixes for sh_eth #4 v2 I'm continuing review and testing of Ethernet support on the R-Car H2 chip, with help from a colleague. This series fixes a few more issues. These are not tested on any of the other supported chips. v2: Add note that the revert is not a pure revert. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents eee617a + dacc73e commit 096b1c1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ static struct sh_eth_cpu_data r8a779x_data = {
508508
.tpauser = 1,
509509
.hw_swap = 1,
510510
.rmiimode = 1,
511-
.shift_rd0 = 1,
512511
};
513512

514513
static void sh_eth_set_rate_sh7724(struct net_device *ndev)
@@ -1410,6 +1409,8 @@ static int sh_eth_txfree(struct net_device *ndev)
14101409
txdesc = &mdp->tx_ring[entry];
14111410
if (txdesc->status & cpu_to_edmac(mdp, TD_TACT))
14121411
break;
1412+
/* TACT bit must be checked before all the following reads */
1413+
rmb();
14131414
/* Free the original skb. */
14141415
if (mdp->tx_skbuff[entry]) {
14151416
dma_unmap_single(&ndev->dev, txdesc->addr,
@@ -1447,6 +1448,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
14471448
limit = boguscnt;
14481449
rxdesc = &mdp->rx_ring[entry];
14491450
while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) {
1451+
/* RACT bit must be checked before all the following reads */
1452+
rmb();
14501453
desc_status = edmac_to_cpu(mdp, rxdesc->status);
14511454
pkt_len = rxdesc->frame_length;
14521455

@@ -1458,8 +1461,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
14581461

14591462
/* In case of almost all GETHER/ETHERs, the Receive Frame State
14601463
* (RFS) bits in the Receive Descriptor 0 are from bit 9 to
1461-
* bit 0. However, in case of the R8A7740, R8A779x, and
1462-
* R7S72100 the RFS bits are from bit 25 to bit 16. So, the
1464+
* bit 0. However, in case of the R8A7740 and R7S72100
1465+
* the RFS bits are from bit 25 to bit 16. So, the
14631466
* driver needs right shifting by 16.
14641467
*/
14651468
if (mdp->cd->shift_rd0)
@@ -1526,6 +1529,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
15261529
skb_checksum_none_assert(skb);
15271530
rxdesc->addr = dma_addr;
15281531
}
1532+
wmb(); /* RACT bit must be set after all the above writes */
15291533
if (entry >= mdp->num_rx_ring - 1)
15301534
rxdesc->status |=
15311535
cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDEL);
@@ -1538,7 +1542,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
15381542
/* If we don't need to check status, don't. -KDU */
15391543
if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) {
15401544
/* fix the values for the next receiving if RDE is set */
1541-
if (intr_status & EESR_RDE) {
1545+
if (intr_status & EESR_RDE && mdp->reg_offset[RDFAR] != 0) {
15421546
u32 count = (sh_eth_read(ndev, RDFAR) -
15431547
sh_eth_read(ndev, RDLAR)) >> 4;
15441548

@@ -2177,7 +2181,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
21772181
}
21782182
spin_unlock_irqrestore(&mdp->lock, flags);
21792183

2180-
if (skb_padto(skb, ETH_ZLEN))
2184+
if (skb_put_padto(skb, ETH_ZLEN))
21812185
return NETDEV_TX_OK;
21822186

21832187
entry = mdp->cur_tx % mdp->num_tx_ring;
@@ -2195,6 +2199,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
21952199
}
21962200
txdesc->buffer_length = skb->len;
21972201

2202+
wmb(); /* TACT bit must be set after all the above writes */
21982203
if (entry >= mdp->num_tx_ring - 1)
21992204
txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE);
22002205
else

0 commit comments

Comments
 (0)