src/dpdk/lib/librte_eventdev/rte_event_eth_rx_adapter.c
static void
rxa_calc_wrr_sequence(struct rte_event_eth_rx_adapter *rx_adapter,
		struct eth_rx_poll_entry *rx_poll,
		uint32_t *rx_wrr)
{
	uint16_t d;
	uint16_t q;
	unsigned int i;
	int prev = -1;
	int cw = -1;

	/* Initialize variables for calculation of wrr schedule */
	uint16_t max_wrr_pos = 0;
	unsigned int poll_q = 0;
	uint16_t max_wt = 0;
	uint16_t gcd = 0;

	if (rx_poll == NULL)
		return;

	/* Generate array of all queues to poll, the size of this
	 * array is poll_q
	 */
	RTE_ETH_FOREACH_DEV(d) {
		uint16_t nb_rx_queues;
		struct eth_device_info *dev_info =
				&rx_adapter->eth_devices[d];
		nb_rx_queues = dev_info->dev->data->nb_rx_queues;
		if (dev_info->rx_queue == NULL)
			continue;
		if (dev_info->internal_event_port)
			continue;
		dev_info->wrr_len = 0;
		for (q = 0; q < nb_rx_queues; q++) {
			struct eth_rx_queue_info *queue_info =
				&dev_info->rx_queue[q];
			uint16_t wt;

			if (!rxa_polled_queue(dev_info, q))
				continue;
			wt = queue_info->wt;
			rx_poll[poll_q].eth_dev_id = d;
			rx_poll[poll_q].eth_rx_qid = q;
			max_wrr_pos += wt;
			dev_info->wrr_len += wt;
			max_wt = RTE_MAX(max_wt, wt);
			gcd = (gcd) ? rxa_gcd_u16(gcd, wt) : wt;
			poll_q++;
		}
	}

	/* Generate polling sequence based on weights */
	prev = -1;
	cw = -1;
	for (i = 0; i < max_wrr_pos; i++) {
		rx_wrr[i] = rxa_wrr_next(rx_adapter, poll_q, &cw,
				     rx_poll, max_wt, gcd, prev);
		prev = rx_wrr[i];
	}
}
/* Precalculate WRR polling sequence for all queues in rx_adapter */
Precalculate WRR polling sequence for all queues in rx_adapter
Precalculate WRR polling sequence for all queues in rx_adapter
static void
rxa_calc_wrr_sequence(struct rte_event_eth_rx_adapter *rx_adapter,
		struct eth_rx_poll_entry *rx_poll,
		uint32_t *rx_wrr)
{
	uint16_t d;
	uint16_t q;
	unsigned int i;
	int prev = -1;
	int cw = -1;
	uint16_t max_wrr_pos = 0;
	unsigned int poll_q = 0;
	uint16_t max_wt = 0;
	uint16_t gcd = 0;
	if (rx_poll == NULL)
		return;
	RTE_ETH_FOREACH_DEV(d) {
		uint16_t nb_rx_queues;
		struct eth_device_info *dev_info =
				&rx_adapter->eth_devices[d];
		nb_rx_queues = dev_info->dev->data->nb_rx_queues;
		if (dev_info->rx_queue == NULL)
			continue;
		if (dev_info->internal_event_port)
			continue;
		dev_info->wrr_len = 0;
		for (q = 0; q < nb_rx_queues; q++) {
			struct eth_rx_queue_info *queue_info =
				&dev_info->rx_queue[q];
			uint16_t wt;
			if (!rxa_polled_queue(dev_info, q))
				continue;
			wt = queue_info->wt;
			rx_poll[poll_q].eth_dev_id = d;
			rx_poll[poll_q].eth_rx_qid = q;
			max_wrr_pos += wt;
			dev_info->wrr_len += wt;
			max_wt = RTE_MAX(max_wt, wt);
			gcd = (gcd) ? rxa_gcd_u16(gcd, wt) : wt;
			poll_q++;
		}
	}
	prev = -1;
	cw = -1;
	for (i = 0; i < max_wrr_pos; i++) {
		rx_wrr[i] = rxa_wrr_next(rx_adapter, poll_q, &cw,
				     rx_poll, max_wt, gcd, prev);
		prev = rx_wrr[i];
	}
}
static void rxa_calc_wrr_sequence ( struct rte_event_eth_rx_adapter * rx_adapter , struct eth_rx_poll_entry * rx_poll , uint32_t * rx_wrr ) { uint16_t d ; uint16_t q ; unsigned int i ; int prev = -1 ; int cw = -1 ; uint16_t max_wrr_pos = 0 ; unsigned int poll_q = 0 ; uint16_t max_wt = 0 ; uint16_t gcd = 0 ; if ( rx_poll == NULL ) return ; RTE_ETH_FOREACH_DEV ( d ) { uint16_t nb_rx_queues ; struct eth_device_info * dev_info = & rx_adapter -> eth_devices [ d ] ; nb_rx_queues = dev_info -> dev -> data -> nb_rx_queues ; if ( dev_info -> rx_queue == NULL ) continue ; if ( dev_info -> internal_event_port ) continue ; dev_info -> wrr_len = 0 ; for ( q = 0 ; q < nb_rx_queues ; q ++ ) { struct eth_rx_queue_info * queue_info = & dev_info -> rx_queue [ q ] ; uint16_t wt ; if ( ! rxa_polled_queue ( dev_info , q ) ) continue ; wt = queue_info -> wt ; rx_poll [ poll_q ] . eth_dev_id = d ; rx_poll [ poll_q ] . eth_rx_qid = q ; max_wrr_pos += wt ; dev_info -> wrr_len += wt ; max_wt = RTE_MAX ( max_wt , wt ) ; gcd = ( gcd ) ? rxa_gcd_u16 ( gcd , wt ) : wt ; poll_q ++ ; } } prev = -1 ; cw = -1 ; for ( i = 0 ; i < max_wrr_pos ; i ++ ) { rx_wrr [ i ] = rxa_wrr_next ( rx_adapter , poll_q , & cw , rx_poll , max_wt , gcd , prev ) ; prev = rx_wrr [ i ] ; } }
Precalculate WRR polling sequence for all queues in rx_adapter
Precalculate WRR polling sequence for all queues in rx_adapter
/* Initialize variables for calculation of wrr schedule */ /* Generate array of all queues to poll, the size of this
	 * array is poll_q
	 */ /* Generate polling sequence based on weights */