[2/9] net/bnxt: fix bumping of L2 filter reference count
Checks
Commit Message
Now that the L2 filter reference count is bumped up in all cases
including bnxt_alloc_filter() which is issued in init, just move this
ref count bump inside the routine issuing the HWRM cmd so that it is
bumped up only if the cmd is successful.
Fixes: f0f6b5e6cf94 ("fix reusing L2 filter")
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_filter.c | 3 +--
drivers/net/bnxt/bnxt_flow.c | 1 -
drivers/net/bnxt/bnxt_hwrm.c | 2 ++
3 files changed, 3 insertions(+), 3 deletions(-)
@@ -39,8 +39,7 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp)
HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK;
memcpy(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN);
memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN);
- /* bump up the reference count of filter */
- filter->l2_ref_cnt++;
+
return filter;
}
@@ -867,7 +867,6 @@
bnxt_free_filter(bp, filter1);
return NULL;
}
- filter1->l2_ref_cnt++;
return filter1;
}
@@ -488,6 +488,8 @@ int bnxt_hwrm_set_l2_filter(struct bnxt *bp,
filter->flow_id = rte_le_to_cpu_32(resp->flow_id);
HWRM_UNLOCK();
+ filter->l2_ref_cnt++;
+
return rc;
}