Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Tomas Winkler <tomasw@gmail.com>
Cc: "Emmanuel Grumbach" <egrumbach@gmail.com>,
	"Michał Mirosław" <mirqus@gmail.com>,
	netdev@vger.kernel.org, linux-wireless@vger.kernel.org,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Guy, Wey-Yi" <wey-yi.w.guy@intel.com>,
	guy.cohen@intel.com
Subject: Re: several packets in a single buffer in Rx
Date: Mon, 16 May 2011 21:15:12 +0100	[thread overview]
Message-ID: <1305576912.2885.32.camel@bwh-desktop> (raw)
In-Reply-To: <BANLkTimvCVcQX-7teQgG7EQV9eeLgG3JnQ@mail.gmail.com>

On Mon, 2011-05-16 at 23:04 +0300, Tomas Winkler wrote:
> 2011/5/16 Emmanuel Grumbach <egrumbach@gmail.com>:
> > 2011/5/16 Michał Mirosław <mirqus@gmail.com>:
> >> W dniu 16 maja 2011 14:59 użytkownik Emmanuel Grumbach
> >> <egrumbach@gmail.com> napisał:
> >>> 2011/5/16 Michał Mirosław <mirqus@gmail.com>:
> >>>> 2011/5/16 Emmanuel Grumbach <egrumbach@gmail.com>:
> >>>>> I would like to be able to deliver the same page several times to the
> >>>>> stack without having the stack consume it before the last time I
> >>>>> deliver it.
> >>>>> Of course I would like to avoid cloning it.
> >>>>
> >>>> Just do get_page() on the page having another packet in it before
> >>>> passing skb up.
> >>>>
> >>>
> >>> I can see the path:
> >>> __kfree_skb -> skb_release_all -> skb_release_data -> put_page
> >>> put_page will free the page iff the _count variable reaches 0. Of course,
> >>> _count is incremented by get_page.
> >>>
> >>> I will give it try.
> >>>
> >>> I understand that this will work regardless the order given to
> >>> alloc_pages right ?
> >>
> >> Yes. Remember that if you put a lot of packets in a big-order page
> >> then the memory will be freed only after all packets are freed.
> >
> > Sure. Thanks for the help.
> 
> How it is ensured that skb manipulation won't corrupt another packet
> on the same page?

Fragments attached to an skb are always treated as read-only.  The
headers will be copied into the skb's header buffer and may be modified
there.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


      reply	other threads:[~2011-05-16 20:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16  9:41 several packets in a single buffer in Rx Emmanuel Grumbach
2011-05-16 11:06 ` Michał Mirosław
2011-05-16 12:59   ` Emmanuel Grumbach
2011-05-16 13:13     ` Michał Mirosław
2011-05-16 13:36       ` Emmanuel Grumbach
2011-05-16 20:04         ` Tomas Winkler
2011-05-16 20:15           ` Ben Hutchings [this message]

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=1305576912.2885.32.camel@bwh-desktop \
    --to=bhutchings@solarflare.com \
    --cc=egrumbach@gmail.com \
    --cc=guy.cohen@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mirqus@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=tomasw@gmail.com \
    --cc=wey-yi.w.guy@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox