[dpdk-dev] [PATCH v1] net/i40e: remove redundant code in free queues.

Zhang, Qi Z qi.z.zhang at intel.com
Mon Dec 10 15:08:29 CET 2018



> -----Original Message-----
> From: Wang, Haiyue
> Sent: Monday, December 10, 2018 8:47 PM
> To: Zhang, Qi Z <qi.z.zhang at intel.com>; Yan, Zhirun <zhirun.yan at intel.com>;
> dev at dpdk.org
> Subject: RE: [PATCH v1] net/i40e: remove redundant code in free queues.
> 
> > -----Original Message-----
> > From: Zhang, Qi Z
> > Sent: Monday, December 10, 2018 20:36
> > To: Yan, Zhirun <zhirun.yan at intel.com>; dev at dpdk.org; Wang, Haiyue
> > <haiyue.wang at intel.com>
> > Subject: RE: [PATCH v1] net/i40e: remove redundant code in free queues.
> >
> >
> >
> > > -----Original Message-----
> > > From: Yan, Zhirun
> > > Sent: Monday, December 10, 2018 9:32 PM
> > > To: dev at dpdk.org; Zhang, Qi Z <qi.z.zhang at intel.com>; Wang, Haiyue
> > > <haiyue.wang at intel.com>
> > > Cc: Yan, Zhirun <zhirun.yan at intel.com>
> > > Subject: [PATCH v1] net/i40e: remove redundant code in free queues.
> > >
> > > Before this patch, there are two functions that will clear RX/TX
> > > queues
> > > number: rte_eth_dev_close() and i40e_dev_free_queues().
> >
> > I agree with what the patch changed, but the commit log is not
> comprehensive.
> > I40e_dev_free_queues is not only in the path of rte_eth_dev_close but
> > also rte_eth_dev_reset.
> > So
> > For rte_eth_dev_close, its redundant because of duplication.
> > For rte_eth_dev_reset its redundant because of not necessary, since
> > following dev_configure is required after dev_reset and it will be updated
> correctly.
> >
> 
> How about this commit message ?
> 
> net/i40e: queue management data set is out of the API scope.
> 
> Function i40e_dev_free_queues is used to free specific i40e queue entries, but
> should not be used to set the upper level queue management data in 'struct
> rte_eth_dev_data', such as ' nb_rx/tx_queues ', which are maintained by
> 'rte_eth_dev_rx/tx_queue_config'.

Ideally it should be what you described , but if you look at exist code in different PMD nb_rx/tx_queues is modified anywhere.
so I'm not very sure if nb_rx/tx_queues should only be modified in rte_ethdev_rx/tx_queue_config is the original design, and I don't have confidence those cleanup is always correct, 
that's why I will prefer an explanation that prove this code clean is correct. I think your comment is much fit for a patch set that do all the cleanup.

> 
> > >
> > > This patch remove redundant code in i40e_dev_free_queues().
> > >
> > > Signed-off-by: Zhirun Yan <zhirun.yan at intel.com>
> > > Signed-off-by: Haiyue Wang <haiyue.wang at intel.com>
> > > ---
> > >  drivers/net/i40e/i40e_rxtx.c | 2 --
> > >  1 file changed, 2 deletions(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > > b/drivers/net/i40e/i40e_rxtx.c index
> > > e1152ff0e..cc953ad58 100644
> > > --- a/drivers/net/i40e/i40e_rxtx.c
> > > +++ b/drivers/net/i40e/i40e_rxtx.c
> > > @@ -2753,7 +2753,6 @@ i40e_dev_free_queues(struct rte_eth_dev *dev)
> > >  		i40e_dev_rx_queue_release(dev->data->rx_queues[i]);
> > >  		dev->data->rx_queues[i] = NULL;
> > >  	}
> > > -	dev->data->nb_rx_queues = 0;
> > >
> > >  	for (i = 0; i < dev->data->nb_tx_queues; i++) {
> > >  		if (!dev->data->tx_queues[i])
> > > @@ -2761,7 +2760,6 @@ i40e_dev_free_queues(struct rte_eth_dev *dev)
> > >  		i40e_dev_tx_queue_release(dev->data->tx_queues[i]);
> > >  		dev->data->tx_queues[i] = NULL;
> > >  	}
> > > -	dev->data->nb_tx_queues = 0;
> > >  }
> > >
> > >  #define I40E_FDIR_NUM_TX_DESC  I40E_MIN_RING_DESC
> > > --
> > > 2.17.1



More information about the dev mailing list