Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
distributor: fix flushing in flight packets
[ upstream commit 91d6b82 ]

rte_distributor_flush() is using total_outstanding()
function to calculate if it should still wait
for processing packets. However in burst mode
only backlog packets were counted.

This patch fixes that issue by counting also in flight
packets. There are also sum fixes to properly keep
count of in flight packets for each worker in bufs[].count.

Fixes: 775003a ("distributor: add new burst-capable library")

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 faf47ff commit 84833d7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/librte_distributor/rte_distributor.c
Expand Up @@ -482,6 +482,7 @@ rte_distributor_process_v1705(struct rte_distributor *d,
/* Sync with worker on GET_BUF flag. */
if (__atomic_load_n(&(d->bufs[wid].bufptr64[0]),
__ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF) {
d->bufs[wid].count = 0;
release(d, wid);
handle_returns(d, wid);
}
Expand All @@ -496,11 +497,6 @@ rte_distributor_process_v1705(struct rte_distributor *d,
uint16_t matches[RTE_DIST_BURST_SIZE];
unsigned int pkts;

/* Sync with worker on GET_BUF flag. */
if (__atomic_load_n(&(d->bufs[wkr].bufptr64[0]),
__ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF)
d->bufs[wkr].count = 0;

if ((num_mbufs - next_idx) < RTE_DIST_BURST_SIZE)
pkts = num_mbufs - next_idx;
else
Expand Down Expand Up @@ -620,8 +616,10 @@ rte_distributor_process_v1705(struct rte_distributor *d,
for (wid = 0 ; wid < d->num_workers; wid++)
/* Sync with worker on GET_BUF flag. */
if ((__atomic_load_n(&(d->bufs[wid].bufptr64[0]),
__ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF))
__ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF)) {
d->bufs[wid].count = 0;
release(d, wid);
}

return num_mbufs;
}
Expand Down Expand Up @@ -672,7 +670,7 @@ total_outstanding(const struct rte_distributor *d)
unsigned int wkr, total_outstanding = 0;

for (wkr = 0; wkr < d->num_workers; wkr++)
total_outstanding += d->backlog[wkr].count;
total_outstanding += d->backlog[wkr].count + d->bufs[wkr].count;

return total_outstanding;
}
Expand Down

0 comments on commit 84833d7

Please sign in to comment.