[v1,4/6] app/test: collect return mbufs in distributor test

Message ID 20200915193449.13310-5-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 Sept. 15, 2020, 7:34 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>
---
 app/test/test_distributor.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Hunt, David Sept. 17, 2020, 12:37 p.m. UTC | #1
Hi Lukasz,

On 15/9/2020 8:34 PM, Lukasz Wojciechowski wrote:
> 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>
> ---
>   app/test/test_distributor.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
> index da13a9a3f..13c6397cc 100644
> --- a/app/test/test_distributor.c
> +++ b/app/test/test_distributor.c
> @@ -599,6 +599,10 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p)
>   	rte_distributor_process(d, NULL, 0);
>   	rte_distributor_flush(d);
>   	rte_eal_mp_wait_lcore();
> +
> +	while (rte_distributor_returned_pkts(d, bufs, RTE_MAX_LCORE))
> +		;
> +
>   	quit = 0;
>   	worker_idx = 0;
>   	zero_idx = 0;


Acked-by: David Hunt <david.hunt@intel.com>
  

Patch

diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index da13a9a3f..13c6397cc 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -599,6 +599,10 @@  quit_workers(struct worker_params *wp, struct rte_mempool *p)
 	rte_distributor_process(d, NULL, 0);
 	rte_distributor_flush(d);
 	rte_eal_mp_wait_lcore();
+
+	while (rte_distributor_returned_pkts(d, bufs, RTE_MAX_LCORE))
+		;
+
 	quit = 0;
 	worker_idx = 0;
 	zero_idx = 0;