Skip to content

Commit f1c7e72

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
i40e: clean up error status messages
Clean up a little confusion in reporting error status in phy and fcoe setup error reports by separating the return status from the AQ error. Add two decoder functions to make this easier. Change-ID: I960bcdeef3978a15fec1cdb5eff781d5cbae42fb Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Jim Young <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 606a548 commit f1c7e72

File tree

9 files changed

+673
-177
lines changed

9 files changed

+673
-177
lines changed

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

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,212 @@ static i40e_status i40e_set_mac_type(struct i40e_hw *hw)
7171
return status;
7272
}
7373

74+
/**
75+
* i40e_aq_str - convert AQ err code to a string
76+
* @hw: pointer to the HW structure
77+
* @aq_err: the AQ error code to convert
78+
**/
79+
char *i40e_aq_str(struct i40e_hw *hw, enum i40e_admin_queue_err aq_err)
80+
{
81+
switch (aq_err) {
82+
case I40E_AQ_RC_OK:
83+
return "OK";
84+
case I40E_AQ_RC_EPERM:
85+
return "I40E_AQ_RC_EPERM";
86+
case I40E_AQ_RC_ENOENT:
87+
return "I40E_AQ_RC_ENOENT";
88+
case I40E_AQ_RC_ESRCH:
89+
return "I40E_AQ_RC_ESRCH";
90+
case I40E_AQ_RC_EINTR:
91+
return "I40E_AQ_RC_EINTR";
92+
case I40E_AQ_RC_EIO:
93+
return "I40E_AQ_RC_EIO";
94+
case I40E_AQ_RC_ENXIO:
95+
return "I40E_AQ_RC_ENXIO";
96+
case I40E_AQ_RC_E2BIG:
97+
return "I40E_AQ_RC_E2BIG";
98+
case I40E_AQ_RC_EAGAIN:
99+
return "I40E_AQ_RC_EAGAIN";
100+
case I40E_AQ_RC_ENOMEM:
101+
return "I40E_AQ_RC_ENOMEM";
102+
case I40E_AQ_RC_EACCES:
103+
return "I40E_AQ_RC_EACCES";
104+
case I40E_AQ_RC_EFAULT:
105+
return "I40E_AQ_RC_EFAULT";
106+
case I40E_AQ_RC_EBUSY:
107+
return "I40E_AQ_RC_EBUSY";
108+
case I40E_AQ_RC_EEXIST:
109+
return "I40E_AQ_RC_EEXIST";
110+
case I40E_AQ_RC_EINVAL:
111+
return "I40E_AQ_RC_EINVAL";
112+
case I40E_AQ_RC_ENOTTY:
113+
return "I40E_AQ_RC_ENOTTY";
114+
case I40E_AQ_RC_ENOSPC:
115+
return "I40E_AQ_RC_ENOSPC";
116+
case I40E_AQ_RC_ENOSYS:
117+
return "I40E_AQ_RC_ENOSYS";
118+
case I40E_AQ_RC_ERANGE:
119+
return "I40E_AQ_RC_ERANGE";
120+
case I40E_AQ_RC_EFLUSHED:
121+
return "I40E_AQ_RC_EFLUSHED";
122+
case I40E_AQ_RC_BAD_ADDR:
123+
return "I40E_AQ_RC_BAD_ADDR";
124+
case I40E_AQ_RC_EMODE:
125+
return "I40E_AQ_RC_EMODE";
126+
case I40E_AQ_RC_EFBIG:
127+
return "I40E_AQ_RC_EFBIG";
128+
}
129+
130+
snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err);
131+
return hw->err_str;
132+
}
133+
134+
/**
135+
* i40e_stat_str - convert status err code to a string
136+
* @hw: pointer to the HW structure
137+
* @stat_err: the status error code to convert
138+
**/
139+
char *i40e_stat_str(struct i40e_hw *hw, i40e_status stat_err)
140+
{
141+
switch (stat_err) {
142+
case 0:
143+
return "OK";
144+
case I40E_ERR_NVM:
145+
return "I40E_ERR_NVM";
146+
case I40E_ERR_NVM_CHECKSUM:
147+
return "I40E_ERR_NVM_CHECKSUM";
148+
case I40E_ERR_PHY:
149+
return "I40E_ERR_PHY";
150+
case I40E_ERR_CONFIG:
151+
return "I40E_ERR_CONFIG";
152+
case I40E_ERR_PARAM:
153+
return "I40E_ERR_PARAM";
154+
case I40E_ERR_MAC_TYPE:
155+
return "I40E_ERR_MAC_TYPE";
156+
case I40E_ERR_UNKNOWN_PHY:
157+
return "I40E_ERR_UNKNOWN_PHY";
158+
case I40E_ERR_LINK_SETUP:
159+
return "I40E_ERR_LINK_SETUP";
160+
case I40E_ERR_ADAPTER_STOPPED:
161+
return "I40E_ERR_ADAPTER_STOPPED";
162+
case I40E_ERR_INVALID_MAC_ADDR:
163+
return "I40E_ERR_INVALID_MAC_ADDR";
164+
case I40E_ERR_DEVICE_NOT_SUPPORTED:
165+
return "I40E_ERR_DEVICE_NOT_SUPPORTED";
166+
case I40E_ERR_MASTER_REQUESTS_PENDING:
167+
return "I40E_ERR_MASTER_REQUESTS_PENDING";
168+
case I40E_ERR_INVALID_LINK_SETTINGS:
169+
return "I40E_ERR_INVALID_LINK_SETTINGS";
170+
case I40E_ERR_AUTONEG_NOT_COMPLETE:
171+
return "I40E_ERR_AUTONEG_NOT_COMPLETE";
172+
case I40E_ERR_RESET_FAILED:
173+
return "I40E_ERR_RESET_FAILED";
174+
case I40E_ERR_SWFW_SYNC:
175+
return "I40E_ERR_SWFW_SYNC";
176+
case I40E_ERR_NO_AVAILABLE_VSI:
177+
return "I40E_ERR_NO_AVAILABLE_VSI";
178+
case I40E_ERR_NO_MEMORY:
179+
return "I40E_ERR_NO_MEMORY";
180+
case I40E_ERR_BAD_PTR:
181+
return "I40E_ERR_BAD_PTR";
182+
case I40E_ERR_RING_FULL:
183+
return "I40E_ERR_RING_FULL";
184+
case I40E_ERR_INVALID_PD_ID:
185+
return "I40E_ERR_INVALID_PD_ID";
186+
case I40E_ERR_INVALID_QP_ID:
187+
return "I40E_ERR_INVALID_QP_ID";
188+
case I40E_ERR_INVALID_CQ_ID:
189+
return "I40E_ERR_INVALID_CQ_ID";
190+
case I40E_ERR_INVALID_CEQ_ID:
191+
return "I40E_ERR_INVALID_CEQ_ID";
192+
case I40E_ERR_INVALID_AEQ_ID:
193+
return "I40E_ERR_INVALID_AEQ_ID";
194+
case I40E_ERR_INVALID_SIZE:
195+
return "I40E_ERR_INVALID_SIZE";
196+
case I40E_ERR_INVALID_ARP_INDEX:
197+
return "I40E_ERR_INVALID_ARP_INDEX";
198+
case I40E_ERR_INVALID_FPM_FUNC_ID:
199+
return "I40E_ERR_INVALID_FPM_FUNC_ID";
200+
case I40E_ERR_QP_INVALID_MSG_SIZE:
201+
return "I40E_ERR_QP_INVALID_MSG_SIZE";
202+
case I40E_ERR_QP_TOOMANY_WRS_POSTED:
203+
return "I40E_ERR_QP_TOOMANY_WRS_POSTED";
204+
case I40E_ERR_INVALID_FRAG_COUNT:
205+
return "I40E_ERR_INVALID_FRAG_COUNT";
206+
case I40E_ERR_QUEUE_EMPTY:
207+
return "I40E_ERR_QUEUE_EMPTY";
208+
case I40E_ERR_INVALID_ALIGNMENT:
209+
return "I40E_ERR_INVALID_ALIGNMENT";
210+
case I40E_ERR_FLUSHED_QUEUE:
211+
return "I40E_ERR_FLUSHED_QUEUE";
212+
case I40E_ERR_INVALID_PUSH_PAGE_INDEX:
213+
return "I40E_ERR_INVALID_PUSH_PAGE_INDEX";
214+
case I40E_ERR_INVALID_IMM_DATA_SIZE:
215+
return "I40E_ERR_INVALID_IMM_DATA_SIZE";
216+
case I40E_ERR_TIMEOUT:
217+
return "I40E_ERR_TIMEOUT";
218+
case I40E_ERR_OPCODE_MISMATCH:
219+
return "I40E_ERR_OPCODE_MISMATCH";
220+
case I40E_ERR_CQP_COMPL_ERROR:
221+
return "I40E_ERR_CQP_COMPL_ERROR";
222+
case I40E_ERR_INVALID_VF_ID:
223+
return "I40E_ERR_INVALID_VF_ID";
224+
case I40E_ERR_INVALID_HMCFN_ID:
225+
return "I40E_ERR_INVALID_HMCFN_ID";
226+
case I40E_ERR_BACKING_PAGE_ERROR:
227+
return "I40E_ERR_BACKING_PAGE_ERROR";
228+
case I40E_ERR_NO_PBLCHUNKS_AVAILABLE:
229+
return "I40E_ERR_NO_PBLCHUNKS_AVAILABLE";
230+
case I40E_ERR_INVALID_PBLE_INDEX:
231+
return "I40E_ERR_INVALID_PBLE_INDEX";
232+
case I40E_ERR_INVALID_SD_INDEX:
233+
return "I40E_ERR_INVALID_SD_INDEX";
234+
case I40E_ERR_INVALID_PAGE_DESC_INDEX:
235+
return "I40E_ERR_INVALID_PAGE_DESC_INDEX";
236+
case I40E_ERR_INVALID_SD_TYPE:
237+
return "I40E_ERR_INVALID_SD_TYPE";
238+
case I40E_ERR_MEMCPY_FAILED:
239+
return "I40E_ERR_MEMCPY_FAILED";
240+
case I40E_ERR_INVALID_HMC_OBJ_INDEX:
241+
return "I40E_ERR_INVALID_HMC_OBJ_INDEX";
242+
case I40E_ERR_INVALID_HMC_OBJ_COUNT:
243+
return "I40E_ERR_INVALID_HMC_OBJ_COUNT";
244+
case I40E_ERR_INVALID_SRQ_ARM_LIMIT:
245+
return "I40E_ERR_INVALID_SRQ_ARM_LIMIT";
246+
case I40E_ERR_SRQ_ENABLED:
247+
return "I40E_ERR_SRQ_ENABLED";
248+
case I40E_ERR_ADMIN_QUEUE_ERROR:
249+
return "I40E_ERR_ADMIN_QUEUE_ERROR";
250+
case I40E_ERR_ADMIN_QUEUE_TIMEOUT:
251+
return "I40E_ERR_ADMIN_QUEUE_TIMEOUT";
252+
case I40E_ERR_BUF_TOO_SHORT:
253+
return "I40E_ERR_BUF_TOO_SHORT";
254+
case I40E_ERR_ADMIN_QUEUE_FULL:
255+
return "I40E_ERR_ADMIN_QUEUE_FULL";
256+
case I40E_ERR_ADMIN_QUEUE_NO_WORK:
257+
return "I40E_ERR_ADMIN_QUEUE_NO_WORK";
258+
case I40E_ERR_BAD_IWARP_CQE:
259+
return "I40E_ERR_BAD_IWARP_CQE";
260+
case I40E_ERR_NVM_BLANK_MODE:
261+
return "I40E_ERR_NVM_BLANK_MODE";
262+
case I40E_ERR_NOT_IMPLEMENTED:
263+
return "I40E_ERR_NOT_IMPLEMENTED";
264+
case I40E_ERR_PE_DOORBELL_NOT_ENABLED:
265+
return "I40E_ERR_PE_DOORBELL_NOT_ENABLED";
266+
case I40E_ERR_DIAG_TEST_FAILED:
267+
return "I40E_ERR_DIAG_TEST_FAILED";
268+
case I40E_ERR_NOT_READY:
269+
return "I40E_ERR_NOT_READY";
270+
case I40E_NOT_SUPPORTED:
271+
return "I40E_NOT_SUPPORTED";
272+
case I40E_ERR_FIRMWARE_API_VERSION:
273+
return "I40E_ERR_FIRMWARE_API_VERSION";
274+
}
275+
276+
snprintf(hw->err_str, sizeof(hw->err_str), "%d", stat_err);
277+
return hw->err_str;
278+
}
279+
74280
/**
75281
* i40e_debug_aq
76282
* @hw: debug mask related to admin queue

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

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -681,15 +681,17 @@ static int i40e_set_settings(struct net_device *netdev,
681681
/* make the aq call */
682682
status = i40e_aq_set_phy_config(hw, &config, NULL);
683683
if (status) {
684-
netdev_info(netdev, "Set phy config failed with error %d.\n",
685-
status);
684+
netdev_info(netdev, "Set phy config failed, err %s aq_err %s\n",
685+
i40e_stat_str(hw, status),
686+
i40e_aq_str(hw, hw->aq.asq_last_status));
686687
return -EAGAIN;
687688
}
688689

