bnxt_en: Extend ETHTOOL_RESET to hot reset driver.
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Mon, 18 Nov 2019 08:56:38 +0000 (03:56 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Nov 2019 01:13:28 +0000 (17:13 -0800)
If firmware supports hot reset, extend ETHTOOL_RESET to support
hot reset driver which does not require a driver reload after
ETHTOOL_RESET.  The driver will go through the same coordinated
reset sequence as a firmware initiated fatal/non-fatal reset.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index 0e5b5b853b2d88cb6aaee8f44c720bf1a200a39e..b081a555534bfdd8d0269b23064ba9fc736dc032 100644 (file)
@@ -6947,6 +6947,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
                bp->flags |= BNXT_FLAG_ROCEV2_CAP;
        if (flags & FUNC_QCAPS_RESP_FLAGS_PCIE_STATS_SUPPORTED)
                bp->fw_cap |= BNXT_FW_CAP_PCIE_STATS_SUPPORTED;
+       if (flags & FUNC_QCAPS_RESP_FLAGS_HOT_RESET_CAPABLE)
+               bp->fw_cap |= BNXT_FW_CAP_HOT_RESET;
        if (flags & FUNC_QCAPS_RESP_FLAGS_EXT_STATS_SUPPORTED)
                bp->fw_cap |= BNXT_FW_CAP_EXT_STATS_SUPPORTED;
        if (flags &  FUNC_QCAPS_RESP_FLAGS_ERROR_RECOVERY_CAPABLE)
index f2b5da7028737d969e46b32c679aa14c9a9f28ea..271085f7e4810fcff124c6bc43a04b0f43cfb9d7 100644 (file)
@@ -1671,6 +1671,7 @@ struct bnxt {
        #define BNXT_FW_CAP_PCIE_STATS_SUPPORTED        0x00020000
        #define BNXT_FW_CAP_EXT_STATS_SUPPORTED         0x00040000
        #define BNXT_FW_CAP_ERR_RECOVER_RELOAD          0x00100000
+       #define BNXT_FW_CAP_HOT_RESET                   0x00200000
 
 #define BNXT_NEW_RM(bp)                ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM)
        u32                     hwrm_spec_code;
index c5cd8d802f022f3eca75bcb012aed35629f9bfa0..0641020b56d5ed0be0bb9e18bab898597b4357f7 100644 (file)
@@ -1787,6 +1787,8 @@ static int bnxt_firmware_reset(struct net_device *dev,
        case BNXT_FW_RESET_CHIP:
                req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP;
                req.selfrst_status = FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP;
+               if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET)
+                       req.flags = FW_RESET_REQ_FLAGS_RESET_GRACEFUL;
                break;
        case BNXT_FW_RESET_AP:
                req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_AP;
@@ -2983,7 +2985,8 @@ static int bnxt_reset(struct net_device *dev, u32 *flags)
                return -EOPNOTSUPP;
        }
 
-       if (pci_vfs_assigned(bp->pdev)) {
+       if (pci_vfs_assigned(bp->pdev) &&
+           !(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) {
                netdev_err(dev,
                           "Reset not allowed when VFs are assigned to VMs\n");
                return -EBUSY;
@@ -2996,7 +2999,9 @@ static int bnxt_reset(struct net_device *dev, u32 *flags)
 
                rc = bnxt_firmware_reset(dev, BNXT_FW_RESET_CHIP);
                if (!rc) {
-                       netdev_info(dev, "Reset request successful. Reload driver to complete reset\n");
+                       netdev_info(dev, "Reset request successful.\n");
+                       if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET))
+                               netdev_info(dev, "Reload driver to complete reset\n");
                        *flags = 0;
                }
        } else if (*flags == ETH_RESET_AP) {