* skb header allocation
@ 2009-08-26 3:04 Chris Ross
2009-08-26 3:15 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Chris Ross @ 2009-08-26 3:04 UTC (permalink / raw)
To: netdev
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?
thanks
-chris
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: skb header allocation
2009-08-26 3:04 skb header allocation Chris Ross
@ 2009-08-26 3:15 ` Stephen Hemminger
2009-08-26 6:01 ` Frank Blaschka
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2009-08-26 3:15 UTC (permalink / raw)
To: Chris Ross; +Cc: netdev
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.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: skb header allocation
2009-08-26 3:15 ` Stephen Hemminger
@ 2009-08-26 6:01 ` Frank Blaschka
2009-09-03 23:23 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Frank Blaschka @ 2009-08-26 6:01 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Chris Ross, netdev
Is it save to change dev->hard_header_len to a value other than ETH_HLEN for
an ethernet device?
I rememeber we run in trouble with some kernel components (netfilter?, I'm
not sure can't remember the details ...) when we did this is the past.
Is this not an issue any more?
Thanks
Stephen Hemminger schrieb:
> 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.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: skb header allocation
2009-08-26 6:01 ` Frank Blaschka
@ 2009-09-03 23:23 ` Stephen Hemminger
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2009-09-03 23:23 UTC (permalink / raw)
To: Frank Blaschka; +Cc: Chris Ross, netdev
On Wed, 26 Aug 2009 08:01:23 +0200
Frank Blaschka <blaschka@linux.vnet.ibm.com> wrote:
> Is it save to change dev->hard_header_len to a value other than ETH_HLEN for
> an ethernet device?
>
> I rememeber we run in trouble with some kernel components (netfilter?, I'm
> not sure can't remember the details ...) when we did this is the past.
>
You can add extra data but need a minimum with ETH_HLEN of space above
packet when receiving.
--
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-03 23:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-26 3:04 skb header allocation Chris Ross
2009-08-26 3:15 ` Stephen Hemminger
2009-08-26 6:01 ` Frank Blaschka
2009-09-03 23:23 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).