Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752315Ab3JaLfJ (ORCPT ); Thu, 31 Oct 2013 07:35:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32686 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715Ab3JaLfH (ORCPT ); Thu, 31 Oct 2013 07:35:07 -0400 Message-ID: <5272405A.4050708@redhat.com> Date: Thu, 31 Oct 2013 19:34:50 +0800 From: Jason Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Kmindg G CC: davem@davemloft.net, edumazet@google.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, mst@redhat.com, rusty@rustcorp.com.au, mwdalton@google.com, virtualization@lists.linux-foundation.org Subject: Re: [PATCH net-next 1/2] net: introduce skb_coalesce_rx_frag() References: <1383215313-23651-1-git-send-email-jasowang@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2548 Lines: 60 On 10/31/2013 07:05 PM, Kmindg G wrote: > On Thu, Oct 31, 2013 at 6:28 PM, Jason Wang wrote: >> > 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 >> > Cc: Michael S. Tsirkin >> > Cc: Michael Dalton >> > Cc: Eric Dumazet >> > Signed-off-by: Jason Wang >> > --- >> > include/linux/skbuff.h | 3 +++ >> > net/core/skbuff.c | 13 +++++++++++++ >> > 2 files changed, 16 insertions(+) >> > >> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h >> > index 2c15497..e34652b 100644 >> > --- a/include/linux/skbuff.h >> > +++ b/include/linux/skbuff.h >> > @@ -1372,6 +1372,9 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, >> > void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, >> > int size, unsigned int truesize); >> > >> > +void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int off, int size, >> > + unsigned int truesize); >> > + >> > #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) >> > #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) >> > #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) >> > diff --git a/net/core/skbuff.c b/net/core/skbuff.c >> > index 0ab32fa..fdef994 100644 >> > --- a/net/core/skbuff.c >> > +++ b/net/core/skbuff.c >> > @@ -476,6 +476,19 @@ 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 off, 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; >> > + skb_frag_unref(skb, i); >> > +} > I didn't see you use "off" in skb_coalesce_rx_frag. > Ture, it's useless. Will post V2. Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/