[3/7] net/bnxt: refactor VNIC context cleanup

Message ID 20240208171330.31139-4-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
  Currently the VNIC context cleanup is being called a little early
leading to the VNIC RSS context being freed prior to the filter
cleanup corresponding to the VNIC. But since these filters could
still be referenced by the default VNIC the hardware fails to find
the corresponding VNIC context in some rare cases.

Modify the cleanup sequence for the VNICs to free the VNIC contexts
after the filters and the actual VNIC is freed up in the firmware.

Also make sure to clear the rx_mask with mask of 0 for default VNIC.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 17527a3c4d..397b4a0e05 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3570,16 +3570,18 @@  void bnxt_free_all_hwrm_resources(struct bnxt *bp)
 		if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
 			continue;
 
+		if (vnic->func_default && (bp->flags & BNXT_FLAG_DFLT_VNIC_SET))
+			bnxt_hwrm_cfa_l2_clear_rx_mask(bp, vnic);
 		bnxt_clear_hwrm_vnic_flows(bp, vnic);
 
 		bnxt_clear_hwrm_vnic_filters(bp, vnic);
 
-		bnxt_hwrm_vnic_ctx_free(bp, vnic);
-
 		bnxt_hwrm_vnic_tpa_cfg(bp, vnic, false);
 
 		bnxt_hwrm_vnic_free(bp, vnic);
 
+		bnxt_hwrm_vnic_ctx_free(bp, vnic);
+
 		rte_free(vnic->fw_grp_ids);
 		vnic->fw_grp_ids = NULL;
 	}