DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [v1] net/i40e: fix RX/TX setup when restart port
       [not found] ` <CGME20181128093221eucas1p119d9c4741bb612ae7fc5700c64e8595a@eucas1p1.samsung.com>
@ 2018-11-28  9:32   ` Ilya Maximets
  2018-11-30  6:52     ` Yan, Zhirun
  0 siblings, 1 reply; 3+ messages in thread
From: Ilya Maximets @ 2018-11-28  9:32 UTC (permalink / raw)
  To: Zhirun Yan, dev, qi.z.zhang; +Cc: haiyue.wang

On 28.11.2018 19:51, Zhirun Yan wrote:
> Before this patch, there are two functions that will clear RX/TX queues
> number: rte_eth_dev_close() and i40e_dev_free_queues(). But if also
> i40e_dev_free_queues() clear it, RX/TX queues will not set up correctly
> when restart port.

According to DPDK API device could not be restarted after rte_eth_dev_close:

  "Close a stopped Ethernet device. The device cannot be restarted!"
  http://doc.dpdk.org/api/rte__ethdev_8h.html#a93eeb672a2f9cd18e338aad10c77687c

You should not close the device if you're willing to use it later.
If you really want to close it, you'll need to detach it and attach
back when needed.

> 
> Fixes: 6b4537128394 ("i40e: free queue memory when closing")
> 
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> Signed-off-by: Haiyue Wang <haiyue.wang@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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH v1] net/i40e: fix RX/TX setup when restart port
@ 2018-11-28 16:51 Zhirun Yan
       [not found] ` <CGME20181128093221eucas1p119d9c4741bb612ae7fc5700c64e8595a@eucas1p1.samsung.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Zhirun Yan @ 2018-11-28 16:51 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: haiyue.wang, Zhirun Yan

Before this patch, there are two functions that will clear RX/TX queues
number: rte_eth_dev_close() and i40e_dev_free_queues(). But if also
i40e_dev_free_queues() clear it, RX/TX queues will not set up correctly
when restart port.

Fixes: 6b4537128394 ("i40e: free queue memory when closing")

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
Signed-off-by: Haiyue Wang <haiyue.wang@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [v1] net/i40e: fix RX/TX setup when restart port
  2018-11-28  9:32   ` [dpdk-dev] [v1] " Ilya Maximets
@ 2018-11-30  6:52     ` Yan, Zhirun
  0 siblings, 0 replies; 3+ messages in thread
From: Yan, Zhirun @ 2018-11-30  6:52 UTC (permalink / raw)
  To: 'Ilya Maximets', dev; +Cc: Wang, Haiyue, Zhang, Qi Z

Hi Ilya,

> -----Original Message-----
> From: Ilya Maximets [mailto:i.maximets@samsung.com]
> Sent: Wednesday, November 28, 2018 5:32 PM
> To: Yan, Zhirun <zhirun.yan@intel.com>; dev@dpdk.org; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: Wang, Haiyue <haiyue.wang@intel.com>
> Subject: Re: [v1] net/i40e: fix RX/TX setup when restart port
> 
> On 28.11.2018 19:51, Zhirun Yan wrote:
> > Before this patch, there are two functions that will clear RX/TX
> > queues
> > number: rte_eth_dev_close() and i40e_dev_free_queues(). But if also
> > i40e_dev_free_queues() clear it, RX/TX queues will not set up
> > correctly when restart port.
> 
> According to DPDK API device could not be restarted after rte_eth_dev_close:
> 
>   "Close a stopped Ethernet device. The device cannot be restarted!"
> 
> http://doc.dpdk.org/api/rte__ethdev_8h.html#a93eeb672a2f9cd18e338aad10
> c77687c
> 
> You should not close the device if you're willing to use it later.
> If you really want to close it, you'll need to detach it and attach back when
> needed.
> 

Thanks for your advice. I am agree with you.

By the way, I think the close will do some clean job in i40e. For example, the reset
function will call it in uninit  to release resource.

Rte_eth_dev_rx\tx_queue_config() malloc the dev->data->rx_queues, so
 dev->data->nb_rx_queues = 0 should be in rte layer when rte_eth_dev_close try to
release the queues.

I think I have write a bad commit, I will modify it in V2.


> >
> > Fixes: 6b4537128394 ("i40e: free queue memory when closing")
> >
> > Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> > Signed-off-by: Haiyue Wang <haiyue.wang@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
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-30  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 16:51 [dpdk-dev] [PATCH v1] net/i40e: fix RX/TX setup when restart port Zhirun Yan
     [not found] ` <CGME20181128093221eucas1p119d9c4741bb612ae7fc5700c64e8595a@eucas1p1.samsung.com>
2018-11-28  9:32   ` [dpdk-dev] [v1] " Ilya Maximets
2018-11-30  6:52     ` Yan, Zhirun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).