diff options
author | Krishna Kumar <krkumar2@in.ibm.com> | 2011-10-19 22:17:27 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-20 04:53:56 -0400 |
commit | 8a59a7b94fc56e3ed3054c3c655b646bb631f9bc (patch) | |
tree | 62a491815692b197ebb1425fa03a36c03ff48e3a /drivers/net/virtio_net.c | |
parent | a0bec1cd8f7ac966f2885f7e56ec44df87bab738 (diff) | |
download | linux-8a59a7b94fc56e3ed3054c3c655b646bb631f9bc.tar.bz2 |
virtio_net: Clean up set_skb_frag()
Remove manual initialization in set_skb_frag, and instead
use __skb_fill_page_desc() to do the same. Patch tested
on net-next.
Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 0d4841bed0f9..abbf34fcf4cd 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -143,18 +143,15 @@ static void skb_xmit_done(struct virtqueue *svq) static void set_skb_frag(struct sk_buff *skb, struct page *page, unsigned int offset, unsigned int *len) { + int size = min((unsigned)PAGE_SIZE - offset, *len); int i = skb_shinfo(skb)->nr_frags; - skb_frag_t *f; - f = &skb_shinfo(skb)->frags[i]; - skb_frag_size_set(f, min((unsigned)PAGE_SIZE - offset, *len)); - f->page_offset = offset; - __skb_frag_set_page(f, page); + __skb_fill_page_desc(skb, i, page, offset, size); - skb->data_len += skb_frag_size(f); - skb->len += skb_frag_size(f); + skb->data_len += size; + skb->len += size; skb_shinfo(skb)->nr_frags++; - *len -= skb_frag_size(f); + *len -= size; } static struct sk_buff *page_to_skb(struct virtnet_info *vi, |