[v7,09/16] test/distributor: collect return mbufs

Message ID 20201010160508.19709-10-l.wojciechow@partner.samsung.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series fix distributor synchronization issues |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Lukasz Wojciechowski Oct. 10, 2020, 4:05 p.m. UTC
  During quit_workers function distributor's main core processes
some packets to wake up pending worker cores so they can quit.
As quit_workers acts also as a cleanup procedure for next test
case it should also collect these packages returned by workers'
handlers, so the cyclic buffer with returned packets
in distributor remains empty.

Fixes: c3eabff124e6 ("distributor: add unit tests")
Cc: bruce.richardson@intel.com
Fixes: c0de0eb82e40 ("distributor: switch over to new API")
Cc: david.hunt@intel.com
Cc: stable@dpdk.org

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: David Hunt <david.hunt@intel.com>
---
 app/test/test_distributor.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Honnappa Nagarahalli Oct. 16, 2020, 4:53 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Lukasz Wojciechowski
> Sent: Saturday, October 10, 2020 11:05 AM
> To: David Hunt <david.hunt@intel.com>; Bruce Richardson
> <bruce.richardson@intel.com>
> Cc: dev@dpdk.org; l.wojciechow@partner.samsung.com; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v7 09/16] test/distributor: collect return mbufs
> 
> During quit_workers function distributor's main core processes some packets
> to wake up pending worker cores so they can quit.
> As quit_workers acts also as a cleanup procedure for next test case it should
> also collect these packages returned by workers'
> handlers, so the cyclic buffer with returned packets in distributor remains
> empty.
> 
> Fixes: c3eabff124e6 ("distributor: add unit tests")
> Cc: bruce.richardson@intel.com
> Fixes: c0de0eb82e40 ("distributor: switch over to new API")
> Cc: david.hunt@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> Acked-by: David Hunt <david.hunt@intel.com>
> ---
>  app/test/test_distributor.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index
> 06e01ff9d..ed03040d1 100644
> --- a/app/test/test_distributor.c
> +++ b/app/test/test_distributor.c
> @@ -590,6 +590,7 @@ quit_workers(struct worker_params *wp, struct
> rte_mempool *p)
>  	const unsigned num_workers = rte_lcore_count() - 1;
>  	unsigned i;
>  	struct rte_mbuf *bufs[RTE_MAX_LCORE];
> +	struct rte_mbuf *returns[RTE_MAX_LCORE];
>  	if (rte_mempool_get_bulk(p, (void *)bufs, num_workers) != 0) {
>  		printf("line %d: Error getting mbufs from pool\n", __LINE__);
>  		return;
> @@ -605,6 +606,10 @@ quit_workers(struct worker_params *wp, struct
> rte_mempool *p)
>  	rte_distributor_flush(d);
>  	rte_eal_mp_wait_lcore();
> 
> +	while (rte_distributor_returned_pkts(d, returns, RTE_MAX_LCORE))
> +		;
> +
> +	rte_distributor_clear_returns(d);
>  	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
> 
>  	quit = 0;
> --
> 2.17.1
  
Honnappa Nagarahalli Oct. 16, 2020, 5:13 a.m. UTC | #2
<snip>
> 
> During quit_workers function distributor's main core processes some packets
> to wake up pending worker cores so they can quit.
> As quit_workers acts also as a cleanup procedure for next test case it should
> also collect these packages returned by workers'
nit                              ^^^^^^^^ packets

> handlers, so the cyclic buffer with returned packets in distributor remains
> empty.
> 
> Fixes: c3eabff124e6 ("distributor: add unit tests")
> Cc: bruce.richardson@intel.com
> Fixes: c0de0eb82e40 ("distributor: switch over to new API")
> Cc: david.hunt@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> Acked-by: David Hunt <david.hunt@intel.com>
> ---
>  app/test/test_distributor.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index
> 06e01ff9d..ed03040d1 100644
> --- a/app/test/test_distributor.c
> +++ b/app/test/test_distributor.c
> @@ -590,6 +590,7 @@ quit_workers(struct worker_params *wp, struct
> rte_mempool *p)
>  	const unsigned num_workers = rte_lcore_count() - 1;
>  	unsigned i;
>  	struct rte_mbuf *bufs[RTE_MAX_LCORE];
> +	struct rte_mbuf *returns[RTE_MAX_LCORE];
>  	if (rte_mempool_get_bulk(p, (void *)bufs, num_workers) != 0) {
>  		printf("line %d: Error getting mbufs from pool\n", __LINE__);
>  		return;
> @@ -605,6 +606,10 @@ quit_workers(struct worker_params *wp, struct
> rte_mempool *p)
>  	rte_distributor_flush(d);
>  	rte_eal_mp_wait_lcore();
> 
> +	while (rte_distributor_returned_pkts(d, returns, RTE_MAX_LCORE))
> +		;
> +
> +	rte_distributor_clear_returns(d);
>  	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
> 
>  	quit = 0;
> --
> 2.17.1
  
Lukasz Wojciechowski Oct. 17, 2020, 3:29 a.m. UTC | #3
Hi Honnappa,

W dniu 16.10.2020 o 07:13, Honnappa Nagarahalli pisze:
> <snip>
>> During quit_workers function distributor's main core processes some packets
>> to wake up pending worker cores so they can quit.
>> As quit_workers acts also as a cleanup procedure for next test case it should
>> also collect these packages returned by workers'
> nit                              ^^^^^^^^ packets
Fixed in v8
>
>> handlers, so the cyclic buffer with returned packets in distributor remains
>> empty.
>>
>> Fixes: c3eabff124e6 ("distributor: add unit tests")
>> Cc: bruce.richardson@intel.com
>> Fixes: c0de0eb82e40 ("distributor: switch over to new API")
>> Cc: david.hunt@intel.com
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
>> Acked-by: David Hunt <david.hunt@intel.com>
>> ---
>>   app/test/test_distributor.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index
>> 06e01ff9d..ed03040d1 100644
>> --- a/app/test/test_distributor.c
>> +++ b/app/test/test_distributor.c
>> @@ -590,6 +590,7 @@ quit_workers(struct worker_params *wp, struct
>> rte_mempool *p)
>>   	const unsigned num_workers = rte_lcore_count() - 1;
>>   	unsigned i;
>>   	struct rte_mbuf *bufs[RTE_MAX_LCORE];
>> +	struct rte_mbuf *returns[RTE_MAX_LCORE];
>>   	if (rte_mempool_get_bulk(p, (void *)bufs, num_workers) != 0) {
>>   		printf("line %d: Error getting mbufs from pool\n", __LINE__);
>>   		return;
>> @@ -605,6 +606,10 @@ quit_workers(struct worker_params *wp, struct
>> rte_mempool *p)
>>   	rte_distributor_flush(d);
>>   	rte_eal_mp_wait_lcore();
>>
>> +	while (rte_distributor_returned_pkts(d, returns, RTE_MAX_LCORE))
>> +		;
>> +
>> +	rte_distributor_clear_returns(d);
>>   	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
>>
>>   	quit = 0;
>> --
>> 2.17.1
  

Patch

diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index 06e01ff9d..ed03040d1 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -590,6 +590,7 @@  quit_workers(struct worker_params *wp, struct rte_mempool *p)
 	const unsigned num_workers = rte_lcore_count() - 1;
 	unsigned i;
 	struct rte_mbuf *bufs[RTE_MAX_LCORE];
+	struct rte_mbuf *returns[RTE_MAX_LCORE];
 	if (rte_mempool_get_bulk(p, (void *)bufs, num_workers) != 0) {
 		printf("line %d: Error getting mbufs from pool\n", __LINE__);
 		return;
@@ -605,6 +606,10 @@  quit_workers(struct worker_params *wp, struct rte_mempool *p)
 	rte_distributor_flush(d);
 	rte_eal_mp_wait_lcore();
 
+	while (rte_distributor_returned_pkts(d, returns, RTE_MAX_LCORE))
+		;
+
+	rte_distributor_clear_returns(d);
 	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
 
 	quit = 0;