From: "christophe barbé" <christophe.barbe@lineo.fr>
To: lkml <linux-kernel@vger.kernel.org>
Subject: sk_buff destructor in 2.2.18
Date: Wed, 23 May 2001 16:16:54 +0200 [thread overview]
Message-ID: <20010523161654.C7531@pc8.lineo.fr> (raw)
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
next reply other threads:[~2001-05-23 14:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-23 14:16 christophe barbé [this message]
2001-05-23 14:27 ` sk_buff destructor in 2.2.18 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010523161654.C7531@pc8.lineo.fr \
--to=christophe.barbe@lineo.fr \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.