[dpdk-dev] [PATCH v2 06/13] net/ice: add action number check for swicth

Zhao1, Wei wei.zhao1 at intel.com
Thu Apr 2 10:31:00 CEST 2020


Ok

> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang at intel.com>
> Sent: Thursday, April 2, 2020 4:30 PM
> To: Zhao1, Wei <wei.zhao1 at intel.com>; dev at dpdk.org
> Cc: Peng, Yuan <yuan.peng at intel.com>; Lu, Nannan <nannan.lu at intel.com>;
> Fu, Qi <qi.fu at intel.com>; Wang, Haiyue <haiyue.wang at intel.com>;
> stable at dpdk.org
> Subject: RE: [PATCH v2 06/13] net/ice: add action number check for swicth
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei <wei.zhao1 at intel.com>
> > Sent: Thursday, April 2, 2020 2:46 PM
> > To: dev at dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang at intel.com>; Peng, Yuan
> > <yuan.peng at intel.com>; Lu, Nannan <nannan.lu at intel.com>; Fu, Qi
> > <qi.fu at intel.com>; Wang, Haiyue <haiyue.wang at intel.com>;
> > stable at dpdk.org; Zhao1, Wei <wei.zhao1 at intel.com>
> > Subject: [PATCH v2 06/13] net/ice: add action number check for swicth
> >
> > The action number can only be one for DCF or PF switch filter, not
> > support large action.
> 
> There is no "large action" in rte_flow, maybe just "not support multiple
> actions"?



> 
> >
> > Cc: stable at dpdk.org
> > Fixes: 47d460d63233 ("net/ice: rework switch filter")
> >
> > Signed-off-by: Wei Zhao <wei.zhao1 at intel.com>
> > ---
> >  drivers/net/ice/ice_switch_filter.c | 48
> > +++++++++++++++++++++++++++++
> >  1 file changed, 48 insertions(+)
> >
> > diff --git a/drivers/net/ice/ice_switch_filter.c
> > b/drivers/net/ice/ice_switch_filter.c
> > index d9bdf9637..cc48f22dd 100644
> > --- a/drivers/net/ice/ice_switch_filter.c
> > +++ b/drivers/net/ice/ice_switch_filter.c
> > @@ -1073,6 +1073,46 @@ ice_switch_parse_action(struct ice_pf *pf,
> >  	return -rte_errno;
> >  }
> >
> > +static int
> > +ice_switch_check_action(const struct rte_flow_action *actions,
> > +			    struct rte_flow_error *error)
> > +{
> > +	const struct rte_flow_action *action;
> > +	enum rte_flow_action_type action_type;
> > +	uint16_t actions_num = 0;
> > +
> > +	for (action = actions; action->type !=
> > +				RTE_FLOW_ACTION_TYPE_END; action++) {
> > +		action_type = action->type;
> > +		switch (action_type) {
> > +		case RTE_FLOW_ACTION_TYPE_VF:
> > +		case RTE_FLOW_ACTION_TYPE_RSS:
> > +		case RTE_FLOW_ACTION_TYPE_QUEUE:
> > +		case RTE_FLOW_ACTION_TYPE_DROP:
> > +			actions_num++;
> > +			break;
> > +		case RTE_FLOW_ACTION_TYPE_VOID:
> > +			continue;
> > +		default:
> > +			rte_flow_error_set(error,
> > +					   EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
> > +					   actions,
> > +					   "Invalid action type");
> > +			return -rte_errno;
> > +		}
> > +	}
> > +
> > +	if (actions_num > 1) {
> > +		rte_flow_error_set(error,
> > +				   EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
> > +				   actions,
> > +				   "Invalid action number");
> > +		return -rte_errno;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> >  static int
> >  ice_switch_parse_pattern_action(struct ice_adapter *ad,
> >  		struct ice_pattern_match_item *array, @@ -1158,6 +1198,14 @@
> > ice_switch_parse_pattern_action(struct ice_adapter *ad,
> >  		goto error;
> >  	}
> >
> > +	ret = ice_switch_check_action(actions, error);
> > +	if (ret) {
> > +		rte_flow_error_set(error, EINVAL,
> > +				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> > +				   "Invalid input action number");
> > +		goto error;
> > +	}
> > +
> >  	if (ad->hw.dcf_enabled)
> >  		ret = ice_switch_parse_dcf_action(actions, error, &rule_info);
> >  	else
> > --
> > 2.19.1



More information about the dev mailing list