Commit 94f17e89 authored by Edwin Peer's avatar Edwin Peer Committed by David S. Miller

bnxt_en: refactor ethtool firmware reset types

The case statement in bnxt_firmware_reset() dangerously mixes types.
This patch separates the application processor and whole chip resets
from the rest such that the selection is performed on a pure type.
Signed-off-by: default avatarEdwin Peer <edwin.peer@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 95fec034
...@@ -1768,10 +1768,10 @@ static int bnxt_hwrm_firmware_reset(struct net_device *dev, u8 proc_type, ...@@ -1768,10 +1768,10 @@ static int bnxt_hwrm_firmware_reset(struct net_device *dev, u8 proc_type,
return rc; return rc;
} }
static int bnxt_firmware_reset(struct net_device *dev, u16 dir_type) static int bnxt_firmware_reset(struct net_device *dev,
enum bnxt_nvm_directory_type dir_type)
{ {
u8 self_reset = FW_RESET_REQ_SELFRST_STATUS_SELFRSTNONE; u8 self_reset = FW_RESET_REQ_SELFRST_STATUS_SELFRSTNONE;
struct bnxt *bp = netdev_priv(dev);
u8 proc_type, flags = 0; u8 proc_type, flags = 0;
/* TODO: Address self-reset of APE/KONG/BONO/TANG or ungraceful reset */ /* TODO: Address self-reset of APE/KONG/BONO/TANG or ungraceful reset */
...@@ -1798,15 +1798,6 @@ static int bnxt_firmware_reset(struct net_device *dev, u16 dir_type) ...@@ -1798,15 +1798,6 @@ static int bnxt_firmware_reset(struct net_device *dev, u16 dir_type)
case BNX_DIR_TYPE_BONO_PATCH: case BNX_DIR_TYPE_BONO_PATCH:
proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE; proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE;
break; break;
case BNXT_FW_RESET_CHIP:
proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP;
self_reset = FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP;
if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET)
flags = FW_RESET_REQ_FLAGS_RESET_GRACEFUL;
break;
case BNXT_FW_RESET_AP:
proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_AP;
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -1814,6 +1805,27 @@ static int bnxt_firmware_reset(struct net_device *dev, u16 dir_type) ...@@ -1814,6 +1805,27 @@ static int bnxt_firmware_reset(struct net_device *dev, u16 dir_type)
return bnxt_hwrm_firmware_reset(dev, proc_type, self_reset, flags); return bnxt_hwrm_firmware_reset(dev, proc_type, self_reset, flags);
} }
static int bnxt_firmware_reset_chip(struct net_device *dev)
{
struct bnxt *bp = netdev_priv(dev);
u8 flags = 0;
if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET)
flags = FW_RESET_REQ_FLAGS_RESET_GRACEFUL;
return bnxt_hwrm_firmware_reset(dev,
FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP,
FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP,
flags);
}
static int bnxt_firmware_reset_ap(struct net_device *dev)
{
return bnxt_hwrm_firmware_reset(dev, FW_RESET_REQ_EMBEDDED_PROC_TYPE_AP,
FW_RESET_REQ_SELFRST_STATUS_SELFRSTNONE,
0);
}
static int bnxt_flash_firmware(struct net_device *dev, static int bnxt_flash_firmware(struct net_device *dev,
u16 dir_type, u16 dir_type,
const u8 *fw_data, const u8 *fw_data,
...@@ -3006,7 +3018,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) ...@@ -3006,7 +3018,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags)
if (bp->hwrm_spec_code < 0x10803) if (bp->hwrm_spec_code < 0x10803)
return -EOPNOTSUPP; return -EOPNOTSUPP;
rc = bnxt_firmware_reset(dev, BNXT_FW_RESET_CHIP); rc = bnxt_firmware_reset_chip(dev);
if (!rc) { if (!rc) {
netdev_info(dev, "Reset request successful.\n"); netdev_info(dev, "Reset request successful.\n");
if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET))
...@@ -3018,7 +3030,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) ...@@ -3018,7 +3030,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags)
if (bp->hwrm_spec_code < 0x10803) if (bp->hwrm_spec_code < 0x10803)
return -EOPNOTSUPP; return -EOPNOTSUPP;
rc = bnxt_firmware_reset(dev, BNXT_FW_RESET_AP); rc = bnxt_firmware_reset_ap(dev);
if (!rc) { if (!rc) {
netdev_info(dev, "Reset Application Processor request successful.\n"); netdev_info(dev, "Reset Application Processor request successful.\n");
*flags = 0; *flags = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment