bnxt_en: Handle firmware reset status during IF_UP.
During IF_UP, newer firmware has a new status flag that indicates that firmware has reset. Add new function bnxt_fw_init_one() to re-probe the firmware and re-setup VF resources on the PF if necessary. If the re-probe fails, set a flag to prevent bnxt_open() from proceeding again. 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>
This commit is contained in:
Родитель
91b9be4870
Коммит
ec5d31e3c1
|
@ -8523,11 +8523,14 @@ static int bnxt_hwrm_shutdown_link(struct bnxt *bp)
|
||||||
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int bnxt_fw_init_one(struct bnxt *bp);
|
||||||
|
|
||||||
static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
|
static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
|
||||||
{
|
{
|
||||||
struct hwrm_func_drv_if_change_output *resp = bp->hwrm_cmd_resp_addr;
|
struct hwrm_func_drv_if_change_output *resp = bp->hwrm_cmd_resp_addr;
|
||||||
struct hwrm_func_drv_if_change_input req = {0};
|
struct hwrm_func_drv_if_change_input req = {0};
|
||||||
bool resc_reinit = false;
|
bool resc_reinit = false, fw_reset = false;
|
||||||
|
u32 flags = 0;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!(bp->fw_cap & BNXT_FW_CAP_IF_CHANGE))
|
if (!(bp->fw_cap & BNXT_FW_CAP_IF_CHANGE))
|
||||||
|
@ -8538,12 +8541,36 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
|
||||||
req.flags = cpu_to_le32(FUNC_DRV_IF_CHANGE_REQ_FLAGS_UP);
|
req.flags = cpu_to_le32(FUNC_DRV_IF_CHANGE_REQ_FLAGS_UP);
|
||||||
mutex_lock(&bp->hwrm_cmd_lock);
|
mutex_lock(&bp->hwrm_cmd_lock);
|
||||||
rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
||||||
if (!rc && (resp->flags &
|
if (!rc)
|
||||||
cpu_to_le32(FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE)))
|
flags = le32_to_cpu(resp->flags);
|
||||||
resc_reinit = true;
|
|
||||||
mutex_unlock(&bp->hwrm_cmd_lock);
|
mutex_unlock(&bp->hwrm_cmd_lock);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
|
||||||
if (up && resc_reinit && BNXT_NEW_RM(bp)) {
|
if (!up)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE)
|
||||||
|
resc_reinit = true;
|
||||||
|
if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE)
|
||||||
|
fw_reset = true;
|
||||||
|
|
||||||
|
if (resc_reinit || fw_reset) {
|
||||||
|
if (fw_reset) {
|
||||||
|
rc = bnxt_fw_init_one(bp);
|
||||||
|
if (rc) {
|
||||||
|
set_bit(BNXT_STATE_ABORT_ERR, &bp->state);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
bnxt_clear_int_mode(bp);
|
||||||
|
rc = bnxt_init_int_mode(bp);
|
||||||
|
if (rc) {
|
||||||
|
netdev_err(bp->dev, "init int mode failed\n");
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
set_bit(BNXT_STATE_FW_RESET_DET, &bp->state);
|
||||||
|
}
|
||||||
|
if (BNXT_NEW_RM(bp)) {
|
||||||
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
|
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
|
||||||
|
|
||||||
rc = bnxt_hwrm_func_resc_qcaps(bp, true);
|
rc = bnxt_hwrm_func_resc_qcaps(bp, true);
|
||||||
|
@ -8554,10 +8581,13 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
|
||||||
hw_resc->resv_rx_rings = 0;
|
hw_resc->resv_rx_rings = 0;
|
||||||
hw_resc->resv_hw_ring_grps = 0;
|
hw_resc->resv_hw_ring_grps = 0;
|
||||||
hw_resc->resv_vnics = 0;
|
hw_resc->resv_vnics = 0;
|
||||||
|
if (!fw_reset) {
|
||||||
bp->tx_nr_rings = 0;
|
bp->tx_nr_rings = 0;
|
||||||
bp->rx_nr_rings = 0;
|
bp->rx_nr_rings = 0;
|
||||||
}
|
}
|
||||||
return rc;
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bnxt_hwrm_port_led_qcaps(struct bnxt *bp)
|
static int bnxt_hwrm_port_led_qcaps(struct bnxt *bp)
|
||||||
|
@ -8977,12 +9007,28 @@ static int bnxt_open(struct net_device *dev)
|
||||||
struct bnxt *bp = netdev_priv(dev);
|
struct bnxt *bp = netdev_priv(dev);
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
bnxt_hwrm_if_change(bp, true);
|
if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
|
||||||
rc = __bnxt_open_nic(bp, true, true);
|
netdev_err(bp->dev, "A previous firmware reset did not complete, aborting\n");
|
||||||
if (rc)
|
return -ENODEV;
|
||||||
bnxt_hwrm_if_change(bp, false);
|
}
|
||||||
|
|
||||||
|
rc = bnxt_hwrm_if_change(bp, true);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
rc = __bnxt_open_nic(bp, true, true);
|
||||||
|
if (rc) {
|
||||||
|
bnxt_hwrm_if_change(bp, false);
|
||||||
|
} else {
|
||||||
|
if (test_and_clear_bit(BNXT_STATE_FW_RESET_DET, &bp->state) &&
|
||||||
|
BNXT_PF(bp)) {
|
||||||
|
struct bnxt_pf_info *pf = &bp->pf;
|
||||||
|
int n = pf->active_vfs;
|
||||||
|
|
||||||
|
if (n)
|
||||||
|
bnxt_cfg_hw_sriov(bp, &n);
|
||||||
|
}
|
||||||
bnxt_hwmon_open(bp);
|
bnxt_hwmon_open(bp);
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -10075,6 +10121,27 @@ static void bnxt_fw_init_one_p3(struct bnxt *bp)
|
||||||
bnxt_hwrm_coal_params_qcaps(bp);
|
bnxt_hwrm_coal_params_qcaps(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int bnxt_fw_init_one(struct bnxt *bp)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
rc = bnxt_fw_init_one_p1(bp);
|
||||||
|
if (rc) {
|
||||||
|
netdev_err(bp->dev, "Firmware init phase 1 failed\n");
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
rc = bnxt_fw_init_one_p2(bp);
|
||||||
|
if (rc) {
|
||||||
|
netdev_err(bp->dev, "Firmware init phase 2 failed\n");
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
rc = bnxt_approve_mac(bp, bp->dev->dev_addr, false);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
bnxt_fw_init_one_p3(bp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
|
static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
|
@ -1555,6 +1555,8 @@ struct bnxt {
|
||||||
#define BNXT_STATE_OPEN 0
|
#define BNXT_STATE_OPEN 0
|
||||||
#define BNXT_STATE_IN_SP_TASK 1
|
#define BNXT_STATE_IN_SP_TASK 1
|
||||||
#define BNXT_STATE_READ_STATS 2
|
#define BNXT_STATE_READ_STATS 2
|
||||||
|
#define BNXT_STATE_FW_RESET_DET 3
|
||||||
|
#define BNXT_STATE_ABORT_ERR 5
|
||||||
|
|
||||||
struct bnxt_irq *irq_tbl;
|
struct bnxt_irq *irq_tbl;
|
||||||
int total_irqs;
|
int total_irqs;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче