net/bnxt: don't fail rte_pmd_bnxt_set_all_queues_drop_en if no VF's

Message ID 20201125174951.12198-1-stephen@networkplumber.org (mailing list archive)
State Not Applicable, archived
Delegated to: Ajit Khaparde
Headers
Series net/bnxt: don't fail rte_pmd_bnxt_set_all_queues_drop_en if no VF's |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Stephen Hemminger Nov. 25, 2020, 5:49 p.m. UTC
  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@6wind.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnxt/rte_pmd_bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

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,