Skip to content

Commit aa8ed02

Browse files
Michael Chandavem330
authored andcommitted
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: Somnath Kotur <somnath.kotur@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7809592 commit aa8ed02

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5613,22 +5613,7 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
56135613
static int bnxt_open(struct net_device *dev)
56145614
{
56155615
struct bnxt *bp = netdev_priv(dev);
5616-
int rc = 0;
56175616

5618-
if (!test_bit(BNXT_STATE_FN_RST_DONE, &bp->state)) {
5619-
rc = bnxt_hwrm_func_reset(bp);
5620-
if (rc) {
5621-
netdev_err(bp->dev, "hwrm chip reset failure rc: %x\n",
5622-
rc);
5623-
rc = -EBUSY;
5624-
return rc;
5625-
}
5626-
/* Do func_reset during the 1st PF open only to prevent killing
5627-
* the VFs when the PF is brought down and up.
5628-
*/
5629-
if (BNXT_PF(bp))
5630-
set_bit(BNXT_STATE_FN_RST_DONE, &bp->state);
5631-
}
56325617
return __bnxt_open_nic(bp, true, true);
56335618
}
56345619

@@ -7028,6 +7013,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
70287013
if (rc)
70297014
goto init_err;
70307015

7016+
rc = bnxt_hwrm_func_reset(bp);
7017+
if (rc)
7018+
goto init_err;
7019+
70317020
rc = bnxt_init_int_mode(bp);
70327021
if (rc)
70337022
goto init_err;
@@ -7069,7 +7058,6 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
70697058
pci_channel_state_t state)
70707059
{
70717060
struct net_device *netdev = pci_get_drvdata(pdev);
7072-
struct bnxt *bp = netdev_priv(netdev);
70737061

70747062
netdev_info(netdev, "PCI I/O error detected\n");
70757063

@@ -7084,8 +7072,6 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
70847072
if (netif_running(netdev))
70857073
bnxt_close(netdev);
70867074

7087-
/* So that func_reset will be done during slot_reset */
7088-
clear_bit(BNXT_STATE_FN_RST_DONE, &bp->state);
70897075
pci_disable_device(pdev);
70907076
rtnl_unlock();
70917077

@@ -7119,7 +7105,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
71197105
} else {
71207106
pci_set_master(pdev);
71217107

7122-
if (netif_running(netdev))
7108+
err = bnxt_hwrm_func_reset(bp);
7109+
if (!err && netif_running(netdev))
71237110
err = bnxt_open(netdev);
71247111

71257112
if (!err)

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,6 @@ struct bnxt {
10211021
unsigned long state;
10221022
#define BNXT_STATE_OPEN 0
10231023
#define BNXT_STATE_IN_SP_TASK 1
1024-
#define BNXT_STATE_FN_RST_DONE 2
10251024

10261025
struct bnxt_irq *irq_tbl;
10271026
int total_irqs;

0 commit comments

Comments
 (0)