From: Jarek Poplawski <jarkao2@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Alexander Duyck <alexander.duyck@gmail.com>,
Alexander Duyck <alexander.h.duyck@intel.com>,
netdev@vger.kernel.org, herbert@gondor.apana.org.au,
kaber@trash.net
Subject: [PATCH] pkt_sched: Fix TX state checking in qdisc_run()
Date: Fri, 19 Sep 2008 13:07:55 +0000 [thread overview]
Message-ID: <20080919130755.GA13578@ff.dom.local> (raw)
In-Reply-To: <20080919103225.GB9135@ff.dom.local>
pkt_sched: Fix TX state checking in qdisc_run()
Current check wrongly uses the state of the first tx queue for all tx
queues. This patch brings back per dev __LINK_STATE_XOFF flag, which
is set when all tx queues are stopped. This check is needed in
qdisc_run() to avoid useless __netif_schedule() calls.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
include/linux/netdevice.h | 7 ++++++-
include/net/pkt_sched.h | 4 +---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 488c56e..dc76e4b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -271,6 +271,7 @@ struct header_ops {
enum netdev_state_t
{
+ __LINK_STATE_XOFF,
__LINK_STATE_START,
__LINK_STATE_PRESENT,
__LINK_STATE_NOCARRIER,
@@ -1043,6 +1044,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
static inline void netif_wake_queue(struct net_device *dev)
{
netif_tx_wake_queue(netdev_get_tx_queue(dev, 0));
+ clear_bit(__LINK_STATE_XOFF, &dev->state);
}
static inline void netif_tx_wake_all_queues(struct net_device *dev)
@@ -1053,6 +1055,7 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
netif_tx_wake_queue(txq);
}
+ clear_bit(__LINK_STATE_XOFF, &dev->state);
}
static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
@@ -1069,6 +1072,7 @@ static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
*/
static inline void netif_stop_queue(struct net_device *dev)
{
+ set_bit(__LINK_STATE_XOFF, &dev->state);
netif_tx_stop_queue(netdev_get_tx_queue(dev, 0));
}
@@ -1076,6 +1080,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev)
{
unsigned int i;
+ set_bit(__LINK_STATE_XOFF, &dev->state);
for (i = 0; i < dev->num_tx_queues; i++) {
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
netif_tx_stop_queue(txq);
@@ -1095,7 +1100,7 @@ static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
*/
static inline int netif_queue_stopped(const struct net_device *dev)
{
- return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
+ return test_bit(__LINK_STATE_XOFF, &dev->state);
}
static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue)
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index b786a5b..1718a60 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -90,9 +90,7 @@ extern void __qdisc_run(struct Qdisc *q);
static inline void qdisc_run(struct Qdisc *q)
{
- struct netdev_queue *txq = q->dev_queue;
-
- if (!netif_tx_queue_stopped(txq) &&
+ if (!netif_queue_stopped(qdisc_dev(q)) &&
!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
__qdisc_run(q);
}
next prev parent reply other threads:[~2008-09-19 13:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-18 6:43 [RFC PATCH] sched: only dequeue if packet can be queued to hardware queue Alexander Duyck
2008-09-18 6:56 ` Alexander Duyck
2008-09-18 9:46 ` David Miller
2008-09-18 14:51 ` Alexander Duyck
2008-09-18 19:44 ` Jarek Poplawski
2008-09-19 1:11 ` Alexander Duyck
2008-09-19 9:17 ` Jarek Poplawski
2008-09-19 10:32 ` [take 2] " Jarek Poplawski
2008-09-19 13:07 ` Jarek Poplawski [this message]
2008-09-19 14:44 ` [PATCH take2] pkt_sched: Fix TX state checking in qdisc_run() Jarek Poplawski
2008-09-19 17:49 ` Jarek Poplawski
2008-09-21 5:18 ` David Miller
2008-09-19 17:46 ` [take 2] Re: [RFC PATCH] sched: only dequeue if packet can be queued to hardware queue Jarek Poplawski
2008-09-19 15:16 ` Jarek Poplawski
2008-09-19 16:26 ` Duyck, Alexander H
2008-09-19 17:35 ` Jarek Poplawski
2008-09-19 18:01 ` Duyck, Alexander H
2008-09-19 18:51 ` Jarek Poplawski
2008-09-19 21:43 ` Duyck, Alexander H
2008-09-19 16:37 ` Jarek Poplawski
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=20080919130755.GA13578@ff.dom.local \
--to=jarkao2@gmail.com \
--cc=alexander.duyck@gmail.com \
--cc=alexander.h.duyck@intel.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kaber@trash.net \
--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).