goto free_flow;
}
- STAILQ_INSERT_TAIL(&vnic->filter, filter, next);
- PMD_DRV_LOG(DEBUG, "Successfully created flow.\n");
- STAILQ_INSERT_TAIL(&vnic->flow_list, flow, next);
if (filter->valid_flags & BNXT_FLOW_MARK_FLAG) {
PMD_DRV_LOG(DEBUG,
"Mark action: mark id 0x%x, flow id 0x%x\n",
RTE_FLOW_ERROR_TYPE_HANDLE,
NULL,
"Flow with mark id exists");
+ bnxt_clear_one_vnic_filter(bp, filter);
goto free_filter;
}
bp->mark_table[flow_id].valid = true;
bp->mark_table[flow_id].mark_id = filter->mark;
}
+
+ STAILQ_INSERT_TAIL(&vnic->filter, filter, next);
+ STAILQ_INSERT_TAIL(&vnic->flow_list, flow, next);
+
if (BNXT_FLOW_XSTATS_EN(bp))
bp->flow_stat->flow_count++;
bnxt_release_flow_lock(bp);
bnxt_setup_flow_counter(bp);
+ PMD_DRV_LOG(DEBUG, "Successfully created flow.\n");
return flow;
}
filter->flow_id = 0;
}
- if (filter->filter_type == HWRM_CFA_EM_FILTER)
- ret = bnxt_hwrm_clear_em_filter(bp, filter);
- if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER)
- ret = bnxt_hwrm_clear_ntuple_filter(bp, filter);
- ret = bnxt_hwrm_clear_l2_filter(bp, filter);
+ ret = bnxt_clear_one_vnic_filter(bp, filter);
done:
if (!ret) {
return 0;
}
+int
+bnxt_clear_one_vnic_filter(struct bnxt *bp, struct bnxt_filter_info *filter)
+{
+ int rc = 0;
+
+ if (filter->filter_type == HWRM_CFA_EM_FILTER) {
+ rc = bnxt_hwrm_clear_em_filter(bp, filter);
+ if (rc)
+ return rc;
+ } else if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) {
+ rc = bnxt_hwrm_clear_ntuple_filter(bp, filter);
+ if (rc)
+ return rc;
+ }
+
+ rc = bnxt_hwrm_clear_l2_filter(bp, filter);
+ return rc;
+}
+
static int
bnxt_clear_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic)
{
int rc = 0;
STAILQ_FOREACH(filter, &vnic->filter, next) {
- if (filter->filter_type == HWRM_CFA_EM_FILTER)
- rc = bnxt_hwrm_clear_em_filter(bp, filter);
- else if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER)
- rc = bnxt_hwrm_clear_ntuple_filter(bp, filter);
- rc = bnxt_hwrm_clear_l2_filter(bp, filter);
+ rc = bnxt_clear_one_vnic_filter(bp, filter);
STAILQ_REMOVE(&vnic->filter, filter, bnxt_filter_info, next);
bnxt_free_filter(bp, filter);
}
flow = STAILQ_FIRST(&vnic->flow_list);
filter = flow->filter;
PMD_DRV_LOG(DEBUG, "filter type %d\n", filter->filter_type);
- if (filter->filter_type == HWRM_CFA_EM_FILTER)
- rc = bnxt_hwrm_clear_em_filter(bp, filter);
- else if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER)
- rc = bnxt_hwrm_clear_ntuple_filter(bp, filter);
- rc = bnxt_hwrm_clear_l2_filter(bp, filter);
+ rc = bnxt_clear_one_vnic_filter(bp, filter);
STAILQ_REMOVE(&vnic->flow_list, flow, rte_flow, next);
rte_free(flow);