[dpdk-dev] [PATCH v3 3/4] net/mlx5: add rte_flow rule creation

Nélio Laranjeiro nelio.laranjeiro at 6wind.com
Mon Dec 26 13:20:34 CET 2016


On Fri, Dec 23, 2016 at 12:21:10PM +0000, Ferruh Yigit wrote:
> On 12/21/2016 3:19 PM, Nelio Laranjeiro wrote:
> > Convert Ethernet, IPv4, IPv6, TCP, UDP layers into ibv_flow and create
> > those rules when after validation (i.e. NIC supports the rule).
> > 
> > VLAN is still not supported in this commit.
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
> 
> <...>
> 
> > +static struct rte_flow *
> > +priv_flow_create(struct priv *priv,
> > +		 const struct rte_flow_attr *attr,
> > +		 const struct rte_flow_item items[],
> > +		 const struct rte_flow_action actions[],
> > +		 struct rte_flow_error *error)
> > +{
> > +	struct rte_flow *rte_flow = NULL;
> 
> Unnecessary assignment.
> 
> <...>
> 
> > +	action = (struct action) {
> > +		.queue = -1,
> > +		.drop = 0,
> > +	};
> > +	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; ++actions) {
> > +		if (actions->type == RTE_FLOW_ACTION_TYPE_VOID) {
> > +			continue;
> > +		} else if (actions->type == RTE_FLOW_ACTION_TYPE_QUEUE) {
> > +			action.queue = ((const struct rte_flow_action_queue *)
> > +					actions->conf)->index;
> > +		} else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) {
> > +			action.drop = 1;
> > +		} else {
> > +			rte_flow_error_set(error, ENOTSUP,
> > +					   RTE_FLOW_ERROR_TYPE_ACTION,
> > +					   actions, "unsupported action");
> > +			goto exit;
> > +		}
> > +	}
> > +	if (action.queue >= 0) {
> > +		queue = action.queue;
> > +	} else if (action.drop) {
> > +		queue = MLX5_FLOW_DROP_QUEUE;
> > +	} else {
> 
> Not really so important, but as a note, ACTION_TYPE_VOID hits here. It
> pass from validation, but gives error in creation.
> 
> > +		rte_flow_error_set(error, ENOTSUP,
> > +				   RTE_FLOW_ERROR_TYPE_ACTION,
> > +				   actions,
> > +				   "no possible action found");
> > +		goto exit;
> > +	}
> 
> <...>

Hi Ferruh,

I will send (very soon) a v4 to handle this situation.

Regards,

-- 
Nélio Laranjeiro
6WIND


More information about the dev mailing list