Skip to content

Commit 0fdd052

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
i40e: fix up NVM update sm error handling
The state transitions after an error were not managed well, so these changes get us back to the INIT state or don't transition out of the INIT state after most errors. Change-ID: I90aa0e4e348dc4f58cbcdce9c5d4b7fd35981c6c Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Acked-by: Michal Kosiarz <michal.kosiarz@intel.com> Tested-by: Jim Young <jamesx.m.young@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent c509c1d commit 0fdd052

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

drivers/net/ethernet/intel/i40e/i40e_nvm.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,10 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
535535
*errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status);
536536
} else {
537537
status = i40e_nvmupd_nvm_read(hw, cmd, bytes, errno);
538-
hw->nvmupd_state = I40E_NVMUPD_STATE_READING;
538+
if (status)
539+
i40e_release_nvm(hw);
540+
else
541+
hw->nvmupd_state = I40E_NVMUPD_STATE_READING;
539542
}
540543
break;
541544

@@ -571,7 +574,10 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
571574
*errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status);
572575
} else {
573576
status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno);
574-
hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING;
577+
if (status)
578+
i40e_release_nvm(hw);
579+
else
580+
hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING;
575581
}
576582
break;
577583

@@ -671,30 +677,30 @@ static i40e_status i40e_nvmupd_state_writing(struct i40e_hw *hw,
671677

672678
case I40E_NVMUPD_WRITE_LCB:
673679
status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno);
674-
if (!status) {
680+
if (!status)
675681
hw->aq.nvm_release_on_done = true;
676-
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
677-
}
682+
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
678683
break;
679684

680685
case I40E_NVMUPD_CSUM_CON:
681686
status = i40e_update_nvm_checksum(hw);
682-
if (status)
687+
if (status) {
683688
*errno = hw->aq.asq_last_status ?
684689
i40e_aq_rc_to_posix(hw->aq.asq_last_status) :
685690
-EIO;
691+
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
692+
}
686693
break;
687694

688695
case I40E_NVMUPD_CSUM_LCB:
689696
status = i40e_update_nvm_checksum(hw);
690-
if (status) {
697+
if (status)
691698
*errno = hw->aq.asq_last_status ?
692699
i40e_aq_rc_to_posix(hw->aq.asq_last_status) :
693700
-EIO;
694-
} else {
701+
else
695702
hw->aq.nvm_release_on_done = true;
696-
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
697-
}
703+
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
698704
break;
699705

700706
default:

0 commit comments

Comments
 (0)