summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@broadcom.com>2018-07-25 18:15:47 -0700
committerYongseok Koh <yskoh@mellanox.com>2018-08-13 11:45:59 -0700
commite6af6f16d45dca27115526bd6201a6c658bf6d2c (patch)
tree33bcd5582f5cc158be467e2acf893fed8c316d99
parent063f7f0b46368f58da1a2d6e08dddfb999dfb393 (diff)
downloaddpdk-stable-e6af6f16d45dca27115526bd6201a6c658bf6d2c.zip
dpdk-stable-e6af6f16d45dca27115526bd6201a6c658bf6d2c.tar.gz
dpdk-stable-e6af6f16d45dca27115526bd6201a6c658bf6d2c.tar.xz
net/bnxt: check access denied for HWRM commands
[ upstream commit 6dc875ab5ff76377376906aa6d05d95ffd34b9f9 ] Firmware can restrict access to certain resources in the hardware depending on various factors. In such cases when the PMD tries to configure these resources the firmware will return HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED error. Parse this and return the standard EACCES error to the applications. Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code") Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
-rw-r--r--drivers/net/bnxt/bnxt_hwrm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index fa8f1fa..db3222f 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -197,6 +197,10 @@ err_ret:
RTE_LOG(ERR, PMD, "%s failed rc:%d\n", \
__func__, rc); \
rte_spinlock_unlock(&bp->hwrm_lock); \
+ if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) \
+ rc = -EACCES; \
+ else if (rc > 0) \
+ rc = -EINVAL; \
return rc; \
} \
if (resp->error_code) { \
@@ -218,6 +222,10 @@ err_ret:
"%s error %d\n", __func__, rc); \
} \
rte_spinlock_unlock(&bp->hwrm_lock); \
+ if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) \
+ rc = -EACCES; \
+ else if (rc > 0) \
+ rc = -EINVAL; \
return rc; \
} \
} while (0)