11// SPDX-License-Identifier: GPL-2.0
22/* Copyright(c) 2013 - 2018 Intel Corporation. */
33
4- #include "i40e_status.h"
54#include "i40e_type.h"
65#include "i40e_register.h"
76#include "i40e_adminq.h"
@@ -284,7 +283,7 @@ static int i40e_config_asq_regs(struct i40e_hw *hw)
284283 /* Check one register to verify that config was applied */
285284 reg = rd32 (hw , hw -> aq .asq .bal );
286285 if (reg != lower_32_bits (hw -> aq .asq .desc_buf .pa ))
287- ret_code = I40E_ERR_ADMIN_QUEUE_ERROR ;
286+ ret_code = - EIO ;
288287
289288 return ret_code ;
290289}
@@ -316,7 +315,7 @@ static int i40e_config_arq_regs(struct i40e_hw *hw)
316315 /* Check one register to verify that config was applied */
317316 reg = rd32 (hw , hw -> aq .arq .bal );
318317 if (reg != lower_32_bits (hw -> aq .arq .desc_buf .pa ))
319- ret_code = I40E_ERR_ADMIN_QUEUE_ERROR ;
318+ ret_code = - EIO ;
320319
321320 return ret_code ;
322321}
@@ -340,14 +339,14 @@ static int i40e_init_asq(struct i40e_hw *hw)
340339
341340 if (hw -> aq .asq .count > 0 ) {
342341 /* queue already initialized */
343- ret_code = I40E_ERR_NOT_READY ;
342+ ret_code = - EBUSY ;
344343 goto init_adminq_exit ;
345344 }
346345
347346 /* verify input for valid configuration */
348347 if ((hw -> aq .num_asq_entries == 0 ) ||
349348 (hw -> aq .asq_buf_size == 0 )) {
350- ret_code = I40E_ERR_CONFIG ;
349+ ret_code = - EIO ;
351350 goto init_adminq_exit ;
352351 }
353352
@@ -399,14 +398,14 @@ static int i40e_init_arq(struct i40e_hw *hw)
399398
400399 if (hw -> aq .arq .count > 0 ) {
401400 /* queue already initialized */
402- ret_code = I40E_ERR_NOT_READY ;
401+ ret_code = - EBUSY ;
403402 goto init_adminq_exit ;
404403 }
405404
406405 /* verify input for valid configuration */
407406 if ((hw -> aq .num_arq_entries == 0 ) ||
408407 (hw -> aq .arq_buf_size == 0 )) {
409- ret_code = I40E_ERR_CONFIG ;
408+ ret_code = - EIO ;
410409 goto init_adminq_exit ;
411410 }
412411
@@ -452,7 +451,7 @@ static int i40e_shutdown_asq(struct i40e_hw *hw)
452451 mutex_lock (& hw -> aq .asq_mutex );
453452
454453 if (hw -> aq .asq .count == 0 ) {
455- ret_code = I40E_ERR_NOT_READY ;
454+ ret_code = - EBUSY ;
456455 goto shutdown_asq_out ;
457456 }
458457
@@ -486,7 +485,7 @@ static int i40e_shutdown_arq(struct i40e_hw *hw)
486485 mutex_lock (& hw -> aq .arq_mutex );
487486
488487 if (hw -> aq .arq .count == 0 ) {
489- ret_code = I40E_ERR_NOT_READY ;
488+ ret_code = - EBUSY ;
490489 goto shutdown_arq_out ;
491490 }
492491
@@ -594,7 +593,7 @@ int i40e_init_adminq(struct i40e_hw *hw)
594593 (hw -> aq .num_asq_entries == 0 ) ||
595594 (hw -> aq .arq_buf_size == 0 ) ||
596595 (hw -> aq .asq_buf_size == 0 )) {
597- ret_code = I40E_ERR_CONFIG ;
596+ ret_code = - EIO ;
598597 goto init_adminq_exit ;
599598 }
600599
@@ -626,13 +625,13 @@ int i40e_init_adminq(struct i40e_hw *hw)
626625 & hw -> aq .api_maj_ver ,
627626 & hw -> aq .api_min_ver ,
628627 NULL );
629- if (ret_code != I40E_ERR_ADMIN_QUEUE_TIMEOUT )
628+ if (ret_code != - EIO )
630629 break ;
631630 retry ++ ;
632631 msleep (100 );
633632 i40e_resume_aq (hw );
634633 } while (retry < 10 );
635- if (ret_code != I40E_SUCCESS )
634+ if (ret_code != 0 )
636635 goto init_adminq_free_arq ;
637636
638637 /* Some features were introduced in different FW API version
@@ -672,7 +671,7 @@ int i40e_init_adminq(struct i40e_hw *hw)
672671 hw -> flags |= I40E_HW_FLAG_802_1AD_CAPABLE ;
673672
674673 if (hw -> aq .api_maj_ver > I40E_FW_API_VERSION_MAJOR ) {
675- ret_code = I40E_ERR_FIRMWARE_API_VERSION ;
674+ ret_code = - EIO ;
676675 goto init_adminq_free_arq ;
677676 }
678677
@@ -799,7 +798,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
799798 if (hw -> aq .asq .count == 0 ) {
800799 i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
801800 "AQTX: Admin queue not initialized.\n" );
802- status = I40E_ERR_QUEUE_EMPTY ;
801+ status = - EIO ;
803802 goto asq_send_command_error ;
804803 }
805804
@@ -809,7 +808,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
809808 if (val >= hw -> aq .num_asq_entries ) {
810809 i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
811810 "AQTX: head overrun at %d\n" , val );
812- status = I40E_ERR_ADMIN_QUEUE_FULL ;
811+ status = - ENOSPC ;
813812 goto asq_send_command_error ;
814813 }
815814
@@ -840,15 +839,15 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
840839 I40E_DEBUG_AQ_MESSAGE ,
841840 "AQTX: Invalid buffer size: %d.\n" ,
842841 buff_size );
843- status = I40E_ERR_INVALID_SIZE ;
842+ status = - EINVAL ;
844843 goto asq_send_command_error ;
845844 }
846845
847846 if (details -> postpone && !details -> async ) {
848847 i40e_debug (hw ,
849848 I40E_DEBUG_AQ_MESSAGE ,
850849 "AQTX: Async flag not set along with postpone flag" );
851- status = I40E_ERR_PARAM ;
850+ status = - EINVAL ;
852851 goto asq_send_command_error ;
853852 }
854853
@@ -863,7 +862,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
863862 i40e_debug (hw ,
864863 I40E_DEBUG_AQ_MESSAGE ,
865864 "AQTX: Error queue is full.\n" );
866- status = I40E_ERR_ADMIN_QUEUE_FULL ;
865+ status = - ENOSPC ;
867866 goto asq_send_command_error ;
868867 }
869868
@@ -940,9 +939,9 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
940939 if ((enum i40e_admin_queue_err )retval == I40E_AQ_RC_OK )
941940 status = 0 ;
942941 else if ((enum i40e_admin_queue_err )retval == I40E_AQ_RC_EBUSY )
943- status = I40E_ERR_NOT_READY ;
942+ status = - EBUSY ;
944943 else
945- status = I40E_ERR_ADMIN_QUEUE_ERROR ;
944+ status = - EIO ;
946945 hw -> aq .asq_last_status = (enum i40e_admin_queue_err )retval ;
947946 }
948947
@@ -960,11 +959,11 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
960959 if (rd32 (hw , hw -> aq .asq .len ) & I40E_GL_ATQLEN_ATQCRIT_MASK ) {
961960 i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
962961 "AQTX: AQ Critical error.\n" );
963- status = I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR ;
962+ status = - EIO ;
964963 } else {
965964 i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
966965 "AQTX: Writeback timeout.\n" );
967- status = I40E_ERR_ADMIN_QUEUE_TIMEOUT ;
966+ status = - EIO ;
968967 }
969968 }
970969
@@ -1106,15 +1105,15 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
11061105 if (hw -> aq .arq .count == 0 ) {
11071106 i40e_debug (hw , I40E_DEBUG_AQ_MESSAGE ,
11081107 "AQRX: Admin queue not initialized.\n" );
1109- ret_code = I40E_ERR_QUEUE_EMPTY ;
1108+ ret_code = - EIO ;
11101109 goto clean_arq_element_err ;
11111110 }
11121111
11131112 /* set next_to_use to head */
11141113 ntu = rd32 (hw , hw -> aq .arq .head ) & I40E_PF_ARQH_ARQH_MASK ;
11151114 if (ntu == ntc ) {
11161115 /* nothing to do - shouldn't need to update ring's values */
1117- ret_code = I40E_ERR_ADMIN_QUEUE_NO_WORK ;
1116+ ret_code = - EALREADY ;
11181117 goto clean_arq_element_out ;
11191118 }
11201119
@@ -1126,7 +1125,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
11261125 (enum i40e_admin_queue_err )le16_to_cpu (desc -> retval );
11271126 flags = le16_to_cpu (desc -> flags );
11281127 if (flags & I40E_AQ_FLAG_ERR ) {
1129- ret_code = I40E_ERR_ADMIN_QUEUE_ERROR ;
1128+ ret_code = - EIO ;
11301129 i40e_debug (hw ,
11311130 I40E_DEBUG_AQ_MESSAGE ,
11321131 "AQRX: Event received with error 0x%X.\n" ,
0 commit comments