summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@broadcom.com>2019-10-02 16:25:42 -0700
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-08 12:14:31 +0200
commit9848979bcc89c84b6704ac804490ace910fd159e (patch)
treef62d0a6100f37acb784be7d575ed76496a8462f8 /drivers/net
parent07737474ece260fc4adbc46a0b2e7352887fa0c2 (diff)
downloaddpdk-9848979bcc89c84b6704ac804490ace910fd159e.zip
dpdk-9848979bcc89c84b6704ac804490ace910fd159e.tar.gz
dpdk-9848979bcc89c84b6704ac804490ace910fd159e.tar.xz
net/bnxt: return standard error codes for HWRM command
If the FW returns an error for an HWRM request, it does not necessarily return standard error codes. Convert these HWRM errors to standard errno. Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnxt/bnxt_hwrm.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index f476b10..187d378 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -219,8 +219,14 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
rte_spinlock_unlock(&bp->hwrm_lock); \
if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) \
rc = -EACCES; \
- else if (rc > 0) \
+ else if (rc == HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR) \
+ rc = -ENOSPC; \
+ else if (rc == HWRM_ERR_CODE_INVALID_PARAMS) \
rc = -EINVAL; \
+ else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
+ rc = -ENOTSUP; \
+ else if (rc > 0) \
+ rc = -EIO; \
return rc; \
} \
if (resp->error_code) { \
@@ -241,8 +247,14 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
rte_spinlock_unlock(&bp->hwrm_lock); \
if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) \
rc = -EACCES; \
- else if (rc > 0) \
+ else if (rc == HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR) \
+ rc = -ENOSPC; \
+ else if (rc == HWRM_ERR_CODE_INVALID_PARAMS) \
rc = -EINVAL; \
+ else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
+ rc = -ENOTSUP; \
+ else if (rc > 0) \
+ rc = -EIO; \
return rc; \
} \
} while (0)