DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
@ 2016-05-16  9:33 Simon Kagstrom
  2016-05-16 10:24 ` Pattan, Reshma
  2016-06-23 15:53 ` Thomas Monjalon
  0 siblings, 2 replies; 9+ messages in thread
From: Simon Kagstrom @ 2016-05-16  9:33 UTC (permalink / raw)
  To: dev, thomas.monjalon, reshma.pattan

This allows releasing RX/TX queue memory.
---
We're using DPDK 16.04 and have a test suite which performs a sequence
of separate tests of the type

   allocate mempool
   rte_eth_dev_configure(port, n_rxq, n_txq, ...)
   setup rx/tx queues
   rte_eth_dev_start(port)

   <perform actual test>

   stop rx/tx queues
   rte_eth_dev_stop(port)

-> rte_eth_dev_configure(port, 0, 0, ...)
   
   check that there are no leaks from the mempool

The crucial point is the marked line above. This is done so that the
rx_queue_release/tx_queue_release callbacks in the PMD is called, so
that mbufs allocated by the driver is released.

Without this patch, this explicitly isn't allowed. Is there a particular
reason why it shouldn't? It was introduced in

  d505ba80a165a9735f3d9d3c6ab68a7bd85f271b

  "ethdev: support unidirectional configuration"

 lib/librte_ether/rte_ethdev.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a31018e..5481d45 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -944,11 +944,6 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
