summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2013-11-01 14:07:47 +0800
committerDavid S. Miller <davem@davemloft.net>2013-11-04 20:03:52 -0500
commitf8e617e100d7369a0108f96abf4414e9fb82ced7 (patch)
tree669f70c7c3ce6ed05097771890d708d83f1eb8be /net/core
parente50fddc8b0c0698cba446221be3654aa0a642372 (diff)
downloadop-kernel-dev-f8e617e100d7369a0108f96abf4414e9fb82ced7.zip
op-kernel-dev-f8e617e100d7369a0108f96abf4414e9fb82ced7.tar.gz
net: introduce skb_coalesce_rx_frag()
Sometimes we need to coalesce the rx frags to avoid frag list. One example is virtio-net driver which tries to use small frags for both MTU sized packet and GSO packet. So this patch introduce skb_coalesce_rx_frag() to do this. Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Michael Dalton <mwdalton@google.com> Cc: Eric Dumazet <edumazet@google.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/skbuff.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index e411559..3735fad 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -476,6 +476,18 @@ void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
}
EXPORT_SYMBOL(skb_add_rx_frag);
+void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
+ unsigned int truesize)
+{
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
+
+ skb_frag_size_add(frag, size);
+ skb->len += size;
+ skb->data_len += size;
+ skb->truesize += truesize;
+}
+EXPORT_SYMBOL(skb_coalesce_rx_frag);
+
static void skb_drop_list(struct sk_buff **listp)
{
kfree_skb_list(*listp);
OpenPOWER on IntegriCloud