[dpdk-stable] patch 'net/bnxt: fix return values to standard error codes' has been queued to LTS release 18.11.3

Kevin Traynor ktraynor at redhat.com
Wed Aug 28 15:42:20 CEST 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 09/04/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/1f49e67da91ba94cc3f3a03f7e17070cc0d3696e

Thanks.

Kevin Traynor

---
>From 1f49e67da91ba94cc3f3a03f7e17070cc0d3696e Mon Sep 17 00:00:00 2001
From: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
Date: Thu, 18 Jul 2019 09:06:06 +0530
Subject: [PATCH] net/bnxt: fix return values to standard error codes

[ upstream commit e67daabd224bbd3d95a03f1192ea78db6314c0f4 ]

Fixed the return values of few routines to return standard error code.
Also fixed few error logs to more meaningful one.

Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
Fixes: e3d8f1e6a665 ("net/bnxt: cache address of doorbell to subsequent access")
Fixes: 19e6af01bb36 ("net/bnxt: support get/set EEPROM")
Fixes: b7435d660a8c ("net/bnxt: add ntuple filtering support")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur at broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 44 +++++++---------------------------
 drivers/net/bnxt/bnxt_hwrm.c   | 30 ++++++++++-------------
 2 files changed, 20 insertions(+), 54 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0bfa386aa..611a5302d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1974,5 +1974,5 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev,
 		filter1 = bnxt_get_l2_filter(bp, bfilter, vnic0);
 		if (filter1 == NULL) {
-			ret = -1;
+			ret = -EINVAL;
 			goto cleanup;
 		}
@@ -2168,5 +2168,5 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
 	filter1 = STAILQ_FIRST(&vnic0->filter);
 	if (filter1 == NULL) {
-		ret = -1;
+		ret = -EINVAL;
 		goto free_filter;
 	}
@@ -3108,5 +3108,4 @@ bnxt_set_eeprom_op(struct rte_eth_dev *dev,
 	return bnxt_hwrm_flash_nvram(bp, type, ordinal, ext, attr,
 				     in_eeprom->data, in_eeprom->length);
-	return 0;
 }
 
@@ -3210,14 +3209,13 @@ bool bnxt_stratus_device(struct bnxt *bp)
 static int bnxt_init_board(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = eth_dev->data->dev_private;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-	int rc;
+	struct bnxt *bp = eth_dev->data->dev_private;
 
 	/* enable device (incl. PCI PM wakeup), and bus-mastering */
-	if (!pci_dev->mem_resource[0].addr) {
-		PMD_DRV_LOG(ERR,
-			"Cannot find PCI device base address, aborting\n");
-		rc = -ENODEV;
-		goto init_err_disable;
+	bp->bar0 = (void *)pci_dev->mem_resource[0].addr;
+	bp->doorbell_base = (void *)pci_dev->mem_resource[2].addr;
+	if (!bp->bar0 || !bp->doorbell_base) {
+		PMD_DRV_LOG(ERR, "Unable to access Hardware\n");
+		return -ENODEV;
 	}
 
@@ -3225,31 +3223,5 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
 	bp->pdev = pci_dev;
 
-	bp->bar0 = (void *)pci_dev->mem_resource[0].addr;
-	if (!bp->bar0) {
-		PMD_DRV_LOG(ERR, "Cannot map device registers, aborting\n");
-		rc = -ENOMEM;
-		goto init_err_release;
-	}
-
-	if (!pci_dev->mem_resource[2].addr) {
-		PMD_DRV_LOG(ERR,
-			    "Cannot find PCI device BAR 2 address, aborting\n");
-		rc = -ENODEV;
-		goto init_err_release;
-	} else {
-		bp->doorbell_base = (void *)pci_dev->mem_resource[2].addr;
-	}
-
 	return 0;
-
-init_err_release:
-	if (bp->bar0)
-		bp->bar0 = NULL;
-	if (bp->doorbell_base)
-		bp->doorbell_base = NULL;
-
-init_err_disable:
-
-	return rc;
 }
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 0713e86f9..865b42870 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -140,12 +140,9 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 
 	if (i >= HWRM_CMD_TIMEOUT) {
-		PMD_DRV_LOG(ERR, "Error sending msg 0x%04x\n",
-			req->req_type);
-		goto err_ret;
+		PMD_DRV_LOG(ERR, "Error(timeout) sending msg 0x%04x\n",
+			    req->req_type);
+		return -ETIMEDOUT;
 	}
 	return 0;
-
-err_ret:
-	return -1;
 }
 
@@ -1134,5 +1131,5 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 			ring_type);
 		HWRM_UNLOCK();
-		return -1;
+		return -EINVAL;
 	}
 	req.enables = rte_cpu_to_le_32(enables);
@@ -2703,5 +2700,5 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp)
 	if (!BNXT_PF(bp)) {
 		PMD_DRV_LOG(ERR, "Attempt to allcoate VFs on a VF!\n");
-		return -1;
+		return -EINVAL;
 	}
 
@@ -2730,5 +2727,5 @@ int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs)
 	if (!BNXT_PF(bp)) {
 		PMD_DRV_LOG(ERR, "Attempt to allcoate VFs on a VF!\n");
-		return -1;
+		return -EINVAL;
 	}
 
