net/bnxt: fix bumping of L2 filter reference count
authorSomnath Kotur <somnath.kotur@broadcom.com>
Tue, 28 Jan 2020 07:29:16 +0000 (12:59 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 5 Feb 2020 08:51:20 +0000 (09:51 +0100)
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: 5c1171c97216 ("net/bnxt: refactor filter/flow")
Cc: stable@dpdk.org
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_filter.c
drivers/net/bnxt/bnxt_flow.c
drivers/net/bnxt/bnxt_hwrm.c

index e218433..a1463a0 100644 (file)
@@ -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;
 }
 
index 5564c53..4b3b597 100644 (file)
@@ -867,7 +867,6 @@ bnxt_create_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf,
                bnxt_free_filter(bp, filter1);
                return NULL;
        }
-       filter1->l2_ref_cnt++;
        return filter1;
 }
 
index 3b01339..460cc48 100644 (file)
@@ -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;
 }