Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3688384lfo; Mon, 23 May 2022 11:29:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzC2g7qWhcOoIoXRKItiUqGGE2143usEPF4v0nO/zqvaobJO10FcJwIHpIc3ANr/QqsXQb X-Received: by 2002:a17:902:b083:b0:161:955e:f16e with SMTP id p3-20020a170902b08300b00161955ef16emr23632167plr.73.1653330575579; Mon, 23 May 2022 11:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330575; cv=none; d=google.com; s=arc-20160816; b=SfSTh5tR2eOGl5LW3Ubh6Z4nWf71hLmKXPp30m8T401uZDK0YlUSPO5A6v1TOFWvPv LjsrdX1fgqmgfWnPUyJvCwYeGX0MMAPoEEyCTfoM1XrCS0JGOPqoWep9Z3Ipuzn+FPO3 k9IL7j0vJoz7jgxJ7ooDGpPjrNhWXMHR5d4c46dZDLsyWe9+6GJUuh1ho8UzeFvLIofx stBets8jQNPqLNcQT2/SjHeGHz0vjGt3uJo0kFN/5jVnqir88pVStlOuyf1xjoGGNsN3 A+4OAW++1lACk8DEBTn/gNw+VJLE8eHhddVweZvtuF5/MtitFNZ9eUZx40LsDEmyiwQ6 0qQA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6fibxR+/Hr1wo8wbCpMr58WLfDRLOEia6pQZ+EE4Jbs=; b=f0KoDmYWjpaul21z1k2dzgZ6fzhplVJ3vjXyA2HUiZGFzFGfvfWCKFpPbXP6KIMuTt AuCiomOgUy6Knd0C1taScEBMBwc+EBzjHdL1k4N330KXwoC7bhXgaKbj/dX/bUk9vxse Ewjfm3G8BF1Lk9zqjvys6XX80hjyY0UZUEuHI3INYm4en7eZe+/t7i1woeNElXOzEzuS Hj1K45nmeR8cwS3hZITyWoQnhtYjB5j21a9pKNQ9USW7XphuGPbDwn3JpvWJ9GxZG3/E LoSEQ8Y7G0tSsNbmU579JSr4jQusgVWoOHOalDzjLI5VuA/caX1JF1VWt5kNqZujUCGY 8C4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xWfqN58+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u4-20020a170902e5c400b001584ee3ba07si13108933plf.439.2022.05.23.11.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:29:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xWfqN58+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8DDE1134E13; Mon, 23 May 2022 11:29:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244053AbiEWSGP (ORCPT + 99 others); Mon, 23 May 2022 14:06:15 -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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: 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 Intel) 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/ethernet/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); } - /* clear this now, and the first stats read will be used as baseline */ - vsi->stat_offsets_loaded = 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); return 0; -- 2.35.1