src/dpdk/lib/librte_distributor/rte_distributor_single.c
static int
process_returns(struct rte_distributor_single *d)
{
	unsigned wkr;
	unsigned flushed = 0;
	unsigned ret_start = d->returns.start,
			ret_count = d->returns.count;

	for (wkr = 0; wkr < d->num_workers; wkr++) {
		uintptr_t oldbuf = 0;
		/* Sync with worker. Acquire bufptr64. */
		const int64_t data = __atomic_load_n(&(d->bufs[wkr].bufptr64),
							__ATOMIC_ACQUIRE);

		if (data & RTE_DISTRIB_GET_BUF) {
			flushed++;
			if (d->backlog[wkr].count)
				/* Sync with worker. Release bufptr64. */
				__atomic_store_n(&(d->bufs[wkr].bufptr64),
					backlog_pop(&d->backlog[wkr]),
					__ATOMIC_RELEASE);
			else {
				/* Sync with worker on GET_BUF flag. */
				__atomic_store_n(&(d->bufs[wkr].bufptr64),
					RTE_DISTRIB_GET_BUF,
					__ATOMIC_RELEASE);
				d->in_flight_tags[wkr] = 0;
				d->in_flight_bitmask &= ~(1UL << wkr);
			}
			oldbuf = data >> RTE_DISTRIB_FLAG_BITS;
		} else if (data & RTE_DISTRIB_RETURN_BUF) {
			handle_worker_shutdown(d, wkr);
			oldbuf = data >> RTE_DISTRIB_FLAG_BITS;
		}

		store_return(oldbuf, d, &ret_start, &ret_count);
	}

	d->returns.start = ret_start;
	d->returns.count = ret_count;

	return flushed;
}
/* this function is called when process() fn is called without any new
 * packets. It goes through all the workers and clears any returned packets
 * to do a partial flush.
 */
this function is called when process() fn is called without any new
packets. It goes through all the workers and clears any returned packets
to do a partial flush.
this function is called when process () fn is called without any new packets . It goes through all the workers and clears any returned packets to do a partial flush .
static int
process_returns(struct rte_distributor_single *d)
{
	unsigned wkr;
	unsigned flushed = 0;
	unsigned ret_start = d->returns.start,
			ret_count = d->returns.count;
	for (wkr = 0; wkr < d->num_workers; wkr++) {
		uintptr_t oldbuf = 0;
		const int64_t data = __atomic_load_n(&(d->bufs[wkr].bufptr64),
							__ATOMIC_ACQUIRE);
		if (data & RTE_DISTRIB_GET_BUF) {
			flushed++;
			if (d->backlog[wkr].count)
				__atomic_store_n(&(d->bufs[wkr].bufptr64),
					backlog_pop(&d->backlog[wkr]),
					__ATOMIC_RELEASE);
			else {
				__atomic_store_n(&(d->bufs[wkr].bufptr64),
					RTE_DISTRIB_GET_BUF,
					__ATOMIC_RELEASE);
				d->in_flight_tags[wkr] = 0;
				d->in_flight_bitmask &= ~(1UL << wkr);
			}
			oldbuf = data >> RTE_DISTRIB_FLAG_BITS;
		} else if (data & RTE_DISTRIB_RETURN_BUF) {
			handle_worker_shutdown(d, wkr);
			oldbuf = data >> RTE_DISTRIB_FLAG_BITS;
		}
		store_return(oldbuf, d, &ret_start, &ret_count);
	}
	d->returns.start = ret_start;
	d->returns.count = ret_count;
	return flushed;
}
static int process_returns ( struct rte_distributor_single * d ) { unsigned wkr ; unsigned flushed = 0 ; unsigned ret_start = d -> returns . start , ret_count = d -> returns . count ; for ( wkr = 0 ; wkr < d -> num_workers ; wkr ++ ) { uintptr_t oldbuf = 0 ; const int64_t data = __atomic_load_n ( & ( d -> bufs [ wkr ] . bufptr64 ) , __ATOMIC_ACQUIRE ) ; if ( data & RTE_DISTRIB_GET_BUF ) { flushed ++ ; if ( d -> backlog [ wkr ] . count ) __atomic_store_n ( & ( d -> bufs [ wkr ] . bufptr64 ) , backlog_pop ( & d -> backlog [ wkr ] ) , __ATOMIC_RELEASE ) ; else { __atomic_store_n ( & ( d -> bufs [ wkr ] . bufptr64 ) , RTE_DISTRIB_GET_BUF , __ATOMIC_RELEASE ) ; d -> in_flight_tags [ wkr ] = 0 ; d -> in_flight_bitmask &= ~ ( 1UL << wkr ) ; } oldbuf = data >> RTE_DISTRIB_FLAG_BITS ; } else if ( data & RTE_DISTRIB_RETURN_BUF ) { handle_worker_shutdown ( d , wkr ) ; oldbuf = data >> RTE_DISTRIB_FLAG_BITS ; } store_return ( oldbuf , d , & ret_start , & ret_count ) ; } d -> returns . start = ret_start ; d -> returns . count = ret_count ; return flushed ; }
this function is called when process() fn is called without any new
 packets.
this function is called when process () fn is called without any new packets .
/* Sync with worker. Acquire bufptr64. */ /* Sync with worker. Release bufptr64. */ /* Sync with worker on GET_BUF flag. */