src/dpdk/lib/librte_distributor/rte_distributor.c
static unsigned int
release(struct rte_distributor *d, unsigned int wkr)
{
	struct rte_distributor_buffer *buf = &(d->bufs[wkr]);
	unsigned int i;

	handle_returns(d, wkr);
	if (unlikely(!d->active[wkr]))
		return 0;

	/* Sync with worker on GET_BUF flag */
	while (!(__atomic_load_n(&(d->bufs[wkr].bufptr64[0]), __ATOMIC_ACQUIRE)
		& RTE_DISTRIB_GET_BUF)) {
		handle_returns(d, wkr);
		if (unlikely(!d->active[wkr]))
			return 0;
		rte_pause();
	}

	buf->count = 0;

	for (i = 0; i < d->backlog[wkr].count; i++) {
		d->bufs[wkr].bufptr64[i] = d->backlog[wkr].pkts[i] |
				RTE_DISTRIB_GET_BUF | RTE_DISTRIB_VALID_BUF;
		d->in_flight_tags[wkr][i] = d->backlog[wkr].tags[i];
	}
	buf->count = i;
	for ( ; i < RTE_DIST_BURST_SIZE ; i++) {
		buf->bufptr64[i] = RTE_DISTRIB_GET_BUF;
		d->in_flight_tags[wkr][i] = 0;
	}

	d->backlog[wkr].count = 0;

	/* Clear the GET bit.
	 * Sync with worker on GET_BUF flag. Release bufptrs.
	 */
	__atomic_store_n(&(buf->bufptr64[0]),
		buf->bufptr64[0] & ~RTE_DISTRIB_GET_BUF, __ATOMIC_RELEASE);
	return  buf->count;

}
/*
 * This function releases a burst (cache line) to a worker.
 * It is called from the process function when a cacheline is
 * full to make room for more packets for that worker, or when
 * all packets have been assigned to bursts and need to be flushed
 * to the workers.
 * It also needs to wait for any outstanding packets from the worker
 * before sending out new packets.
 */
This function releases a burst (cache line) to a worker.
It is called from the process function when a cacheline is
full to make room for more packets for that worker, or when
all packets have been assigned to bursts and need to be flushed
to the workers.
It also needs to wait for any outstanding packets from the worker
before sending out new packets.
This function releases a burst ( cache line ) to a worker . It is called from the process function when a cacheline is full to make room for more packets for that worker or when all packets have been assigned to bursts and need to be flushed to the workers . It also needs to wait for any outstanding packets from the worker before sending out new packets .
static unsigned int
release(struct rte_distributor *d, unsigned int wkr)
{
	struct rte_distributor_buffer *buf = &(d->bufs[wkr]);
	unsigned int i;
	handle_returns(d, wkr);
	if (unlikely(!d->active[wkr]))
		return 0;
	while (!(__atomic_load_n(&(d->bufs[wkr].bufptr64[0]), __ATOMIC_ACQUIRE)
		& RTE_DISTRIB_GET_BUF)) {
		handle_returns(d, wkr);
		if (unlikely(!d->active[wkr]))
			return 0;
		rte_pause();
	}
	buf->count = 0;
	for (i = 0; i < d->backlog[wkr].count; i++) {
		d->bufs[wkr].bufptr64[i] = d->backlog[wkr].pkts[i] |
				RTE_DISTRIB_GET_BUF | RTE_DISTRIB_VALID_BUF;
		d->in_flight_tags[wkr][i] = d->backlog[wkr].tags[i];
	}
	buf->count = i;
	for ( ; i < RTE_DIST_BURST_SIZE ; i++) {
		buf->bufptr64[i] = RTE_DISTRIB_GET_BUF;
		d->in_flight_tags[wkr][i] = 0;
	}
	d->backlog[wkr].count = 0;
	__atomic_store_n(&(buf->bufptr64[0]),
		buf->bufptr64[0] & ~RTE_DISTRIB_GET_BUF, __ATOMIC_RELEASE);
	return  buf->count;
}
static unsigned int release ( struct rte_distributor * d , unsigned int wkr ) { struct rte_distributor_buffer * buf = & ( d -> bufs [ wkr ] ) ; unsigned int i ; handle_returns ( d , wkr ) ; if ( unlikely ( ! d -> active [ wkr ] ) ) return 0 ; while ( ! ( __atomic_load_n ( & ( d -> bufs [ wkr ] . bufptr64 [ 0 ] ) , __ATOMIC_ACQUIRE ) & RTE_DISTRIB_GET_BUF ) ) { handle_returns ( d , wkr ) ; if ( unlikely ( ! d -> active [ wkr ] ) ) return 0 ; rte_pause ( ) ; } buf -> count = 0 ; for ( i = 0 ; i < d -> backlog [ wkr ] . count ; i ++ ) { d -> bufs [ wkr ] . bufptr64 [ i ] = d -> backlog [ wkr ] . pkts [ i ] | RTE_DISTRIB_GET_BUF | RTE_DISTRIB_VALID_BUF ; d -> in_flight_tags [ wkr ] [ i ] = d -> backlog [ wkr ] . tags [ i ] ; } buf -> count = i ; for ( ; i < RTE_DIST_BURST_SIZE ; i ++ ) { buf -> bufptr64 [ i ] = RTE_DISTRIB_GET_BUF ; d -> in_flight_tags [ wkr ] [ i ] = 0 ; } d -> backlog [ wkr ] . count = 0 ; __atomic_store_n ( & ( buf -> bufptr64 [ 0 ] ) , buf -> bufptr64 [ 0 ] & ~ RTE_DISTRIB_GET_BUF , __ATOMIC_RELEASE ) ; return buf -> count ; }
This function releases a burst (cache line) to a worker.
This function releases a burst ( cache line ) to a worker .
/* Sync with worker on GET_BUF flag */ /* Clear the GET bit.
	 * Sync with worker on GET_BUF flag. Release bufptrs.
	 */