aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/macvtap.c4
-rw-r--r--drivers/net/tun.c13
-rw-r--r--drivers/net/virtio_net.c13
3 files changed, 12 insertions, 18 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index b181dfb3d6d6..97243011d319 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -543,7 +543,6 @@ 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;
547 atomic_add(truesize, &skb->sk->sk_wmem_alloc); 546 atomic_add(truesize, &skb->sk->sk_wmem_alloc);
548 while (len) { 547 while (len) {
549 int off = base & ~PAGE_MASK; 548 int off = base & ~PAGE_MASK;
@@ -599,7 +598,7 @@ static int macvtap_skb_from_vnet_hdr(struct sk_buff *skb,
599 598
600 if (vnet_hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { 599 if (vnet_hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
601 skb_shinfo(skb)->gso_size = vnet_hdr->gso_size; 600 skb_shinfo(skb)->gso_size = vnet_hdr->gso_size;
602 skb_shinfo(skb)->gso_type |= gso_type; 601 skb_shinfo(skb)->gso_type = gso_type;
603 602
604 /* Header must be checked, and gso_segs computed. */ 603 /* Header must be checked, and gso_segs computed. */
605 skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; 604 skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
@@ -743,6 +742,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
743 if (zerocopy) { 742 if (zerocopy) {
744 skb_shinfo(skb)->destructor_arg = m->msg_control; 743 skb_shinfo(skb)->destructor_arg = m->msg_control;
745 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; 744 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
745 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
746 } 746 }
747 if (vlan) 747 if (vlan)
748 macvlan_start_xmit(skb, vlan->dev); 748 macvlan_start_xmit(skb, vlan->dev);
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index b1038c0e2240..b6f45c5d84d5 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1019,7 +1019,6 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
1019 skb->data_len += len; 1019 skb->data_len += len;
1020 skb->len += len; 1020 skb->len += len;
1021 skb->truesize += truesize; 1021 skb->truesize += truesize;
1022 skb_shinfo(skb)->gso_type |= SKB_GSO_SHARED_FRAG;
1023 atomic_add(truesize, &skb->sk->sk_wmem_alloc); 1022 atomic_add(truesize, &skb->sk->sk_wmem_alloc);
1024 while (len) { 1023 while (len) {
1025 int off = base & ~PAGE_MASK; 1024 int off = base & ~PAGE_MASK;
@@ -1165,18 +1164,16 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1165 } 1164 }
1166 1165
1167 if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { 1166 if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) {
1168 unsigned short gso_type = 0;
1169
1170 pr_debug("GSO!\n"); 1167 pr_debug("GSO!\n");
1171 switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { 1168 switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
1172 case VIRTIO_NET_HDR_GSO_TCPV4: 1169 case VIRTIO_NET_HDR_GSO_TCPV4:
1173 gso_type = SKB_GSO_TCPV4; 1170 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
1174 break; 1171 break;
1175 case VIRTIO_NET_HDR_GSO_TCPV6: 1172 case VIRTIO_NET_HDR_GSO_TCPV6:
1176 gso_type = SKB_GSO_TCPV6; 1173 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
1177 break; 1174 break;
1178 case VIRTIO_NET_HDR_GSO_UDP: 1175 case VIRTIO_NET_HDR_GSO_UDP:
1179 gso_type = SKB_GSO_UDP; 1176 skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
1180 break; 1177 break;
1181 default: 1178 default:
1182 tun->dev->stats.rx_frame_errors++; 1179 tun->dev->stats.rx_frame_errors++;
@@ -1185,10 +1182,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1185 } 1182 }
1186 1183
1187 if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN) 1184 if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN)
1188 gso_type |= SKB_GSO_TCP_ECN; 1185 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
1189 1186
1190 skb_shinfo(skb)->gso_size = gso.gso_size; 1187 skb_shinfo(skb)->gso_size = gso.gso_size;
1191 skb_shinfo(skb)->gso_type |= gso_type;
1192 if (skb_shinfo(skb)->gso_size == 0) { 1188 if (skb_shinfo(skb)->gso_size == 0) {
1193 tun->dev->stats.rx_frame_errors++; 1189 tun->dev->stats.rx_frame_errors++;
1194 kfree_skb(skb); 1190 kfree_skb(skb);
@@ -1204,6 +1200,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1204 if (zerocopy) { 1200 if (zerocopy) {
1205 skb_shinfo(skb)->destructor_arg = msg_control; 1201 skb_shinfo(skb)->destructor_arg = msg_control;
1206 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; 1202 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
1203 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
1207 } 1204 }
1208 1205
1209 skb_reset_network_header(skb); 1206 skb_reset_network_header(skb);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 381a2d8d8a81..192c91c8e799 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -227,7 +227,7 @@ static void set_skb_frag(struct sk_buff *skb, struct page *page,
227 skb->len += size; 227 skb->len += size;
228 skb->truesize += PAGE_SIZE; 228 skb->truesize += PAGE_SIZE;
229 skb_shinfo(skb)->nr_frags++; 229 skb_shinfo(skb)->nr_frags++;
230 skb_shinfo(skb)->gso_type |= SKB_GSO_SHARED_FRAG; 230 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
231 *len -= size; 231 *len -= size;
232} 232}
233 233
@@ -387,18 +387,16 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
387 ntohs(skb->protocol), skb->len, skb->pkt_type); 387 ntohs(skb->protocol), skb->len, skb->pkt_type);
388 388
389 if (hdr->hdr.gso_type != VIRTIO_NET_HDR_GSO_NONE) { 389 if (hdr->hdr.gso_type != VIRTIO_NET_HDR_GSO_NONE) {
390 unsigned short gso_type = 0;
391
392 pr_debug("GSO!\n"); 390 pr_debug("GSO!\n");
393 switch (hdr->hdr.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { 391 switch (hdr->hdr.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
394 case VIRTIO_NET_HDR_GSO_TCPV4: 392 case VIRTIO_NET_HDR_GSO_TCPV4:
395 gso_type = SKB_GSO_TCPV4; 393 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
396 break; 394 break;
397 case VIRTIO_NET_HDR_GSO_UDP: 395 case VIRTIO_NET_HDR_GSO_UDP:
398 gso_type = SKB_GSO_UDP; 396 skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
399 break; 397 break;
400 case VIRTIO_NET_HDR_GSO_TCPV6: 398 case VIRTIO_NET_HDR_GSO_TCPV6:
401 gso_type = SKB_GSO_TCPV6; 399 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
402 break; 400 break;
403 default: 401 default:
404 net_warn_ratelimited("%s: bad gso type %u.\n", 402 net_warn_ratelimited("%s: bad gso type %u.\n",
@@ -407,7 +405,7 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
407 } 405 }
408 406
409 if (hdr->hdr.gso_type & VIRTIO_NET_HDR_GSO_ECN) 407 if (hdr->hdr.gso_type & VIRTIO_NET_HDR_GSO_ECN)
410 gso_type |= SKB_GSO_TCP_ECN; 408 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
411 409
412 skb_shinfo(skb)->gso_size = hdr->hdr.gso_size; 410 skb_shinfo(skb)->gso_size = hdr->hdr.gso_size;
413 if (skb_shinfo(skb)->gso_size == 0) { 411 if (skb_shinfo(skb)->gso_size == 0) {
@@ -415,7 +413,6 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
415 goto frame_err; 413 goto frame_err;
416 } 414 }
417 415
418 skb_shinfo(skb)->gso_type |= gso_type;
419 /* Header must be checked, and gso_segs computed. */ 416 /* Header must be checked, and gso_segs computed. */
420 skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; 417 skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
421 skb_shinfo(skb)->gso_segs = 0; 418 skb_shinfo(skb)->gso_segs = 0;