From: Jarek Poplawski <jarkao2@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: jcliburn@gmail.com, netdev@vger.kernel.org, jacliburn@bellsouth.net
Subject: [PATCH] pkt_sched: Simplify dev_requeue_skb and dequeue_skb
Date: Mon, 6 Oct 2008 19:38:42 +0200 [thread overview]
Message-ID: <20081006173842.GA2610@ami.dom.local> (raw)
In-Reply-To: <20081006.095501.128868430.davem@davemloft.net>
On Mon, Oct 06, 2008 at 09:55:01AM -0700, David Miller wrote:
> From: Jarek Poplawski <jarkao2@gmail.com>
> Date: Mon, 6 Oct 2008 09:45:43 +0000
>
> > pkt_sched: Fix handling of gso skbs on requeuing
> >
> > Jay Cliburn noticed and diagnosed a bug triggered in
> > dev_gso_skb_destructor() after last change from qdisc->gso_skb
> > to qdisc->requeue list. Since gso_segmented skbs can't be queued
> > to another list this patch brings back qdisc->gso_skb for them.
> >
> > Reported-by: Jay Cliburn <jcliburn@gmail.com>
> > Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
>
> Applied thanks Jarek.
Actually, I was just about to send take 2...
So, here is some PS.
Thanks,
Jarek P.
--------------------->
pkt_sched: Simplify dev_requeue_skb and dequeue_skb
qdisc->requeue was planned to universally replace all requeuing code,
but at the top level we never requeue more than one skb, so qdisc->
gso_skb is enough for this. qdisc->requeue would be used on the lower
levels only for one level deep requeuing (like in sch_hfsc) after
finishing all the changes.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
diff -Nurp a/net/sched/sch_generic.c b/net/sched/sch_generic.c
--- a/net/sched/sch_generic.c 2008-10-06 19:07:28.000000000 +0200
+++ b/net/sched/sch_generic.c 2008-10-06 18:26:29.000000000 +0200
@@ -44,12 +44,9 @@ static inline int qdisc_qlen(struct Qdis
static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q)
{
- if (unlikely(skb->next))
- q->gso_skb = skb;
- else
- __skb_queue_head(&q->requeue, skb);
-
+ q->gso_skb = skb;
__netif_schedule(q);
+
return 0;
}
@@ -57,24 +54,16 @@ static inline struct sk_buff *dequeue_sk
{
struct sk_buff *skb = q->gso_skb;
- if (!skb)
- skb = skb_peek(&q->requeue);
-
if (unlikely(skb)) {
struct net_device *dev = qdisc_dev(q);
struct netdev_queue *txq;
/* check the reason of requeuing without tx lock first */
txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
- if (!netif_tx_queue_stopped(txq) &&
- !netif_tx_queue_frozen(txq)) {
- if (q->gso_skb)
- q->gso_skb = NULL;
- else
- __skb_unlink(skb, &q->requeue);
- } else {
+ if (!netif_tx_queue_stopped(txq) && !netif_tx_queue_frozen(txq))
+ q->gso_skb = NULL;
+ else
skb = NULL;
- }
} else {
skb = q->dequeue(q);
}
next prev parent reply other threads:[~2008-10-06 17:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-05 18:24 [net-next-2.6] Null pointer dereference in dev_gso_skb_destructor() Jay Cliburn
2008-10-06 9:45 ` [PATCH] " Jarek Poplawski
2008-10-06 16:55 ` David Miller
2008-10-06 17:38 ` Jarek Poplawski [this message]
2008-10-06 17:41 ` [PATCH] pkt_sched: Simplify dev_requeue_skb and dequeue_skb David Miller
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=20081006173842.GA2610@ami.dom.local \
--to=jarkao2@gmail.com \
--cc=davem@davemloft.net \
--cc=jacliburn@bellsouth.net \
--cc=jcliburn@gmail.com \
--cc=netdev@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 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).