Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4049599rwb; Sun, 9 Oct 2022 16:50:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7a9EMBIX0PHLVz4pp2SZrJR1ILaL5heA/m8ZettBRmZ23zz+yhVIkMfHA04aAGFx9IwhsF X-Received: by 2002:a05:6402:3988:b0:44e:6f08:ddfb with SMTP id fk8-20020a056402398800b0044e6f08ddfbmr15030580edb.89.1665359423137; Sun, 09 Oct 2022 16:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665359423; cv=none; d=google.com; s=arc-20160816; b=a6fNTC5pz+qANOzRVXqZwzWG8wr1iFhaIT/sAt1cnbji9aS7ctE7SiupW0HsBJDM4q pV/kA/A33gLwzYwpi0xHe8whbrKjJ1lO2BuSxDZzs3VKqBXHNcZf+t4bgfaN6BQGWRZf hojxVP05FueZ5etlBq0x3QpMGr9oPB9M+l2EDnbvjKI2dvTPj1gBLMF/rbESVP34J2O9 C9+RK63RxpP49iidyWCBhr9LRQy0vrZuKxNciQoVX6X9XWFg8i54h2F5OzXyHuKqzJPd ZM7JpT8g155XyoNOHe+wKaEukMjNUSoyyPHcZGf8BknxQxoQkLBdW0C6Bf/y542TZRb4 5RfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u5jODtNhS2li85chdlg8O11OEY2To3QhRFtb8m4J7Zw=; b=Z7HBg3IK+Dep//6NxwusW/uojFXr1+arJngJdYHgwUZNKYleS5aKauEJ9GPOT+8ocN odOyNmU+/+N/AuM2qIf7D1kPp2drvy+IDBQRuvsB6hksg2zzDvRY2vGB6s6V0MQ2Np8t 8RW3ScER93eyyTGT4fKH1K6LEL8uD9m3EJ3pokzqR7KqvMKvI/uGKt5v/xLchSpKXaFP J/XACvXKkBXsgRmeDd9slz5lIj3kGLV8FxNS8XVyPlejWVMWw1fbKLJSNnxUulEQ06fb mhNf8zY+pw6tAJqXSanFVIYpYd1hWqSGPTtTfHmNjtXefqn8gShM+3z/Z+u/VYTsODYL UzJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KE0mMgdQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a170906361200b00730bc62507csi7791290ejb.125.2022.10.09.16.49.56; Sun, 09 Oct 2022 16:50:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KE0mMgdQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232125AbiJIW1p (ORCPT + 99 others); Sun, 9 Oct 2022 18:27:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbiJIWZy (ORCPT ); Sun, 9 Oct 2022 18:25:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B88E83E744; Sun, 9 Oct 2022 15:18:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 271B1B80E04; Sun, 9 Oct 2022 22:17:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A818FC4347C; Sun, 9 Oct 2022 22:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665353834; bh=3e9UCbg0XtmrjGbgRHnu3bAdc2sCOpxbyJgRQrouSEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KE0mMgdQ3r8kdN7C5iTXBNBSGpz1RLPr9hdSZwTP6q5T1CAJu6VzL6VNeaThv3xlX 4UwGMZRI62xLyiAmbenLlebN3xkM3syUIU2w1kIFa2CHDFGW/IJspJYTKGIonidFm1 rusAmv6YinIpPKOI91e1rNPgPtnrAEnT1ClbdRjyT3BH4VTM6qnsiCVn+OJKCMqeT1 Pzz8xQ2JF6UTVs2iNBbrjUV59w6P/kBbA6WPRc6ce3yQLnYPjZdO6bjXag5mjkGe8C S20UOujtzavdaM2xAj2nVzZ8cEeSX09WSE0G8mBWlr+e8/H+bN7Ppn3tP06NuwvrtL QKB9OTmuXCN4Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vladimir Oltean , "David S . Miller" , Sasha Levin , claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 34/73] net: mscc: ocelot: report FIFO drop counters through stats->rx_dropped Date: Sun, 9 Oct 2022 18:14:12 -0400 Message-Id: <20221009221453.1216158-34-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221009221453.1216158-1-sashal@kernel.org> References: <20221009221453.1216158-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean [ Upstream commit cc160fc29a264726b2bfbc2f551081430db3df03 ] if_link.h says: * @rx_dropped: Number of packets received but not processed, * e.g. due to lack of resources or unsupported protocol. * For hardware interfaces this counter may include packets discarded * due to L2 address filtering but should not include packets dropped * by the device due to buffer exhaustion which are counted separately in * @rx_missed_errors (since procfs folds those two counters together). Currently we report "stats->rx_dropped = dev->stats.rx_dropped", the latter being incremented by various entities in the stack. This is not wrong, but we'd like to move ocelot_get_stats64() in the common ocelot switch lib which is independent of struct net_device. To do that, report the hardware RX drop counters instead. These drops are due to policer action, or due to no destinations. When we have no memory in the queue system, report this through rx_missed_errors, as instructed. Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mscc/ocelot_net.c | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c index 330d30841cdc..d7956fd051e6 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -745,7 +745,32 @@ static void ocelot_get_stats64(struct net_device *dev, s[OCELOT_STAT_RX_1024_1526] + s[OCELOT_STAT_RX_1527_MAX]; stats->multicast = s[OCELOT_STAT_RX_MULTICAST]; - stats->rx_dropped = dev->stats.rx_dropped; + stats->rx_missed_errors = s[OCELOT_STAT_DROP_TAIL]; + stats->rx_dropped = s[OCELOT_STAT_RX_RED_PRIO_0] + + s[OCELOT_STAT_RX_RED_PRIO_1] + + s[OCELOT_STAT_RX_RED_PRIO_2] + + s[OCELOT_STAT_RX_RED_PRIO_3] + + s[OCELOT_STAT_RX_RED_PRIO_4] + + s[OCELOT_STAT_RX_RED_PRIO_5] + + s[OCELOT_STAT_RX_RED_PRIO_6] + + s[OCELOT_STAT_RX_RED_PRIO_7] + + s[OCELOT_STAT_DROP_LOCAL] + + s[OCELOT_STAT_DROP_YELLOW_PRIO_0] + + s[OCELOT_STAT_DROP_YELLOW_PRIO_1] + + s[OCELOT_STAT_DROP_YELLOW_PRIO_2] + + s[OCELOT_STAT_DROP_YELLOW_PRIO_3] + + s[OCELOT_STAT_DROP_YELLOW_PRIO_4] + + s[OCELOT_STAT_DROP_YELLOW_PRIO_5] + + s[OCELOT_STAT_DROP_YELLOW_PRIO_6] + + s[OCELOT_STAT_DROP_YELLOW_PRIO_7] + + s[OCELOT_STAT_DROP_GREEN_PRIO_0] + + s[OCELOT_STAT_DROP_GREEN_PRIO_1] + + s[OCELOT_STAT_DROP_GREEN_PRIO_2] + + s[OCELOT_STAT_DROP_GREEN_PRIO_3] + + s[OCELOT_STAT_DROP_GREEN_PRIO_4] + + s[OCELOT_STAT_DROP_GREEN_PRIO_5] + + s[OCELOT_STAT_DROP_GREEN_PRIO_6] + + s[OCELOT_STAT_DROP_GREEN_PRIO_7]; /* Get Tx stats */ stats->tx_bytes = s[OCELOT_STAT_TX_OCTETS]; -- 2.35.1