netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Usage of skb->cb and dev->xmit_lock
@ 2002-05-16 23:58 Patrick McHardy
  0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2002-05-16 23:58 UTC (permalink / raw)
  To: netdev

Hi.

I'm looking for some advice concerning two things.
First a little introduction:

I've written a software device used as a placeholder for qdiscs to 
perform ingress shaping / shaping over multiple interfaces. It feeds
itself packets marked by an iptables target through netfilter hooks.
For marked packets NF_QUEUE is returned and the packet is then enqueued
to the attached qdisc. The device's xmit function later reinjects them 
to the network stack.

Now my problems:
For reinjecting i need to keep the struct nf_info passed to my netfilter 
  queue handler. I therefore introduced a new field in struct sk_buff.
I don't really like this solution so i though of using skb->cb.
It says "This is owned by whoever has the skb queued ATM." which of 
course if not the device but the qdisc. But i haven't found any 
refernece to it in any qdisc so my question is: is it safe to use 
skb->cb in this altered code flow ?

The second problem arises when used with tunnels (only gre tested).
If packets going to a gre tunnel are redirected though imq and the gre 
packets themselves are redirected too then qdisc_restart starts 
complaining about the tunnel device beeing deadlooped. (why the tunnel 
device and not mine?). I thought releasing dev->xmit_lock before calling 
nf_reinject and grabing it back afterwards would solve the problem, but 
i'm not sure about the consequences ..
i guess on UP it doesn't matter, on SMP the worst thing i can imagine is 
   one processor waiting until the lock becomes free for grabbing it 
back if in the meantime another processor has taken it.
Can someone please enlighten me ? :)

Thanks for your help,
Patrick

PS: If you want to look at the source, it is available at 
http://luxik.cdi.cz/~patrick/imq

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-16 23:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-16 23:58 Usage of skb->cb and dev->xmit_lock Patrick McHardy

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).