diff options
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 25dc77ccbf58..b0577dd1a42d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/virtio_net.h> | 25 | #include <linux/virtio_net.h> |
26 | #include <linux/scatterlist.h> | 26 | #include <linux/scatterlist.h> |
27 | #include <linux/if_vlan.h> | 27 | #include <linux/if_vlan.h> |
28 | #include <linux/slab.h> | ||
28 | 29 | ||
29 | static int napi_weight = 128; | 30 | static int napi_weight = 128; |
30 | module_param(napi_weight, int, 0444); | 31 | module_param(napi_weight, int, 0444); |
@@ -326,6 +327,7 @@ static int add_recvbuf_small(struct virtnet_info *vi, gfp_t gfp) | |||
326 | struct scatterlist sg[2]; | 327 | struct scatterlist sg[2]; |
327 | int err; | 328 | int err; |
328 | 329 | ||
330 | sg_init_table(sg, 2); | ||
329 | skb = netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN); | 331 | skb = netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN); |
330 | if (unlikely(!skb)) | 332 | if (unlikely(!skb)) |
331 | return -ENOMEM; | 333 | return -ENOMEM; |
@@ -351,6 +353,7 @@ static int add_recvbuf_big(struct virtnet_info *vi, gfp_t gfp) | |||
351 | char *p; | 353 | char *p; |
352 | int i, err, offset; | 354 | int i, err, offset; |
353 | 355 | ||
356 | sg_init_table(sg, MAX_SKB_FRAGS + 2); | ||
354 | /* page in sg[MAX_SKB_FRAGS + 1] is list tail */ | 357 | /* page in sg[MAX_SKB_FRAGS + 1] is list tail */ |
355 | for (i = MAX_SKB_FRAGS + 1; i > 1; --i) { | 358 | for (i = MAX_SKB_FRAGS + 1; i > 1; --i) { |
356 | first = get_a_page(vi, gfp); | 359 | first = get_a_page(vi, gfp); |