[dpdk-dev] [PATCH v2] net/i40e: Fail rte_flow MARK requests if RX func was vectorized

Ergin, Mesut A mesut.a.ergin at intel.com
Mon Jun 3 19:44:44 CEST 2019


> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Saturday, May 25, 2019 4:56 AM
> To: Ergin, Mesut A <mesut.a.ergin at intel.com>; Xing, Beilei
> <beilei.xing at intel.com>
> Cc: dev at dpdk.org
> Subject: RE: [PATCH v2] net/i40e: Fail rte_flow MARK requests if RX func was
> vectorized
> 
> 
> 
> > -----Original Message-----
> > From: Ergin, Mesut A
> > Sent: Saturday, May 25, 2019 6:50 AM
> > To: Xing, Beilei <beilei.xing at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>
> > Cc: dev at dpdk.org; Ergin, Mesut A <mesut.a.ergin at intel.com>
> > Subject: [PATCH v2] net/i40e: Fail rte_flow MARK requests if RX func was
> > vectorized
> >
> > Runtime requests to install an rte_flow with MARK action should fail if a vector
> > RX function was already chosen for the device during configuration time.
> >
> > Currently, i40e rte_flow driver would successfully install the flow with MARK
> > action, even when vector RX functions are in use. However, those vector RX
> > functions will fail to retrieve the MARK data from the device descriptor into
> > the mbuf. The original app installing the flow would never know what went
> > wrong. The change introduced in this patch must be reverted if/when vector
> > RX functions start supporting correct FDIR processing for MARK actions.
> >
> > Signed-off-by: Mesut Ali Ergin <mesut.a.ergin at intel.com>
> 
> You can add below fix line with cc stable
> Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
> Cc: stable at dpdk.org
> 
Done in v3, sending shortly.

> >
> > v2:
> >  - Check added to fail MARK request only if the device was started
> > ---
> >  drivers/net/i40e/i40e_flow.c | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index
> > 3afd779..d1233ed 100644
> > --- a/drivers/net/i40e/i40e_flow.c
> > +++ b/drivers/net/i40e/i40e_flow.c
> > @@ -22,12 +22,20 @@
> >  #include "base/i40e_type.h"
> >  #include "base/i40e_prototype.h"
> >  #include "i40e_ethdev.h"
> > +#include "i40e_rxtx.h"
> >
> >  #define I40E_IPV6_TC_MASK	(0xFF << I40E_FDIR_IPv6_TC_OFFSET)
> >  #define I40E_IPV6_FRAG_HEADER	44
> >  #define I40E_TENANT_ARRAY_NUM	3
> >  #define I40E_TCI_MASK		0xFFFF
> >
> > +/* Check whether device RX function is vectorized  */
> > +#define I40E_RX_IS_VECTOR(dev)	\
> > +	(dev->rx_pkt_burst == i40e_recv_scattered_pkts_vec || \
> > +	 dev->rx_pkt_burst == i40e_recv_pkts_vec || \
> > +	 dev->rx_pkt_burst == i40e_recv_scattered_pkts_vec_avx2 || \
> > +	 dev->rx_pkt_burst == i40e_recv_pkts_vec_avx2)
> 
> Some code style warning in patchwork need to be fixed.
> Maybe we can just wrap the check algorithm into one function (ex.
> i40e_check_mark_support.)
> And in future when the mark offload is ready, we can keep the function name
> and just replace the inside logic? What do you think?
> 
> Regards
> Qi
> 

Fair enough -- done in v3 and sending shortly. Thanks.

Mesut

> > +
> >  static int i40e_flow_validate(struct rte_eth_dev *dev,
> >  			      const struct rte_flow_attr *attr,
> >  			      const struct rte_flow_item pattern[], @@ -3079,6
> > +3087,13 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
> >  		filter->action.behavior = I40E_FDIR_PASSTHRU;
> >  		break;
> >  	case RTE_FLOW_ACTION_TYPE_MARK:
> > +		if (I40E_RX_IS_VECTOR(dev) && dev->data->dev_started) {
> > +			/* MARK not supported w/ Vector RX on a started
> device*/
> > +			rte_flow_error_set(error, EINVAL,
> > +					   RTE_FLOW_ERROR_TYPE_ACTION,
> act,
> > +					   "Action not supported: Vector RX has
> been
> > active.");
> > +			return -rte_errno;
> > +		}
> >  		filter->action.behavior = I40E_FDIR_PASSTHRU;
> >  		mark_spec = act->conf;
> >  		filter->action.report_status = I40E_FDIR_REPORT_ID; @@ -
> 3103,6
> > +3118,13 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
> >  			   "Invalid action.");
> >  			return -rte_errno;
> >  		}
> > +		if (I40E_RX_IS_VECTOR(dev) && dev->data->dev_started) {
> > +			/* MARK not supported w/ Vector RX on a started
> device*/
> > +			rte_flow_error_set(error, EINVAL,
> > +					   RTE_FLOW_ERROR_TYPE_ACTION,
> act,
> > +					   "Action not supported: Vector RX has
> been
> > active.");
> > +			return -rte_errno;
> > +		}
> >  		mark_spec = act->conf;
> >  		filter->action.report_status = I40E_FDIR_REPORT_ID;
> >  		filter->soft_id = mark_spec->id;
> > --
> > 2.7.4



More information about the dev mailing list