From nobody Sun Feb 8 11:43:32 2026 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 223B5C433FE for ; Mon, 23 May 2022 18:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244059AbiEWSGS (ORCPT ); Mon, 23 May 2022 14:06:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243150AbiEWRhz (ORCPT ); Mon, 23 May 2022 13:37:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 816B26FA1E; Mon, 23 May 2022 10:32:07 -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 C20FBB8121A; Mon, 23 May 2022 17:29:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0D35C385A9; Mon, 23 May 2022 17:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653326998; bh=23su02o+7aksN6p3FS7YDRxWi6rUQ/aMOIQEY1F9QY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xWfqN58+W68llD0fiBLtWJJC7roo7rSrRtTKorXJ35zL3XzVNdZWK5ZhbAca0qD6W oDTB0KZqnl6P2p+gIMsC7shCLg21CSXTodZcpZXikx8c5bTGl/BREk0NGRdc3znoOn dwhn+b9D3WKS2GkdsCbOuHXLwlG/W2PFT+doEa1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Greenwalt , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.17 097/158] ice: fix possible under reporting of ethtool Tx and Rx statistics Date: Mon, 23 May 2022 19:04:14 +0200 Message-Id: <20220523165847.535271104@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165830.581652127@linuxfoundation.org> References: <20220523165830.581652127@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Greenwalt [ Upstream commit 31b6298fd8e29effe9ed6b77351ac5969be56ce0 ] The hardware statistics counters are not cleared during resets so the drivers first access is to initialize the baseline and then subsequent reads are for reporting the counters. The statistics counters are read during the watchdog subtask when the interface is up. If the baseline is not initialized before the interface is up, then there can be a brief window in which some traffic can be transmitted/received before the initial baseline reading takes place. Directly initialize ethtool statistics in driver open so the baseline will be initialized when the interface is up, and any dropped packets incremented before the interface is up won't be reported. Fixes: 28dc1b86f8ea9 ("ice: ignore dropped packets during init") Signed-off-by: Paul Greenwalt Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 7f6715eb862f..30f055e1a92a 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -5907,9 +5907,10 @@ static int ice_up_complete(struct ice_vsi *vsi) ice_ptp_link_change(pf, pf->hw.pf_id, true); } =20 - /* clear this now, and the first stats read will be used as baseline */ - vsi->stat_offsets_loaded =3D false; - + /* Perform an initial read of the statistics registers now to + * set the baseline so counters are ready when interface is up + */ + ice_update_eth_stats(vsi); ice_service_task_schedule(pf); =20 return 0; --=20 2.35.1