Skip to content

Commit 81fa7c9

Browse files
Maciej SosinJeff Kirsher
authored andcommitted
i40e: Implementation of ERROR state for NVM update state machine
This patch adds I40E_NVMUPD_STATE_ERROR state for NVM update. Without this patch driver has no possibility to return NVM image write failure.This state is being set when ARQ rises error. arq_last_status is also updated every time when ARQ event comes, not only on error cases. Change-ID: I67ce43ba22a240773c2821b436e96054db0b7c81 Signed-off-by: Maciej Sosin <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 999b315 commit 81fa7c9

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,11 +964,11 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw,
964964
desc = I40E_ADMINQ_DESC(hw->aq.arq, ntc);
965965
desc_idx = ntc;
966966

967+
hw->aq.arq_last_status =
968+
(enum i40e_admin_queue_err)le16_to_cpu(desc->retval);
967969
flags = le16_to_cpu(desc->flags);
968970
if (flags & I40E_AQ_FLAG_ERR) {
969971
ret_code = I40E_ERR_ADMIN_QUEUE_ERROR;
970-
hw->aq.arq_last_status =
971-
(enum i40e_admin_queue_err)le16_to_cpu(desc->retval);
972972
i40e_debug(hw,
973973
I40E_DEBUG_AQ_MESSAGE,
974974
"AQRX: Event received with error 0x%X.\n",

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,20 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,
722722
*((u16 *)&bytes[2]) = hw->nvm_wait_opcode;
723723
}
724724

725+
/* Clear error status on read */
726+
if (hw->nvmupd_state == I40E_NVMUPD_STATE_ERROR)
727+
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
728+
725729
return 0;
726730
}
727731

732+
/* Clear status even it is not read and log */
733+
if (hw->nvmupd_state == I40E_NVMUPD_STATE_ERROR) {
734+
i40e_debug(hw, I40E_DEBUG_NVM,
735+
"Clearing I40E_NVMUPD_STATE_ERROR state without reading\n");
736+
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
737+
}
738+
728739
switch (hw->nvmupd_state) {
729740
case I40E_NVMUPD_STATE_INIT:
730741
status = i40e_nvmupd_state_init(hw, cmd, bytes, perrno);
@@ -1074,6 +1085,11 @@ void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode)
10741085
}
10751086
hw->nvm_wait_opcode = 0;
10761087

1088+
if (hw->aq.arq_last_status) {
1089+
hw->nvmupd_state = I40E_NVMUPD_STATE_ERROR;
1090+
return;
1091+
}
1092+
10771093
switch (hw->nvmupd_state) {
10781094
case I40E_NVMUPD_STATE_INIT_WAIT:
10791095
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;

drivers/net/ethernet/intel/i40e/i40e_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ enum i40e_nvmupd_state {
366366
I40E_NVMUPD_STATE_WRITING,
367367
I40E_NVMUPD_STATE_INIT_WAIT,
368368
I40E_NVMUPD_STATE_WRITE_WAIT,
369+
I40E_NVMUPD_STATE_ERROR
369370
};
370371

371372
/* nvm_access definition and its masks/shifts need to be accessible to

drivers/net/ethernet/intel/i40evf/i40e_adminq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,11 +912,11 @@ i40e_status i40evf_clean_arq_element(struct i40e_hw *hw,
912912
desc = I40E_ADMINQ_DESC(hw->aq.arq, ntc);
913913
desc_idx = ntc;
914914

915+
hw->aq.arq_last_status =
916+
(enum i40e_admin_queue_err)le16_to_cpu(desc->retval);
915917
flags = le16_to_cpu(desc->flags);
916918
if (flags & I40E_AQ_FLAG_ERR) {
917919
ret_code = I40E_ERR_ADMIN_QUEUE_ERROR;
918-
hw->aq.arq_last_status =
919-
(enum i40e_admin_queue_err)le16_to_cpu(desc->retval);
920920
i40e_debug(hw,
921921
I40E_DEBUG_AQ_MESSAGE,
922922
"AQRX: Event received with error 0x%X.\n",

drivers/net/ethernet/intel/i40evf/i40e_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ enum i40e_nvmupd_state {
348348
I40E_NVMUPD_STATE_WRITING,
349349
I40E_NVMUPD_STATE_INIT_WAIT,
350350
I40E_NVMUPD_STATE_WRITE_WAIT,
351+
I40E_NVMUPD_STATE_ERROR
351352
};
352353

353354
/* nvm_access definition and its masks/shifts need to be accessible to

0 commit comments

Comments
 (0)