All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krishna Kumar <krkumar2@in.ibm.com>
To: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	Krishna Kumar <krkumar2@in.ibm.com>
Subject: Re: [PATCH] PATCH 1/2 [SCHED 2.6.24]: Check subqueue status before calling hard_start_xmit
Date: Wed, 14 Nov 2007 11:34:12 +0530	[thread overview]
Message-ID: <20071114060412.9556.84833.sendpatchset@localhost.localdomain> (raw)

Hi Peter,

Peter wrote on 11/13/2007 11:14:50 PM:
> @@ -134,7 +134,7 @@ static inline int qdisc_restart(struct net_device *dev)
>  {
>     struct Qdisc *q = dev->qdisc;
>     struct sk_buff *skb;
> -   int ret;
> +   int ret = NETDEV_TX_BUSY;
>  
>     /* Dequeue packet */
>     if (unlikely((skb = dev_dequeue_skb(dev, q)) == NULL))
> @@ -145,7 +145,8 @@ static inline int qdisc_restart(struct net_device *dev)
>     spin_unlock(&dev->queue_lock);
>  
>     HARD_TX_LOCK(dev, smp_processor_id());
> -   ret = dev_hard_start_xmit(skb, dev);
> +   if (!netif_subqueue_stopped(dev, skb))
> +      ret = dev_hard_start_xmit(skb, dev);
>     HARD_TX_UNLOCK(dev);

You could optimize this by getting HARD_TX_LOCK after the check. I
assume that netif_stop_subqueue (from another CPU) would always be
called by the driver xmit, and that is not possible since we hold
the __LINK_STATE_QDISC_RUNNING bit. Does that sound correct?

PATCH
------

diff -ruNp 1/net/sched/sch_generic.c 2/net/sched/sch_generic.c
--- 1/net/sched/sch_generic.c	2007-11-14 11:14:10.000000000 +0530
+++ 2/net/sched/sch_generic.c	2007-11-14 11:18:27.000000000 +0530
@@ -144,10 +144,11 @@ static inline int qdisc_restart(struct n
 	/* And release queue */
 	spin_unlock(&dev->queue_lock);
 
-	HARD_TX_LOCK(dev, smp_processor_id());
 	if (!netif_subqueue_stopped(dev, skb))
+		HARD_TX_LOCK(dev, smp_processor_id());
 		ret = dev_hard_start_xmit(skb, dev);
-	HARD_TX_UNLOCK(dev);
+		HARD_TX_UNLOCK(dev);
+	}
 
 	spin_lock(&dev->queue_lock);
 	q = dev->qdisc;

Thanks,

- KK

             reply	other threads:[~2007-11-14  6:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14  6:04 Krishna Kumar [this message]
2007-11-14  6:14 ` [PATCH] PATCH 1/2 [SCHED 2.6.24]: Check subqueue status before calling hard_start_xmit David Miller
2007-11-14  7:47   ` Krishna Kumar2
2007-11-14  8:28   ` Krishna Kumar2
2007-11-15 20:57 ` Waskiewicz Jr, Peter P
  -- strict thread matches above, loose matches on Subject: below --
2007-11-13 17:44 [PATCH] SCHED: Fix unnecesary driver entries when queue is stopped PJ Waskiewicz
2007-11-13 17:44 ` [PATCH] PATCH 1/2 [SCHED 2.6.24]: Check subqueue status before calling hard_start_xmit PJ Waskiewicz
2007-11-14  4:41   ` 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=20071114060412.9556.84833.sendpatchset@localhost.localdomain \
    --to=krkumar2@in.ibm.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=peter.p.waskiewicz.jr@intel.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 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.