bnxt_free_filter(bp, filter1);
return NULL;
}
- filter1->l2_ref_cnt++;
return filter1;
}
vnic_id = act_q->index;
}
+ BNXT_VALID_VNIC_OR_RET(bp, vnic_id);
+
vnic = &bp->vnic_info[vnic_id];
- if (vnic == NULL) {
- rte_flow_error_set(error,
- EINVAL,
- RTE_FLOW_ERROR_TYPE_ACTION,
- act,
- "No matching VNIC found.");
- rc = -rte_errno;
- goto ret;
- }
if (vnic->rx_queue_cnt) {
if (vnic->start_grp_id != act_q->index) {
PMD_DRV_LOG(ERR,
rss = (const struct rte_flow_action_rss *)act->conf;
vnic_id = attr->group;
- if (!vnic_id) {
- PMD_DRV_LOG(ERR, "Group id cannot be 0\n");
- rte_flow_error_set(error,
- EINVAL,
- RTE_FLOW_ERROR_TYPE_ATTR,
- NULL,
- "Group id cannot be 0");
- rc = -rte_errno;
- goto ret;
- }
+ BNXT_VALID_VNIC_OR_RET(bp, vnic_id);
vnic = &bp->vnic_info[vnic_id];
- if (vnic == NULL) {
- rte_flow_error_set(error,
- EINVAL,
- RTE_FLOW_ERROR_TYPE_ACTION,
- act,
- "No matching VNIC for RSS group.");
- rc = -rte_errno;
- goto ret;
- }
- PMD_DRV_LOG(DEBUG, "VNIC found\n");
/* Check if requested RSS config matches RSS config of VNIC
* only if it is not a fresh VNIC configuration.
bool update_flow = false;
struct rte_flow *flow;
int ret = 0;
- uint32_t tun_type;
+ uint32_t tun_type, flow_id;
if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
rte_flow_error_set(error, EINVAL,
filter = bnxt_get_unused_filter(bp);
if (filter == NULL) {
- PMD_DRV_LOG(ERR, "Not enough resources for a new flow.\n");
+ rte_flow_error_set(error, ENOSPC,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Not enough resources for a new flow");
goto free_flow;
}
/* TCAM and EM should be 16-bit only.
* Other modes not supported.
*/
- bp->mark_table[filter->flow_id & BNXT_FLOW_ID_MASK] =
- filter->mark;
+ flow_id = filter->flow_id & BNXT_FLOW_ID_MASK;
+ if (bp->mark_table[flow_id].valid) {
+ PMD_DRV_LOG(ERR,
+ "Entry for Mark id 0x%x occupied"
+ " flow id 0x%x\n",
+ filter->mark, filter->flow_id);
+ goto free_filter;
+ }
+ bp->mark_table[flow_id].valid = true;
+ bp->mark_table[flow_id].mark_id = filter->mark;
}
bnxt_release_flow_lock(bp);
return flow;
struct bnxt_filter_info *filter;
struct bnxt_vnic_info *vnic;
int ret = 0;
+ uint32_t flow_id;
filter = flow->filter;
vnic = flow->vnic;
PMD_DRV_LOG(ERR, "Could not find matching flow\n");
if (filter->valid_flags & BNXT_FLOW_MARK_FLAG) {
- bp->mark_table[filter->flow_id & BNXT_FLOW_ID_MASK] = 0;
+ flow_id = filter->flow_id & BNXT_FLOW_ID_MASK;
+ memset(&bp->mark_table[flow_id], 0,
+ sizeof(bp->mark_table[flow_id]));
filter->flow_id = 0;
}