Skip to content

Commit 14756b2

Browse files
SlawomirLabaanguy11
authored andcommitted
iavf: Fix __IAVF_RESETTING state usage
The setup of __IAVF_RESETTING state in watchdog task had no effect and could lead to slow resets in the driver as the task for __IAVF_RESETTING state only requeues watchdog. Till now the __IAVF_RESETTING was interpreted by reset task as running state which could lead to errors with allocating and resources disposal. Make watchdog_task queue the reset task when it's necessary. Do not update the state to __IAVF_RESETTING so the reset task knows exactly what is the current state of the adapter. Fixes: 898ef1c ("iavf: Combine init and watchdog state machines") Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com> Signed-off-by: Phani Burra <phani.r.burra@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com> Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent d2c0f45 commit 14756b2

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,7 @@ void iavf_down(struct iavf_adapter *adapter)
11371137
rss->state = IAVF_ADV_RSS_DEL_REQUEST;
11381138
spin_unlock_bh(&adapter->adv_rss_lock);
11391139

1140-
if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) &&
1141-
adapter->state != __IAVF_RESETTING) {
1140+
if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)) {
11421141
/* cancel any current operation */
11431142
adapter->current_op = VIRTCHNL_OP_UNKNOWN;
11441143
/* Schedule operations to close down the HW. Don't wait
@@ -2385,11 +2384,12 @@ static void iavf_watchdog_task(struct work_struct *work)
23852384
if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)
23862385
iavf_change_state(adapter, __IAVF_COMM_FAILED);
23872386

2388-
if (adapter->flags & IAVF_FLAG_RESET_NEEDED &&
2389-
adapter->state != __IAVF_RESETTING) {
2390-
iavf_change_state(adapter, __IAVF_RESETTING);
2387+
if (adapter->flags & IAVF_FLAG_RESET_NEEDED) {
23912388
adapter->aq_required = 0;
23922389
adapter->current_op = VIRTCHNL_OP_UNKNOWN;
2390+
mutex_unlock(&adapter->crit_lock);
2391+
queue_work(iavf_wq, &adapter->reset_task);
2392+
return;
23932393
}
23942394

23952395
switch (adapter->state) {
@@ -2697,8 +2697,7 @@ static void iavf_reset_task(struct work_struct *work)
26972697
* ndo_open() returning, so we can't assume it means all our open
26982698
* tasks have finished, since we're not holding the rtnl_lock here.
26992699
*/
2700-
running = ((adapter->state == __IAVF_RUNNING) ||
2701-
(adapter->state == __IAVF_RESETTING));
2700+
running = adapter->state == __IAVF_RUNNING;
27022701

27032702
if (running) {
27042703
netdev->flags &= ~IFF_UP;

0 commit comments

Comments
 (0)