aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index b9e002fccbca..c708ecc3cb2e 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -282,13 +282,12 @@ static bool try_fill_recv_maxbufs(struct virtnet_info *vi, gfp_t gfp)
282 do { 282 do {
283 struct skb_vnet_hdr *hdr; 283 struct skb_vnet_hdr *hdr;
284 284
285 skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN); 285 skb = netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN);
286 if (unlikely(!skb)) { 286 if (unlikely(!skb)) {
287 oom = true; 287 oom = true;
288 break; 288 break;
289 } 289 }
290 290
291 skb_reserve(skb, NET_IP_ALIGN);
292 skb_put(skb, MAX_PACKET_LEN); 291 skb_put(skb, MAX_PACKET_LEN);
293 292
294 hdr = skb_vnet_hdr(skb); 293 hdr = skb_vnet_hdr(skb);
@@ -343,14 +342,12 @@ static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp)
343 do { 342 do {
344 skb_frag_t *f; 343 skb_frag_t *f;
345 344
346 skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN); 345 skb = netdev_alloc_skb_ip_align(vi->dev, GOOD_COPY_LEN);
347 if (unlikely(!skb)) { 346 if (unlikely(!skb)) {
348 oom = true; 347 oom = true;
349 break; 348 break;
350 } 349 }
351 350
352 skb_reserve(skb, NET_IP_ALIGN);
353
354 f = &skb_shinfo(skb)->frags[0]; 351 f = &skb_shinfo(skb)->frags[0];
355 f->page = get_a_page(vi, gfp); 352 f->page = get_a_page(vi, gfp);
356 if (!f->page) { 353 if (!f->page) {
@@ -431,8 +428,8 @@ again:
431 /* Out of packets? */ 428 /* Out of packets? */
432 if (received < budget) { 429 if (received < budget) {
433 napi_complete(napi); 430 napi_complete(napi);
434 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) 431 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) &&
435 && napi_schedule_prep(napi)) { 432 napi_schedule_prep(napi)) {
436 vi->rvq->vq_ops->disable_cb(vi->rvq); 433 vi->rvq->vq_ops->disable_cb(vi->rvq);
437 __napi_schedule(napi); 434 __napi_schedule(napi);
438 goto again; 435 goto again;
@@ -893,9 +890,9 @@ static int virtnet_probe(struct virtio_device *vdev)
893 INIT_DELAYED_WORK(&vi->refill, refill_work); 890 INIT_DELAYED_WORK(&vi->refill, refill_work);
894 891
895 /* If we can receive ANY GSO packets, we must allocate large ones. */ 892 /* If we can receive ANY GSO packets, we must allocate large ones. */
896 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) 893 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
897 || virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) 894 virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) ||
898 || virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN)) 895 virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN))
899 vi->big_packets = true; 896 vi->big_packets = true;
900 897
901 if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) 898 if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))