[dpdk-stable] [PATCH] net/bnxt: don't fail rte_pmd_bnxt_set_all_queues_drop_en if no VF's

Stephen Hemminger stephen at networkplumber.org
Wed Nov 25 18:49:51 CET 2020


The function should return success if called with no active VF's.
It is OK to call this function if the desired outcome is to change
the flag for PF's even if there are no VF's.

Original code may have worked by accidental uninitialized variable;
then this bug was introduced by change to fix compilation warning.

Fixes: 4a671fdea9f4 ("net/bnxt: fix compilation with -Og")
Cc: olivier.matz at 6wind.com
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/bnxt/rte_pmd_bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index d67db46c65eb..6a236ff4803b 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -85,7 +85,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on)
 	struct rte_eth_dev *eth_dev;
 	struct bnxt *bp;
 	uint32_t i;
-	int rc = -EINVAL;
+	int rc;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
@@ -118,6 +118,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on)
 	}
 
 	/* Stall all active VFs */
+	rc = 0;
 	for (i = 0; i < bp->pf->active_vfs; i++) {
 		rc = bnxt_hwrm_func_vf_vnic_query_and_config(bp, i,
 				rte_pmd_bnxt_set_all_queues_drop_en_cb, &on,
-- 
2.27.0



More information about the stable mailing list