[4/7] net/bnxt: cleanup vnic ref count

Message ID 20240208171330.31139-5-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series bnxt bug fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Feb. 8, 2024, 5:13 p.m. UTC
  From: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>

Cleanup vnic ref count when port is stopped.
When vlan strip is set/unset the current active
vnics are destroyed and recreated with VNIC id
provided by firmware. The default vnic at index 0
still has ref_cnt=1 while rx_queues are reset to 0,
which fails the check under bnxt_vnic_rss_action_free()

Resetting the vnic->ref_cnt in bnxt_free_all_hwrm_resources()
post FW handshake in clean-up path.

Signed-off-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 397b4a0e05..1d523d6dec 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3584,6 +3584,8 @@  void bnxt_free_all_hwrm_resources(struct bnxt *bp)
 
 		rte_free(vnic->fw_grp_ids);
 		vnic->fw_grp_ids = NULL;
+		if (vnic->ref_cnt && !vnic->rx_queue_cnt)
+			vnic->ref_cnt--;
 	}
 	/* Ring resources */
 	bnxt_free_all_hwrm_rings(bp);