lkml.org 
[lkml]   [2001]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectsk_buff destructor in 2.2.18
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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:53    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site