[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1590908625-10952-7-git-send-email-vasundhara-v.volam@broadcom.com>
Date: Sun, 31 May 2020 12:33:45 +0530
From: Vasundhara Volam <vasundhara-v.volam@...adcom.com>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, michael.chan@...adcom.com,
Vasundhara Volam <vasundhara-v.volam@...adcom.com>
Subject: [PATCH v3 net-next 6/6] bnxt_en: Check if fw_live_reset is allowed before doing ETHTOOL_RESET
If device does not allow fw_live_reset, issue FW_RESET command
without graceful flag, which requires a driver reload to reset
the firmware.
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@...adcom.com>
Signed-off-by: Michael Chan <michael.chan@...adcom.com>
Reviewed-by: Edwin Peer <edwin.peer@...adcom.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
Powered by blists - more mailing lists