All of lore.kernel.org
 help / color / mirror / Atom feed
* sk_buff destructor in 2.2.18
@ 2001-05-23 14:16 christophe barbé
  2001-05-23 14:27 ` Andi Kleen
  0 siblings, 1 reply; 8+ messages in thread
From: christophe barbé @ 2001-05-23 14:16 UTC (permalink / raw)
  To: lkml

Hi all,

I'm trying to figure out how to use the destructor function in the skbuff
object. 
I've read (the source code and) the alan cox's article from linuxjournal
but it refers to linux 2.0.
Perhaps someone can tell me what's wrong in the following :

Normally the rx code of a network driver do the following code :
allocate a skbuff
	skb=dev_alloc_skb(length);
	if (skb==NULL) ...
fill data
	skb_put(skb,length);
	memcpy((void *)skb->data, buf,length);
end so on ...

In my case, I own the incomming buffer so I would like to use it directly
without copying data.
I've written a new allocation function.
And use the destructor to free my buffer (replacing it on a free list).

First I imagine something is wrong because the destructor is called before
kfree_skbmem() so If I don't lie to skb->cloned (I set it to 1), an
unexpected skb->head occured.
I think the destructor method is provided to free privates data not the
main data. But I can't see an another way to do it.

Secondly, When my destructor function is called, the cloned flag is already
set (and datarefp indicates also that data is referenced elsewhere).
When is a skbuff cloned?
Is there a way to avoid this?
Where can I register a function to free (= replace it in my list) the data
buffer?

Thank you,
Christophe

-- 
Christophe Barbé
Software Engineer - christophe.barbe@lineo.fr
Lineo France - Lineo High Availability Group
42-46, rue Médéric - 92110 Clichy - France
phone (33).1.41.40.02.12 - fax (33).1.41.40.02.01
http://www.lineo.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-05-23 15:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-23 14:16 sk_buff destructor in 2.2.18 christophe barbé
2001-05-23 14:27 ` Andi Kleen
2001-05-23 14:37   ` christophe barbé
2001-05-23 14:40     ` Andi Kleen
2001-05-23 14:50       ` christophe barbé
2001-05-23 14:55         ` Andi Kleen
2001-05-23 15:02           ` christophe barbé
2001-05-23 15:08             ` Andi Kleen

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.