From patchwork Sun Feb 20 09:05:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752634 X-Patchwork-Delegate: kuba@kernel.org 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 21E83C433FE for ; Sun, 20 Feb 2022 09:06:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243486AbiBTJGp (ORCPT ); Sun, 20 Feb 2022 04:06:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243479AbiBTJGn (ORCPT ); Sun, 20 Feb 2022 04:06:43 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F953366A2 for ; Sun, 20 Feb 2022 01:06:23 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id q11-20020a17090a304b00b001b94d25eaecso12503964pjl.4 for ; Sun, 20 Feb 2022 01:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZcoxsAYhpedU3kP0gZ1E9rs7GvC/JbZ1FmgOsnZQTyA=; b=FLUedk3/rFONwezyHn5QfujWh/sUMTJWB55Zqo7faXCzG9nSUQ2d75MbtKEG8qvoNm B4LZvVDssITAWX2+C6K3M7MyxTtdSM7YahqYMZNUAR7YU4pBnGhvNg9/hVEzsmTtbbg6 hNBppdcQCA4i3qPrKvgorqG9D3Fh4xYIa6jn8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZcoxsAYhpedU3kP0gZ1E9rs7GvC/JbZ1FmgOsnZQTyA=; b=LmQU/dDz13T4N95zChoRpw6q4By8gEiYJNhXhoYnSxikxLfi7NmN5sCZ0X1mmhDwj8 9j7+n9GAbg9gjudMMQJ0dq/4eoD8g8t8/7jCWpzWQQQ5J7suV6ujnbQg7CzbuNxb/MOi vfeYAdmigjQ8oXL9ooceFHGvONkMf3uM0ZL3BS7HohwluH3VkwWb7to3ahRX2KUbf9nG P0iEGAe9J5EwKStP4NYNmMMEfUO7lddHnO+DTvCoR+FPI+N+ugCwBssdoEXdwllO2Uar YRpbciCergyNZXuT9EMdsVcqamvP0fKRBR28DFaLUvNRCHbN/+FgiQB7R8TnYqxKuXZF Jr1A== X-Gm-Message-State: AOAM533bCXfhDEaakww2VOHR3Xzcmsmh6q9OgbUTjTRkOPxxxOmIcSIu pApeSWJ0YmEM3aUwpO+fRbJj7w== X-Google-Smtp-Source: ABdhPJy9q+G5Sili9GHLPoQRzM/tp6pBgGPMJNLeJUh0GuIiJq1q+ri3gBt2eI2q8z98Sd8UrZ+zZA== X-Received: by 2002:a17:903:40cd:b0:14e:dd7f:f3d5 with SMTP id t13-20020a17090340cd00b0014edd7ff3d5mr14532625pld.88.1645347982403; Sun, 20 Feb 2022 01:06:22 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:21 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Kalesh AP Subject: [PATCH net 5/7] bnxt_en: Restore the resets_reliable flag in bnxt_open() Date: Sun, 20 Feb 2022 04:05:51 -0500 Message-Id: <1645347953-27003-6-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Kalesh AP During ifdown, we call bnxt_inv_fw_health_reg() which will clear both the status_reliable and resets_reliable flags if these registers are mapped. This is correct because a FW reset during ifdown will clear these register mappings. If we detect that FW has gone through reset during the next ifup, we will remap these registers. But during normal ifup with no FW reset, we need to restore the resets_reliable flag otherwise we will not show the reset counter during devlink diagnose. Fixes: 8cc95ceb7087 ("bnxt_en: improve fw diagnose devlink health messages") Reviewed-by: Vikas Gupta Reviewed-by: Pavan Chebbi Reviewed-by: Somnath Kotur Signed-off-by: Kalesh AP Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index fc5b1d816bdb..b1c98d1408b8 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7789,6 +7789,19 @@ static int bnxt_map_fw_health_regs(struct bnxt *bp) return 0; } +static void bnxt_remap_fw_health_regs(struct bnxt *bp) +{ + if (!bp->fw_health) + return; + + if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) { + bp->fw_health->status_reliable = true; + bp->fw_health->resets_reliable = true; + } else { + bnxt_try_map_fw_health_reg(bp); + } +} + static int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp) { struct bnxt_fw_health *fw_health = bp->fw_health; @@ -9856,8 +9869,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) resc_reinit = true; if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE) fw_reset = true; - else if (bp->fw_health && !bp->fw_health->status_reliable) - bnxt_try_map_fw_health_reg(bp); + else + bnxt_remap_fw_health_regs(bp); if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && !fw_reset) { netdev_err(bp->dev, "RESET_DONE not set during FW reset.\n");