Commit 230f3d53 authored by Jan Sokolowski's avatar Jan Sokolowski Committed by Jakub Kicinski

i40e: remove i40e_status

Replace uses of i40e_status to as equivalent as possible error codes.
Remove enum i40e_status as it is no longer needed
Signed-off-by: default avatarJan Sokolowski <jan.sokolowski@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230728171336.2446156-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 68223f96
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2013 - 2018 Intel Corporation. */ /* Copyright(c) 2013 - 2018 Intel Corporation. */
#include "i40e_status.h"
#include "i40e_type.h" #include "i40e_type.h"
#include "i40e_register.h" #include "i40e_register.h"
#include "i40e_adminq.h" #include "i40e_adminq.h"
...@@ -284,7 +283,7 @@ static int i40e_config_asq_regs(struct i40e_hw *hw) ...@@ -284,7 +283,7 @@ static int i40e_config_asq_regs(struct i40e_hw *hw)
/* Check one register to verify that config was applied */ /* Check one register to verify that config was applied */
reg = rd32(hw, hw->aq.asq.bal); reg = rd32(hw, hw->aq.asq.bal);
if (reg != lower_32_bits(hw->aq.asq.desc_buf.pa)) if (reg != lower_32_bits(hw->aq.asq.desc_buf.pa))
ret_code = I40E_ERR_ADMIN_QUEUE_ERROR; ret_code = -EIO;
return ret_code; return ret_code;
} }
...@@ -316,7 +315,7 @@ static int i40e_config_arq_regs(struct i40e_hw *hw) ...@@ -316,7 +315,7 @@ static int i40e_config_arq_regs(struct i40e_hw *hw)
/* Check one register to verify that config was applied */ /* Check one register to verify that config was applied */
reg = rd32(hw, hw->aq.arq.bal); reg = rd32(hw, hw->aq.arq.bal);
if (reg != lower_32_bits(hw->aq.arq.desc_buf.pa)) if (reg != lower_32_bits(hw->aq.arq.desc_buf.pa))
ret_code = I40E_ERR_ADMIN_QUEUE_ERROR; ret_code = -EIO;
return ret_code; return ret_code;
} }
...@@ -340,14 +339,14 @@ static int i40e_init_asq(struct i40e_hw *hw) ...@@ -340,14 +339,14 @@ static int i40e_init_asq(struct i40e_hw *hw)
if (hw->aq.asq.count > 0) { if (hw->aq.asq.count > 0) {
/* queue already initialized */ /* queue already initialized */
ret_code = I40E_ERR_NOT_READY; ret_code = -EBUSY;
goto init_adminq_exit; goto init_adminq_exit;
} }
/* verify input for valid configuration */ /* verify input for valid configuration */
if ((hw->aq.num_asq_entries == 0) || if ((hw->aq.num_asq_entries == 0) ||
(hw->aq.asq_buf_size == 0)) { (hw->aq.asq_buf_size == 0)) {
ret_code = I40E_ERR_CONFIG; ret_code = -EIO;
goto init_adminq_exit; goto init_adminq_exit;
} }
...@@ -399,14 +398,14 @@ static int i40e_init_arq(struct i40e_hw *hw) ...@@ -399,14 +398,14 @@ static int i40e_init_arq(struct i40e_hw *hw)
if (hw->aq.arq.count > 0) { if (hw->aq.arq.count > 0) {
/* queue already initialized */ /* queue already initialized */
ret_code = I40E_ERR_NOT_READY; ret_code = -EBUSY;
goto init_adminq_exit; goto init_adminq_exit;
} }
/* verify input for valid configuration */ /* verify input for valid configuration */
if ((hw->aq.num_arq_entries == 0) || if ((hw->aq.num_arq_entries == 0) ||
(hw->aq.arq_buf_size == 0)) { (hw->aq.arq_buf_size == 0)) {
ret_code = I40E_ERR_CONFIG; ret_code = -EIO;
goto init_adminq_exit; goto init_adminq_exit;
} }
...@@ -452,7 +451,7 @@ static int i40e_shutdown_asq(struct i40e_hw *hw) ...@@ -452,7 +451,7 @@ static int i40e_shutdown_asq(struct i40e_hw *hw)
mutex_lock(&hw->aq.asq_mutex); mutex_lock(&hw->aq.asq_mutex);
if (hw->aq.asq.count == 0) { if (hw->aq.asq.count == 0) {
ret_code = I40E_ERR_NOT_READY; ret_code = -EBUSY;
goto shutdown_asq_out; goto shutdown_asq_out;
} }
...@@ -486,7 +485,7 @@ static int i40e_shutdown_arq(struct i40e_hw *hw) ...@@ -486,7 +485,7 @@ static int i40e_shutdown_arq(struct i40e_hw *hw)
mutex_lock(&hw->aq.arq_mutex); mutex_lock(&hw->aq.arq_mutex);
if (hw->aq.arq.count == 0) { if (hw->aq.arq.count == 0) {
ret_code = I40E_ERR_NOT_READY; ret_code = -EBUSY;
goto shutdown_arq_out; goto shutdown_arq_out;
} }
...@@ -594,7 +593,7 @@ int i40e_init_adminq(struct i40e_hw *hw) ...@@ -594,7 +593,7 @@ int i40e_init_adminq(struct i40e_hw *hw)
(hw->aq.num_asq_entries == 0) || (hw->aq.num_asq_entries == 0) ||
(hw->aq.arq_buf_size == 0) || (hw->aq.arq_buf_size == 0) ||
(hw->aq.asq_buf_size == 0)) { (hw->aq.asq_buf_size == 0)) {
ret_code = I40E_ERR_CONFIG; ret_code = -EIO;
goto init_adminq_exit; goto init_adminq_exit;
} }
...@@ -626,13 +625,13 @@ int i40e_init_adminq(struct i40e_hw *hw) ...@@ -626,13 +625,13 @@ int i40e_init_adminq(struct i40e_hw *hw)
&hw->aq.api_maj_ver, &hw->aq.api_maj_ver,
&hw->aq.api_min_ver, &hw->aq.api_min_ver,
NULL); NULL);
if (ret_code != I40E_ERR_ADMIN_QUEUE_TIMEOUT) if (ret_code != -EIO)
break; break;
retry++; retry++;
msleep(100); msleep(100);
i40e_resume_aq(hw); i40e_resume_aq(hw);
} while (retry < 10); } while (retry < 10);
if (ret_code != I40E_SUCCESS) if (ret_code != 0)
goto init_adminq_free_arq; goto init_adminq_free_arq;
/* Some features were introduced in different FW API version /* Some features were introduced in different FW API version
...@@ -672,7 +671,7 @@ int i40e_init_adminq(struct i40e_hw *hw) ...@@ -672,7 +671,7 @@ int i40e_init_adminq(struct i40e_hw *hw)
hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE; hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) { if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) {
ret_code = I40E_ERR_FIRMWARE_API_VERSION; ret_code = -EIO;
goto init_adminq_free_arq; goto init_adminq_free_arq;
} }
...@@ -799,7 +798,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw, ...@@ -799,7 +798,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
if (hw->aq.asq.count == 0) { if (hw->aq.asq.count == 0) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQTX: Admin queue not initialized.\n"); "AQTX: Admin queue not initialized.\n");
status = I40E_ERR_QUEUE_EMPTY; status = -EIO;
goto asq_send_command_error; goto asq_send_command_error;
} }
...@@ -809,7 +808,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw, ...@@ -809,7 +808,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
if (val >= hw->aq.num_asq_entries) { if (val >= hw->aq.num_asq_entries) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQTX: head overrun at %d\n", val); "AQTX: head overrun at %d\n", val);
status = I40E_ERR_ADMIN_QUEUE_FULL; status = -ENOSPC;
goto asq_send_command_error; goto asq_send_command_error;
} }
...@@ -840,7 +839,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw, ...@@ -840,7 +839,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
I40E_DEBUG_AQ_MESSAGE, I40E_DEBUG_AQ_MESSAGE,
"AQTX: Invalid buffer size: %d.\n", "AQTX: Invalid buffer size: %d.\n",
buff_size); buff_size);
status = I40E_ERR_INVALID_SIZE; status = -EINVAL;
goto asq_send_command_error; goto asq_send_command_error;
} }
...@@ -848,7 +847,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw, ...@@ -848,7 +847,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
i40e_debug(hw, i40e_debug(hw,
I40E_DEBUG_AQ_MESSAGE, I40E_DEBUG_AQ_MESSAGE,
"AQTX: Async flag not set along with postpone flag"); "AQTX: Async flag not set along with postpone flag");
status = I40E_ERR_PARAM; status = -EINVAL;
goto asq_send_command_error; goto asq_send_command_error;
} }
...@@ -863,7 +862,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw, ...@@ -863,7 +862,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
i40e_debug(hw, i40e_debug(hw,
I40E_DEBUG_AQ_MESSAGE, I40E_DEBUG_AQ_MESSAGE,
"AQTX: Error queue is full.\n"); "AQTX: Error queue is full.\n");
status = I40E_ERR_ADMIN_QUEUE_FULL; status = -ENOSPC;
goto asq_send_command_error; goto asq_send_command_error;
} }
...@@ -940,9 +939,9 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw, ...@@ -940,9 +939,9 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_OK) if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_OK)
status = 0; status = 0;
else if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_EBUSY) else if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_EBUSY)
status = I40E_ERR_NOT_READY; status = -EBUSY;
else else
status = I40E_ERR_ADMIN_QUEUE_ERROR; status = -EIO;
hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval; hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
} }
...@@ -960,11 +959,11 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw, ...@@ -960,11 +959,11 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
if (rd32(hw, hw->aq.asq.len) & I40E_GL_ATQLEN_ATQCRIT_MASK) { if (rd32(hw, hw->aq.asq.len) & I40E_GL_ATQLEN_ATQCRIT_MASK) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQTX: AQ Critical error.\n"); "AQTX: AQ Critical error.\n");
status = I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR; status = -EIO;
} else { } else {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQTX: Writeback timeout.\n"); "AQTX: Writeback timeout.\n");
status = I40E_ERR_ADMIN_QUEUE_TIMEOUT; status = -EIO;
} }
} }
...@@ -1106,7 +1105,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw, ...@@ -1106,7 +1105,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
if (hw->aq.arq.count == 0) { if (hw->aq.arq.count == 0) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQRX: Admin queue not initialized.\n"); "AQRX: Admin queue not initialized.\n");
ret_code = I40E_ERR_QUEUE_EMPTY; ret_code = -EIO;
goto clean_arq_element_err; goto clean_arq_element_err;
} }
...@@ -1114,7 +1113,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw, ...@@ -1114,7 +1113,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
ntu = rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK; ntu = rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK;
if (ntu == ntc) { if (ntu == ntc) {
/* nothing to do - shouldn't need to update ring's values */ /* nothing to do - shouldn't need to update ring's values */
ret_code = I40E_ERR_ADMIN_QUEUE_NO_WORK; ret_code = -EALREADY;
goto clean_arq_element_out; goto clean_arq_element_out;
} }
...@@ -1126,7 +1125,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw, ...@@ -1126,7 +1125,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
(enum i40e_admin_queue_err)le16_to_cpu(desc->retval); (enum i40e_admin_queue_err)le16_to_cpu(desc->retval);
flags = le16_to_cpu(desc->flags); flags = le16_to_cpu(desc->flags);
if (flags & I40E_AQ_FLAG_ERR) { if (flags & I40E_AQ_FLAG_ERR) {
ret_code = I40E_ERR_ADMIN_QUEUE_ERROR; ret_code = -EIO;
i40e_debug(hw, i40e_debug(hw,
I40E_DEBUG_AQ_MESSAGE, I40E_DEBUG_AQ_MESSAGE,
"AQRX: Event received with error 0x%X.\n", "AQRX: Event received with error 0x%X.\n",
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#define _I40E_ADMINQ_H_ #define _I40E_ADMINQ_H_
#include "i40e_osdep.h" #include "i40e_osdep.h"
#include "i40e_status.h"
#include "i40e_adminq_cmd.h" #include "i40e_adminq_cmd.h"
#define I40E_ADMINQ_DESC(R, i) \ #define I40E_ADMINQ_DESC(R, i) \
...@@ -117,7 +116,7 @@ static inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc) ...@@ -117,7 +116,7 @@ static inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
}; };
/* aq_rc is invalid if AQ timed out */ /* aq_rc is invalid if AQ timed out */
if (aq_ret == I40E_ERR_ADMIN_QUEUE_TIMEOUT) if (aq_ret == -EIO)
return -EAGAIN; return -EAGAIN;
if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0])))) if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0]))))
......
...@@ -17,7 +17,7 @@ int i40e_get_dcbx_status(struct i40e_hw *hw, u16 *status) ...@@ -17,7 +17,7 @@ int i40e_get_dcbx_status(struct i40e_hw *hw, u16 *status)
u32 reg; u32 reg;
if (!status) if (!status)
return I40E_ERR_PARAM; return -EINVAL;
reg = rd32(hw, I40E_PRTDCB_GENS); reg = rd32(hw, I40E_PRTDCB_GENS);
*status = (u16)((reg & I40E_PRTDCB_GENS_DCBX_STATUS_MASK) >> *status = (u16)((reg & I40E_PRTDCB_GENS_DCBX_STATUS_MASK) >>
...@@ -508,7 +508,7 @@ int i40e_lldp_to_dcb_config(u8 *lldpmib, ...@@ -508,7 +508,7 @@ int i40e_lldp_to_dcb_config(u8 *lldpmib,
u16 type; u16 type;
if (!lldpmib || !dcbcfg) if (!lldpmib || !dcbcfg)
return I40E_ERR_PARAM; return -EINVAL;
/* set to the start of LLDPDU */ /* set to the start of LLDPDU */
lldpmib += ETH_HLEN; lldpmib += ETH_HLEN;
...@@ -874,7 +874,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) ...@@ -874,7 +874,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
int ret = 0; int ret = 0;
if (!hw->func_caps.dcb) if (!hw->func_caps.dcb)
return I40E_NOT_SUPPORTED; return -EOPNOTSUPP;
/* Read LLDP NVM area */ /* Read LLDP NVM area */
if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) { if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) {
...@@ -885,7 +885,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) ...@@ -885,7 +885,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
else if (hw->mac.type == I40E_MAC_X722) else if (hw->mac.type == I40E_MAC_X722)
offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET; offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET;
else else
return I40E_NOT_SUPPORTED; return -EOPNOTSUPP;
ret = i40e_read_nvm_module_data(hw, ret = i40e_read_nvm_module_data(hw,
I40E_SR_EMP_SR_SETTINGS_PTR, I40E_SR_EMP_SR_SETTINGS_PTR,
...@@ -897,7 +897,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) ...@@ -897,7 +897,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
ret = i40e_read_lldp_cfg(hw, &lldp_cfg); ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
} }
if (ret) if (ret)
return I40E_ERR_NOT_READY; return -EBUSY;
/* Get the LLDP AdminStatus for the current port */ /* Get the LLDP AdminStatus for the current port */
adminstatus = lldp_cfg.adminstatus >> (hw->port * 4); adminstatus = lldp_cfg.adminstatus >> (hw->port * 4);
...@@ -906,7 +906,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) ...@@ -906,7 +906,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
/* LLDP agent disabled */ /* LLDP agent disabled */
if (!adminstatus) { if (!adminstatus) {
hw->dcbx_status = I40E_DCBX_STATUS_DISABLED; hw->dcbx_status = I40E_DCBX_STATUS_DISABLED;
return I40E_ERR_NOT_READY; return -EBUSY;
} }
/* Get DCBX status */ /* Get DCBX status */
...@@ -922,7 +922,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) ...@@ -922,7 +922,7 @@ int i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
if (ret) if (ret)
return ret; return ret;
} else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) { } else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
return I40E_ERR_NOT_READY; return -EBUSY;
} }
/* Configure the LLDP MIB change event */ /* Configure the LLDP MIB change event */
...@@ -949,7 +949,7 @@ i40e_get_fw_lldp_status(struct i40e_hw *hw, ...@@ -949,7 +949,7 @@ i40e_get_fw_lldp_status(struct i40e_hw *hw,
int ret; int ret;
if (!lldp_status) if (!lldp_status)
return I40E_ERR_PARAM; return -EINVAL;
/* Allocate buffer for the LLDPDU */ /* Allocate buffer for the LLDPDU */
ret = i40e_allocate_virt_mem(hw, &mem, I40E_LLDPDU_SIZE); ret = i40e_allocate_virt_mem(hw, &mem, I40E_LLDPDU_SIZE);
...@@ -1299,7 +1299,7 @@ int i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen, ...@@ -1299,7 +1299,7 @@ int i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen,
sizeof(tlv->typelength) + length); sizeof(tlv->typelength) + length);
} while (tlvid < I40E_TLV_ID_END_OF_LLDPPDU); } while (tlvid < I40E_TLV_ID_END_OF_LLDPPDU);
*miblen = offset; *miblen = offset;
return I40E_SUCCESS; return 0;
} }
/** /**
...@@ -1957,7 +1957,7 @@ int i40e_read_lldp_cfg(struct i40e_hw *hw, ...@@ -1957,7 +1957,7 @@ int i40e_read_lldp_cfg(struct i40e_hw *hw,
u32 mem; u32 mem;
if (!lldp_cfg) if (!lldp_cfg)
return I40E_ERR_PARAM; return -EINVAL;
ret = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); ret = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
if (ret) if (ret)
......
...@@ -344,7 +344,7 @@ int i40e_ddp_load(struct net_device *netdev, const u8 *data, size_t size, ...@@ -344,7 +344,7 @@ int i40e_ddp_load(struct net_device *netdev, const u8 *data, size_t size,
if (is_add) { if (is_add) {
status = i40e_write_profile(&pf->hw, profile_hdr, track_id); status = i40e_write_profile(&pf->hw, profile_hdr, track_id);
if (status) { if (status) {
if (status == I40E_ERR_DEVICE_NOT_SUPPORTED) { if (status == -ENODEV) {
netdev_err(netdev, netdev_err(netdev,
"Profile is not supported by the device."); "Profile is not supported by the device.");
return -EPERM; return -EPERM;
......
...@@ -1309,7 +1309,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1309,7 +1309,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
ret = i40e_asq_send_command(&pf->hw, desc, NULL, 0, NULL); ret = i40e_asq_send_command(&pf->hw, desc, NULL, 0, NULL);
if (!ret) { if (!ret) {
dev_info(&pf->pdev->dev, "AQ command sent Status : Success\n"); dev_info(&pf->pdev->dev, "AQ command sent Status : Success\n");
} else if (ret == I40E_ERR_ADMIN_QUEUE_ERROR) { } else if (ret == -EIO) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"AQ command send failed Opcode %x AQ Error: %d\n", "AQ command send failed Opcode %x AQ Error: %d\n",
desc->opcode, pf->hw.aq.asq_last_status); desc->opcode, pf->hw.aq.asq_last_status);
...@@ -1370,7 +1370,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1370,7 +1370,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
buffer_len, NULL); buffer_len, NULL);
if (!ret) { if (!ret) {
dev_info(&pf->pdev->dev, "AQ command sent Status : Success\n"); dev_info(&pf->pdev->dev, "AQ command sent Status : Success\n");
} else if (ret == I40E_ERR_ADMIN_QUEUE_ERROR) { } else if (ret == -EIO) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"AQ command send failed Opcode %x AQ Error: %d\n", "AQ command send failed Opcode %x AQ Error: %d\n",
desc->opcode, pf->hw.aq.asq_last_status); desc->opcode, pf->hw.aq.asq_last_status);
......
...@@ -28,7 +28,7 @@ static int i40e_diag_reg_pattern_test(struct i40e_hw *hw, ...@@ -28,7 +28,7 @@ static int i40e_diag_reg_pattern_test(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_DIAG, i40e_debug(hw, I40E_DEBUG_DIAG,
"%s: reg pattern test failed - reg 0x%08x pat 0x%08x val 0x%08x\n", "%s: reg pattern test failed - reg 0x%08x pat 0x%08x val 0x%08x\n",
__func__, reg, pat, val); __func__, reg, pat, val);
return I40E_ERR_DIAG_TEST_FAILED; return -EIO;
} }
} }
...@@ -38,7 +38,7 @@ static int i40e_diag_reg_pattern_test(struct i40e_hw *hw, ...@@ -38,7 +38,7 @@ static int i40e_diag_reg_pattern_test(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_DIAG, i40e_debug(hw, I40E_DEBUG_DIAG,
"%s: reg restore test failed - reg 0x%08x orig_val 0x%08x val 0x%08x\n", "%s: reg restore test failed - reg 0x%08x orig_val 0x%08x val 0x%08x\n",
__func__, reg, orig_val, val); __func__, reg, orig_val, val);
return I40E_ERR_DIAG_TEST_FAILED; return -EIO;
} }
return 0; return 0;
...@@ -127,5 +127,5 @@ int i40e_diag_eeprom_test(struct i40e_hw *hw) ...@@ -127,5 +127,5 @@ int i40e_diag_eeprom_test(struct i40e_hw *hw)
BIT(I40E_SR_CONTROL_WORD_1_SHIFT))) BIT(I40E_SR_CONTROL_WORD_1_SHIFT)))
return i40e_validate_nvm_checksum(hw, NULL); return i40e_validate_nvm_checksum(hw, NULL);
else else
return I40E_ERR_DIAG_TEST_FAILED; return -EIO;
} }
...@@ -5699,8 +5699,8 @@ static int i40e_set_eee(struct net_device *netdev, struct ethtool_eee *edata) ...@@ -5699,8 +5699,8 @@ static int i40e_set_eee(struct net_device *netdev, struct ethtool_eee *edata)
struct i40e_vsi *vsi = np->vsi; struct i40e_vsi *vsi = np->vsi;
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
struct i40e_hw *hw = &pf->hw; struct i40e_hw *hw = &pf->hw;
int status = I40E_SUCCESS;
__le16 eee_capability; __le16 eee_capability;
int status = 0;
/* Deny parameters we don't support */ /* Deny parameters we don't support */
if (i40e_is_eee_param_supported(netdev, edata)) if (i40e_is_eee_param_supported(netdev, edata))
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "i40e.h" #include "i40e.h"
#include "i40e_osdep.h" #include "i40e_osdep.h"
#include "i40e_register.h" #include "i40e_register.h"
#include "i40e_status.h"
#include "i40e_alloc.h" #include "i40e_alloc.h"
#include "i40e_hmc.h" #include "i40e_hmc.h"
#include "i40e_type.h" #include "i40e_type.h"
...@@ -26,18 +25,18 @@ int i40e_add_sd_table_entry(struct i40e_hw *hw, ...@@ -26,18 +25,18 @@ int i40e_add_sd_table_entry(struct i40e_hw *hw,
enum i40e_memory_type mem_type __attribute__((unused)); enum i40e_memory_type mem_type __attribute__((unused));
struct i40e_hmc_sd_entry *sd_entry; struct i40e_hmc_sd_entry *sd_entry;
bool dma_mem_alloc_done = false; bool dma_mem_alloc_done = false;
int ret_code = I40E_SUCCESS;
struct i40e_dma_mem mem; struct i40e_dma_mem mem;
int ret_code = 0;
u64 alloc_len; u64 alloc_len;
if (NULL == hmc_info->sd_table.sd_entry) { if (NULL == hmc_info->sd_table.sd_entry) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_add_sd_table_entry: bad sd_entry\n"); hw_dbg(hw, "i40e_add_sd_table_entry: bad sd_entry\n");
goto exit; goto exit;
} }
if (sd_index >= hmc_info->sd_table.sd_cnt) { if (sd_index >= hmc_info->sd_table.sd_cnt) {
ret_code = I40E_ERR_INVALID_SD_INDEX; ret_code = -EINVAL;
hw_dbg(hw, "i40e_add_sd_table_entry: bad sd_index\n"); hw_dbg(hw, "i40e_add_sd_table_entry: bad sd_index\n");
goto exit; goto exit;
} }
...@@ -121,7 +120,7 @@ int i40e_add_pd_table_entry(struct i40e_hw *hw, ...@@ -121,7 +120,7 @@ int i40e_add_pd_table_entry(struct i40e_hw *hw,
u64 *pd_addr; u64 *pd_addr;
if (pd_index / I40E_HMC_PD_CNT_IN_SD >= hmc_info->sd_table.sd_cnt) { if (pd_index / I40E_HMC_PD_CNT_IN_SD >= hmc_info->sd_table.sd_cnt) {
ret_code = I40E_ERR_INVALID_PAGE_DESC_INDEX; ret_code = -EINVAL;
hw_dbg(hw, "i40e_add_pd_table_entry: bad pd_index\n"); hw_dbg(hw, "i40e_add_pd_table_entry: bad pd_index\n");
goto exit; goto exit;
} }
...@@ -200,13 +199,13 @@ int i40e_remove_pd_bp(struct i40e_hw *hw, ...@@ -200,13 +199,13 @@ int i40e_remove_pd_bp(struct i40e_hw *hw,
sd_idx = idx / I40E_HMC_PD_CNT_IN_SD; sd_idx = idx / I40E_HMC_PD_CNT_IN_SD;
rel_pd_idx = idx % I40E_HMC_PD_CNT_IN_SD; rel_pd_idx = idx % I40E_HMC_PD_CNT_IN_SD;
if (sd_idx >= hmc_info->sd_table.sd_cnt) { if (sd_idx >= hmc_info->sd_table.sd_cnt) {
ret_code = I40E_ERR_INVALID_PAGE_DESC_INDEX; ret_code = -EINVAL;
hw_dbg(hw, "i40e_remove_pd_bp: bad idx\n"); hw_dbg(hw, "i40e_remove_pd_bp: bad idx\n");
goto exit; goto exit;
} }
sd_entry = &hmc_info->sd_table.sd_entry[sd_idx]; sd_entry = &hmc_info->sd_table.sd_entry[sd_idx];
if (I40E_SD_TYPE_PAGED != sd_entry->entry_type) { if (I40E_SD_TYPE_PAGED != sd_entry->entry_type) {
ret_code = I40E_ERR_INVALID_SD_TYPE; ret_code = -EINVAL;
hw_dbg(hw, "i40e_remove_pd_bp: wrong sd_entry type\n"); hw_dbg(hw, "i40e_remove_pd_bp: wrong sd_entry type\n");
goto exit; goto exit;
} }
...@@ -251,7 +250,7 @@ int i40e_prep_remove_sd_bp(struct i40e_hmc_info *hmc_info, ...@@ -251,7 +250,7 @@ int i40e_prep_remove_sd_bp(struct i40e_hmc_info *hmc_info,
sd_entry = &hmc_info->sd_table.sd_entry[idx]; sd_entry = &hmc_info->sd_table.sd_entry[idx];
I40E_DEC_BP_REFCNT(&sd_entry->u.bp); I40E_DEC_BP_REFCNT(&sd_entry->u.bp);
if (sd_entry->u.bp.ref_cnt) { if (sd_entry->u.bp.ref_cnt) {
ret_code = I40E_ERR_NOT_READY; ret_code = -EBUSY;
goto exit; goto exit;
} }
I40E_DEC_SD_REFCNT(&hmc_info->sd_table); I40E_DEC_SD_REFCNT(&hmc_info->sd_table);
...@@ -276,7 +275,7 @@ int i40e_remove_sd_bp_new(struct i40e_hw *hw, ...@@ -276,7 +275,7 @@ int i40e_remove_sd_bp_new(struct i40e_hw *hw,
struct i40e_hmc_sd_entry *sd_entry; struct i40e_hmc_sd_entry *sd_entry;
if (!is_pf) if (!is_pf)
return I40E_NOT_SUPPORTED; return -EOPNOTSUPP;
/* get the entry and decrease its ref counter */ /* get the entry and decrease its ref counter */
sd_entry = &hmc_info->sd_table.sd_entry[idx]; sd_entry = &hmc_info->sd_table.sd_entry[idx];
...@@ -299,7 +298,7 @@ int i40e_prep_remove_pd_page(struct i40e_hmc_info *hmc_info, ...@@ -299,7 +298,7 @@ int i40e_prep_remove_pd_page(struct i40e_hmc_info *hmc_info,
sd_entry = &hmc_info->sd_table.sd_entry[idx]; sd_entry = &hmc_info->sd_table.sd_entry[idx];
if (sd_entry->u.pd_table.ref_cnt) { if (sd_entry->u.pd_table.ref_cnt) {
ret_code = I40E_ERR_NOT_READY; ret_code = -EBUSY;
goto exit; goto exit;
} }
...@@ -325,7 +324,7 @@ int i40e_remove_pd_page_new(struct i40e_hw *hw, ...@@ -325,7 +324,7 @@ int i40e_remove_pd_page_new(struct i40e_hw *hw,
struct i40e_hmc_sd_entry *sd_entry; struct i40e_hmc_sd_entry *sd_entry;
if (!is_pf) if (!is_pf)
return I40E_NOT_SUPPORTED; return -EOPNOTSUPP;
sd_entry = &hmc_info->sd_table.sd_entry[idx]; sd_entry = &hmc_info->sd_table.sd_entry[idx];
I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_PAGED); I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_PAGED);
......
...@@ -111,7 +111,7 @@ int i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num, ...@@ -111,7 +111,7 @@ int i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num,
/* validate values requested by driver don't exceed HMC capacity */ /* validate values requested by driver don't exceed HMC capacity */
if (txq_num > obj->max_cnt) { if (txq_num > obj->max_cnt) {
ret_code = I40E_ERR_INVALID_HMC_OBJ_COUNT; ret_code = -EINVAL;
hw_dbg(hw, "i40e_init_lan_hmc: Tx context: asks for 0x%x but max allowed is 0x%x, returns error %d\n", hw_dbg(hw, "i40e_init_lan_hmc: Tx context: asks for 0x%x but max allowed is 0x%x, returns error %d\n",
txq_num, obj->max_cnt, ret_code); txq_num, obj->max_cnt, ret_code);
goto init_lan_hmc_out; goto init_lan_hmc_out;
...@@ -134,7 +134,7 @@ int i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num, ...@@ -134,7 +134,7 @@ int i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num,
/* validate values requested by driver don't exceed HMC capacity */ /* validate values requested by driver don't exceed HMC capacity */
if (rxq_num > obj->max_cnt) { if (rxq_num > obj->max_cnt) {
ret_code = I40E_ERR_INVALID_HMC_OBJ_COUNT; ret_code = -EINVAL;
hw_dbg(hw, "i40e_init_lan_hmc: Rx context: asks for 0x%x but max allowed is 0x%x, returns error %d\n", hw_dbg(hw, "i40e_init_lan_hmc: Rx context: asks for 0x%x but max allowed is 0x%x, returns error %d\n",
rxq_num, obj->max_cnt, ret_code); rxq_num, obj->max_cnt, ret_code);
goto init_lan_hmc_out; goto init_lan_hmc_out;
...@@ -157,7 +157,7 @@ int i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num, ...@@ -157,7 +157,7 @@ int i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num,
/* validate values requested by driver don't exceed HMC capacity */ /* validate values requested by driver don't exceed HMC capacity */
if (fcoe_cntx_num > obj->max_cnt) { if (fcoe_cntx_num > obj->max_cnt) {
ret_code = I40E_ERR_INVALID_HMC_OBJ_COUNT; ret_code = -EINVAL;
hw_dbg(hw, "i40e_init_lan_hmc: FCoE context: asks for 0x%x but max allowed is 0x%x, returns error %d\n", hw_dbg(hw, "i40e_init_lan_hmc: FCoE context: asks for 0x%x but max allowed is 0x%x, returns error %d\n",
fcoe_cntx_num, obj->max_cnt, ret_code); fcoe_cntx_num, obj->max_cnt, ret_code);
goto init_lan_hmc_out; goto init_lan_hmc_out;
...@@ -180,7 +180,7 @@ int i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num, ...@@ -180,7 +180,7 @@ int i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num,
/* validate values requested by driver don't exceed HMC capacity */ /* validate values requested by driver don't exceed HMC capacity */
if (fcoe_filt_num > obj->max_cnt) { if (fcoe_filt_num > obj->max_cnt) {
ret_code = I40E_ERR_INVALID_HMC_OBJ_COUNT; ret_code = -EINVAL;
hw_dbg(hw, "i40e_init_lan_hmc: FCoE filter: asks for 0x%x but max allowed is 0x%x, returns error %d\n", hw_dbg(hw, "i40e_init_lan_hmc: FCoE filter: asks for 0x%x but max allowed is 0x%x, returns error %d\n",
fcoe_filt_num, obj->max_cnt, ret_code); fcoe_filt_num, obj->max_cnt, ret_code);
goto init_lan_hmc_out; goto init_lan_hmc_out;
...@@ -289,30 +289,30 @@ static int i40e_create_lan_hmc_object(struct i40e_hw *hw, ...@@ -289,30 +289,30 @@ static int i40e_create_lan_hmc_object(struct i40e_hw *hw,
u32 i, j; u32 i, j;
if (NULL == info) { if (NULL == info) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_create_lan_hmc_object: bad info ptr\n"); hw_dbg(hw, "i40e_create_lan_hmc_object: bad info ptr\n");
goto exit; goto exit;
} }
if (NULL == info->hmc_info) { if (NULL == info->hmc_info) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_create_lan_hmc_object: bad hmc_info ptr\n"); hw_dbg(hw, "i40e_create_lan_hmc_object: bad hmc_info ptr\n");
goto exit; goto exit;
} }
if (I40E_HMC_INFO_SIGNATURE != info->hmc_info->signature) { if (I40E_HMC_INFO_SIGNATURE != info->hmc_info->signature) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_create_lan_hmc_object: bad signature\n"); hw_dbg(hw, "i40e_create_lan_hmc_object: bad signature\n");
goto exit; goto exit;
} }
if (info->start_idx >= info->hmc_info->hmc_obj[info->rsrc_type].cnt) { if (info->start_idx >= info->hmc_info->hmc_obj[info->rsrc_type].cnt) {
ret_code = I40E_ERR_INVALID_HMC_OBJ_INDEX; ret_code = -EINVAL;
hw_dbg(hw, "i40e_create_lan_hmc_object: returns error %d\n", hw_dbg(hw, "i40e_create_lan_hmc_object: returns error %d\n",
ret_code); ret_code);
goto exit; goto exit;
} }
if ((info->start_idx + info->count) > if ((info->start_idx + info->count) >
info->hmc_info->hmc_obj[info->rsrc_type].cnt) { info->hmc_info->hmc_obj[info->rsrc_type].cnt) {
ret_code = I40E_ERR_INVALID_HMC_OBJ_COUNT; ret_code = -EINVAL;
hw_dbg(hw, "i40e_create_lan_hmc_object: returns error %d\n", hw_dbg(hw, "i40e_create_lan_hmc_object: returns error %d\n",
ret_code); ret_code);
goto exit; goto exit;
...@@ -324,7 +324,7 @@ static int i40e_create_lan_hmc_object(struct i40e_hw *hw, ...@@ -324,7 +324,7 @@ static int i40e_create_lan_hmc_object(struct i40e_hw *hw,
&sd_idx, &sd_lmt); &sd_idx, &sd_lmt);
if (sd_idx >= info->hmc_info->sd_table.sd_cnt || if (sd_idx >= info->hmc_info->sd_table.sd_cnt ||
sd_lmt > info->hmc_info->sd_table.sd_cnt) { sd_lmt > info->hmc_info->sd_table.sd_cnt) {
ret_code = I40E_ERR_INVALID_SD_INDEX; ret_code = -EINVAL;
goto exit; goto exit;
} }
/* find pd index */ /* find pd index */
...@@ -393,7 +393,7 @@ static int i40e_create_lan_hmc_object(struct i40e_hw *hw, ...@@ -393,7 +393,7 @@ static int i40e_create_lan_hmc_object(struct i40e_hw *hw,
j, sd_entry->entry_type); j, sd_entry->entry_type);
break; break;
default: default:
ret_code = I40E_ERR_INVALID_SD_TYPE; ret_code = -EINVAL;
goto exit; goto exit;
} }
} }
...@@ -417,7 +417,7 @@ static int i40e_create_lan_hmc_object(struct i40e_hw *hw, ...@@ -417,7 +417,7 @@ static int i40e_create_lan_hmc_object(struct i40e_hw *hw,
i40e_remove_sd_bp(hw, info->hmc_info, (j - 1)); i40e_remove_sd_bp(hw, info->hmc_info, (j - 1));
break; break;
default: default:
ret_code = I40E_ERR_INVALID_SD_TYPE; ret_code = -EINVAL;
break; break;
} }
j--; j--;
...@@ -474,7 +474,7 @@ int i40e_configure_lan_hmc(struct i40e_hw *hw, ...@@ -474,7 +474,7 @@ int i40e_configure_lan_hmc(struct i40e_hw *hw,
break; break;
default: default:
/* unsupported type */ /* unsupported type */
ret_code = I40E_ERR_INVALID_SD_TYPE; ret_code = -EINVAL;
hw_dbg(hw, "i40e_configure_lan_hmc: Unknown SD type: %d\n", hw_dbg(hw, "i40e_configure_lan_hmc: Unknown SD type: %d\n",
ret_code); ret_code);
goto configure_lan_hmc_out; goto configure_lan_hmc_out;
...@@ -530,34 +530,34 @@ static int i40e_delete_lan_hmc_object(struct i40e_hw *hw, ...@@ -530,34 +530,34 @@ static int i40e_delete_lan_hmc_object(struct i40e_hw *hw,
u32 i, j; u32 i, j;
if (NULL == info) { if (NULL == info) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_delete_hmc_object: bad info ptr\n"); hw_dbg(hw, "i40e_delete_hmc_object: bad info ptr\n");
goto exit; goto exit;
} }
if (NULL == info->hmc_info) { if (NULL == info->hmc_info) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_delete_hmc_object: bad info->hmc_info ptr\n"); hw_dbg(hw, "i40e_delete_hmc_object: bad info->hmc_info ptr\n");
goto exit; goto exit;
} }
if (I40E_HMC_INFO_SIGNATURE != info->hmc_info->signature) { if (I40E_HMC_INFO_SIGNATURE != info->hmc_info->signature) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_delete_hmc_object: bad hmc_info->signature\n"); hw_dbg(hw, "i40e_delete_hmc_object: bad hmc_info->signature\n");
goto exit; goto exit;
} }
if (NULL == info->hmc_info->sd_table.sd_entry) { if (NULL == info->hmc_info->sd_table.sd_entry) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_delete_hmc_object: bad sd_entry\n"); hw_dbg(hw, "i40e_delete_hmc_object: bad sd_entry\n");
goto exit; goto exit;
} }
if (NULL == info->hmc_info->hmc_obj) { if (NULL == info->hmc_info->hmc_obj) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_delete_hmc_object: bad hmc_info->hmc_obj\n"); hw_dbg(hw, "i40e_delete_hmc_object: bad hmc_info->hmc_obj\n");
goto exit; goto exit;
} }
if (info->start_idx >= info->hmc_info->hmc_obj[info->rsrc_type].cnt) { if (info->start_idx >= info->hmc_info->hmc_obj[info->rsrc_type].cnt) {
ret_code = I40E_ERR_INVALID_HMC_OBJ_INDEX; ret_code = -EINVAL;
hw_dbg(hw, "i40e_delete_hmc_object: returns error %d\n", hw_dbg(hw, "i40e_delete_hmc_object: returns error %d\n",
ret_code); ret_code);
goto exit; goto exit;
...@@ -565,7 +565,7 @@ static int i40e_delete_lan_hmc_object(struct i40e_hw *hw, ...@@ -565,7 +565,7 @@ static int i40e_delete_lan_hmc_object(struct i40e_hw *hw,
if ((info->start_idx + info->count) > if ((info->start_idx + info->count) >
info->hmc_info->hmc_obj[info->rsrc_type].cnt) { info->hmc_info->hmc_obj[info->rsrc_type].cnt) {
ret_code = I40E_ERR_INVALID_HMC_OBJ_COUNT; ret_code = -EINVAL;
hw_dbg(hw, "i40e_delete_hmc_object: returns error %d\n", hw_dbg(hw, "i40e_delete_hmc_object: returns error %d\n",
ret_code); ret_code);
goto exit; goto exit;
...@@ -599,7 +599,7 @@ static int i40e_delete_lan_hmc_object(struct i40e_hw *hw, ...@@ -599,7 +599,7 @@ static int i40e_delete_lan_hmc_object(struct i40e_hw *hw,
&sd_idx, &sd_lmt); &sd_idx, &sd_lmt);
if (sd_idx >= info->hmc_info->sd_table.sd_cnt || if (sd_idx >= info->hmc_info->sd_table.sd_cnt ||
sd_lmt > info->hmc_info->sd_table.sd_cnt) { sd_lmt > info->hmc_info->sd_table.sd_cnt) {
ret_code = I40E_ERR_INVALID_SD_INDEX; ret_code = -EINVAL;
goto exit; goto exit;
} }
...@@ -987,29 +987,29 @@ int i40e_hmc_get_object_va(struct i40e_hw *hw, u8 **object_base, ...@@ -987,29 +987,29 @@ int i40e_hmc_get_object_va(struct i40e_hw *hw, u8 **object_base,
int ret_code = 0; int ret_code = 0;
if (NULL == hmc_info) { if (NULL == hmc_info) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_hmc_get_object_va: bad hmc_info ptr\n"); hw_dbg(hw, "i40e_hmc_get_object_va: bad hmc_info ptr\n");
goto exit; goto exit;
} }
if (NULL == hmc_info->hmc_obj) { if (NULL == hmc_info->hmc_obj) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_hmc_get_object_va: bad hmc_info->hmc_obj ptr\n"); hw_dbg(hw, "i40e_hmc_get_object_va: bad hmc_info->hmc_obj ptr\n");
goto exit; goto exit;
} }
if (NULL == object_base) { if (NULL == object_base) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_hmc_get_object_va: bad object_base ptr\n"); hw_dbg(hw, "i40e_hmc_get_object_va: bad object_base ptr\n");
goto exit; goto exit;
} }
if (I40E_HMC_INFO_SIGNATURE != hmc_info->signature) { if (I40E_HMC_INFO_SIGNATURE != hmc_info->signature) {
ret_code = I40E_ERR_BAD_PTR; ret_code = -EINVAL;
hw_dbg(hw, "i40e_hmc_get_object_va: bad hmc_info->signature\n"); hw_dbg(hw, "i40e_hmc_get_object_va: bad hmc_info->signature\n");
goto exit; goto exit;
} }
if (obj_idx >= hmc_info->hmc_obj[rsrc_type].cnt) { if (obj_idx >= hmc_info->hmc_obj[rsrc_type].cnt) {
hw_dbg(hw, "i40e_hmc_get_object_va: returns error %d\n", hw_dbg(hw, "i40e_hmc_get_object_va: returns error %d\n",
ret_code); ret_code);
ret_code = I40E_ERR_INVALID_HMC_OBJ_INDEX; ret_code = -EINVAL;
goto exit; goto exit;
} }
/* find sd index and limit */ /* find sd index and limit */
......
...@@ -5709,7 +5709,7 @@ int i40e_update_adq_vsi_queues(struct i40e_vsi *vsi, int vsi_offset) ...@@ -5709,7 +5709,7 @@ int i40e_update_adq_vsi_queues(struct i40e_vsi *vsi, int vsi_offset)
int ret; int ret;
if (!vsi) if (!vsi)
return I40E_ERR_PARAM; return -EINVAL;
pf = vsi->back; pf = vsi->back;
hw = &pf->hw; hw = &pf->hw;
...@@ -7153,7 +7153,7 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf) ...@@ -7153,7 +7153,7 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)
*/ */
if (pf->hw_features & I40E_HW_NO_DCB_SUPPORT) { if (pf->hw_features & I40E_HW_NO_DCB_SUPPORT) {
dev_info(&pf->pdev->dev, "DCB is not supported.\n"); dev_info(&pf->pdev->dev, "DCB is not supported.\n");
err = I40E_NOT_SUPPORTED; err = -EOPNOTSUPP;
goto out; goto out;
} }
if (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) { if (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) {
...@@ -7463,7 +7463,7 @@ static int i40e_force_link_state(struct i40e_pf *pf, bool is_up) ...@@ -7463,7 +7463,7 @@ static int i40e_force_link_state(struct i40e_pf *pf, bool is_up)
if (pf->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED) if (pf->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED)
non_zero_phy_type = true; non_zero_phy_type = true;
else if (is_up && abilities.phy_type != 0 && abilities.link_speed != 0) else if (is_up && abilities.phy_type != 0 && abilities.link_speed != 0)
return I40E_SUCCESS; return 0;
/* To force link we need to set bits for all supported PHY types, /* To force link we need to set bits for all supported PHY types,
* but there are now more than 32, so we need to split the bitmap * but there are now more than 32, so we need to split the bitmap
...@@ -7514,7 +7514,7 @@ static int i40e_force_link_state(struct i40e_pf *pf, bool is_up) ...@@ -7514,7 +7514,7 @@ static int i40e_force_link_state(struct i40e_pf *pf, bool is_up)
i40e_aq_set_link_restart_an(hw, is_up, NULL); i40e_aq_set_link_restart_an(hw, is_up, NULL);
return I40E_SUCCESS; return 0;
} }
/** /**
...@@ -8361,7 +8361,7 @@ int i40e_add_del_cloud_filter(struct i40e_vsi *vsi, ...@@ -8361,7 +8361,7 @@ int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,
}; };
if (filter->flags >= ARRAY_SIZE(flag_table)) if (filter->flags >= ARRAY_SIZE(flag_table))
return I40E_ERR_CONFIG; return -EIO;
memset(&cld_filter, 0, sizeof(cld_filter)); memset(&cld_filter, 0, sizeof(cld_filter));
...@@ -8575,7 +8575,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi, ...@@ -8575,7 +8575,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi,
} else { } else {
dev_err(&pf->pdev->dev, "Bad ether dest mask %pM\n", dev_err(&pf->pdev->dev, "Bad ether dest mask %pM\n",
match.mask->dst); match.mask->dst);
return I40E_ERR_CONFIG; return -EIO;
} }
} }
...@@ -8585,7 +8585,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi, ...@@ -8585,7 +8585,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi,
} else { } else {
dev_err(&pf->pdev->dev, "Bad ether src mask %pM\n", dev_err(&pf->pdev->dev, "Bad ether src mask %pM\n",
match.mask->src); match.mask->src);
return I40E_ERR_CONFIG; return -EIO;
} }
} }
ether_addr_copy(filter->dst_mac, match.key->dst); ether_addr_copy(filter->dst_mac, match.key->dst);
...@@ -8603,7 +8603,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi, ...@@ -8603,7 +8603,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi,
} else { } else {
dev_err(&pf->pdev->dev, "Bad vlan mask 0x%04x\n", dev_err(&pf->pdev->dev, "Bad vlan mask 0x%04x\n",
match.mask->vlan_id); match.mask->vlan_id);
return I40E_ERR_CONFIG; return -EIO;
} }
} }
...@@ -8627,7 +8627,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi, ...@@ -8627,7 +8627,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi,
} else { } else {
dev_err(&pf->pdev->dev, "Bad ip dst mask %pI4b\n", dev_err(&pf->pdev->dev, "Bad ip dst mask %pI4b\n",
&match.mask->dst); &match.mask->dst);
return I40E_ERR_CONFIG; return -EIO;
} }
} }
...@@ -8637,13 +8637,13 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi, ...@@ -8637,13 +8637,13 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi,
} else { } else {
dev_err(&pf->pdev->dev, "Bad ip src mask %pI4b\n", dev_err(&pf->pdev->dev, "Bad ip src mask %pI4b\n",
&match.mask->src); &match.mask->src);
return I40E_ERR_CONFIG; return -EIO;
} }
} }
if (field_flags & I40E_CLOUD_FIELD_TEN_ID) { if (field_flags & I40E_CLOUD_FIELD_TEN_ID) {
dev_err(&pf->pdev->dev, "Tenant id not allowed for ip filter\n"); dev_err(&pf->pdev->dev, "Tenant id not allowed for ip filter\n");
return I40E_ERR_CONFIG; return -EIO;
} }
filter->dst_ipv4 = match.key->dst; filter->dst_ipv4 = match.key->dst;
filter->src_ipv4 = match.key->src; filter->src_ipv4 = match.key->src;
...@@ -8661,7 +8661,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi, ...@@ -8661,7 +8661,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi,
ipv6_addr_loopback(&match.key->src)) { ipv6_addr_loopback(&match.key->src)) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
"Bad ipv6, addr is LOOPBACK\n"); "Bad ipv6, addr is LOOPBACK\n");
return I40E_ERR_CONFIG; return -EIO;
} }
if (!ipv6_addr_any(&match.mask->dst) || if (!ipv6_addr_any(&match.mask->dst) ||
!ipv6_addr_any(&match.mask->src)) !ipv6_addr_any(&match.mask->src))
...@@ -8683,7 +8683,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi, ...@@ -8683,7 +8683,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi,
} else { } else {
dev_err(&pf->pdev->dev, "Bad src port mask 0x%04x\n", dev_err(&pf->pdev->dev, "Bad src port mask 0x%04x\n",
be16_to_cpu(match.mask->src)); be16_to_cpu(match.mask->src));
return I40E_ERR_CONFIG; return -EIO;
} }
} }
...@@ -8693,7 +8693,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi, ...@@ -8693,7 +8693,7 @@ static int i40e_parse_cls_flower(struct i40e_vsi *vsi,
} else { } else {
dev_err(&pf->pdev->dev, "Bad dst port mask 0x%04x\n", dev_err(&pf->pdev->dev, "Bad dst port mask 0x%04x\n",
be16_to_cpu(match.mask->dst)); be16_to_cpu(match.mask->dst));
return I40E_ERR_CONFIG; return -EIO;
} }
} }
...@@ -9901,11 +9901,11 @@ static void i40e_link_event(struct i40e_pf *pf) ...@@ -9901,11 +9901,11 @@ static void i40e_link_event(struct i40e_pf *pf)
status = i40e_get_link_status(&pf->hw, &new_link); status = i40e_get_link_status(&pf->hw, &new_link);
/* On success, disable temp link polling */ /* On success, disable temp link polling */
if (status == I40E_SUCCESS) { if (status == 0) {
clear_bit(__I40E_TEMP_LINK_POLLING, pf->state); clear_bit(__I40E_TEMP_LINK_POLLING, pf->state);
} else { } else {
/* Enable link polling temporarily until i40e_get_link_status /* Enable link polling temporarily until i40e_get_link_status
* returns I40E_SUCCESS * returns 0
*/ */
set_bit(__I40E_TEMP_LINK_POLLING, pf->state); set_bit(__I40E_TEMP_LINK_POLLING, pf->state);
dev_dbg(&pf->pdev->dev, "couldn't get link state, status: %d\n", dev_dbg(&pf->pdev->dev, "couldn't get link state, status: %d\n",
...@@ -10159,7 +10159,7 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf) ...@@ -10159,7 +10159,7 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)
do { do {
ret = i40e_clean_arq_element(hw, &event, &pending); ret = i40e_clean_arq_element(hw, &event, &pending);
if (ret == I40E_ERR_ADMIN_QUEUE_NO_WORK) if (ret == -EALREADY)
break; break;
else if (ret) { else if (ret) {
dev_info(&pf->pdev->dev, "ARQ event error %d\n", ret); dev_info(&pf->pdev->dev, "ARQ event error %d\n", ret);
...@@ -12569,7 +12569,7 @@ int i40e_commit_partition_bw_setting(struct i40e_pf *pf) ...@@ -12569,7 +12569,7 @@ int i40e_commit_partition_bw_setting(struct i40e_pf *pf)
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"Commit BW only works on partition 1! This is partition %d", "Commit BW only works on partition 1! This is partition %d",
pf->hw.partition_id); pf->hw.partition_id);
ret = I40E_NOT_SUPPORTED; ret = -EOPNOTSUPP;
goto bw_commit_out; goto bw_commit_out;
} }
...@@ -12651,10 +12651,10 @@ static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf) ...@@ -12651,10 +12651,10 @@ static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf)
#define I40E_LINK_BEHAVIOR_WORD_LENGTH 0x1 #define I40E_LINK_BEHAVIOR_WORD_LENGTH 0x1
#define I40E_LINK_BEHAVIOR_OS_FORCED_ENABLED BIT(0) #define I40E_LINK_BEHAVIOR_OS_FORCED_ENABLED BIT(0)
#define I40E_LINK_BEHAVIOR_PORT_BIT_LENGTH 4 #define I40E_LINK_BEHAVIOR_PORT_BIT_LENGTH 4
int read_status = I40E_SUCCESS;
u16 sr_emp_sr_settings_ptr = 0; u16 sr_emp_sr_settings_ptr = 0;
u16 features_enable = 0; u16 features_enable = 0;
u16 link_behavior = 0; u16 link_behavior = 0;
int read_status = 0;
bool ret = false; bool ret = false;
read_status = i40e_read_nvm_word(&pf->hw, read_status = i40e_read_nvm_word(&pf->hw,
...@@ -15462,12 +15462,12 @@ static int i40e_pf_loop_reset(struct i40e_pf *pf) ...@@ -15462,12 +15462,12 @@ static int i40e_pf_loop_reset(struct i40e_pf *pf)
int ret; int ret;
ret = i40e_pf_reset(hw); ret = i40e_pf_reset(hw);
while (ret != I40E_SUCCESS && time_before(jiffies, time_end)) { while (ret != 0 && time_before(jiffies, time_end)) {
usleep_range(10000, 20000); usleep_range(10000, 20000);
ret = i40e_pf_reset(hw); ret = i40e_pf_reset(hw);
} }
if (ret == I40E_SUCCESS) if (ret == 0)
pf->pfr_count++; pf->pfr_count++;
else else
dev_info(&pf->pdev->dev, "PF reset failed: %d\n", ret); dev_info(&pf->pdev->dev, "PF reset failed: %d\n", ret);
...@@ -15510,10 +15510,10 @@ static int i40e_handle_resets(struct i40e_pf *pf) ...@@ -15510,10 +15510,10 @@ static int i40e_handle_resets(struct i40e_pf *pf)
const int pfr = i40e_pf_loop_reset(pf); const int pfr = i40e_pf_loop_reset(pf);
const bool is_empr = i40e_check_fw_empr(pf); const bool is_empr = i40e_check_fw_empr(pf);
if (is_empr || pfr != I40E_SUCCESS) if (is_empr || pfr != 0)
dev_crit(&pf->pdev->dev, "Entering recovery mode due to repeated FW resets. This may take several minutes. Refer to the Intel(R) Ethernet Adapters and Devices User Guide.\n"); dev_crit(&pf->pdev->dev, "Entering recovery mode due to repeated FW resets. This may take several minutes. Refer to the Intel(R) Ethernet Adapters and Devices User Guide.\n");
return is_empr ? I40E_ERR_RESET_FAILED : pfr; return is_empr ? -EIO : pfr;
} }
/** /**
...@@ -15806,7 +15806,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -15806,7 +15806,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err = i40e_init_adminq(hw); err = i40e_init_adminq(hw);
if (err) { if (err) {
if (err == I40E_ERR_FIRMWARE_API_VERSION) if (err == -EIO)
dev_info(&pdev->dev, dev_info(&pdev->dev,
"The driver for the device stopped because the NVM image v%u.%u is newer than expected v%u.%u. You must install the most recent version of the network driver.\n", "The driver for the device stopped because the NVM image v%u.%u is newer than expected v%u.%u. You must install the most recent version of the network driver.\n",
hw->aq.api_maj_ver, hw->aq.api_maj_ver,
......
...@@ -37,7 +37,7 @@ int i40e_init_nvm(struct i40e_hw *hw) ...@@ -37,7 +37,7 @@ int i40e_init_nvm(struct i40e_hw *hw)
nvm->blank_nvm_mode = false; nvm->blank_nvm_mode = false;
} else { /* Blank programming mode */ } else { /* Blank programming mode */
nvm->blank_nvm_mode = true; nvm->blank_nvm_mode = true;
ret_code = I40E_ERR_NVM_BLANK_MODE; ret_code = -EIO;
i40e_debug(hw, I40E_DEBUG_NVM, "NVM init error: unsupported blank mode.\n"); i40e_debug(hw, I40E_DEBUG_NVM, "NVM init error: unsupported blank mode.\n");
} }
...@@ -111,8 +111,8 @@ int i40e_acquire_nvm(struct i40e_hw *hw, ...@@ -111,8 +111,8 @@ int i40e_acquire_nvm(struct i40e_hw *hw,
**/ **/
void i40e_release_nvm(struct i40e_hw *hw) void i40e_release_nvm(struct i40e_hw *hw)
{ {
int ret_code = I40E_SUCCESS;
u32 total_delay = 0; u32 total_delay = 0;
int ret_code = 0;
if (hw->nvm.blank_nvm_mode) if (hw->nvm.blank_nvm_mode)
return; return;
...@@ -122,7 +122,7 @@ void i40e_release_nvm(struct i40e_hw *hw) ...@@ -122,7 +122,7 @@ void i40e_release_nvm(struct i40e_hw *hw)
/* there are some rare cases when trying to release the resource /* there are some rare cases when trying to release the resource
* results in an admin Q timeout, so handle them correctly * results in an admin Q timeout, so handle them correctly
*/ */
while ((ret_code == I40E_ERR_ADMIN_QUEUE_TIMEOUT) && while ((ret_code == -EIO) &&
(total_delay < hw->aq.asq_cmd_timeout)) { (total_delay < hw->aq.asq_cmd_timeout)) {
usleep_range(1000, 2000); usleep_range(1000, 2000);
ret_code = i40e_aq_release_resource(hw, ret_code = i40e_aq_release_resource(hw,
...@@ -140,7 +140,7 @@ void i40e_release_nvm(struct i40e_hw *hw) ...@@ -140,7 +140,7 @@ void i40e_release_nvm(struct i40e_hw *hw)
**/ **/
static int i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw) static int i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw)
{ {
int ret_code = I40E_ERR_TIMEOUT; int ret_code = -EIO;
u32 srctl, wait_cnt; u32 srctl, wait_cnt;
/* Poll the I40E_GLNVM_SRCTL until the done bit is set */ /* Poll the I40E_GLNVM_SRCTL until the done bit is set */
...@@ -152,7 +152,7 @@ static int i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw) ...@@ -152,7 +152,7 @@ static int i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw)
} }
udelay(5); udelay(5);
} }
if (ret_code == I40E_ERR_TIMEOUT) if (ret_code == -EIO)
i40e_debug(hw, I40E_DEBUG_NVM, "Done bit in GLNVM_SRCTL not set"); i40e_debug(hw, I40E_DEBUG_NVM, "Done bit in GLNVM_SRCTL not set");
return ret_code; return ret_code;
} }
...@@ -168,14 +168,14 @@ static int i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw) ...@@ -168,14 +168,14 @@ static int i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw)
static int i40e_read_nvm_word_srctl(struct i40e_hw *hw, u16 offset, static int i40e_read_nvm_word_srctl(struct i40e_hw *hw, u16 offset,
u16 *data) u16 *data)
{ {
int ret_code = I40E_ERR_TIMEOUT; int ret_code = -EIO;
u32 sr_reg; u32 sr_reg;
if (offset >= hw->nvm.sr_size) { if (offset >= hw->nvm.sr_size) {
i40e_debug(hw, I40E_DEBUG_NVM, i40e_debug(hw, I40E_DEBUG_NVM,
"NVM read error: offset %d beyond Shadow RAM limit %d\n", "NVM read error: offset %d beyond Shadow RAM limit %d\n",
offset, hw->nvm.sr_size); offset, hw->nvm.sr_size);
ret_code = I40E_ERR_PARAM; ret_code = -EINVAL;
goto read_nvm_exit; goto read_nvm_exit;
} }
...@@ -222,7 +222,7 @@ static int i40e_read_nvm_aq(struct i40e_hw *hw, ...@@ -222,7 +222,7 @@ static int i40e_read_nvm_aq(struct i40e_hw *hw,
bool last_command) bool last_command)
{ {
struct i40e_asq_cmd_details cmd_details; struct i40e_asq_cmd_details cmd_details;
int ret_code = I40E_ERR_NVM; int ret_code = -EIO;
memset(&cmd_details, 0, sizeof(cmd_details)); memset(&cmd_details, 0, sizeof(cmd_details));
cmd_details.wb_desc = &hw->nvm_wb_desc; cmd_details.wb_desc = &hw->nvm_wb_desc;
...@@ -267,7 +267,7 @@ static int i40e_read_nvm_aq(struct i40e_hw *hw, ...@@ -267,7 +267,7 @@ static int i40e_read_nvm_aq(struct i40e_hw *hw,
static int i40e_read_nvm_word_aq(struct i40e_hw *hw, u16 offset, static int i40e_read_nvm_word_aq(struct i40e_hw *hw, u16 offset,
u16 *data) u16 *data)
{ {
int ret_code = I40E_ERR_TIMEOUT; int ret_code = -EIO;
ret_code = i40e_read_nvm_aq(hw, 0x0, offset, 1, data, true); ret_code = i40e_read_nvm_aq(hw, 0x0, offset, 1, data, true);
*data = le16_to_cpu(*(__le16 *)data); *data = le16_to_cpu(*(__le16 *)data);
...@@ -348,7 +348,7 @@ int i40e_read_nvm_module_data(struct i40e_hw *hw, ...@@ -348,7 +348,7 @@ int i40e_read_nvm_module_data(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_ALL, i40e_debug(hw, I40E_DEBUG_ALL,
"Reading nvm word failed.Error code: %d.\n", "Reading nvm word failed.Error code: %d.\n",
status); status);
return I40E_ERR_NVM; return -EIO;
} }
} }
#define I40E_NVM_INVALID_PTR_VAL 0x7FFF #define I40E_NVM_INVALID_PTR_VAL 0x7FFF
...@@ -358,7 +358,7 @@ int i40e_read_nvm_module_data(struct i40e_hw *hw, ...@@ -358,7 +358,7 @@ int i40e_read_nvm_module_data(struct i40e_hw *hw,
if (ptr_value == I40E_NVM_INVALID_PTR_VAL || if (ptr_value == I40E_NVM_INVALID_PTR_VAL ||
ptr_value == I40E_NVM_INVALID_VAL) { ptr_value == I40E_NVM_INVALID_VAL) {
i40e_debug(hw, I40E_DEBUG_ALL, "Pointer not initialized.\n"); i40e_debug(hw, I40E_DEBUG_ALL, "Pointer not initialized.\n");
return I40E_ERR_BAD_PTR; return -EINVAL;
} }
/* Check whether the module is in SR mapped area or outside */ /* Check whether the module is in SR mapped area or outside */
...@@ -367,7 +367,7 @@ int i40e_read_nvm_module_data(struct i40e_hw *hw, ...@@ -367,7 +367,7 @@ int i40e_read_nvm_module_data(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_ALL, i40e_debug(hw, I40E_DEBUG_ALL,
"Reading nvm data failed. Pointer points outside of the Shared RAM mapped area.\n"); "Reading nvm data failed. Pointer points outside of the Shared RAM mapped area.\n");
return I40E_ERR_PARAM; return -EINVAL;
} else { } else {
/* Read from the Shadow RAM */ /* Read from the Shadow RAM */
...@@ -377,7 +377,7 @@ int i40e_read_nvm_module_data(struct i40e_hw *hw, ...@@ -377,7 +377,7 @@ int i40e_read_nvm_module_data(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_ALL, i40e_debug(hw, I40E_DEBUG_ALL,
"Reading nvm word failed.Error code: %d.\n", "Reading nvm word failed.Error code: %d.\n",
status); status);
return I40E_ERR_NVM; return -EIO;
} }
offset = ptr_value + module_offset + specific_ptr + offset = ptr_value + module_offset + specific_ptr +
...@@ -549,7 +549,7 @@ static int i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer, ...@@ -549,7 +549,7 @@ static int i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer,
bool last_command) bool last_command)
{ {
struct i40e_asq_cmd_details cmd_details; struct i40e_asq_cmd_details cmd_details;
int ret_code = I40E_ERR_NVM; int ret_code = -EIO;
memset(&cmd_details, 0, sizeof(cmd_details)); memset(&cmd_details, 0, sizeof(cmd_details));
cmd_details.wb_desc = &hw->nvm_wb_desc; cmd_details.wb_desc = &hw->nvm_wb_desc;
...@@ -614,7 +614,7 @@ static int i40e_calc_nvm_checksum(struct i40e_hw *hw, ...@@ -614,7 +614,7 @@ static int i40e_calc_nvm_checksum(struct i40e_hw *hw,
/* read pointer to VPD area */ /* read pointer to VPD area */
ret_code = __i40e_read_nvm_word(hw, I40E_SR_VPD_PTR, &vpd_module); ret_code = __i40e_read_nvm_word(hw, I40E_SR_VPD_PTR, &vpd_module);
if (ret_code) { if (ret_code) {
ret_code = I40E_ERR_NVM_CHECKSUM; ret_code = -EIO;
goto i40e_calc_nvm_checksum_exit; goto i40e_calc_nvm_checksum_exit;
} }
...@@ -622,7 +622,7 @@ static int i40e_calc_nvm_checksum(struct i40e_hw *hw, ...@@ -622,7 +622,7 @@ static int i40e_calc_nvm_checksum(struct i40e_hw *hw,
ret_code = __i40e_read_nvm_word(hw, I40E_SR_PCIE_ALT_AUTO_LOAD_PTR, ret_code = __i40e_read_nvm_word(hw, I40E_SR_PCIE_ALT_AUTO_LOAD_PTR,
&pcie_alt_module); &pcie_alt_module);
if (ret_code) { if (ret_code) {
ret_code = I40E_ERR_NVM_CHECKSUM; ret_code = -EIO;
goto i40e_calc_nvm_checksum_exit; goto i40e_calc_nvm_checksum_exit;
} }
...@@ -636,7 +636,7 @@ static int i40e_calc_nvm_checksum(struct i40e_hw *hw, ...@@ -636,7 +636,7 @@ static int i40e_calc_nvm_checksum(struct i40e_hw *hw,
ret_code = __i40e_read_nvm_buffer(hw, i, &words, data); ret_code = __i40e_read_nvm_buffer(hw, i, &words, data);
if (ret_code) { if (ret_code) {
ret_code = I40E_ERR_NVM_CHECKSUM; ret_code = -EIO;
goto i40e_calc_nvm_checksum_exit; goto i40e_calc_nvm_checksum_exit;
} }
} }
...@@ -724,7 +724,7 @@ int i40e_validate_nvm_checksum(struct i40e_hw *hw, ...@@ -724,7 +724,7 @@ int i40e_validate_nvm_checksum(struct i40e_hw *hw,
* calculated checksum * calculated checksum
*/ */
if (checksum_local != checksum_sr) if (checksum_local != checksum_sr)
ret_code = I40E_ERR_NVM_CHECKSUM; ret_code = -EIO;
/* If the user cares, return the calculated checksum */ /* If the user cares, return the calculated checksum */
if (checksum) if (checksum)
...@@ -839,7 +839,7 @@ int i40e_nvmupd_command(struct i40e_hw *hw, ...@@ -839,7 +839,7 @@ int i40e_nvmupd_command(struct i40e_hw *hw,
if (upd_cmd == I40E_NVMUPD_STATUS) { if (upd_cmd == I40E_NVMUPD_STATUS) {
if (!cmd->data_size) { if (!cmd->data_size) {
*perrno = -EFAULT; *perrno = -EFAULT;
return I40E_ERR_BUF_TOO_SHORT; return -EINVAL;
} }
bytes[0] = hw->nvmupd_state; bytes[0] = hw->nvmupd_state;
...@@ -896,7 +896,7 @@ int i40e_nvmupd_command(struct i40e_hw *hw, ...@@ -896,7 +896,7 @@ int i40e_nvmupd_command(struct i40e_hw *hw,
break; break;
} }
status = I40E_ERR_NOT_READY; status = -EBUSY;
*perrno = -EBUSY; *perrno = -EBUSY;
break; break;
...@@ -904,7 +904,7 @@ int i40e_nvmupd_command(struct i40e_hw *hw, ...@@ -904,7 +904,7 @@ int i40e_nvmupd_command(struct i40e_hw *hw,
/* invalid state, should never happen */ /* invalid state, should never happen */
i40e_debug(hw, I40E_DEBUG_NVM, i40e_debug(hw, I40E_DEBUG_NVM,
"NVMUPD: no such state %d\n", hw->nvmupd_state); "NVMUPD: no such state %d\n", hw->nvmupd_state);
status = I40E_NOT_SUPPORTED; status = -EOPNOTSUPP;
*perrno = -ESRCH; *perrno = -ESRCH;
break; break;
} }
...@@ -1045,7 +1045,7 @@ static int i40e_nvmupd_state_init(struct i40e_hw *hw, ...@@ -1045,7 +1045,7 @@ static int i40e_nvmupd_state_init(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_NVM, i40e_debug(hw, I40E_DEBUG_NVM,
"NVMUPD: bad cmd %s in init state\n", "NVMUPD: bad cmd %s in init state\n",
i40e_nvm_update_state_str[upd_cmd]); i40e_nvm_update_state_str[upd_cmd]);
status = I40E_ERR_NVM; status = -EIO;
*perrno = -ESRCH; *perrno = -ESRCH;
break; break;
} }
...@@ -1087,7 +1087,7 @@ static int i40e_nvmupd_state_reading(struct i40e_hw *hw, ...@@ -1087,7 +1087,7 @@ static int i40e_nvmupd_state_reading(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_NVM, i40e_debug(hw, I40E_DEBUG_NVM,
"NVMUPD: bad cmd %s in reading state.\n", "NVMUPD: bad cmd %s in reading state.\n",
i40e_nvm_update_state_str[upd_cmd]); i40e_nvm_update_state_str[upd_cmd]);
status = I40E_NOT_SUPPORTED; status = -EOPNOTSUPP;
*perrno = -ESRCH; *perrno = -ESRCH;
break; break;
} }
...@@ -1174,7 +1174,7 @@ static int i40e_nvmupd_state_writing(struct i40e_hw *hw, ...@@ -1174,7 +1174,7 @@ static int i40e_nvmupd_state_writing(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_NVM, i40e_debug(hw, I40E_DEBUG_NVM,
"NVMUPD: bad cmd %s in writing state.\n", "NVMUPD: bad cmd %s in writing state.\n",
i40e_nvm_update_state_str[upd_cmd]); i40e_nvm_update_state_str[upd_cmd]);
status = I40E_NOT_SUPPORTED; status = -EOPNOTSUPP;
*perrno = -ESRCH; *perrno = -ESRCH;
break; break;
} }
...@@ -1398,7 +1398,7 @@ static int i40e_nvmupd_exec_aq(struct i40e_hw *hw, ...@@ -1398,7 +1398,7 @@ static int i40e_nvmupd_exec_aq(struct i40e_hw *hw,
"NVMUPD: not enough aq desc bytes for exec, size %d < %d\n", "NVMUPD: not enough aq desc bytes for exec, size %d < %d\n",
cmd->data_size, aq_desc_len); cmd->data_size, aq_desc_len);
*perrno = -EINVAL; *perrno = -EINVAL;
return I40E_ERR_PARAM; return -EINVAL;
} }
aq_desc = (struct i40e_aq_desc *)bytes; aq_desc = (struct i40e_aq_desc *)bytes;
...@@ -1473,7 +1473,7 @@ static int i40e_nvmupd_get_aq_result(struct i40e_hw *hw, ...@@ -1473,7 +1473,7 @@ static int i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
i40e_debug(hw, I40E_DEBUG_NVM, "%s: offset too big %d > %d\n", i40e_debug(hw, I40E_DEBUG_NVM, "%s: offset too big %d > %d\n",
__func__, cmd->offset, aq_total_len); __func__, cmd->offset, aq_total_len);
*perrno = -EINVAL; *perrno = -EINVAL;
return I40E_ERR_PARAM; return -EINVAL;
} }
/* check copylength range */ /* check copylength range */
......
...@@ -1132,7 +1132,7 @@ int i40e_ptp_alloc_pins(struct i40e_pf *pf) ...@@ -1132,7 +1132,7 @@ int i40e_ptp_alloc_pins(struct i40e_pf *pf)
if (!pf->ptp_pins) { if (!pf->ptp_pins) {
dev_warn(&pf->pdev->dev, "Cannot allocate memory for PTP pins structure.\n"); dev_warn(&pf->pdev->dev, "Cannot allocate memory for PTP pins structure.\n");
return -I40E_ERR_NO_MEMORY; return -ENOMEM;
} }
pf->ptp_pins->sdp3_2 = off; pf->ptp_pins->sdp3_2 = off;
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2013 - 2018 Intel Corporation. */
#ifndef _I40E_STATUS_H_
#define _I40E_STATUS_H_
/* Error Codes */
enum i40e_status_code {
I40E_SUCCESS = 0,
I40E_ERR_NVM = -1,
I40E_ERR_NVM_CHECKSUM = -2,
I40E_ERR_CONFIG = -4,
I40E_ERR_PARAM = -5,
I40E_ERR_UNKNOWN_PHY = -7,
I40E_ERR_INVALID_MAC_ADDR = -10,
I40E_ERR_DEVICE_NOT_SUPPORTED = -11,
I40E_ERR_RESET_FAILED = -15,
I40E_ERR_NO_AVAILABLE_VSI = -17,
I40E_ERR_NO_MEMORY = -18,
I40E_ERR_BAD_PTR = -19,
I40E_ERR_INVALID_SIZE = -26,
I40E_ERR_QUEUE_EMPTY = -32,
I40E_ERR_TIMEOUT = -37,
I40E_ERR_INVALID_SD_INDEX = -45,
I40E_ERR_INVALID_PAGE_DESC_INDEX = -46,
I40E_ERR_INVALID_SD_TYPE = -47,
I40E_ERR_INVALID_HMC_OBJ_INDEX = -49,
I40E_ERR_INVALID_HMC_OBJ_COUNT = -50,
I40E_ERR_ADMIN_QUEUE_ERROR = -53,
I40E_ERR_ADMIN_QUEUE_TIMEOUT = -54,
I40E_ERR_BUF_TOO_SHORT = -55,
I40E_ERR_ADMIN_QUEUE_FULL = -56,
I40E_ERR_ADMIN_QUEUE_NO_WORK = -57,
I40E_ERR_NVM_BLANK_MODE = -59,
I40E_ERR_NOT_IMPLEMENTED = -60,
I40E_ERR_DIAG_TEST_FAILED = -62,
I40E_ERR_NOT_READY = -63,
I40E_NOT_SUPPORTED = -64,
I40E_ERR_FIRMWARE_API_VERSION = -65,
I40E_ERR_ADMIN_QUEUE_CRITICAL_ERROR = -66,
};
#endif /* _I40E_STATUS_H_ */
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#ifndef _I40E_TYPE_H_ #ifndef _I40E_TYPE_H_
#define _I40E_TYPE_H_ #define _I40E_TYPE_H_
#include "i40e_status.h"
#include "i40e_osdep.h" #include "i40e_osdep.h"
#include "i40e_register.h" #include "i40e_register.h"
#include "i40e_adminq.h" #include "i40e_adminq.h"
......
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