diff options
author | Michael Chan <michael.chan@broadcom.com> | 2018-01-17 03:21:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-17 14:48:25 -0500 |
commit | 86e953db0114f396f916344395160aa267bf2627 (patch) | |
tree | 222d5e6a1b61ddc68d688a7421f0f6acd0e815f6 | |
parent | 894aa69a90932907f3de9d849ab9970884151d0e (diff) |
bnxt_en: Refactor bnxt_close_nic().
Add a new __bnxt_close_nic() function to do all the work previously done
in bnxt_close_nic() except waiting for SRIOV configuration. The new
function will be used in the next patch as part of SRIOV cleanup.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3015d863bc8c..0833a5398958 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -6512,23 +6512,13 @@ static bool bnxt_drv_busy(struct bnxt *bp) | |||
6512 | test_bit(BNXT_STATE_READ_STATS, &bp->state)); | 6512 | test_bit(BNXT_STATE_READ_STATS, &bp->state)); |
6513 | } | 6513 | } |
6514 | 6514 | ||
6515 | int bnxt_close_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) | 6515 | static void __bnxt_close_nic(struct bnxt *bp, bool irq_re_init, |
6516 | bool link_re_init) | ||
6516 | { | 6517 | { |
6517 | int rc = 0; | ||
6518 | |||
6519 | #ifdef CONFIG_BNXT_SRIOV | ||
6520 | if (bp->sriov_cfg) { | ||
6521 | rc = wait_event_interruptible_timeout(bp->sriov_cfg_wait, | ||
6522 | !bp->sriov_cfg, | ||
6523 | BNXT_SRIOV_CFG_WAIT_TMO); | ||
6524 | if (rc) | ||
6525 | netdev_warn(bp->dev, "timeout waiting for SRIOV config operation to complete!\n"); | ||
6526 | } | ||
6527 | |||
6528 | /* Close the VF-reps before closing PF */ | 6518 | /* Close the VF-reps before closing PF */ |
6529 | if (BNXT_PF(bp)) | 6519 | if (BNXT_PF(bp)) |
6530 | bnxt_vf_reps_close(bp); | 6520 | bnxt_vf_reps_close(bp); |
6531 | #endif | 6521 | |
6532 | /* Change device state to avoid TX queue wake up's */ | 6522 | /* Change device state to avoid TX queue wake up's */ |
6533 | bnxt_tx_disable(bp); | 6523 | bnxt_tx_disable(bp); |
6534 | 6524 | ||
@@ -6551,6 +6541,22 @@ int bnxt_close_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) | |||
6551 | bnxt_del_napi(bp); | 6541 | bnxt_del_napi(bp); |
6552 | } | 6542 | } |
6553 | bnxt_free_mem(bp, irq_re_init); | 6543 | bnxt_free_mem(bp, irq_re_init); |
6544 | } | ||
6545 | |||
6546 | int bnxt_close_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) | ||
6547 | { | ||
6548 | int rc = 0; | ||
6549 | |||
6550 | #ifdef CONFIG_BNXT_SRIOV | ||
6551 | if (bp->sriov_cfg) { | ||
6552 | rc = wait_event_interruptible_timeout(bp->sriov_cfg_wait, | ||
6553 | !bp->sriov_cfg, | ||
6554 | BNXT_SRIOV_CFG_WAIT_TMO); | ||
6555 | if (rc) | ||
6556 | netdev_warn(bp->dev, "timeout waiting for SRIOV config operation to complete!\n"); | ||
6557 | } | ||
6558 | #endif | ||
6559 | __bnxt_close_nic(bp, irq_re_init, link_re_init); | ||
6554 | return rc; | 6560 | return rc; |
6555 | } | 6561 | } |
6556 | 6562 | ||