aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/renesas/ravb_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/renesas/ravb_main.c')
-rw-r--r--drivers/net/ethernet/renesas/ravb_main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index ffc1ada4e6da..d28c8f9ca55b 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -343,7 +343,7 @@ static int ravb_ring_init(struct net_device *ndev, int q)
343 int i; 343 int i;
344 344
345 priv->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : ndev->mtu) + 345 priv->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : ndev->mtu) +
346 ETH_HLEN + VLAN_HLEN; 346 ETH_HLEN + VLAN_HLEN + sizeof(__sum16);
347 347
348 /* Allocate RX and TX skb rings */ 348 /* Allocate RX and TX skb rings */
349 priv->rx_skb[q] = kcalloc(priv->num_rx_ring[q], 349 priv->rx_skb[q] = kcalloc(priv->num_rx_ring[q],
@@ -524,13 +524,15 @@ static void ravb_rx_csum(struct sk_buff *skb)
524{ 524{
525 u8 *hw_csum; 525 u8 *hw_csum;
526 526
527 /* The hardware checksum is 2 bytes appended to packet data */ 527 /* The hardware checksum is contained in sizeof(__sum16) (2) bytes
528 if (unlikely(skb->len < 2)) 528 * appended to packet data
529 */
530 if (unlikely(skb->len < sizeof(__sum16)))
529 return; 531 return;
530 hw_csum = skb_tail_pointer(skb) - 2; 532 hw_csum = skb_tail_pointer(skb) - sizeof(__sum16);
531 skb->csum = csum_unfold((__force __sum16)get_unaligned_le16(hw_csum)); 533 skb->csum = csum_unfold((__force __sum16)get_unaligned_le16(hw_csum));
532 skb->ip_summed = CHECKSUM_COMPLETE; 534 skb->ip_summed = CHECKSUM_COMPLETE;
533 skb_trim(skb, skb->len - 2); 535 skb_trim(skb, skb->len - sizeof(__sum16));
534} 536}
535 537
536/* Packet receive function for Ethernet AVB */ 538/* Packet receive function for Ethernet AVB */