If device does not allow hot_fw_reset, issue firmware reset
without graceful flag.

Cc: Michael Chan <michael.c...@broadcom.com>
Signed-off-by: Vasundhara Volam <vasundhara-v.vo...@broadcom.com>
Reviewed-by: Edwin Peer <edwin.p...@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c 
b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index dd0c3f2..e5eb8d2 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -1888,12 +1888,11 @@ static int bnxt_firmware_reset(struct net_device *dev,
        return bnxt_hwrm_firmware_reset(dev, proc_type, self_reset, flags);
 }
 
-static int bnxt_firmware_reset_chip(struct net_device *dev)
+static int bnxt_firmware_reset_chip(struct net_device *dev, bool hot_reset)
 {
-       struct bnxt *bp = netdev_priv(dev);
        u8 flags = 0;
 
-       if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET)
+       if (hot_reset)
                flags = FW_RESET_REQ_FLAGS_RESET_GRACEFUL;
 
        return bnxt_hwrm_firmware_reset(dev,
@@ -3082,7 +3081,7 @@ static void bnxt_self_test(struct net_device *dev, struct 
ethtool_test *etest,
 static int bnxt_reset(struct net_device *dev, u32 *flags)
 {
        struct bnxt *bp = netdev_priv(dev);
-       bool reload = false;
+       bool reload = false, hot_reset;
        u32 req = *flags;
 
        if (!req)
@@ -3093,8 +3092,10 @@ static int bnxt_reset(struct net_device *dev, u32 *flags)
                return -EOPNOTSUPP;
        }
 
-       if (pci_vfs_assigned(bp->pdev) &&
-           !(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) {
+       if (bnxt_hwrm_get_hot_reset(bp, &hot_reset))
+               hot_reset = !!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET);
+
+       if (pci_vfs_assigned(bp->pdev) && !hot_reset) {
                netdev_err(dev,
                           "Reset not allowed when VFs are assigned to VMs\n");
                return -EBUSY;
@@ -3103,9 +3104,9 @@ static int bnxt_reset(struct net_device *dev, u32 *flags)
        if ((req & BNXT_FW_RESET_CHIP) == BNXT_FW_RESET_CHIP) {
                /* This feature is not supported in older firmware versions */
                if (bp->hwrm_spec_code >= 0x10803) {
-                       if (!bnxt_firmware_reset_chip(dev)) {
+                       if (!bnxt_firmware_reset_chip(dev, hot_reset)) {
                                netdev_info(dev, "Firmware reset request 
successful.\n");
-                               if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET))
+                               if (!hot_reset)
                                        reload = true;
                                *flags &= ~BNXT_FW_RESET_CHIP;
                        }
-- 
1.8.3.1

Reply via email to