Skip to content

Commit fdd288e

Browse files
pgardocxanguy11
authored andcommitted
ice: Distinguish driver reset and removal for AQ shutdown
Admin queue command for shutdown AQ contains a flag to indicate driver unload. However, the flag is always set in the driver, even for resets. It can cause the firmware to consider driver as unloaded once the PF reset is triggered on all ports of device, which could lead to unexpected results. Add an additional function parameter to functions that shutdown AQ, indicating whether the driver is actually unloading. Reviewed-by: Ahmed Zaki <ahmed.zaki@intel.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Piotr Gardocki <piotrx.gardocki@intel.com> Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 7dfefd0 commit fdd288e

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

drivers/net/ethernet/intel/ice/ice_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int ice_check_reset(struct ice_hw *hw);
2323
int ice_reset(struct ice_hw *hw, enum ice_reset_req req);
2424
int ice_create_all_ctrlq(struct ice_hw *hw);
2525
int ice_init_all_ctrlq(struct ice_hw *hw);
26-
void ice_shutdown_all_ctrlq(struct ice_hw *hw);
26+
void ice_shutdown_all_ctrlq(struct ice_hw *hw, bool unloading);
2727
void ice_destroy_all_ctrlq(struct ice_hw *hw);
2828
int
2929
ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,

drivers/net/ethernet/intel/ice/ice_controlq.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -687,18 +687,20 @@ struct ice_ctl_q_info *ice_get_sbq(struct ice_hw *hw)
687687
* ice_shutdown_ctrlq - shutdown routine for any control queue
688688
* @hw: pointer to the hardware structure
689689
* @q_type: specific Control queue type
690+
* @unloading: is the driver unloading itself
690691
*
691692
* NOTE: this function does not destroy the control queue locks.
692693
*/
693-
static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
694+
static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type,
695+
bool unloading)
694696
{
695697
struct ice_ctl_q_info *cq;
696698

697699
switch (q_type) {
698700
case ICE_CTL_Q_ADMIN:
699701
cq = &hw->adminq;
700702
if (ice_check_sq_alive(hw, cq))
701-
ice_aq_q_shutdown(hw, true);
703+
ice_aq_q_shutdown(hw, unloading);
702704
break;
703705
case ICE_CTL_Q_SB:
704706
cq = &hw->sbq;
@@ -717,20 +719,21 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
717719
/**
718720
* ice_shutdown_all_ctrlq - shutdown routine for all control queues
719721
* @hw: pointer to the hardware structure
722+
* @unloading: is the driver unloading itself
720723
*
721724
* NOTE: this function does not destroy the control queue locks. The driver
722725
* may call this at runtime to shutdown and later restart control queues, such
723726
* as in response to a reset event.
724727
*/
725-
void ice_shutdown_all_ctrlq(struct ice_hw *hw)
728+
void ice_shutdown_all_ctrlq(struct ice_hw *hw, bool unloading)
726729
{
727730
/* Shutdown FW admin queue */
728-
ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN);
731+
ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN, unloading);
729732
/* Shutdown PHY Sideband */
730733
if (ice_is_sbq_supported(hw))
731-
ice_shutdown_ctrlq(hw, ICE_CTL_Q_SB);
734+
ice_shutdown_ctrlq(hw, ICE_CTL_Q_SB, unloading);
732735
/* Shutdown PF-VF Mailbox */
733-
ice_shutdown_ctrlq(hw, ICE_CTL_Q_MAILBOX);
736+
ice_shutdown_ctrlq(hw, ICE_CTL_Q_MAILBOX, unloading);
734737
}
735738

736739
/**
@@ -762,7 +765,7 @@ int ice_init_all_ctrlq(struct ice_hw *hw)
762765
break;
763766

764767
ice_debug(hw, ICE_DBG_AQ_MSG, "Retry Admin Queue init due to FW critical error\n");
765-
ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN);
768+
ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN, true);
766769
msleep(ICE_CTL_Q_ADMIN_INIT_MSEC);
767770
} while (retry++ < ICE_CTL_Q_ADMIN_INIT_TIMEOUT);
768771

@@ -843,7 +846,7 @@ static void ice_destroy_ctrlq_locks(struct ice_ctl_q_info *cq)
843846
void ice_destroy_all_ctrlq(struct ice_hw *hw)
844847
{
845848
/* shut down all the control queues first */
846-
ice_shutdown_all_ctrlq(hw);
849+
ice_shutdown_all_ctrlq(hw, true);
847850

848851
ice_destroy_ctrlq_locks(&hw->adminq);
849852
if (ice_is_sbq_supported(hw))

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
623623
if (hw->port_info)
624624
ice_sched_clear_port(hw->port_info);
625625

626-
ice_shutdown_all_ctrlq(hw);
626+
ice_shutdown_all_ctrlq(hw, false);
627627

628628
set_bit(ICE_PREPARED_FOR_RESET, pf->state);
629629
}
@@ -5499,7 +5499,7 @@ static void ice_prepare_for_shutdown(struct ice_pf *pf)
54995499
if (pf->vsi[v])
55005500
pf->vsi[v]->vsi_num = 0;
55015501

5502-
ice_shutdown_all_ctrlq(hw);
5502+
ice_shutdown_all_ctrlq(hw, true);
55035503
}
55045504

55055505
/**
@@ -7759,7 +7759,7 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
77597759
err_sched_init_port:
77607760
ice_sched_cleanup_all(hw);
77617761
err_init_ctrlq:
7762-
ice_shutdown_all_ctrlq(hw);
7762+
ice_shutdown_all_ctrlq(hw, false);
77637763
set_bit(ICE_RESET_FAILED, pf->state);
77647764
clear_recovery:
77657765
/* set this bit in PF state to control service task scheduling */

0 commit comments

Comments
 (0)