net/softnic: fix memory leak as profile is freed
[dpdk.git] / drivers / net / i40e / i40e_fdir.c
index 2065881..af075fd 100644 (file)
@@ -160,7 +160,7 @@ i40e_fdir_setup(struct i40e_pf *pf)
        int err = I40E_SUCCESS;
        char z_name[RTE_MEMZONE_NAMESIZE];
        const struct rte_memzone *mz = NULL;
-       struct rte_eth_dev *eth_dev = pf->adapter->eth_dev;
+       struct rte_eth_dev *eth_dev = &rte_eth_devices[pf->dev_data->port_id];
        uint16_t i;
 
        if ((pf->flags & I40E_FLAG_FDIR) == 0) {
@@ -284,7 +284,7 @@ i40e_fdir_teardown(struct i40e_pf *pf)
 {
        struct i40e_hw *hw = I40E_PF_TO_HW(pf);
        struct i40e_vsi *vsi;
-       struct rte_eth_dev *dev = pf->adapter->eth_dev;
+       struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 
        vsi = pf->fdir.fdir_vsi;
        if (!vsi)
@@ -1607,13 +1607,13 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
        }
 
        /* Check if the configuration is conflicted */
-       if (pf->fdir.inset_flag[pctype] &&
+       if (pf->fdir.flow_count[pctype] &&
            memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t))) {
                PMD_DRV_LOG(ERR, "Conflict with the first rule's input set.");
                return -EINVAL;
        }
 
-       if (pf->fdir.inset_flag[pctype] &&
+       if (pf->fdir.flow_count[pctype] &&
            !memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
                return 0;
 
@@ -1666,7 +1666,6 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
        I40E_WRITE_FLUSH(hw);
 
        pf->fdir.input_set[pctype] = input_set;
-       pf->fdir.inset_flag[pctype] = 1;
        return 0;
 }
 
@@ -1890,11 +1889,13 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
        }
 
        if (add) {
+               fdir_info->flow_count[pctype]++;
                fdir_info->fdir_actual_cnt++;
                if (fdir_info->fdir_invalprio == 1 &&
                                fdir_info->fdir_guarantee_free_space > 0)
                        fdir_info->fdir_guarantee_free_space--;
        } else {
+               fdir_info->flow_count[pctype]--;
                fdir_info->fdir_actual_cnt--;
                if (fdir_info->fdir_invalprio == 1 &&
                                fdir_info->fdir_guarantee_free_space <