From patchwork Sat Mar 5 08:54:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12770274 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 22BC6C433F5 for ; Sat, 5 Mar 2022 08:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbiCEIzx (ORCPT ); Sat, 5 Mar 2022 03:55:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiCEIzx (ORCPT ); Sat, 5 Mar 2022 03:55:53 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1393225259F for ; Sat, 5 Mar 2022 00:55:04 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id 6so4916152pgg.0 for ; Sat, 05 Mar 2022 00:55:04 -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=eC1lzqanh4BuhcfVyujuAm3QV1fvH0oW+3+onCEn47g=; b=BXmKFNH4PhSFGss4glGJYyD6HCjGBQjRP5jxi1Nn3q7s7EUOqcvVQHzs5SognaLATe JmD3Xql4EA/G3oIvSHwT4YkSa+kDAqp2q1dB1QiVvsJDd4dV/77qbgx8xjBDbVe8NTcn lkVTNOevE39sHecDSxroJ5WZ4sx7LazrRv6+g= 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=eC1lzqanh4BuhcfVyujuAm3QV1fvH0oW+3+onCEn47g=; b=bqbXvWJFmzfcORBaKBwGB+7qHlVFHgn4A3P/UyUETZE5iTwBIhuyCe94nrAa6jPUq7 OQU1hZl2j51hKhlAa9on350s5ZLkQdh53Bfyc0Ej9dm2fmQv38mj1VYuiJTnz/cgTtFK EiPiwsQGBlFUZhYm5lkojlDVKqNn/iH4favfTTEQCAnNnYJ+uUErGzoYb6xDqYxX6zFT jS7UjT5IopIFpUOGQjppEchnEiqEa0CT1ZCVAMXzeJuuWfBRvCHrSOh4EikVuuOAe8en BkzvUXjh+TLVUbHROJc4J0fK4cOgv33Wa5q2wsOozanWfNbvH429KDteMLy4CsCAGvNJ MmcA== X-Gm-Message-State: AOAM531R250Cyl+TM6LepHq/EMPnnFvGYGi8k3TVSzPR8pKhGCi++LLi nsxNq2/xrcvMJySsdv+i4Tj+KQ== X-Google-Smtp-Source: ABdhPJw0Ad9mJW3w6Vx/XecBMBa8eV4mlz1RlsMEe9AAyU3LyfGwhnFtZICZBgEeriqA6BhuG0K1Bg== X-Received: by 2002:a05:6a00:1a47:b0:4e1:5bc7:840d with SMTP id h7-20020a056a001a4700b004e15bc7840dmr2810666pfv.10.1646470502851; Sat, 05 Mar 2022 00:55:02 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p28-20020a056a000a1c00b004f6519e61b7sm9213261pfh.21.2022.03.05.00.55.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Mar 2022 00:55:02 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next 1/9] bnxt_en: refactor error handling of HWRM_NVM_INSTALL_UPDATE Date: Sat, 5 Mar 2022 03:54:34 -0500 Message-Id: <1646470482-13763-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1646470482-13763-1-git-send-email-michael.chan@broadcom.com> References: <1646470482-13763-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 This is in anticipation of handling more "cmd_err" from FW in the next patch. Reviewed-by: Somnath Kotur Reviewed-by: Edwin Peer Signed-off-by: Kalesh AP Signed-off-by: Michael Chan --- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index fecb03b49f01..59838a4f45fb 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2512,6 +2512,7 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware u8 *kmem = NULL; u32 modify_len; u32 item_len; + u8 cmd_err; u16 index; int rc; @@ -2595,6 +2596,8 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware } rc = hwrm_req_send_silent(bp, install); + if (!rc) + break; if (defrag_attempted) { /* We have tried to defragment already in the previous @@ -2603,15 +2606,20 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware break; } - if (rc && ((struct hwrm_err_output *)resp)->cmd_err == - NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR) { + cmd_err = ((struct hwrm_err_output *)resp)->cmd_err; + + switch (cmd_err) { + case NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR: install->flags = cpu_to_le16(NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG); rc = hwrm_req_send_silent(bp, install); + if (!rc) + break; + + cmd_err = ((struct hwrm_err_output *)resp)->cmd_err; - if (rc && ((struct hwrm_err_output *)resp)->cmd_err == - NVM_INSTALL_UPDATE_CMD_ERR_CODE_NO_SPACE) { + if (cmd_err == NVM_INSTALL_UPDATE_CMD_ERR_CODE_NO_SPACE) { /* FW has cleared NVM area, driver will create * UPDATE directory and try the flash again */ @@ -2621,11 +2629,13 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware BNX_DIR_TYPE_UPDATE, BNX_DIR_ORDINAL_FIRST, 0, 0, item_len, NULL, 0); - } else if (rc) { - netdev_err(dev, "HWRM_NVM_INSTALL_UPDATE failure rc :%x\n", rc); + if (!rc) + break; } - } else if (rc) { - netdev_err(dev, "HWRM_NVM_INSTALL_UPDATE failure rc :%x\n", rc); + fallthrough; + default: + netdev_err(dev, "HWRM_NVM_INSTALL_UPDATE failure rc :%x cmd_err :%x\n", + rc, cmd_err); } } while (defrag_attempted && !rc);