Skip to content

Commit

Permalink
test/distributor: collect return mbufs
Browse files Browse the repository at this point in the history
[ upstream commit 79c5e12 ]

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 packets returned by workers'
handlers, so the cyclic buffer with returned packets
in distributor remains empty.

Fixes: c3eabff ("distributor: add unit tests")
Fixes: c0de0eb ("distributor: switch over to new API")

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: David Hunt <david.hunt@intel.com>
  • Loading branch information
lukaszwojciechowski authored and kevintraynor committed Nov 17, 2020
1 parent 4852ea2 commit 6a938ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test/test_distributor.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 6a938ac

Please sign in to comment.