689690
status = i40e_aq_get_link_info(hw, true, NULL, NULL);
690691
if (status)
691-
netdev_info(netdev, "Updating link info failed with error %d\n",
692-
status);
692+
netdev_info(netdev, "Updating link info failed with err %s aq_err %s\n",
693+
i40e_stat_str(hw, status),
694+
i40e_aq_str(hw, hw->aq.asq_last_status));
693695

694696
} else {
695697
netdev_info(netdev, "Nothing changed, exiting without setting anything.\n");
@@ -709,8 +711,9 @@ static int i40e_nway_reset(struct net_device *netdev)
709711

710712
ret = i40e_aq_set_link_restart_an(hw, link_up, NULL);
711713
if (ret) {
712-
netdev_info(netdev, "link restart failed, aq_err=%d\n",
713-
pf->hw.aq.asq_last_status);
714+
netdev_info(netdev, "link restart failed, err %s aq_err %s\n",
715+
i40e_stat_str(hw, ret),
716+
i40e_aq_str(hw, hw->aq.asq_last_status));
714717
return -EIO;
715718
}
716719

@@ -822,18 +825,21 @@ static int i40e_set_pauseparam(struct net_device *netdev,
822825
status = i40e_set_fc(hw, &aq_failures, link_up);
823826

824827
if (aq_failures & I40E_SET_FC_AQ_FAIL_GET) {
825-
netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with error %d and status %d\n",
826-
status, hw->aq.asq_last_status);
828+
netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with err %s aq_err %s\n",
829+
i40e_stat_str(hw, status),
830+
i40e_aq_str(hw, hw->aq.asq_last_status));
827831
err = -EAGAIN;
828832
}
829833
if (aq_failures & I40E_SET_FC_AQ_FAIL_SET) {
830-
netdev_info(netdev, "Set fc failed on the set_phy_config call with error %d and status %d\n",
831-
status, hw->aq.asq_last_status);
834+
netdev_info(netdev, "Set fc failed on the set_phy_config call with err %s aq_err %s\n",
835+
i40e_stat_str(hw, status),
836+
i40e_aq_str(hw, hw->aq.asq_last_status));
832837
err = -EAGAIN;
833838
}
834839
if (aq_failures & I40E_SET_FC_AQ_FAIL_UPDATE) {
835-
netdev_info(netdev, "Set fc failed on the get_link_info call with error %d and status %d\n",
836-
status, hw->aq.asq_last_status);
840+
netdev_info(netdev, "Set fc failed on the get_link_info call with err %s aq_err %s\n",
841+
i40e_stat_str(hw, status),
842+
i40e_aq_str(hw, hw->aq.asq_last_status));
837843
err = -EAGAIN;
838844
}
839845

0 commit comments

Comments
 (0)