netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: netdev@oss.sgi.com
Subject: Usage of skb->cb and dev->xmit_lock
Date: Fri, 17 May 2002 01:58:53 +0200	[thread overview]
Message-ID: <3CE447BD.8040107@ws.localnet> (raw)

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

                 reply	other threads:[~2002-05-16 23:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3CE447BD.8040107@ws.localnet \
    --to=kaber@trash.net \
    --cc=netdev@oss.sgi.com \
    /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 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).