From patchwork Thu Oct 7 17:49:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12542489 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6923CC433F5 for ; Thu, 7 Oct 2021 17:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CF31610C7 for ; Thu, 7 Oct 2021 17:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243286AbhJGRxJ (ORCPT ); Thu, 7 Oct 2021 13:53:09 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38494 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243381AbhJGRxG (ORCPT ); Thu, 7 Oct 2021 13:53:06 -0400 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1633629067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GqAcs6fZNMpt3K2p53zBaOxfCsVsSpzSeje3PIrdYVA=; b=U5YGeTkq/3C4SEr5GYJNYV7UArfEoPOIA8cn8MrYw/qYcfVXK08rdaLuiYi8e0Dm3bd7Qu QJRHB0C/P5QGqijTjsSJqadvHYRCzW0SwsifopWqW2hVqp/MS9bg4W2sbJ87N7iedaDu4I TZztKYWEv4LzWQexFTHliiAKk46nXbbqy8ZRGqFkkx52/NDMUGdic2qO0gjmdlG+62l5Xv r6K8PXkh1XiZZc5tPR9fcDLcaPZUu/gOkIcO3jVt/i1ZXh9ma1wYlHJEucgaOKguK4/CJ7 poLjXEQyk+4usjNd91ItpvqOdGdz293p/aAlpJ++UFpaSZNFOE+wj+sSJBeXgg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1633629067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GqAcs6fZNMpt3K2p53zBaOxfCsVsSpzSeje3PIrdYVA=; b=RwUQzf70LVcek1YhHvyR0OhmykbexBKB2o4agrrjM7UYISLKIBVDiQ+bvCtgIwQibSHUKl OXD2JLVuqxU30eAA== To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Thomas Gleixner , "Ahmed S. Darwish" , Sebastian Andrzej Siewior , John Fastabend Subject: [PATCH net 1/4] mqprio: Correct stats in mqprio_dump_class_stats(). Date: Thu, 7 Oct 2021 19:49:57 +0200 Message-Id: <20211007175000.2334713-2-bigeasy@linutronix.de> In-Reply-To: <20211007175000.2334713-1-bigeasy@linutronix.de> References: <20211007175000.2334713-1-bigeasy@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org It looks like with the introduction of subqueus the statics broke. Before the change `bstats' and `qstats' on stack was fed and later this was copied over to struct gnet_dump. After the change the `bstats' and `qstats' are only set to 0 and no longer updated and that is then fed to gnet_dump. Additionally qdisc->cpu_bstats and qdisc->cpu_qstats is destroeyd for global stats. For per-CPU stats both __gnet_stats_copy_basic() and __gnet_stats_copy_queue() add the values but for global stats the value set and so the previous value is lost and only the last value from the loop ends up in sch->[bq]stats. Use the on-stack [bq]stats variables again and add the stats manually in the global case. Fixes: ce679e8df7ed2 ("net: sched: add support for TCQ_F_NOLOCK subqueues to sch_mqprio") Cc: John Fastabend Signed-off-by: Sebastian Andrzej Siewior --- net/sched/sch_mqprio.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 8766ab5b87880..5eb3b1b7ae5e7 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -529,22 +529,28 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, for (i = tc.offset; i < tc.offset + tc.count; i++) { struct netdev_queue *q = netdev_get_tx_queue(dev, i); struct Qdisc *qdisc = rtnl_dereference(q->qdisc); - struct gnet_stats_basic_cpu __percpu *cpu_bstats = NULL; - struct gnet_stats_queue __percpu *cpu_qstats = NULL; spin_lock_bh(qdisc_lock(qdisc)); - if (qdisc_is_percpu_stats(qdisc)) { - cpu_bstats = qdisc->cpu_bstats; - cpu_qstats = qdisc->cpu_qstats; - } - qlen = qdisc_qlen_sum(qdisc); - __gnet_stats_copy_basic(NULL, &sch->bstats, - cpu_bstats, &qdisc->bstats); - __gnet_stats_copy_queue(&sch->qstats, - cpu_qstats, - &qdisc->qstats, - qlen); + if (qdisc_is_percpu_stats(qdisc)) { + qlen = qdisc_qlen_sum(qdisc); + + __gnet_stats_copy_basic(NULL, &bstats, + qdisc->cpu_bstats, + &qdisc->bstats); + __gnet_stats_copy_queue(&qstats, + qdisc->cpu_qstats, + &qdisc->qstats, + qlen); + } else { + qlen += qdisc->q.qlen; + bstats.bytes += qdisc->bstats.bytes; + bstats.packets += qdisc->bstats.packets; + qstats.backlog += qdisc->qstats.backlog; + qstats.drops += qdisc->qstats.drops; + qstats.requeues += qdisc->qstats.requeues; + qstats.overlimits += qdisc->qstats.overlimits; + } spin_unlock_bh(qdisc_lock(qdisc)); } From patchwork Thu Oct 7 17:49:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12542493 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B29EC43217 for ; Thu, 7 Oct 2021 17:51:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6484B61248 for ; Thu, 7 Oct 2021 17:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243063AbhJGRxN (ORCPT ); Thu, 7 Oct 2021 13:53:13 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38506 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243383AbhJGRxG (ORCPT ); Thu, 7 Oct 2021 13:53:06 -0400 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1633629068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XOMWDoD1SdKXS/QHNB7RZQwaZoX8OvnSfKd24MnYn+M=; b=yvBf6Q7eADeluCZtE/HRvDGSw/D2mFcxgO+4Sop7TD3hgln+vwAH6MqSpNH0bn4rXnWqqf AMkCEHmLD4Gg92M4XhYp/fOXKBvN0WZSMAKWjQdHnvuK7597SeNcHHOStyuA0guGUK+KNx FX6OFGEe+3tKpmC2WwY2+RiTRM3Kv+BTh22MzrfIzhJzVSthJEGN/vuprfIT8hJ5IkQs0d 6+1gYr+FKbb/c4R7P5RpPzQ1S9U/eYZyHE8Jo7DOdzs2bb9CX9IxZcxose6lNaHJdmbk68 4AghMhGxnMu5h9MY9QS3SvQOAd31+qE29FL3atFkngsJJ+8WYc7Gya9OAOC31g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1633629068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XOMWDoD1SdKXS/QHNB7RZQwaZoX8OvnSfKd24MnYn+M=; b=wpv8QHlzD47W0dYjeeqtVgqC4LzJNnwZeSECdcq79P/f9Ww0d+ACtN0m68dBOc1OXeB3J2 fwWdzxJXcUpxlZBg== To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Thomas Gleixner , "Ahmed S. Darwish" , Sebastian Andrzej Siewior Subject: [PATCH net-next 2/4] gen_stats: Add instead Set the value in __gnet_stats_copy_basic(). Date: Thu, 7 Oct 2021 19:49:58 +0200 Message-Id: <20211007175000.2334713-3-bigeasy@linutronix.de> In-Reply-To: <20211007175000.2334713-1-bigeasy@linutronix.de> References: <20211007175000.2334713-1-bigeasy@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since day one __gnet_stats_copy_basic() always assigned the value to the bstats argument overwriting the previous value. Based on review there are five users of that function as of today: - est_fetch_counters(), ___gnet_stats_copy_basic() memsets() bstats to zero, single invocation. - mq_dump(), mqprio_dump(), mqprio_dump_class_stats() memsets() bstats to zero, multiple invocation but does not use the function due to !qdisc_is_percpu_stats(). It will probably simplify in percpu stats case if the value would be added and not just stored. Signed-off-by: Sebastian Andrzej Siewior --- net/core/gen_stats.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index e491b083b3485..e12e544a7ab0f 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c @@ -143,6 +143,8 @@ __gnet_stats_copy_basic(const seqcount_t *running, struct gnet_stats_basic_packed *b) { unsigned int seq; + __u64 bytes = 0; + __u64 packets = 0; if (cpu) { __gnet_stats_copy_basic_cpu(bstats, cpu); @@ -151,9 +153,12 @@ __gnet_stats_copy_basic(const seqcount_t *running, do { if (running) seq = read_seqcount_begin(running); - bstats->bytes = b->bytes; - bstats->packets = b->packets; + bytes = b->bytes; + packets = b->packets; } while (running && read_seqcount_retry(running, seq)); + + bstats->bytes += bytes; + bstats->packets += packets; } EXPORT_SYMBOL(__gnet_stats_copy_basic); From patchwork Thu Oct 7 17:49:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12542491 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C905C433EF for ; Thu, 7 Oct 2021 17:51:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 484B661248 for ; Thu, 7 Oct 2021 17:51:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243424AbhJGRxM (ORCPT ); Thu, 7 Oct 2021 13:53:12 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38518 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243388AbhJGRxG (ORCPT ); Thu, 7 Oct 2021 13:53:06 -0400 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1633629068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xv5MVdotlTKmY5ii8/4CGxbMZHJ1EOvwZ6cVVhxlQxg=; b=Fy0oijd5wFoLlD3TSiIf4IcZWkYup5fViSvjdwxQ818WmIWIY10De9I+xtYEemqE65dUAF oK01wujjxu+w509eqksizzWWW2gGiIInnzHNdPrG4goqNtylV4Xc1qg+rQZbWeZfF47P1k bH13L6XCoNNcD1MrdFYnFUQInoJQVrsMztzg9H+/6oR8SnOSbGtXc3sIilPRD/6jXlREeu x6TtaLzUNc+EEofrsD2tnjHb15DW0CCdUIBX7txCTaB+MnN8rw3UFEEofIQLQ3BrGKzZCa ZOtlc2Dw67M/swh4sN/e0bhepBIJCOO9J20j6npihkwfOB3K8FtmwKHB/HoWxQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1633629068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xv5MVdotlTKmY5ii8/4CGxbMZHJ1EOvwZ6cVVhxlQxg=; b=sJQzeu0+b2AORl75b5ZifL8WCEzhTaEIw3LuygHBOlfKIacCLR3J8MoDn5tGWn2ECVcvBf KvBxAEsafi3TCXBA== To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Thomas Gleixner , "Ahmed S. Darwish" , Sebastian Andrzej Siewior Subject: [PATCH net-next 3/4] gen_stats: Add instead Set the value in __gnet_stats_copy_queue(). Date: Thu, 7 Oct 2021 19:49:59 +0200 Message-Id: <20211007175000.2334713-4-bigeasy@linutronix.de> In-Reply-To: <20211007175000.2334713-1-bigeasy@linutronix.de> References: <20211007175000.2334713-1-bigeasy@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Based on review there are five users of __gnet_stats_copy_queue as of today: - qdisc_qstats_qlen_backlog(), gnet_stats_copy_queue(), memsets() bstats to zero, single invocation. - mq_dump(), mqprio_dump(), mqprio_dump_class_stats(), memsets() bstats to zero, multiple invocation but does not use the function due to !qdisc_is_percpu_stats(). It will probably simplify in percpu stats case if the value would be added and not just stored. Signed-off-by: Sebastian Andrzej Siewior --- net/core/gen_stats.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index e12e544a7ab0f..76dbae98c83fd 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c @@ -312,14 +312,14 @@ void __gnet_stats_copy_queue(struct gnet_stats_queue *qstats, if (cpu) { __gnet_stats_copy_queue_cpu(qstats, cpu); } else { - qstats->qlen = q->qlen; - qstats->backlog = q->backlog; - qstats->drops = q->drops; - qstats->requeues = q->requeues; - qstats->overlimits = q->overlimits; + qstats->qlen += q->qlen; + qstats->backlog += q->backlog; + qstats->drops += q->drops; + qstats->requeues += q->requeues; + qstats->overlimits += q->overlimits; } - qstats->qlen = qlen; + qstats->qlen += qlen; } EXPORT_SYMBOL(__gnet_stats_copy_queue); From patchwork Thu Oct 7 17:50:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12542497 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F33C433FE for ; Thu, 7 Oct 2021 17:51:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C24361245 for ; Thu, 7 Oct 2021 17:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243401AbhJGRxP (ORCPT ); Thu, 7 Oct 2021 13:53:15 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38530 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243399AbhJGRxG (ORCPT ); Thu, 7 Oct 2021 13:53:06 -0400 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1633629069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MtuwQ+KIKiQM3yaQjSCUzwcZYRlc2d3zt5xqYnLecpM=; b=fEY12/sM7fkkKWyZL21o5bXo1sd1ulKOO4JA3MDd4/uKfMrQIikjUfKgLG9CTovz3OvfUZ T5nX1yN8KHkQO6Q3lgNVltPNeSYftIUzfcY5zNxEeDgxAU+t2466vfHS5uWu5QRLnB8lmk Q7PpL0LC/96ZQXpg8ZsSvzM7G6DFy6jpaYUS8u1z8hebneTtElcAVFWN7LBCtg5PDjzWAw JnunEqASfhe266hG/sdAshm4rTNLVhSEPaoFQ/W+hJwbnBgD5CLGb5bru3dHOLV/6vVPFP qLmkaUpsqyZhF+4VP6woe9xeYRFeQc7LuuXL+wWVGepXhsG8S2bP+++jNyPY9A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1633629069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MtuwQ+KIKiQM3yaQjSCUzwcZYRlc2d3zt5xqYnLecpM=; b=9UNiyPdvvKuTk/i9fgFRnTp7AB73AtGro2IEijXUleLKNrp4u7dNcrfmIQdl5+telz3Cu8 YyH+ULjUyfBH5qBw== To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Thomas Gleixner , "Ahmed S. Darwish" , Sebastian Andrzej Siewior Subject: [PATCH net-next 4/4] mq, mqprio: Simplify stats copy. Date: Thu, 7 Oct 2021 19:50:00 +0200 Message-Id: <20211007175000.2334713-5-bigeasy@linutronix.de> In-Reply-To: <20211007175000.2334713-1-bigeasy@linutronix.de> References: <20211007175000.2334713-1-bigeasy@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org __gnet_stats_copy_basic() and __gnet_stats_copy_queue() update the statistics and don't overwritte them for both: global and per-CPU statistics. Simplify the code by removing the else case. Signed-off-by: Sebastian Andrzej Siewior --- Could someone please double check if the qdisc_qlen_sum() for !qdisc_is_percpu_stats() is correct here? I would lke not break it again in another way ;) net/sched/sch_mq.c | 27 ++++++--------------- net/sched/sch_mqprio.c | 55 +++++++++++++----------------------------- 2 files changed, 25 insertions(+), 57 deletions(-) diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c index e79f1afe0cfd6..9aa9534f62ff5 100644 --- a/net/sched/sch_mq.c +++ b/net/sched/sch_mq.c @@ -145,26 +145,15 @@ static int mq_dump(struct Qdisc *sch, struct sk_buff *skb) qdisc = netdev_get_tx_queue(dev, ntx)->qdisc_sleeping; spin_lock_bh(qdisc_lock(qdisc)); - if (qdisc_is_percpu_stats(qdisc)) { - qlen = qdisc_qlen_sum(qdisc); - __gnet_stats_copy_basic(NULL, &sch->bstats, - qdisc->cpu_bstats, - &qdisc->bstats); - __gnet_stats_copy_queue(&sch->qstats, - qdisc->cpu_qstats, - &qdisc->qstats, qlen); - sch->q.qlen += qlen; - } else { - sch->q.qlen += qdisc->q.qlen; - sch->bstats.bytes += qdisc->bstats.bytes; - sch->bstats.packets += qdisc->bstats.packets; - sch->qstats.qlen += qdisc->qstats.qlen; - sch->qstats.backlog += qdisc->qstats.backlog; - sch->qstats.drops += qdisc->qstats.drops; - sch->qstats.requeues += qdisc->qstats.requeues; - sch->qstats.overlimits += qdisc->qstats.overlimits; - } + qlen = qdisc_qlen_sum(qdisc); + __gnet_stats_copy_basic(NULL, &sch->bstats, + qdisc->cpu_bstats, + &qdisc->bstats); + __gnet_stats_copy_queue(&sch->qstats, + qdisc->cpu_qstats, + &qdisc->qstats, qlen); + sch->q.qlen += qlen; spin_unlock_bh(qdisc_lock(qdisc)); } diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 5eb3b1b7ae5e7..8e57c4a3545ee 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -399,28 +399,18 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb) * qdisc totals are added at end. */ for (ntx = 0; ntx < dev->num_tx_queues; ntx++) { + u32 qlen = qdisc_qlen_sum(qdisc); + qdisc = netdev_get_tx_queue(dev, ntx)->qdisc_sleeping; spin_lock_bh(qdisc_lock(qdisc)); - if (qdisc_is_percpu_stats(qdisc)) { - __u32 qlen = qdisc_qlen_sum(qdisc); - - __gnet_stats_copy_basic(NULL, &sch->bstats, - qdisc->cpu_bstats, - &qdisc->bstats); - __gnet_stats_copy_queue(&sch->qstats, - qdisc->cpu_qstats, - &qdisc->qstats, qlen); - sch->q.qlen += qlen; - } else { - sch->q.qlen += qdisc->q.qlen; - sch->bstats.bytes += qdisc->bstats.bytes; - sch->bstats.packets += qdisc->bstats.packets; - sch->qstats.backlog += qdisc->qstats.backlog; - sch->qstats.drops += qdisc->qstats.drops; - sch->qstats.requeues += qdisc->qstats.requeues; - sch->qstats.overlimits += qdisc->qstats.overlimits; - } + __gnet_stats_copy_basic(NULL, &sch->bstats, + qdisc->cpu_bstats, + &qdisc->bstats); + __gnet_stats_copy_queue(&sch->qstats, + qdisc->cpu_qstats, + &qdisc->qstats, qlen); + sch->q.qlen += qlen; spin_unlock_bh(qdisc_lock(qdisc)); } @@ -532,25 +522,14 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, spin_lock_bh(qdisc_lock(qdisc)); - if (qdisc_is_percpu_stats(qdisc)) { - qlen = qdisc_qlen_sum(qdisc); - - __gnet_stats_copy_basic(NULL, &bstats, - qdisc->cpu_bstats, - &qdisc->bstats); - __gnet_stats_copy_queue(&qstats, - qdisc->cpu_qstats, - &qdisc->qstats, - qlen); - } else { - qlen += qdisc->q.qlen; - bstats.bytes += qdisc->bstats.bytes; - bstats.packets += qdisc->bstats.packets; - qstats.backlog += qdisc->qstats.backlog; - qstats.drops += qdisc->qstats.drops; - qstats.requeues += qdisc->qstats.requeues; - qstats.overlimits += qdisc->qstats.overlimits; - } + qlen = qdisc_qlen_sum(qdisc); + __gnet_stats_copy_basic(NULL, &bstats, + qdisc->cpu_bstats, + &qdisc->bstats); + __gnet_stats_copy_queue(&qstats, + qdisc->cpu_qstats, + &qdisc->qstats, + qlen); spin_unlock_bh(qdisc_lock(qdisc)); }