Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2126470ioo; Mon, 23 May 2022 10:38:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwALWYvoiC6PQdtx7DYYjFYWrbWc8n8+EILL0syNfRG92NltJEOwmqEiBjs86nbHCO4S3O/ X-Received: by 2002:a17:90b:1249:b0:1df:257a:539a with SMTP id gx9-20020a17090b124900b001df257a539amr116155pjb.47.1653327503291; Mon, 23 May 2022 10:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653327503; cv=none; d=google.com; s=arc-20160816; b=ZzV6LjTE6LoXoY4BVtXX3LIzG+/O7DAiGy6ENFuTiKWgNkWq9uc8OGPwLIILHrXKBP cCO+jEzDZ6SLHGLhLb2MXv9hW5K3h18vt3sVFPqjDoYSLCsZmKRqO/eh5p9Qs8e/n7Lp iVHCQAtZdSohfeN2/+Xkcc7BN+M1im/VztPSfoEnZ8y8bkHi0LCRFyp4nv93scrA6ZQc 2hbzRkULZg1Wp188H/I77w/WZ1rXufSu8D/Ex6e2HGAOepFNsldF5lzjIDzcUKhHFgcr gH5Q9Uag4BMrIy+/ty+MD65vrAOss+qFs/N222HRt/QBxfaxnJ1Qha79+NZHzsKJPR10 DECw== 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=9ShIzFcdORxpM57dRvoFk01fUPRCq7kTKCaaDbP/l0Y=; b=CsjVR8vEeae5H+2RNqkByefvT23NMpbxqNLUkP4kVgtlO/GkkUKXvr7knyuyUmmiis P2BN7I1iXnN5c5WRzwBzDv7aFi/wdEkQoAarh10rPC/oYg2ddV7WHy+/XQH0u2Z9WhuV jNAQ5kE/ouWegHl1HgvV1XjXWYmYWeW2df+cEnyls+ozfp6RzNlgj4fwWka5bGVHwR6S FEBamVZED65E7CGahdMEjFbULC/HbOgPubmFXsJR/pOd5tVWApb7Hx0QDrtV3fuJ4Y1x 43ukoigZASBopir7UxaCd1pWuzLGlXV3oHGjouVaz7dcjup72xUR7pfNWES0lV9W5Xew /qaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DICNcjAu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id s18-20020a17090302d200b001619688aee1si10614894plk.318.2022.05.23.10.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:38:23 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DICNcjAu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 2499742EFB; Mon, 23 May 2022 10:36:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240761AbiEWRfQ (ORCPT + 99 others); Mon, 23 May 2022 13:35:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240489AbiEWRZj (ORCPT ); Mon, 23 May 2022 13:25:39 -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 9144A11449; Mon, 23 May 2022 10:21:03 -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 D9F22B811FE; Mon, 23 May 2022 17:20:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36C61C34115; Mon, 23 May 2022 17:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653326445; bh=+Amairj8U8GW1OyfSYV76KxnNpCLyPfmgJ3BR4dJjmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DICNcjAuT4ACAxhg8E2JF0MGUcwmb4L9vFm/9lD/fboQ9iwbCt88EgP49IncDHZGQ VutfaILcQkPOJ8E9mKv6VAM+WTZXoAcQOBy1ToswqUs3pIHLVtZBbQrJqypeehwXtU aImsI6dqXElP5u4r/epTUiHILO/Dcor9Iw/rdSNc= 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.15 084/132] ice: fix possible under reporting of ethtool Tx and Rx statistics Date: Mon, 23 May 2022 19:04:53 +0200 Message-Id: <20220523165837.042443737@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165823.492309987@linuxfoundation.org> References: <20220523165823.492309987@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 27b5c75ce386..188abf36a5b2 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -5656,9 +5656,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