[dpdk-dev,05/13] net/bnxt: return proper error code

Message ID 20180108202437.56305-6-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Jan. 8, 2018, 8:24 p.m. UTC
  If the FW fails bnxt_hwrm_func_reset() with an error status,
instead of returning -1, return a more standard value of -EIO.
Similarly sometimes the status returned by certain FW commands
may not be generic. Return a more standard value of -EIO in
that case as well.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d0002824f..ce7030d1a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -378,6 +378,10 @@  static int bnxt_init_chip(struct bnxt *bp)
 err_out:
 	bnxt_free_all_hwrm_resources(bp);
 
+	/* Some of the error status returned by FW may not be from errno.h */
+	if (rc > 0)
+		rc = -EIO;
+
 	return rc;
 }
 
@@ -3268,7 +3272,7 @@  bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	rc = bnxt_hwrm_func_reset(bp);
 	if (rc) {
 		RTE_LOG(ERR, PMD, "hwrm chip reset failure rc: %x\n", rc);
-		rc = -1;
+		rc = -EIO;
 		goto error_free;
 	}