Commit aa8ed021 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Move function reset to bnxt_init_one().

Now that MSIX is enabled in bnxt_init_one(), resources may be allocated by
the RDMA driver before the network device is opened.  So we cannot do
function reset in bnxt_open() which will clear all the resources.

The proper place to do function reset now is in bnxt_init_one().
If we get AER, we'll do function reset as well.
Signed-off-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7809592d
...@@ -5613,22 +5613,7 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) ...@@ -5613,22 +5613,7 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
static int bnxt_open(struct net_device *dev) static int bnxt_open(struct net_device *dev)
{ {
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
int rc = 0;
if (!test_bit(BNXT_STATE_FN_RST_DONE, &bp->state)) {
rc = bnxt_hwrm_func_reset(bp);
if (rc) {
netdev_err(bp->dev, "hwrm chip reset failure rc: %x\n",
rc);
rc = -EBUSY;
return rc;
}
/* Do func_reset during the 1st PF open only to prevent killing
* the VFs when the PF is brought down and up.
*/
if (BNXT_PF(bp))
set_bit(BNXT_STATE_FN_RST_DONE, &bp->state);
}
return __bnxt_open_nic(bp, true, true); return __bnxt_open_nic(bp, true, true);
} }
...@@ -7028,6 +7013,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -7028,6 +7013,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) if (rc)
goto init_err; goto init_err;
rc = bnxt_hwrm_func_reset(bp);
if (rc)
goto init_err;
rc = bnxt_init_int_mode(bp); rc = bnxt_init_int_mode(bp);
if (rc) if (rc)
goto init_err; goto init_err;
...@@ -7069,7 +7058,6 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, ...@@ -7069,7 +7058,6 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state) pci_channel_state_t state)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct bnxt *bp = netdev_priv(netdev);
netdev_info(netdev, "PCI I/O error detected\n"); netdev_info(netdev, "PCI I/O error detected\n");
...@@ -7084,8 +7072,6 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, ...@@ -7084,8 +7072,6 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
if (netif_running(netdev)) if (netif_running(netdev))
bnxt_close(netdev); bnxt_close(netdev);
/* So that func_reset will be done during slot_reset */
clear_bit(BNXT_STATE_FN_RST_DONE, &bp->state);
pci_disable_device(pdev); pci_disable_device(pdev);
rtnl_unlock(); rtnl_unlock();
...@@ -7119,7 +7105,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) ...@@ -7119,7 +7105,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
} else { } else {
pci_set_master(pdev); pci_set_master(pdev);
if (netif_running(netdev)) err = bnxt_hwrm_func_reset(bp);
if (!err && netif_running(netdev))
err = bnxt_open(netdev); err = bnxt_open(netdev);
if (!err) if (!err)
......
...@@ -1021,7 +1021,6 @@ struct bnxt { ...@@ -1021,7 +1021,6 @@ struct bnxt {
unsigned long state; unsigned long state;
#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_FN_RST_DONE 2
struct bnxt_irq *irq_tbl; struct bnxt_irq *irq_tbl;
int total_irqs; int total_irqs;
......
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