From patchwork Thu Aug 25 03:29:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12954163 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 195CDC25B06 for ; Thu, 25 Aug 2022 03:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232766AbiHYD1Q (ORCPT ); Wed, 24 Aug 2022 23:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232525AbiHYD1I (ORCPT ); Wed, 24 Aug 2022 23:27:08 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEAD05F997; Wed, 24 Aug 2022 20:27:06 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MCpGG0ZvwzlWCq; Thu, 25 Aug 2022 11:23:50 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 25 Aug 2022 11:27:04 +0800 From: Zhengchao Shao To: , , , , , , , , CC: , , Subject: [PATCH net-next 2/3] net: sched: sch_gred: add statistics when calling qdisc_drop() in sch_gred Date: Thu, 25 Aug 2022 11:29:42 +0800 Message-ID: <20220825032943.34778-3-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220825032943.34778-1-shaozhengchao@huawei.com> References: <20220825032943.34778-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Now, the "other" member in the gred_sched_data structure is not used. According to the description, "other" should be added when calling qdisc_drop() to discard packets. Signed-off-by: Zhengchao Shao --- include/net/red.h | 2 +- net/sched/sch_gred.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/net/red.h b/include/net/red.h index 30c6a23ab8cc..dad41eff8c62 100644 --- a/include/net/red.h +++ b/include/net/red.h @@ -122,7 +122,7 @@ struct red_stats { u32 forced_drop; /* Forced drops, qavg > max_thresh */ u32 forced_mark; /* Forced marks, qavg > max_thresh */ u32 pdrop; /* Drops due to queue limits */ - u32 other; /* Drops due to drop() calls */ + u32 other; /* Drops due to qdisc_drop() calls */ }; struct red_parms { diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index 1073c76d05c4..c50a0853dcb9 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c @@ -251,9 +251,11 @@ static int gred_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->stats.pdrop++; drop: + q->stats.other++; return qdisc_drop(skb, sch, to_free); congestion_drop: + q->stats.other++; qdisc_drop(skb, sch, to_free); return NET_XMIT_CN; }