[dpdk-dev] [PATCH v2] net/i40e: fix Tx fn selection when using new ethdev offloads

Zhang, Qi Z qi.z.zhang at intel.com
Wed May 2 10:30:44 CEST 2018



> -----Original Message-----
> From: Richardson, Bruce
> Sent: Wednesday, May 2, 2018 4:25 PM
> To: Ananyev, Konstantin <konstantin.ananyev at intel.com>
> Cc: Xing, Beilei <beilei.xing at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>;
> dev at dpdk.org; Yigit, Ferruh <ferruh.yigit at intel.com>
> Subject: Re: [PATCH v2] net/i40e: fix Tx fn selection when using new ethdev
> offloads
> 
> On Tue, May 01, 2018 at 06:52:18PM +0100, Ananyev, Konstantin wrote:
> >
> >
> > > -----Original Message-----
> > > From: Richardson, Bruce
> > > Sent: Tuesday, May 1, 2018 3:14 PM
> > > To: Xing, Beilei <beilei.xing at intel.com>; Zhang, Qi Z
> > > <qi.z.zhang at intel.com>
> > > Cc: dev at dpdk.org; Yigit, Ferruh <ferruh.yigit at intel.com>; Ananyev,
> > > Konstantin <konstantin.ananyev at intel.com>; Richardson, Bruce
> > > <bruce.richardson at intel.com>
> > > Subject: [PATCH v2] net/i40e: fix Tx fn selection when using new
> > > ethdev offloads
> > >
> > > The Tx function selection code in the driver only used the older txq
> > > flags values to check whether the scalar or vector functions should
> > > be used. This caused performance regressions with testpmd io-fwd as
> > > the scalar path rather than the vector one was being used in the
> > > default case. Fix this by changing the code to take account of new
> > > offloads and deleting the defines used for the old ones.
> > >
> > > Fixes: 7497d3e2f777 ("net/i40e: convert to new Tx offloads API")
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> > > ---
> > >  drivers/net/i40e/i40e_rxtx.c | 39
> > > ++++++++++++++++++---------------------
> > >  1 file changed, 18 insertions(+), 21 deletions(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > > b/drivers/net/i40e/i40e_rxtx.c index ec1ce54ca..006f5b846 100644
> > > --- a/drivers/net/i40e/i40e_rxtx.c
> > > +++ b/drivers/net/i40e/i40e_rxtx.c
> > > @@ -40,9 +40,6 @@
> > >  /* Base address of the HW descriptor ring should be 128B aligned. */
> > >  #define I40E_RING_BASE_ALIGN	128
> > >
> > > -#define I40E_SIMPLE_FLAGS ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS
> | \
> > > -					ETH_TXQ_FLAGS_NOOFFLOADS)
> > > -
> > >  #define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP |
> I40E_TX_DESC_CMD_RS)
> > >
> > >  #ifdef RTE_LIBRTE_IEEE1588
> > > @@ -2108,11 +2105,9 @@ i40e_dev_tx_queue_setup_runtime(struct
> rte_eth_dev *dev,
> > >  				 dev->data->nb_tx_queues)) {
> > >  		/**
> > >  		 * If it is the first queue to setup,
> > > -		 * set all flags to default and call
> > > +		 * set all flags and call
> > >  		 * i40e_set_tx_function.
> > >  		 */
> > > -		ad->tx_simple_allowed = true;
> > > -		ad->tx_vec_allowed = true;
> > >  		i40e_set_tx_function_flag(dev, txq);
> > >  		i40e_set_tx_function(dev);
> > >  		return 0;
> > > @@ -2128,9 +2123,8 @@ i40e_dev_tx_queue_setup_runtime(struct
> rte_eth_dev *dev,
> > >  	}
> > >  	/* check simple tx conflict */
> > >  	if (ad->tx_simple_allowed) {
> > > -		if (((txq->txq_flags & I40E_SIMPLE_FLAGS) !=
> > > -		     I40E_SIMPLE_FLAGS) ||
> > > -		    txq->tx_rs_thresh < RTE_PMD_I40E_TX_MAX_BURST) {
> > > +		if (txq->offloads != 0 ||
> > > +				txq->tx_rs_thresh < RTE_PMD_I40E_TX_MAX_BURST)
> {
> > >  			PMD_DRV_LOG(ERR, "No-simple tx is required.");
> > >  			return -EINVAL;
> > >  		}
> > > @@ -3080,18 +3074,21 @@ i40e_set_tx_function_flag(struct
> rte_eth_dev *dev, struct i40e_tx_queue *txq)
> > >  		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> > >
> > >  	/* Use a simple Tx queue (no offloads, no multi segs) if possible */
> > > -	if (((txq->txq_flags & I40E_SIMPLE_FLAGS) == I40E_SIMPLE_FLAGS)
> > > -			&& (txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST)) {
> > > -		if (txq->tx_rs_thresh <= RTE_I40E_TX_MAX_FREE_BUF_SZ) {
> > > -			PMD_INIT_LOG(DEBUG, "Vector tx"
> > > -				     " can be enabled on this txq.");
> > > -
> > > -		} else {
> > > -			ad->tx_vec_allowed = false;
> > > -		}
> > > -	} else {
> > > -		ad->tx_simple_allowed = false;
> > > -	}
> > > +	ad->tx_simple_allowed = (txq->offloads == 0 &&
> > > +			txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST);
> >
> > Actually after another thought - who setup txq->offloads?
> > I did a quick scan, through i40e code and seems no one does.
> > So now it seems not possible to enable TX offloads at all.
> > Konstantin
> >
> > BTW, seems like rxq->offloads are not properly initialised too.
> >
> The offloads value should come from the app, no?

This should be a separate issue, I have submit the fix.

http://dpdk.org/dev/patchwork/patch/39229/

Regard
Qi




More information about the dev mailing list