-	if (nb_rx_q == 0 && nb_tx_q == 0) {
-		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d both rx and tx queue cannot be 0\n", port_id);
-		return -EINVAL;
-	}
-
 	if (nb_rx_q > dev_info.max_rx_queues) {
 		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n",
 				port_id, nb_rx_q, dev_info.max_rx_queues);
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
  2016-05-16  9:33 [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues Simon Kagstrom
@ 2016-05-16 10:24 ` Pattan, Reshma
  2016-05-16 10:32   ` Simon Kågström
  2016-06-23 15:53 ` Thomas Monjalon
  1 sibling, 1 reply; 9+ messages in thread
From: Pattan, Reshma @ 2016-05-16 10:24 UTC (permalink / raw)
  To: Simon Kagstrom, dev, thomas.monjalon



> -----Original Message-----
> From: Simon Kagstrom [mailto:simon.kagstrom@netinsight.net]
> Sent: Monday, May 16, 2016 10:34 AM
> To: dev@dpdk.org; thomas.monjalon@6wind.com; Pattan, Reshma
> <reshma.pattan@intel.com>
> Subject: [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX
> queues
> 
> This allows releasing RX/TX queue memory.
> ---
> 
> Without this patch, this explicitly isn't allowed. Is there a particular reason why it
> shouldn't? It was introduced in
> 
>   d505ba80a165a9735f3d9d3c6ab68a7bd85f271b
> 
>   "ethdev: support unidirectional configuration"
> 
>  lib/librte_ether/rte_ethdev.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index
> a31018e..5481d45 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -944,11 +944,6 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
> nb_rx_q, uint16_t nb_tx_q,
>  	 */
>  	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
> 
> -	if (nb_rx_q == 0 && nb_tx_q == 0) {
> -		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d both rx and tx
> queue cannot be 0\n", port_id);
> -		return -EINVAL;
> -	}
> -

This was added to allow devices,  at least with one direction (RX/TX)  supported. As, devices with both directions disabled doesn't make  sense right?

Thanks,
Reshma

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

* Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
  2016-05-16 10:24 ` Pattan, Reshma
@ 2016-05-16 10:32   ` Simon Kågström
  2016-05-16 12:43     ` Pattan, Reshma
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Kågström @ 2016-05-16 10:32 UTC (permalink / raw)
  To: Pattan, Reshma, dev, thomas.monjalon

On 2016-05-16 12:24, Pattan, Reshma wrote:
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index
>> a31018e..5481d45 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -944,11 +944,6 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
>> nb_rx_q, uint16_t nb_tx_q,
>>  	 */
>>  	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
>>
>> -	if (nb_rx_q == 0 && nb_tx_q == 0) {
>> -		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d both rx and tx
>> queue cannot be 0\n", port_id);
>> -		return -EINVAL;
>> -	}
> 
> This was added to allow devices,  at least with one direction (RX/TX)  supported. As, devices with both directions disabled doesn't make  sense right?

Well, not for running them, no. But this is a part of the shutdown
procedure between tests (I should have been more clear I guess).

As far as I can see in the code, rte_eth_dev_configure() is the only
point which actually calls {rx,tx}_queue_release(), so without this
call, we can't get the memory pool full again.


So basically, our test suite looks like

  rte_eth_dev_configure(port, 32, 32); // For example
  <run a test>
  rte_eth_dev_configure(port, 0, 0);
  Check that the mempool is full again

  rte_eth_dev_configure(port, 32, 32);
  <run another test>
  rte_eth_dev_configure(port, 0, 0);
  Check that the mempool is full again
  ...

And without this fix, the mempool check fails since a few of the buffers
are tied up in the RX descriptor ring of the PMD.

// Simon

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

* Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
  2016-05-16 10:32   ` Simon Kågström
@ 2016-05-16 12:43     ` Pattan, Reshma
  2016-05-16 13:16       ` Simon Kågström
  0 siblings, 1 reply; 9+ messages in thread
From: Pattan, Reshma @ 2016-05-16 12:43 UTC (permalink / raw)
  To: Simon Kågström, dev, thomas.monjalon



> -----Original Message-----
> From: Simon Kågström [mailto:simon.kagstrom@netinsight.net]
> Sent: Monday, May 16, 2016 11:33 AM
> To: Pattan, Reshma <reshma.pattan@intel.com>; dev@dpdk.org;
> thomas.monjalon@6wind.com
> Subject: Re: [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero
> RX/TX queues
> 
> On 2016-05-16 12:24, Pattan, Reshma wrote:
> >> diff --git a/lib/librte_ether/rte_ethdev.c
> >> b/lib/librte_ether/rte_ethdev.c index
> >> a31018e..5481d45 100644
> >> --- a/lib/librte_ether/rte_ethdev.c
> >> +++ b/lib/librte_ether/rte_ethdev.c
> >> @@ -944,11 +944,6 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
> >> nb_rx_q, uint16_t nb_tx_q,
> >>  	 */
> >>  	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
> >>
> >> -	if (nb_rx_q == 0 && nb_tx_q == 0) {
> >> -		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d both rx and tx
> >> queue cannot be 0\n", port_id);
> >> -		return -EINVAL;
> >> -	}
> >
> > This was added to allow devices,  at least with one direction (RX/TX)
> supported. As, devices with both directions disabled doesn't make  sense right?
> 
> Well, not for running them, no. But this is a part of the shutdown procedure
> between tests (I should have been more clear I guess).
> 

Yes I understood this. But I am not sure if you can use rte_eth_dev_configure(port, 0, 0) to free the resources.
Can you check if you can use rte_eth_dev_rx_queue_stop/ rte_eth_dev_tx_queue_stop to achieve the same, because they do take care of
releasing mbufs, but doesn't free the queue's sw-ring and queue.

Thanks,
Reshma

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

* Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
  2016-05-16 12:43     ` Pattan, Reshma
@ 2016-05-16 13:16       ` Simon Kågström
  2016-05-20  6:29         ` Simon Kågström
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Kågström @ 2016-05-16 13:16 UTC (permalink / raw)
  To: Pattan, Reshma, dev, thomas.monjalon

On 2016-05-16 14:43, Pattan, Reshma wrote:
>>> This was added to allow devices,  at least with one direction (RX/TX)
>> supported. As, devices with both directions disabled doesn't make  sense right?
>>
>> Well, not for running them, no. But this is a part of the shutdown procedure
>> between tests (I should have been more clear I guess).
> 
> Yes I understood this. But I am not sure if you can use rte_eth_dev_configure(port, 0, 0) to free the resources.
> Can you check if you can use rte_eth_dev_rx_queue_stop/ rte_eth_dev_tx_queue_stop to achieve the same, because they do take care of
> releasing mbufs, but doesn't free the queue's sw-ring and queue.

But isn't that very strange behavior. Aren't the descriptor rings
allocated in rx_queue_setup()? If so, the sequence

  rx_queue_stop(); // Release buffers
  rx_queue_start();

would leave the descriptor ring empty after start, i.e., not able to
receive data.

// Simon

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

* Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
  2016-05-16 13:16       ` Simon Kågström
@ 2016-05-20  6:29         ` Simon Kågström
  2016-05-20  8:26           ` Pattan, Reshma
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Kågström @ 2016-05-20  6:29 UTC (permalink / raw)
  To: Pattan, Reshma, dev, thomas.monjalon

Ping? Any more comments on this?

// Simon

On 2016-05-16 15:16, Simon Kågström wrote:
> On 2016-05-16 14:43, Pattan, Reshma wrote:
>>>> This was added to allow devices,  at least with one direction (RX/TX)
>>> supported. As, devices with both directions disabled doesn't make  sense right?
>>>
>>> Well, not for running them, no. But this is a part of the shutdown procedure
>>> between tests (I should have been more clear I guess).
>>
>> Yes I understood this. But I am not sure if you can use rte_eth_dev_configure(port, 0, 0) to free the resources.
>> Can you check if you can use rte_eth_dev_rx_queue_stop/ rte_eth_dev_tx_queue_stop to achieve the same, because they do take care of
>> releasing mbufs, but doesn't free the queue's sw-ring and queue.
> 
> But isn't that very strange behavior. Aren't the descriptor rings
> allocated in rx_queue_setup()? If so, the sequence
> 
>   rx_queue_stop(); // Release buffers
>   rx_queue_start();
> 
> would leave the descriptor ring empty after start, i.e., not able to
> receive data.
> 
> // Simon
> 

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

* Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
  2016-05-20  6:29         ` Simon Kågström
@ 2016-05-20  8:26           ` Pattan, Reshma
  0 siblings, 0 replies; 9+ messages in thread
From: Pattan, Reshma @ 2016-05-20  8:26 UTC (permalink / raw)
  To: Simon Kågström, dev, thomas.monjalon



> -----Original Message-----
> From: Simon Kågström [mailto:simon.kagstrom@netinsight.net]
> Sent: Friday, May 20, 2016 7:30 AM
> To: Pattan, Reshma <reshma.pattan@intel.com>; dev@dpdk.org;
> thomas.monjalon@6wind.com
> Subject: Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure
> with zero RX/TX queues
> 
> Ping? Any more comments on this?
> 

Hi, I don't have any objections, just let's wait if any other comments from committee. 

Thanks,
Reshma

> // Simon
> 
> On 2016-05-16 15:16, Simon Kågström wrote:
> > On 2016-05-16 14:43, Pattan, Reshma wrote:
> >>>> This was added to allow devices,  at least with one direction
> >>>> (RX/TX)
> >>> supported. As, devices with both directions disabled doesn't make  sense
> right?
> >>>
> >>> Well, not for running them, no. But this is a part of the shutdown
> >>> procedure between tests (I should have been more clear I guess).
> >>
> >> Yes I understood this. But I am not sure if you can use
> rte_eth_dev_configure(port, 0, 0) to free the resources.
> >> Can you check if you can use rte_eth_dev_rx_queue_stop/
> >> rte_eth_dev_tx_queue_stop to achieve the same, because they do take care
> of releasing mbufs, but doesn't free the queue's sw-ring and queue.
> >
> > But isn't that very strange behavior. Aren't the descriptor rings
> > allocated in rx_queue_setup()? If so, the sequence
> >
> >   rx_queue_stop(); // Release buffers
> >   rx_queue_start();
> >
> > would leave the descriptor ring empty after start, i.e., not able to
> > receive data.
> >
> > // Simon
> >

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

* Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
  2016-05-16  9:33 [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues Simon Kagstrom
  2016-05-16 10:24 ` Pattan, Reshma
@ 2016-06-23 15:53 ` Thomas Monjalon
  2018-12-20 23:34   ` Ferruh Yigit
  1 sibling, 1 reply; 9+ messages in thread
From: Thomas Monjalon @ 2016-06-23 15:53 UTC (permalink / raw)
  To: Simon Kagstrom; +Cc: dev, reshma.pattan

2016-05-16 11:33, Simon Kagstrom:
> This allows releasing RX/TX queue memory.
> ---
> We're using DPDK 16.04 and have a test suite which performs a sequence
> of separate tests of the type
> 
>    allocate mempool
>    rte_eth_dev_configure(port, n_rxq, n_txq, ...)
>    setup rx/tx queues
>    rte_eth_dev_start(port)
> 
>    <perform actual test>
> 
>    stop rx/tx queues
>    rte_eth_dev_stop(port)
> 
> -> rte_eth_dev_configure(port, 0, 0, ...)
>    
>    check that there are no leaks from the mempool
> 
> The crucial point is the marked line above. This is done so that the
> rx_queue_release/tx_queue_release callbacks in the PMD is called, so
> that mbufs allocated by the driver is released.

I think you are trying to use a side effect of rte_eth_dev_configure().
After calling rte_eth_dev_stop(), I would say the clean-up should be done
by rte_eth_dev_close().
Why not using close?

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

* Re: [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues
  2016-06-23 15:53 ` Thomas Monjalon
@ 2018-12-20 23:34   ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2018-12-20 23:34 UTC (permalink / raw)
  To: Simon Kagstrom; +Cc: Thomas Monjalon, dpdk-dev

On 6/23/2016 4:53 PM, thomas.monjalon at 6wind.com (Thomas Monjalon) wrote:
> 2016-05-16 11:33, Simon Kagstrom:
>> This allows releasing RX/TX queue memory.
>> ---
>> We're using DPDK 16.04 and have a test suite which performs a sequence
>> of separate tests of the type
>>
>>    allocate mempool
>>    rte_eth_dev_configure(port, n_rxq, n_txq, ...)
>>    setup rx/tx queues
>>    rte_eth_dev_start(port)
>>
>>    <perform actual test>
>>
>>    stop rx/tx queues
>>    rte_eth_dev_stop(port)
>>
>> -> rte_eth_dev_configure(port, 0, 0, ...)
>>    
>>    check that there are no leaks from the mempool
>>
>> The crucial point is the marked line above. This is done so that the
>> rx_queue_release/tx_queue_release callbacks in the PMD is called, so
>> that mbufs allocated by the driver is released.
> 
> I think you are trying to use a side effect of rte_eth_dev_configure().
> After calling rte_eth_dev_stop(), I would say the clean-up should be done
> by rte_eth_dev_close().
> Why not using close?
> 

Hi Simon,

This patch is in patchwork for a long time without response, updating its status
as rejected, if it is still relevant please let us know.

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

end of thread, other threads:[~2018-12-20 23:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-16  9:33 [dpdk-dev] [PATCH / RFC ] ethdev: Allow rte_eth_dev_configure with zero RX/TX queues Simon Kagstrom
2016-05-16 10:24 ` Pattan, Reshma
2016-05-16 10:32   ` Simon Kågström
2016-05-16 12:43     ` Pattan, Reshma
2016-05-16 13:16       ` Simon Kågström
2016-05-20  6:29         ` Simon Kågström
2016-05-20  8:26           ` Pattan, Reshma
2016-06-23 15:53 ` Thomas Monjalon
2018-12-20 23:34   ` Ferruh Yigit

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).