Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2119694ioo; Mon, 23 May 2022 10:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8QsOTFMXCigod26px1/smYbJnd1LR4zy+QRnARV2dsHGgRJ/hGjcwISY9B0yVX/4h92Po X-Received: by 2002:a63:d813:0:b0:3f5:f9d8:7cce with SMTP id b19-20020a63d813000000b003f5f9d87ccemr21208010pgh.585.1653326943709; Mon, 23 May 2022 10:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326943; cv=none; d=google.com; s=arc-20160816; b=cdUbJRQZAgutU23Irc3najMMIfGAI/niZtesSV7brqcQiiep9Az4nE5ASmTAyANY9G qPW+xRW/5oLw04p+zkWNIAHEx4CocroAeGlUwX5JEOD0CXdH1zzM9a7qGpBGgXZOBo9K KzwF0oHH/iog7wdcrWdbKsTOXp6SP3jZJ7mEHNjprrYsIW92dAStYbqAO88tZT8P7D8I OqSHdnScQpc5fb1hDh2HiXJOwUWmM3JL72+QUYjXFY9tLkJKbZsjAAmiVAFnVp4Tl1/E hh2devkRRubgh3GgdChbJFsEVIzvoGrr7eSczzqJI9N2DchQWhngmc16RFC4gDO+BGAZ WVoA== 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=Eg3BUaLgb7aHFeFvcPj4XSn/TcdvNSsnhrJa0wfQCdg=; b=CDKzF0RVsUD5eZj6VTmMRY3Kgd9DGr1F9+YpWa0GVkAvfqaZ05FgYATkpDLHtgAQGX knPVAD9b/MeaTxQOhQ3D7UgsZTrzLtRzHhq5aw2FV39cOhepjm3eKymytoMBY+PL2wqn sd/pbWbrSI+uZZLKLJ1++sLK2Viukdm6eoNGnyJzHGGXAoF2tSeXzAlzblvtgQUcLBc+ KxzJqEQA/uteNSu4pJZattvLHT+DvpxmNd9t3YIIR6/ktQDl1TGPaJXgK7X2JH90BDEu e/Sfmcd9ZNpQViB4JDHqNyRQS5s+zJkR+KcfFoKSq1mbW6UWtb/Hqse8AHvSMiiGtRoI tgdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UwkfwNlB; 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 p1-20020a17090a348100b001e0676bf470si1198753pjb.175.2022.05.23.10.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:29:03 -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=UwkfwNlB; 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 7E58E85EFF; Mon, 23 May 2022 10:28:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240369AbiEWRZM (ORCPT + 99 others); Mon, 23 May 2022 13:25:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240698AbiEWRQk (ORCPT ); Mon, 23 May 2022 13:16:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4856F3BFA8; Mon, 23 May 2022 10:16:27 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 36EF461337; Mon, 23 May 2022 17:13:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42F29C385AA; Mon, 23 May 2022 17:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653326011; bh=rxs6VDxjlSlsa8eXEMlrj2IGeSz+cSzxHHDu/XTGxjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UwkfwNlBI4FPmsmcbjBrnq88Cnnie0rjo7+eIungHwBf+Uf7Zu1qYKqdc0Hsp4hZP oyj8OUC4iqfLkVJfoOCA/KGgXc2UJd6apQ3UMpqIAHCLrHl/G7GyJMJ2RnPXtt2Z7g yhOggqWP8d4jfIcfjVYbAT/kpKaUujliBirzc58c= 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.4 40/68] ice: fix possible under reporting of ethtool Tx and Rx statistics Date: Mon, 23 May 2022 19:05:07 +0200 Message-Id: <20220523165809.213413459@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165802.500642349@linuxfoundation.org> References: <20220523165802.500642349@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 3eea68f3a526..88750a96cb3f 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3561,9 +3561,10 @@ static int ice_up_complete(struct ice_vsi *vsi) netif_carrier_on(vsi->netdev); } - /* 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