From patchwork Thu Aug 17 23:19:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13357067 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00D551B7CD for ; Thu, 17 Aug 2023 23:19:35 +0000 (UTC) Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DBF235AB for ; Thu, 17 Aug 2023 16:19:34 -0700 (PDT) Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-64721b1bae3so1309486d6.1 for ; Thu, 17 Aug 2023 16:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1692314373; x=1692919173; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ALhtleGpAsiGqCc4v25CO+zEa1N6vpILUpx2q/wzENw=; b=VpHCLqZt68DixkFqSL21ytGj7Z2pgEIHmoT2uP2Sw2fIJesVYZ0p4EC9tz5U/+/O3t ZC1UNKUnY9wgpU9LYoFwsG7tL5IcqJjoru4jmwOe158I0vhRbaiJeVIIIt4mvtPShKE3 qRPzSQGqawJckPmy1ea2guLM9aqAGKsQuWE+E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692314373; x=1692919173; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ALhtleGpAsiGqCc4v25CO+zEa1N6vpILUpx2q/wzENw=; b=VKE4v917WIli0LCujIIo8hMjarqJMptYtwgFhzx4lAOE4uNa+mcPFi1lA85W8aCjxU bKZQ31SzvqkTiLNIbS7HzbU517o94jHff+97tEH8iMVerMC+kcsPF2MhSH0SdKqQt1pP hHB8UGSigSPkAVje5TSDz4w3z4P08G/8/3lyc4ELLm6NMGWG3ForywA2q3UQLnGvfhgz KkbhAaeWtqI4Sv1aL5VVJhX4VkGz21LqR7h+uWrTr0Jd3vBUMwDb4biXp8R+39t0k5qz cSR0VKTO2ELjOyGKDNaiqwkvyZXQTblBQpBJmuyIxDO6mOaWXdLnkbG9maQXpY1tO2w4 7C/Q== X-Gm-Message-State: AOJu0YxMDCv4v1yDSlp0ZGUWLCU504Rf/HwOBqgAgDirm2a8OgIKQT01 9OEmcM3WybBVHFiORVjpPdrVew== X-Google-Smtp-Source: AGHT+IEsavE2F3BL6WhRc7OT29n2YoJoDd5WQZ3/XRg1Y8ongj5RdR7fJG/H2HrN7XfP3UB8dF/17A== X-Received: by 2002:a05:6214:2b81:b0:635:e4ed:b6c9 with SMTP id kr1-20020a0562142b8100b00635e4edb6c9mr1236197qvb.24.1692314372898; Thu, 17 Aug 2023 16:19:32 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id w27-20020a05620a149b00b0076d25b11b62sm145516qkj.38.2023.08.17.16.19.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Aug 2023 16:19:32 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com Subject: [PATCH net-next v2 3/6] bnxt_en: Increment rx_resets counter in bnxt_disable_napi() Date: Thu, 17 Aug 2023 16:19:08 -0700 Message-Id: <20230817231911.165035-4-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230817231911.165035-1-michael.chan@broadcom.com> References: <20230817231911.165035-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org If we are doing a complete reset with irq_re_init set to true in bnxt_close_nic(), all the ring structures will be freed. New structures will be allocated in bnxt_open_nic(). The current code increments rx_resets counter in bnxt_enable_napi() if bnapi->in_reset is true. In a complete reset, bnapi->in_reset will never be true since the structure is just allocated. Increment the rx_resets counter in bnxt_disable_napi() instead. This will allow us to save all the ring error counters including the rx_resets counters in the next patch. Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 73a3936ee498..34c3d231946e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -9393,10 +9393,14 @@ static void bnxt_disable_napi(struct bnxt *bp) return; for (i = 0; i < bp->cp_nr_rings; i++) { - struct bnxt_cp_ring_info *cpr = &bp->bnapi[i]->cp_ring; + struct bnxt_napi *bnapi = bp->bnapi[i]; + struct bnxt_cp_ring_info *cpr; - napi_disable(&bp->bnapi[i]->napi); - if (bp->bnapi[i]->rx_ring) + cpr = &bnapi->cp_ring; + if (bnapi->in_reset) + cpr->sw_stats.rx.rx_resets++; + napi_disable(&bnapi->napi); + if (bnapi->rx_ring) cancel_work_sync(&cpr->dim.work); } } @@ -9413,8 +9417,6 @@ static void bnxt_enable_napi(struct bnxt *bp) bnapi->tx_fault = 0; cpr = &bnapi->cp_ring; - if (bnapi->in_reset) - cpr->sw_stats.rx.rx_resets++; bnapi->in_reset = false; bnapi->tx_pkts = 0;