Commit 0fdd052c authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

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: default avatarShannon Nelson <shannon.nelson@intel.com>
Acked-by: default avatarMichal Kosiarz <michal.kosiarz@intel.com>
Tested-by: default avatarJim Young <jamesx.m.young@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent c509c1de
...@@ -535,7 +535,10 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw, ...@@ -535,7 +535,10 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
*errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status); *errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status);
} else { } else {
status = i40e_nvmupd_nvm_read(hw, cmd, bytes, errno); status = i40e_nvmupd_nvm_read(hw, cmd, bytes, errno);
hw->nvmupd_state = I40E_NVMUPD_STATE_READING; if (status)
i40e_release_nvm(hw);
else
hw->nvmupd_state = I40E_NVMUPD_STATE_READING;
} }
break; break;
...@@ -571,7 +574,10 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw, ...@@ -571,7 +574,10 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
*errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status); *errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status);
} else { } else {
status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno); status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno);
hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING; if (status)
i40e_release_nvm(hw);
else
hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING;
} }
break; break;
...@@ -671,30 +677,30 @@ static i40e_status i40e_nvmupd_state_writing(struct i40e_hw *hw, ...@@ -671,30 +677,30 @@ static i40e_status i40e_nvmupd_state_writing(struct i40e_hw *hw,
case I40E_NVMUPD_WRITE_LCB: case I40E_NVMUPD_WRITE_LCB:
status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno); status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno);
if (!status) { if (!status)
hw->aq.nvm_release_on_done = true; hw->aq.nvm_release_on_done = true;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
}
break; break;
case I40E_NVMUPD_CSUM_CON: case I40E_NVMUPD_CSUM_CON:
status = i40e_update_nvm_checksum(hw); status = i40e_update_nvm_checksum(hw);
if (status) if (status) {
*errno = hw->aq.asq_last_status ? *errno = hw->aq.asq_last_status ?
i40e_aq_rc_to_posix(hw->aq.asq_last_status) : i40e_aq_rc_to_posix(hw->aq.asq_last_status) :
-EIO; -EIO;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
}
break; break;
case I40E_NVMUPD_CSUM_LCB: case I40E_NVMUPD_CSUM_LCB:
status = i40e_update_nvm_checksum(hw); status = i40e_update_nvm_checksum(hw);
if (status) { if (status)
*errno = hw->aq.asq_last_status ? *errno = hw->aq.asq_last_status ?
i40e_aq_rc_to_posix(hw->aq.asq_last_status) : i40e_aq_rc_to_posix(hw->aq.asq_last_status) :
-EIO; -EIO;
} else { else
hw->aq.nvm_release_on_done = true; hw->aq.nvm_release_on_done = true;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
}
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment