From: Jason Wang <jasowang@redhat.com>
To: Kmindg G <kmindg@gmail.com>
Cc: mwdalton@google.com, mst@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, edumazet@google.com,
davem@davemloft.net
Subject: Re: [PATCH net-next 1/2] net: introduce skb_coalesce_rx_frag()
Date: Thu, 31 Oct 2013 19:34:50 +0800 [thread overview]
Message-ID: <5272405A.4050708@redhat.com> (raw)
In-Reply-To: <CAOjA20XtG80ePVKKiTHWvy7m99wo5sYC+64RTJN2tWNEopRiSQ@mail.gmail.com>
On 10/31/2013 07:05 PM, Kmindg G wrote:
> On Thu, Oct 31, 2013 at 6:28 PM, Jason Wang <jasowang@redhat.com> 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 <rusty@rustcorp.com.au>
>> > Cc: Michael S. Tsirkin <mst@redhat.com>
>> > Cc: Michael Dalton <mwdalton@google.com>
>> > Cc: Eric Dumazet <edumazet@google.com>
>> > Signed-off-by: Jason Wang <jasowang@redhat.com>
>> > ---
>> > 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
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: Kmindg G <kmindg@gmail.com>
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()
Date: Thu, 31 Oct 2013 19:34:50 +0800 [thread overview]
Message-ID: <5272405A.4050708@redhat.com> (raw)
In-Reply-To: <CAOjA20XtG80ePVKKiTHWvy7m99wo5sYC+64RTJN2tWNEopRiSQ@mail.gmail.com>
On 10/31/2013 07:05 PM, Kmindg G wrote:
> On Thu, Oct 31, 2013 at 6:28 PM, Jason Wang <jasowang@redhat.com> 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 <rusty@rustcorp.com.au>
>> > Cc: Michael S. Tsirkin <mst@redhat.com>
>> > Cc: Michael Dalton <mwdalton@google.com>
>> > Cc: Eric Dumazet <edumazet@google.com>
>> > Signed-off-by: Jason Wang <jasowang@redhat.com>
>> > ---
>> > 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
next prev parent reply other threads:[~2013-10-31 11:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 10:28 [PATCH net-next 1/2] net: introduce skb_coalesce_rx_frag() Jason Wang
2013-10-31 10:28 ` Jason Wang
2013-10-31 10:28 ` [PATCH net-next 2/2] virtio-net: coalesce rx frags when possible during rx Jason Wang
2013-10-31 10:28 ` Jason Wang
2013-10-31 11:41 ` Michael S. Tsirkin
2013-10-31 11:41 ` Michael S. Tsirkin
2013-11-01 2:13 ` Rusty Russell
2013-11-01 2:13 ` Rusty Russell
2013-11-01 5:37 ` Jason Wang
2013-10-31 11:05 ` [PATCH net-next 1/2] net: introduce skb_coalesce_rx_frag() Kmindg G
2013-10-31 11:34 ` Jason Wang [this message]
2013-10-31 11:34 ` Jason Wang
2013-10-31 11:05 ` Kmindg G
2013-10-31 11:41 ` Michael S. Tsirkin
2013-10-31 11:41 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5272405A.4050708@redhat.com \
--to=jasowang@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kmindg@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mwdalton@google.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.