distributor: fix crash in flush
Occasionally, the distributor single-packet-at-a-time mode will segfault because it inadvertently calls some burst mode code when flushing packets. This patch ensures that only the v20 (single mode) codepath is used, and returns without falling through to the burst mode code. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Signed-off-by: David Hunt <david.hunt@intel.com> Tested-by: Yong Liu <yong.liu@intel.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
284c908cc5
commit
917f49cfd0
@ -555,7 +555,7 @@ total_outstanding(const struct rte_distributor *d)
|
||||
int
|
||||
rte_distributor_flush_v1705(struct rte_distributor *d)
|
||||
{
|
||||
const unsigned int flushed = total_outstanding(d);
|
||||
unsigned int flushed;
|
||||
unsigned int wkr;
|
||||
|
||||
if (d->alg_type == RTE_DIST_ALG_SINGLE) {
|
||||
@ -563,6 +563,8 @@ rte_distributor_flush_v1705(struct rte_distributor *d)
|
||||
return rte_distributor_flush_v20(d->d_v20);
|
||||
}
|
||||
|
||||
flushed = total_outstanding(d);
|
||||
|
||||
while (total_outstanding(d) > 0)
|
||||
rte_distributor_process(d, NULL, 0);
|
||||
|
||||
@ -590,6 +592,7 @@ rte_distributor_clear_returns_v1705(struct rte_distributor *d)
|
||||
if (d->alg_type == RTE_DIST_ALG_SINGLE) {
|
||||
/* Call the old API */
|
||||
rte_distributor_clear_returns_v20(d->d_v20);
|
||||
return;
|
||||
}
|
||||
|
||||
/* throw away returns, so workers can exit */
|
||||
|
Loading…
x
Reference in New Issue
Block a user