Aggregated Representor Queues
By utilizing the Receive Memory Pool (RMP) object, multiple Rx queues can share the same memory pool and completion queue.
For a high number of VF/SF representors Rx queues scenario, the memory consumption will be reduced significantly. In the meanwhile, the overhead of polling large number queues is reduced, and the CPU utilization is improved. The standard and the aggregate Rx queue modes are both supported, and the application can decide which mode to choose.
By adding “--rxq-share”
to the dpdk-testpmd startup command, the shared Rx queues mode is enabled. The queues in the same switch domain (PF and representors) are shared according to the queue ID.
/*
* When configuring a port, the Rx offloads should contain the
* attribute of “RTE_ETH_RX_OFFLOAD_SHARED_RXQ”
*/
if (rxq_share && (port->dev_info.dev_caps &
RTE_ETH_DEV_CAPA_RXQ_SHARE)) {
port->rx_conf[qid].share_group = 1;
port->rx_conf[qid].share_qid = qid; /* Equal mapping. */
}
/*
* Receive a burst of packets and forward them.
* The Rx port could be either one of the group sharing queues.
*/
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue,
pkts_burst, nb_pkt_per_burst);
/**
* Forward packets from shared Rx queue.
*
* Source port of packets are identified by mbuf->port.
*/
void
forward_shared_rxq(struct fwd_stream *fs, uint16_t nb_rx,
struct rte_mbuf **pkts_burst, packet_fwd_cb fwd)
{
uint16_t i, nb_fs_rx = 1, port;
/* Locate real source fs according to mbuf->port. */
for (i = 0; i < nb_rx; ++i) {
rte_prefetch0(pkts_burst[i + 1]);
port = pkts_burst[i]->port;
if (i + 1 == nb_rx || pkts_burst[i + 1]->port != port) {
/* Forward packets with same source port. */
forward_by_port(fs, port, nb_fs_rx,
&pkts_burst[i + 1 - nb_fs_rx], fwd);
nb_fs_rx = 1;
} else {
nb_fs_rx++;
}
}
}