diff mbox series

[6/9] net/bnxt: use common function to destroy VNIC resource

Message ID 20210531072644.24656-7-kalesh-anakkur.purayil@broadcom.com (mailing list archive)
State Accepted
Delegated to: Ajit Khaparde
Headers show
Series bnxt PMD fixes | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Kalesh A P May 31, 2021, 7:26 a.m. UTC
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Use the function bnxt_vnic_destroy() to destroy VNIC resources
and thereby eliminate few duplicate code.

Fixes: 8d0a244b40b2 ("net/bnxt: cleanup VNIC after flow validate")
Fixes: 49d0709b257f ("net/bnxt: delete and flush L2 filters cleanly")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index ed201a3..59489b5 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1577,10 +1577,7 @@  bnxt_flow_validate(struct rte_eth_dev *dev,
 	vnic = find_matching_vnic(bp, filter);
 	if (vnic) {
 		if (STAILQ_EMPTY(&vnic->filter)) {
-			rte_free(vnic->fw_grp_ids);
-			bnxt_hwrm_vnic_ctx_free(bp, vnic);
-			bnxt_hwrm_vnic_free(bp, vnic);
-			vnic->rx_queue_cnt = 0;
+			bnxt_vnic_cleanup(bp, vnic);
 			bp->nr_vnics--;
 			PMD_DRV_LOG(DEBUG, "Free VNIC\n");
 		}
@@ -2045,12 +2042,7 @@  _bnxt_flow_destroy(struct bnxt *bp,
 		 */
 		if (vnic && !vnic->func_default &&
 		    STAILQ_EMPTY(&vnic->flow_list)) {
-			rte_free(vnic->fw_grp_ids);
-			if (vnic->rx_queue_cnt > 1)
-				bnxt_hwrm_vnic_ctx_free(bp, vnic);
-
-			bnxt_hwrm_vnic_free(bp, vnic);
-			vnic->rx_queue_cnt = 0;
+			bnxt_vnic_cleanup(bp, vnic);
 			bp->nr_vnics--;
 		}
 	} else {