From: Stephen Hemminger <shemminger@vyatta.com>
To: Chris Ross <chris@compilednetworks.com>
Cc: netdev@vger.kernel.org
Subject: Re: skb header allocation
Date: Tue, 25 Aug 2009 20:15:14 -0700 [thread overview]
Message-ID: <20090825201514.0dd143ad@nehalam> (raw)
In-Reply-To: <17cd85320908252004r31874732n9e06921d6eae4ad7@mail.gmail.com>
On Tue, 25 Aug 2009 22:04:10 -0500
Chris Ross <chris@compilednetworks.com> wrote:
> I have a network driver that acts as a Ethernet device and builds up a
> series of outer headers on skb(s) it receives from upper layers. I am
> currently using the technique that is in ipip.c to ensure I have
> enough room to add my header ...
>
> if (skb_headroom(skb) < some_value || skb_shared(skb) ||
> ((skb_cloned(skb) && !skb_clone_writable(skb, 0))))
> {
> if ((skb2 = skb_realloc_headroom(skb, some_value)) == NULL)
> return -1;
>
> dev_kfree_skb(skb);
> skb = skb2;
> }
>
> Is this the best practice for a high bandwidth scenario?
Define a value of dev->hard_header_len that adds space for what you need.
Use skb_cow_head(skb, headroom) before touching skb header.
next prev parent reply other threads:[~2009-08-26 3:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-26 3:04 skb header allocation Chris Ross
2009-08-26 3:15 ` Stephen Hemminger [this message]
2009-08-26 6:01 ` Frank Blaschka
2009-09-03 23:23 ` Stephen Hemminger
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=20090825201514.0dd143ad@nehalam \
--to=shemminger@vyatta.com \
--cc=chris@compilednetworks.com \
--cc=netdev@vger.kernel.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.