[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080807062436.GA4256@ff.dom.local>
Date: Thu, 7 Aug 2008 06:24:36 +0000
From: Jarek Poplawski <jarkao2@...il.com>
To: David Miller <davem@...emloft.net>
Cc: jussi.kivilinna@...et.fi, kaber@...sh.net, netdev@...r.kernel.org
Subject: Re: qdisc_enqueue, NET_XMIT_SUCCESS and kfree_skb
On Wed, Aug 06, 2008 at 10:09:11PM -0700, David Miller wrote:
> From: David Miller <davem@...emloft.net>
> Date: Wed, 06 Aug 2008 20:26:36 -0700 (PDT)
>
> >
> > I still haven't seen anyone suggest creating a __NET_XMIT_KFREE_SKB to
> > fix this most rediculious problem.
> >
> > I'm still waiting...
>
> Here is what it might look like. I haven't tried to boot this,
> but the only non-trivial case was SFQ's congestion drop code.
>
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index a7abfda..4bfee1b 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -347,6 +347,7 @@ static inline unsigned int qdisc_pkt_len(struct sk_buff *skb)
> enum net_xmit_qdisc_t {
> __NET_XMIT_STOLEN = 0x00010000,
> __NET_XMIT_BYPASS = 0x00020000,
> + __NET_XMIT_KFREE = 0x00040000,
> };
>
> #ifdef CONFIG_NET_CLS_ACT
> @@ -366,8 +367,15 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
>
> static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
> {
> + int ret;
> +
> qdisc_skb_cb(skb)->pkt_len = skb->len;
> - return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
> + ret = qdisc_enqueue(skb, sch);
> +
> + if (unlikely(ret & __NET_XMIT_KFREE))
> + kfree_skb(skb);
Looks very interesting, but isn't there possible a little optimization?
If (almost?) everything not NET_XMIT_SUCCESS does this maybe?:
if (unlikely(ret != NET_XMIT_SUCCESS))
kfree_skb(skb);
or:
if (unlikely(ret != NET_XMIT_SUCCESS &&
!(ret & __NET_XMIT_SKIP_KFREE)))
kfree_skb(skb);
Anyway, it's quite a bit of change, so I definitely need more time to
check this (after awakening...).
Jarek P.
> +
> + return ret & NET_XMIT_MASK;
> }
...
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists