From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 3DA381B1C3 for ; Mon, 8 Jan 2018 21:24:43 +0100 (CET) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 137A330C024; Mon, 8 Jan 2018 12:24:42 -0800 (PST) Received: from C02PT1RBG8WP.dhcp.broadcom.net (c02pt1rbg8wp.dhcp.broadcom.net [10.136.50.173]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id A4F35AC0741; Mon, 8 Jan 2018 12:24:41 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Mon, 8 Jan 2018 12:24:29 -0800 Message-Id: <20180108202437.56305-6-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.14.3 (Apple Git-98) In-Reply-To: <20180108202437.56305-1-ajit.khaparde@broadcom.com> References: <20180108202437.56305-1-ajit.khaparde@broadcom.com> Subject: [dpdk-dev] [PATCH 05/13] net/bnxt: return proper error code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 20:24:43 -0000 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 --- drivers/net/bnxt/bnxt_ethdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- 2.14.3 (Apple Git-98)