{"id":619,"url":"http://patchwork.ozlabs.org/api/1.0/patches/619/?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":"<20080919130755.GA13578@ff.dom.local>","date":"2008-09-19T13:07:55","name":"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/20080919130755.GA13578@ff.dom.local/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/619/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 70E8CDDFCE\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 19 Sep 2008 23:08:16 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752694AbYISNIL (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 19 Sep 2008 09:08:11 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1752660AbYISNIL\n\t(ORCPT <rfc822; netdev-outgoing>); Fri, 19 Sep 2008 09:08:11 -0400","from fg-out-1718.google.com ([72.14.220.156]:33915 \"EHLO\n\tfg-out-1718.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752082AbYISNIJ (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 19 Sep 2008 09:08:09 -0400","by fg-out-1718.google.com with SMTP id 19so560667fgg.17\n\tfor <netdev@vger.kernel.org>; Fri, 19 Sep 2008 06:08:07 -0700 (PDT)","by 10.86.80.17 with SMTP id d17mr1894006fgb.47.1221829687511;\n\tFri, 19 Sep 2008 06:08:07 -0700 (PDT)","from ff.dom.local (bv170.internetdsl.tpnet.pl [80.53.205.170])\n\tby mx.google.com with ESMTPS id 12sm95879fgg.0.2008.09.19.06.07.59\n\t(version=SSLv3 cipher=RC4-MD5);\n\tFri, 19 Sep 2008 06:08:03 -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:references:mime-version:content-type:content-disposition\n\t:in-reply-to:user-agent;\n\tbh=iq65ttgXk6rCtbLXeHzK7qnqeU1Sug/RPq/zlxLw7tg=;\n\tb=XEmFr83WVwSQ68TmB8L9Mz8gCMcGW4Li6naFEGuc/q2hTEkZ9x1/UMeEeTaPgZ5yaz\n\tdug+yuCnuM2FCHlZf/+yicYyF0oKglxVWhR0n6HwZAL4E2f+I9DU19wNDMCRf0sak2VE\n\tdkBYk3tfvXyvLgLpKnOFoaFsWVBlJwLueOXzw=","DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-type:content-disposition:in-reply-to:user-agent;\n\tb=iam7tq+vICa0Km9rDvjOCKyTXupUY5RyPqMfwH5QrQrPuK5nnkOPxgn1e0m5YqcqkJ\n\t5SNq60fmHu0mucejoUA2bk7ZBGERyS3kWbz1x5YDiSS1aEBpcKi5G99cdrju6Ppf5y+/\n\tBF4K0b+pBaYvIxCkMHNkvb5jYmJKxx/r6YoRg=","Date":"Fri, 19 Sep 2008 13:07:55 +0000","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] pkt_sched: Fix TX state checking in qdisc_run()","Message-ID":"<20080919130755.GA13578@ff.dom.local>","References":"<20080918063036.27934.91273.stgit@localhost.localdomain>\n\t<20080918194419.GA2982@ami.dom.local>\n\t<5f2db9d90809181811q74c3211fp9a099acb8e895fd4@mail.gmail.com>\n\t<20080919103225.GB9135@ff.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":"pkt_sched: Fix TX state checking in qdisc_run()\n\nCurrent check wrongly uses the state of the first tx queue for all tx\nqueues. This patch brings back per dev __LINK_STATE_XOFF flag, which\nis set when all tx queues are stopped. This check is needed in\nqdisc_run() to avoid useless __netif_schedule() calls.\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":[]}