Skip to content

Commit d1dc06d

Browse files
rpptdavem330
authored andcommitted
virtio_net: fix csum generation for virtio-net devices
The commit e858fae ("virtio_net: use common code for virtio_net_hdr and skb GSO conversion") replaced the tun code for header manipulation with the generic helpers. While doing so, it implictly moved the skb_partial_csum_set() invocation after eth_type_trans(), which invalidate the current gso start/offset values. Fix it by moving the helper invocation before the mac pulling. Fixes: e858fae ("virtio_net: use common code for virtio_net_hdr and skb GSO conversion") Reported-by: David Ahern <[email protected]> Signed-off-by: Mike Rapoport <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9986020 commit d1dc06d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/virtio_net.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,6 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
482482
if (hdr->hdr.flags & VIRTIO_NET_HDR_F_DATA_VALID)
483483
skb->ip_summed = CHECKSUM_UNNECESSARY;
484484

485-
skb->protocol = eth_type_trans(skb, dev);
486-
pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
487-
ntohs(skb->protocol), skb->len, skb->pkt_type);
488-
489485
if (virtio_net_hdr_to_skb(skb, &hdr->hdr,
490486
virtio_is_little_endian(vi->vdev))) {
491487
net_warn_ratelimited("%s: bad gso: type: %u, size: %u\n",
@@ -494,6 +490,10 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
494490
goto frame_err;
495491
}
496492

493+
skb->protocol = eth_type_trans(skb, dev);
494+
pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
495+
ntohs(skb->protocol), skb->len, skb->pkt_type);
496+
497497
napi_gro_receive(&rq->napi, skb);
498498
return;
499499

0 commit comments

Comments
 (0)