[lkml]   [2001]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectsk_buff destructor in 2.2.18
Hi all,

I'm trying to figure out how to use the destructor function in the skbuff
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
if (skb==NULL) ...
fill data
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

Thank you,

Christophe Barbé
Software Engineer -
Lineo France - Lineo High Availability Group
42-46, rue Médéric - 92110 Clichy - France
phone (33). - fax (33).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:53    [W:0.038 / U:1.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site