{"id":629,"url":"http://patchwork.ozlabs.org/api/1.0/patches/629/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20080919144450.GA2646@ami.dom.local>","date":"2008-09-19T14:44:50","name":"[take2] pkt_sched: Fix TX state checking in qdisc_run()","commit_ref":null,"pull_url":null,"state":"rfc","archived":true,"hash":"95b9bdba012cbf6c2d6049a2c4bb05519a43ffef","submitter":{"id":277,"url":"http://patchwork.ozlabs.org/api/1.0/people/277/?format=json","name":"Jarek Poplawski","email":"jarkao2@gmail.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.0/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20080919144450.GA2646@ami.dom.local/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/629/checks/","tags":{},"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Received":["from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 328C1DE00C\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 20 Sep 2008 00:44:52 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750977AbYISOos (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 19 Sep 2008 10:44:48 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1750987AbYISOos\n\t(ORCPT <rfc822; netdev-outgoing>); Fri, 19 Sep 2008 10:44:48 -0400","from ey-out-2122.google.com ([74.125.78.24]:8718 \"EHLO\n\tey-out-2122.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750927AbYISOor (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 19 Sep 2008 10:44:47 -0400","by ey-out-2122.google.com with SMTP id 6so143977eyi.37\n\tfor <netdev@vger.kernel.org>; Fri, 19 Sep 2008 07:44:45 -0700 (PDT)","by 10.103.213.19 with SMTP id p19mr143241muq.70.1221835484886;\n\tFri, 19 Sep 2008 07:44:44 -0700 (PDT)","from ami.dom.local ( [83.27.43.118])\n\tby mx.google.com with ESMTPS id y2sm5379193mug.2.2008.09.19.07.44.41\n\t(version=SSLv3 cipher=RC4-MD5);\n\tFri, 19 Sep 2008 07:44:44 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\n\th=domainkey-signature:received:received:date:from:to:cc:subject\n\t:message-id:mime-version:content-type:content-disposition\n\t:in-reply-to:user-agent;\n\tbh=+iWI+v2sN7Zw0lRDFD2iLMWKlD81p4M3IEpR0lArcfo=;\n\tb=Zj638sMw16i14jKp3OP995tEVZ24mIKiGnrtx5+VIByeC0tYnt0NAy5In9Tb8ZioIL\n\tEYuGQWzFHqkqPBoCrhYUbNHspqWB0l+pm4ijgGUEjwQsUvTApudGnyVXLCj79LOFa/Qp\n\tJO/ecdkfY4ZzifZL3qnS6/kzxPEsiQraHyRRE=","DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\n\th=date:from:to:cc:subject:message-id:mime-version:content-type\n\t:content-disposition:in-reply-to:user-agent;\n\tb=n4wVEDJyc6ADmVx2nn6WxlQAlzMcdMLUQ2Qc2mS3XBSsHqyInAh/EYbOb1fgNKQBAE\n\tgHY7zmORKqNyW7d+20UBNGoAQdx7Ng/yEVsYyfl+m52zfw2tdcmKMUz1Y/ie961Q8uzX\n\tsdSVzaVybGQaaborC15UUZDpv2PIlDMZiVRGA=","Date":"Fri, 19 Sep 2008 16:44:50 +0200","From":"Jarek Poplawski <jarkao2@gmail.com>","To":"David Miller <davem@davemloft.net>","Cc":"Alexander Duyck <alexander.duyck@gmail.com>,\n\tAlexander Duyck <alexander.h.duyck@intel.com>,\n\tnetdev@vger.kernel.org, herbert@gondor.apana.org.au, kaber@trash.net","Subject":"[PATCH take2] pkt_sched: Fix TX state checking in qdisc_run()","Message-ID":"<20080919144450.GA2646@ami.dom.local>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20080919103225.GB9135@ff.dom.local>","User-Agent":"Mutt/1.5.18 (2008-05-17)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Alas this time the changelog needs more details.\n\nSorry,\nJarek P.\n-----------------> (take 2)\n\npkt_sched: Fix TX state checking in qdisc_run()\n\nCurrent check wrongly uses the state of the first tx queue for all tx\nqueues in case of non-default qdiscs. This patch brings back per dev\n__LINK_STATE_XOFF flag, which is set when all tx queues are stopped.\nThis check is needed in qdisc_run() to avoid useless __netif_schedule()\ncalls. The wrongness of this check was first noticed by Herbert Xu.\n\nSigned-off-by: Jarek Poplawski <jarkao2@gmail.com>","diff":"diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex 488c56e..dc76e4b 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -271,6 +271,7 @@ struct header_ops {\n \n enum netdev_state_t\n {\n+\t__LINK_STATE_XOFF,\n \t__LINK_STATE_START,\n \t__LINK_STATE_PRESENT,\n \t__LINK_STATE_NOCARRIER,\n@@ -1043,6 +1044,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)\n static inline void netif_wake_queue(struct net_device *dev)\n {\n \tnetif_tx_wake_queue(netdev_get_tx_queue(dev, 0));\n+\tclear_bit(__LINK_STATE_XOFF, &dev->state);\n }\n \n static inline void netif_tx_wake_all_queues(struct net_device *dev)\n@@ -1053,6 +1055,7 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)\n \t\tstruct netdev_queue *txq = netdev_get_tx_queue(dev, i);\n \t\tnetif_tx_wake_queue(txq);\n \t}\n+\tclear_bit(__LINK_STATE_XOFF, &dev->state);\n }\n \n static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)\n@@ -1069,6 +1072,7 @@ static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)\n  */\n static inline void netif_stop_queue(struct net_device *dev)\n {\n+\tset_bit(__LINK_STATE_XOFF, &dev->state);\n \tnetif_tx_stop_queue(netdev_get_tx_queue(dev, 0));\n }\n \n@@ -1076,6 +1080,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev)\n {\n \tunsigned int i;\n \n+\tset_bit(__LINK_STATE_XOFF, &dev->state);\n \tfor (i = 0; i < dev->num_tx_queues; i++) {\n \t\tstruct netdev_queue *txq = netdev_get_tx_queue(dev, i);\n \t\tnetif_tx_stop_queue(txq);\n@@ -1095,7 +1100,7 @@ static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)\n  */\n static inline int netif_queue_stopped(const struct net_device *dev)\n {\n-\treturn netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));\n+\treturn test_bit(__LINK_STATE_XOFF, &dev->state);\n }\n \n static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue)\ndiff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h\nindex b786a5b..1718a60 100644\n--- a/include/net/pkt_sched.h\n+++ b/include/net/pkt_sched.h\n@@ -90,9 +90,7 @@ extern void __qdisc_run(struct Qdisc *q);\n \n static inline void qdisc_run(struct Qdisc *q)\n {\n-\tstruct netdev_queue *txq = q->dev_queue;\n-\n-\tif (!netif_tx_queue_stopped(txq) &&\n+\tif (!netif_queue_stopped(qdisc_dev(q)) &&\n \t    !test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))\n \t\t__qdisc_run(q);\n }\n","prefixes":["take2"]}