* hard_start_xmit struct sk_buff read-only?
@ 2007-12-22 6:32 Matti Linnanvuori
2007-12-22 8:50 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: Matti Linnanvuori @ 2007-12-22 6:32 UTC (permalink / raw)
To: netdev
An old article about Linux's network drivers mentioned
that the struct sk_buff whose pointer is passed to a
driver's hard_start_xmit function is read-only to the
function. Is that still so? If it is, there is no
mention about it in the kernel tree as far as I know.
Heute schon einen Blick in die Zukunft von E-Mails wagen? www.yahoo.de/mail
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hard_start_xmit struct sk_buff read-only?
2007-12-22 6:32 hard_start_xmit struct sk_buff read-only? Matti Linnanvuori
@ 2007-12-22 8:50 ` Jeff Garzik
2007-12-22 9:18 ` Matti Linnanvuori
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2007-12-22 8:50 UTC (permalink / raw)
To: Matti Linnanvuori; +Cc: netdev
Matti Linnanvuori wrote:
> An old article about Linux's network drivers mentioned
> that the struct sk_buff whose pointer is passed to a
> driver's hard_start_xmit function is read-only to the
> function. Is that still so? If it is, there is no
> mention about it in the kernel tree as far as I know.
This begs the question, what are you trying to do? ;-)
In terms of object lifetimes, control passes to the net driver when
->hard_start_xmit() is called, but that does not mean you can freely
scribble over things -- the skb may have been cloned, its destructor
callback still needs to be called (via dev_kfree_skb), etc.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hard_start_xmit struct sk_buff read-only?
2007-12-22 8:50 ` Jeff Garzik
@ 2007-12-22 9:18 ` Matti Linnanvuori
0 siblings, 0 replies; 3+ messages in thread
From: Matti Linnanvuori @ 2007-12-22 9:18 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
--- Jeff Garzik <jeff@garzik.org> schrieb:
> This begs the question, what are you trying to do?
> ;-)
I have seen network drivers whose hard_start_xmit
function calls skb_push or skb_put to extend the used
data area of the struct skb_buff passed to the
function. That avoids allocating a new buffer and
copying the whole data area to it. The drivers
apparently do that because the device expects a
specific header or suffix in the DMA buffer it
handles.
> In terms of object lifetimes, control passes to the
> net driver when
> ->hard_start_xmit() is called, but that does not
> mean you can freely
> scribble over things -- the skb may have been
> cloned, its destructor
> callback still needs to be called (via
> dev_kfree_skb), etc.
So I assume modifying the data or header area of
struct sk_buff is incorrect because it can break
cloned buffers.
Heute schon einen Blick in die Zukunft von E-Mails wagen? www.yahoo.de/mail
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-12-22 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-22 6:32 hard_start_xmit struct sk_buff read-only? Matti Linnanvuori
2007-12-22 8:50 ` Jeff Garzik
2007-12-22 9:18 ` Matti Linnanvuori
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).