diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/macvtap.c | 3 | ||||
-rw-r--r-- | drivers/net/tun.c | 12 | ||||
-rw-r--r-- | drivers/net/virtio_net.c | 12 |
3 files changed, 18 insertions, 9 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 0f0f9ce3a776..b181dfb3d6d6 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -543,6 +543,7 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from, | |||
543 | skb->data_len += len; | 543 | skb->data_len += len; |
544 | skb->len += len; | 544 | skb->len += len; |
545 | skb->truesize += truesize; | 545 | skb->truesize += truesize; |
546 | skb_shinfo(skb)->gso_type |= SKB_GSO_SHARED_FRAG; | ||
546 | atomic_add(truesize, &skb->sk->sk_wmem_alloc); | 547 | atomic_add(truesize, &skb->sk->sk_wmem_alloc); |
547 | while (len) { | 548 | while (len) { |
548 | int off = base & ~PAGE_MASK; | 549 | int off = base & ~PAGE_MASK; |
@@ -598,7 +599,7 @@ static int macvtap_skb_from_vnet_hdr(struct sk_buff *skb, | |||
598 | 599 | ||
599 | if (vnet_hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { | 600 | if (vnet_hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { |
600 | skb_shinfo(skb)->gso_size = vnet_hdr->gso_size; | 601 | skb_shinfo(skb)->gso_size = vnet_hdr->gso_size; |
601 | skb_shinfo(skb)->gso_type = gso_type; | 602 | skb_shinfo(skb)->gso_type |= gso_type; |
602 | 603 | ||
603 | /* Header must be checked, and gso_segs computed. */ | 604 | /* Header must be checked, and gso_segs computed. */ |
604 | skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; | 605 | skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index c81680dc10eb..293ce8dfc9e6 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1005,6 +1005,7 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from, | |||
1005 | skb->data_len += len; | 1005 | skb->data_len += len; |
1006 | skb->len += len; | 1006 | skb->len += len; |
1007 | skb->truesize += truesize; | 1007 | skb->truesize += truesize; |
1008 | skb_shinfo(skb)->gso_type |= SKB_GSO_SHARED_FRAG; | ||
1008 | atomic_add(truesize, &skb->sk->sk_wmem_alloc); | 1009 | atomic_add(truesize, &skb->sk->sk_wmem_alloc); |
1009 | while (len) { | 1010 | while (len) { |
1010 | int off = base & ~PAGE_MASK; | 1011 | int off = base & ~PAGE_MASK; |
@@ -1150,16 +1151,18 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1150 | } | 1151 | } |
1151 | 1152 | ||
1152 | if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { | 1153 | if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { |
1154 | unsigned short gso_type = 0; | ||
1155 | |||
1153 | pr_debug("GSO!\n"); | 1156 | pr_debug("GSO!\n"); |
1154 | switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { | 1157 | switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { |
1155 | case VIRTIO_NET_HDR_GSO_TCPV4: | 1158 | case VIRTIO_NET_HDR_GSO_TCPV4: |
1156 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | 1159 | gso_type = SKB_GSO_TCPV4; |
1157 | break; | 1160 | break; |
1158 | case VIRTIO_NET_HDR_GSO_TCPV6: | 1161 | case VIRTIO_NET_HDR_GSO_TCPV6: |
1159 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 1162 | gso_type = SKB_GSO_TCPV6; |
1160 | break; | 1163 | break; |
1161 | case VIRTIO_NET_HDR_GSO_UDP: | 1164 | case VIRTIO_NET_HDR_GSO_UDP: |
1162 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 1165 | gso_type = SKB_GSO_UDP; |
1163 | break; | 1166 | break; |
1164 | default: | 1167 | default: |
1165 | tun->dev->stats.rx_frame_errors++; | 1168 | tun->dev->stats.rx_frame_errors++; |
@@ -1168,9 +1171,10 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1168 | } | 1171 | } |
1169 | 1172 | ||
1170 | if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN) | 1173 | if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN) |
1171 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | 1174 | gso_type |= SKB_GSO_TCP_ECN; |
1172 | 1175 | ||
1173 | skb_shinfo(skb)->gso_size = gso.gso_size; | 1176 | skb_shinfo(skb)->gso_size = gso.gso_size; |
1177 | skb_shinfo(skb)->gso_type |= gso_type; | ||
1174 | if (skb_shinfo(skb)->gso_size == 0) { | 1178 | if (skb_shinfo(skb)->gso_size == 0) { |
1175 | tun->dev->stats.rx_frame_errors++; | 1179 | tun->dev->stats.rx_frame_errors++; |
1176 | kfree_skb(skb); | 1180 | kfree_skb(skb); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 701408a1ded6..58914c8ea68f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -220,6 +220,7 @@ static void set_skb_frag(struct sk_buff *skb, struct page *page, | |||
220 | skb->len += size; | 220 | skb->len += size; |
221 | skb->truesize += PAGE_SIZE; | 221 | skb->truesize += PAGE_SIZE; |
222 | skb_shinfo(skb)->nr_frags++; | 222 | skb_shinfo(skb)->nr_frags++; |
223 | skb_shinfo(skb)->gso_type |= SKB_GSO_SHARED_FRAG; | ||
223 | *len -= size; | 224 | *len -= size; |
224 | } | 225 | } |
225 | 226 | ||
@@ -379,16 +380,18 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
379 | ntohs(skb->protocol), skb->len, skb->pkt_type); | 380 | ntohs(skb->protocol), skb->len, skb->pkt_type); |
380 | 381 | ||
381 | if (hdr->hdr.gso_type != VIRTIO_NET_HDR_GSO_NONE) { | 382 | if (hdr->hdr.gso_type != VIRTIO_NET_HDR_GSO_NONE) { |
383 | unsigned short gso_type = 0; | ||
384 | |||
382 | pr_debug("GSO!\n"); | 385 | pr_debug("GSO!\n"); |
383 | switch (hdr->hdr.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { | 386 | switch (hdr->hdr.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { |
384 | case VIRTIO_NET_HDR_GSO_TCPV4: | 387 | case VIRTIO_NET_HDR_GSO_TCPV4: |
385 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | 388 | gso_type = SKB_GSO_TCPV4; |
386 | break; | 389 | break; |
387 | case VIRTIO_NET_HDR_GSO_UDP: | 390 | case VIRTIO_NET_HDR_GSO_UDP: |
388 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 391 | gso_type = SKB_GSO_UDP; |
389 | break; | 392 | break; |
390 | case VIRTIO_NET_HDR_GSO_TCPV6: | 393 | case VIRTIO_NET_HDR_GSO_TCPV6: |
391 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 394 | gso_type = SKB_GSO_TCPV6; |
392 | break; | 395 | break; |
393 | default: | 396 | default: |
394 | net_warn_ratelimited("%s: bad gso type %u.\n", | 397 | net_warn_ratelimited("%s: bad gso type %u.\n", |
@@ -397,7 +400,7 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
397 | } | 400 | } |
398 | 401 | ||
399 | if (hdr->hdr.gso_type & VIRTIO_NET_HDR_GSO_ECN) | 402 | if (hdr->hdr.gso_type & VIRTIO_NET_HDR_GSO_ECN) |
400 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | 403 | gso_type |= SKB_GSO_TCP_ECN; |
401 | 404 | ||
402 | skb_shinfo(skb)->gso_size = hdr->hdr.gso_size; | 405 | skb_shinfo(skb)->gso_size = hdr->hdr.gso_size; |
403 | if (skb_shinfo(skb)->gso_size == 0) { | 406 | if (skb_shinfo(skb)->gso_size == 0) { |
@@ -405,6 +408,7 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
405 | goto frame_err; | 408 | goto frame_err; |
406 | } | 409 | } |
407 | 410 | ||
411 | skb_shinfo(skb)->gso_type |= gso_type; | ||
408 | /* Header must be checked, and gso_segs computed. */ | 412 | /* Header must be checked, and gso_segs computed. */ |
409 | skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; | 413 | skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; |
410 | skb_shinfo(skb)->gso_segs = 0; | 414 | skb_shinfo(skb)->gso_segs = 0; |