Skip to content

Commit ab85791

Browse files
Sergei Shtylyovdavem330
authored andcommitted
sh_eth: fix RX buffer size alignment
Both Renesas R-Car and RZ/A1 manuals state that RX buffer length must be a multiple of 32 bytes, while the driver only uses 16 byte granularity... Signed-off-by: Sergei Shtylyov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f7e1b37 commit ab85791

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,8 +1148,8 @@ static void sh_eth_ring_format(struct net_device *ndev)
11481148

11491149
/* RX descriptor */
11501150
rxdesc = &mdp->rx_ring[i];
1151-
/* The size of the buffer is a multiple of 16 bytes. */
1152-
rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
1151+
/* The size of the buffer is a multiple of 32 bytes. */
1152+
rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);
11531153
dma_addr = dma_map_single(&ndev->dev, skb->data,
11541154
rxdesc->buffer_length,
11551155
DMA_FROM_DEVICE);
@@ -1506,7 +1506,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
15061506
if (mdp->cd->rpadir)
15071507
skb_reserve(skb, NET_IP_ALIGN);
15081508
dma_unmap_single(&ndev->dev, rxdesc->addr,
1509-
ALIGN(mdp->rx_buf_sz, 16),
1509+
ALIGN(mdp->rx_buf_sz, 32),
15101510
DMA_FROM_DEVICE);
15111511
skb_put(skb, pkt_len);
15121512
skb->protocol = eth_type_trans(skb, ndev);
@@ -1524,8 +1524,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
15241524
for (; mdp->cur_rx - mdp->dirty_rx > 0; mdp->dirty_rx++) {
15251525
entry = mdp->dirty_rx % mdp->num_rx_ring;
15261526
rxdesc = &mdp->rx_ring[entry];
1527-
/* The size of the buffer is 16 byte boundary. */
1528-
rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
1527+
/* The size of the buffer is 32 byte boundary. */
1528+
rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);
15291529

15301530
if (mdp->rx_skbuff[entry] == NULL) {
15311531
skb = netdev_alloc_skb(ndev, skbuff_size);

0 commit comments

Comments
 (0)