@@ -3582,8 +3579,7 @@ int bnxt_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
 	vnic_ids = rte_malloc("bnxt_hwrm_vf_vnic_ids_query", vnic_id_sz,
 			RTE_CACHE_LINE_SIZE);
-	if (vnic_ids == NULL) {
-		rc = -ENOMEM;
-		return rc;
-	}
+	if (vnic_ids == NULL)
+		return -ENOMEM;
+
 	for (sz = 0; sz < vnic_id_sz; sz += getpagesize())
 		rte_mem_lock_page(((char *)vnic_ids) + sz);
@@ -3652,8 +3648,6 @@ int bnxt_hwrm_func_qcfg_vf_dflt_vnic_id(struct bnxt *bp, int vf)
 	vnic_ids = rte_malloc("bnxt_hwrm_vf_vnic_ids_query", vnic_id_sz,
 			RTE_CACHE_LINE_SIZE);
-	if (vnic_ids == NULL) {
-		rc = -ENOMEM;
-		return rc;
-	}
+	if (vnic_ids == NULL)
+		return -ENOMEM;
 
 	for (sz = 0; sz < vnic_id_sz; sz += getpagesize())
@@ -3686,5 +3680,5 @@ int bnxt_hwrm_func_qcfg_vf_dflt_vnic_id(struct bnxt *bp, int vf)
 exit:
 	rte_free(vnic_ids);
-	return -1;
+	return rc;
 }
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-08-28 14:32:34.456056820 +0100
+++ 0045-net-bnxt-fix-return-values-to-standard-error-codes.patch	2019-08-28 14:32:31.707955889 +0100
@@ -1 +1 @@
-From e67daabd224bbd3d95a03f1192ea78db6314c0f4 Mon Sep 17 00:00:00 2001
+From 1f49e67da91ba94cc3f3a03f7e17070cc0d3696e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e67daabd224bbd3d95a03f1192ea78db6314c0f4 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -18,3 +19,3 @@
- drivers/net/bnxt/bnxt_ethdev.c | 46 +++++++---------------------------
- drivers/net/bnxt/bnxt_hwrm.c   | 30 +++++++++-------------
- 2 files changed, 21 insertions(+), 55 deletions(-)
+ drivers/net/bnxt/bnxt_ethdev.c | 44 +++++++---------------------------
+ drivers/net/bnxt/bnxt_hwrm.c   | 30 ++++++++++-------------
+ 2 files changed, 20 insertions(+), 54 deletions(-)
@@ -23 +24 @@
-index 3368508df..69244b8c5 100644
+index 0bfa386aa..611a5302d 100644
@@ -26 +27 @@
-@@ -2153,5 +2153,5 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev,
+@@ -1974,5 +1974,5 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev,
@@ -33 +34 @@
-@@ -2347,5 +2347,5 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
+@@ -2168,5 +2168,5 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
@@ -40 +41 @@
-@@ -3289,5 +3289,4 @@ bnxt_set_eeprom_op(struct rte_eth_dev *dev,
+@@ -3108,5 +3108,4 @@ bnxt_set_eeprom_op(struct rte_eth_dev *dev,
@@ -46 +47 @@
-@@ -3392,14 +3391,13 @@ bool bnxt_stratus_device(struct bnxt *bp)
+@@ -3210,14 +3209,13 @@ bool bnxt_stratus_device(struct bnxt *bp)
@@ -67 +68 @@
-@@ -3407,31 +3405,5 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
+@@ -3225,31 +3223,5 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
@@ -99,7 +99,0 @@
-@@ -3673,5 +3645,5 @@ int bnxt_alloc_ctx_mem(struct bnxt *bp)
- 		ctx->flags |= BNXT_CTX_FLAG_INITED;
- 
--	return 0;
-+	return rc;
- }
- 
@@ -107 +101 @@
-index abc6d4220..456cc76b8 100644
+index 0713e86f9..865b42870 100644
@@ -110 +104 @@
-@@ -153,12 +153,9 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
+@@ -140,12 +140,9 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
@@ -126 +120 @@
-@@ -1218,5 +1215,5 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
+@@ -1134,5 +1131,5 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
@@ -133 +127 @@
-@@ -2931,5 +2928,5 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp)
+@@ -2703,5 +2700,5 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp)
@@ -140 +134 @@
-@@ -2959,5 +2956,5 @@ int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs)
+@@ -2730,5 +2727,5 @@ int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs)
@@ -147 +141 @@
-@@ -3801,8 +3798,7 @@ int bnxt_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
+@@ -3582,8 +3579,7 @@ int bnxt_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
@@ -159 +153 @@
-@@ -3871,8 +3867,6 @@ int bnxt_hwrm_func_qcfg_vf_dflt_vnic_id(struct bnxt *bp, int vf)
+@@ -3652,8 +3648,6 @@ int bnxt_hwrm_func_qcfg_vf_dflt_vnic_id(struct bnxt *bp, int vf)
@@ -170 +164 @@
-@@ -3905,5 +3899,5 @@ int bnxt_hwrm_func_qcfg_vf_dflt_vnic_id(struct bnxt *bp, int vf)
+@@ -3686,5 +3680,5 @@ int bnxt_hwrm_func_qcfg_vf_dflt_vnic_id(struct bnxt *bp, int vf)


More information about the stable mailing list