bnxt.c (7e914027f757b656cd681ba4fe75f3984531ee50) bnxt.c (3bc7d4a352efe5b596883ef16b769055320db1f6)
1/* Broadcom NetXtreme-C/E network driver.
2 *
3 * Copyright (c) 2014-2016 Broadcom Corporation
4 * Copyright (c) 2016-2019 Broadcom Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.

--- 8702 unchanged lines hidden (view full) ---

8711 if (!up)
8712 return 0;
8713
8714 if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE)
8715 resc_reinit = true;
8716 if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE)
8717 fw_reset = true;
8718
1/* Broadcom NetXtreme-C/E network driver.
2 *
3 * Copyright (c) 2014-2016 Broadcom Corporation
4 * Copyright (c) 2016-2019 Broadcom Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.

--- 8702 unchanged lines hidden (view full) ---

8711 if (!up)
8712 return 0;
8713
8714 if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE)
8715 resc_reinit = true;
8716 if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE)
8717 fw_reset = true;
8718
8719 if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && !fw_reset) {
8720 netdev_err(bp->dev, "RESET_DONE not set during FW reset.\n");
8721 return -ENODEV;
8722 }
8719 if (resc_reinit || fw_reset) {
8720 if (fw_reset) {
8721 rc = bnxt_fw_init_one(bp);
8722 if (rc) {
8723 set_bit(BNXT_STATE_ABORT_ERR, &bp->state);
8724 return rc;
8725 }
8726 bnxt_clear_int_mode(bp);

--- 494 unchanged lines hidden (view full) ---

9221 /* Flush rings and and disable interrupts */
9222 bnxt_shutdown_nic(bp, irq_re_init);
9223
9224 /* TODO CHIMP_FW: Link/PHY related cleanup if (link_re_init) */
9225
9226 bnxt_debug_dev_exit(bp);
9227 bnxt_disable_napi(bp);
9228 del_timer_sync(&bp->timer);
8723 if (resc_reinit || fw_reset) {
8724 if (fw_reset) {
8725 rc = bnxt_fw_init_one(bp);
8726 if (rc) {
8727 set_bit(BNXT_STATE_ABORT_ERR, &bp->state);
8728 return rc;
8729 }
8730 bnxt_clear_int_mode(bp);

--- 494 unchanged lines hidden (view full) ---

9225 /* Flush rings and and disable interrupts */
9226 bnxt_shutdown_nic(bp, irq_re_init);
9227
9228 /* TODO CHIMP_FW: Link/PHY related cleanup if (link_re_init) */
9229
9230 bnxt_debug_dev_exit(bp);
9231 bnxt_disable_napi(bp);
9232 del_timer_sync(&bp->timer);
9233 if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) &&
9234 pci_is_enabled(bp->pdev))
9235 pci_disable_device(bp->pdev);
9236
9229 bnxt_free_skbs(bp);
9230
9231 /* Save ring stats before shutdown */
9232 if (bp->bnapi)
9233 bnxt_get_ring_stats(bp, &bp->net_stats_prev);
9234 if (irq_re_init) {
9235 bnxt_free_irq(bp);
9236 bnxt_del_napi(bp);
9237 }
9238 bnxt_free_mem(bp, irq_re_init);
9239}
9240
9241int bnxt_close_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
9242{
9243 int rc = 0;
9244
9237 bnxt_free_skbs(bp);
9238
9239 /* Save ring stats before shutdown */
9240 if (bp->bnapi)
9241 bnxt_get_ring_stats(bp, &bp->net_stats_prev);
9242 if (irq_re_init) {
9243 bnxt_free_irq(bp);
9244 bnxt_del_napi(bp);
9245 }
9246 bnxt_free_mem(bp, irq_re_init);
9247}
9248
9249int bnxt_close_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
9250{
9251 int rc = 0;
9252
9253 if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
9254 /* If we get here, it means firmware reset is in progress
9255 * while we are trying to close. We can safely proceed with
9256 * the close because we are holding rtnl_lock(). Some firmware
9257 * messages may fail as we proceed to close. We set the
9258 * ABORT_ERR flag here so that the FW reset thread will later
9259 * abort when it gets the rtnl_lock() and sees the flag.
9260 */
9261 netdev_warn(bp->dev, "FW reset in progress during close, FW reset will be aborted\n");
9262 set_bit(BNXT_STATE_ABORT_ERR, &bp->state);
9263 }
9264
9245#ifdef CONFIG_BNXT_SRIOV
9246 if (bp->sriov_cfg) {
9247 rc = wait_event_interruptible_timeout(bp->sriov_cfg_wait,
9248 !bp->sriov_cfg,
9249 BNXT_SRIOV_CFG_WAIT_TMO);
9250 if (rc)
9251 netdev_warn(bp->dev, "timeout waiting for SRIOV config operation to complete!\n");
9252 }

--- 2379 unchanged lines hidden ---
9265#ifdef CONFIG_BNXT_SRIOV
9266 if (bp->sriov_cfg) {
9267 rc = wait_event_interruptible_timeout(bp->sriov_cfg_wait,
9268 !bp->sriov_cfg,
9269 BNXT_SRIOV_CFG_WAIT_TMO);
9270 if (rc)
9271 netdev_warn(bp->dev, "timeout waiting for SRIOV config operation to complete!\n");
9272 }

--- 2379 unchanged lines hidden ---