src/dpdk/drivers/event/sw/sw_evdev_scheduler.c
static uint16_t
sw_schedule_reorder(struct sw_evdev *sw, int qid_start, int qid_end)
{
	/* Perform egress reordering */
	struct rte_event *qe;
	uint32_t pkts_iter = 0;

	for (; qid_start < qid_end; qid_start++) {
		struct sw_qid *qid = &sw->qids[qid_start];
		unsigned int i, num_entries_in_use;

		if (qid->type != RTE_SCHED_TYPE_ORDERED)
			continue;

		num_entries_in_use = rob_ring_free_count(
					qid->reorder_buffer_freelist);

		if (num_entries_in_use < sw->sched_min_burst)
			num_entries_in_use = 0;

		for (i = 0; i < num_entries_in_use; i++) {
			struct reorder_buffer_entry *entry;
			int j;

			entry = &qid->reorder_buffer[qid->reorder_buffer_index];

			if (!entry->ready)
				break;

			for (j = 0; j < entry->num_fragments; j++) {
				uint16_t dest_qid;
				uint16_t dest_iq;

				int idx = entry->fragment_index + j;
				qe = &entry->fragments[idx];

				dest_qid = qe->queue_id;
				dest_iq  = PRIO_TO_IQ(qe->priority);

				if (dest_qid >= sw->qid_count) {
					sw->stats.rx_dropped++;
					continue;
				}

				pkts_iter++;

				struct sw_qid *q = &sw->qids[dest_qid];
				struct sw_iq *iq = &q->iq[dest_iq];

				/* we checked for space above, so enqueue must
				 * succeed
				 */
				iq_enqueue(sw, iq, qe);
				q->iq_pkt_mask |= (1 << (dest_iq));
				q->iq_pkt_count[dest_iq]++;
				q->stats.rx_pkts++;
			}

			entry->ready = (j != entry->num_fragments);
			entry->num_fragments -= j;
			entry->fragment_index += j;

			if (!entry->ready) {
				entry->fragment_index = 0;

				rob_ring_enqueue(
						qid->reorder_buffer_freelist,
						entry);

				qid->reorder_buffer_index++;
				qid->reorder_buffer_index %= qid->window_size;
			}
		}
	}
	return pkts_iter;
}
/* This function will perform re-ordering of packets, and injecting into
 * the appropriate QID IQ. As LB and DIR QIDs are in the same array, but *NOT*
 * contiguous in that array, this function accepts a "range" of QIDs to scan.
 */
This function will perform re-ordering of packets, and injecting into
the appropriate QID IQ. As LB and DIR QIDs are in the same array, but *NOT
contiguous in that array, this function accepts a "range" of QIDs to scan.
This function will perform re - ordering of packets and injecting into the appropriate QID IQ . As LB and DIR QIDs are in the same array but * NOT contiguous in that array this function accepts a " range " of QIDs to scan .
static uint16_t
sw_schedule_reorder(struct sw_evdev *sw, int qid_start, int qid_end)
{
	struct rte_event *qe;
	uint32_t pkts_iter = 0;
	for (; qid_start < qid_end; qid_start++) {
		struct sw_qid *qid = &sw->qids[qid_start];
		unsigned int i, num_entries_in_use;
		if (qid->type != RTE_SCHED_TYPE_ORDERED)
			continue;
		num_entries_in_use = rob_ring_free_count(
					qid->reorder_buffer_freelist);
		if (num_entries_in_use < sw->sched_min_burst)
			num_entries_in_use = 0;
		for (i = 0; i < num_entries_in_use; i++) {
			struct reorder_buffer_entry *entry;
			int j;
			entry = &qid->reorder_buffer[qid->reorder_buffer_index];
			if (!entry->ready)
				break;
			for (j = 0; j < entry->num_fragments; j++) {
				uint16_t dest_qid;
				uint16_t dest_iq;
				int idx = entry->fragment_index + j;
				qe = &entry->fragments[idx];
				dest_qid = qe->queue_id;
				dest_iq  = PRIO_TO_IQ(qe->priority);
				if (dest_qid >= sw->qid_count) {
					sw->stats.rx_dropped++;
					continue;
				}
				pkts_iter++;
				struct sw_qid *q = &sw->qids[dest_qid];
				struct sw_iq *iq = &q->iq[dest_iq];
				iq_enqueue(sw, iq, qe);
				q->iq_pkt_mask |= (1 << (dest_iq));
				q->iq_pkt_count[dest_iq]++;
				q->stats.rx_pkts++;
			}
			entry->ready = (j != entry->num_fragments);
			entry->num_fragments -= j;
			entry->fragment_index += j;
			if (!entry->ready) {
				entry->fragment_index = 0;
				rob_ring_enqueue(
						qid->reorder_buffer_freelist,
						entry);
				qid->reorder_buffer_index++;
				qid->reorder_buffer_index %= qid->window_size;
			}
		}
	}
	return pkts_iter;
}
static uint16_t sw_schedule_reorder ( struct sw_evdev * sw , int qid_start , int qid_end ) { struct rte_event * qe ; uint32_t pkts_iter = 0 ; for ( ; qid_start < qid_end ; qid_start ++ ) { struct sw_qid * qid = & sw -> qids [ qid_start ] ; unsigned int i , num_entries_in_use ; if ( qid -> type != RTE_SCHED_TYPE_ORDERED ) continue ; num_entries_in_use = rob_ring_free_count ( qid -> reorder_buffer_freelist ) ; if ( num_entries_in_use < sw -> sched_min_burst ) num_entries_in_use = 0 ; for ( i = 0 ; i < num_entries_in_use ; i ++ ) { struct reorder_buffer_entry * entry ; int j ; entry = & qid -> reorder_buffer [ qid -> reorder_buffer_index ] ; if ( ! entry -> ready ) break ; for ( j = 0 ; j < entry -> num_fragments ; j ++ ) { uint16_t dest_qid ; uint16_t dest_iq ; int idx = entry -> fragment_index + j ; qe = & entry -> fragments [ idx ] ; dest_qid = qe -> queue_id ; dest_iq = PRIO_TO_IQ ( qe -> priority ) ; if ( dest_qid >= sw -> qid_count ) { sw -> stats . rx_dropped ++ ; continue ; } pkts_iter ++ ; struct sw_qid * q = & sw -> qids [ dest_qid ] ; struct sw_iq * iq = & q -> iq [ dest_iq ] ; iq_enqueue ( sw , iq , qe ) ; q -> iq_pkt_mask |= ( 1 << ( dest_iq ) ) ; q -> iq_pkt_count [ dest_iq ] ++ ; q -> stats . rx_pkts ++ ; } entry -> ready = ( j != entry -> num_fragments ) ; entry -> num_fragments -= j ; entry -> fragment_index += j ; if ( ! entry -> ready ) { entry -> fragment_index = 0 ; rob_ring_enqueue ( qid -> reorder_buffer_freelist , entry ) ; qid -> reorder_buffer_index ++ ; qid -> reorder_buffer_index %= qid -> window_size ; } } } return pkts_iter ; }
This function will perform re-ordering of packets, and injecting into
 the appropriate QID IQ.
This function will perform re - ordering of packets and injecting into the appropriate QID IQ .
/* Perform egress reordering */ /* we checked for space above, so enqueue must
				 * succeed
				 */