[dpdk-stable] [PATCH v1] net/virtio: fix vectorized Rx queue stuck
David Christensen
drc at linux.vnet.ibm.com
Fri Apr 16 22:58:32 CEST 2021
> When Rx queue worked in vectorized mode and rxd <= 512, under traffic of
> high PPS rate, testpmd often start and receive packets of rxd without
> further growth.
>
> Testpmd started with rxq flush which tried to rx MAX_PKT_BURST(512)
> packets and drop. When Rx burst size >= Rx queue size, all descriptors
> in used queue consumed without rearm, device can't receive more packets.
> The next Rx burst returned at once since no used descriptors found,
> rearm logic was skipped, rx vq kept in starving state.
>
> To avoid rx vq starving, this patch always check the available queue,
> rearm if needed even no used descriptor reported by device.
>
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> Cc: 谢华伟(此时此刻) <huawei.xhw at alibaba-inc.com>
> Fixes: 2d7c37194ee4 ("net/virtio: add NEON based Rx handler")
> Cc: jerin.jacob at caviumnetworks.com
> Fixes: 52b5a707e6ca ("net/virtio: add Altivec Rx")
> Cc: drc at linux.vnet.ibm.com
> Cc: stable at dpdk.org
>
> Signed-off-by: Xueming Li <xuemingl at nvidia.com>
> ---
> drivers/net/virtio/virtio_rxtx_simple_altivec.c | 12 ++++++------
> drivers/net/virtio/virtio_rxtx_simple_neon.c | 12 ++++++------
> drivers/net/virtio/virtio_rxtx_simple_sse.c | 12 ++++++------
> 3 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> index 62e5100a48..7534974ef4 100644
> --- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> +++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
> @@ -85,6 +85,12 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
> if (unlikely(nb_pkts < RTE_VIRTIO_DESC_PER_LOOP))
> return 0;
>
> + if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
> + virtio_rxq_rearm_vec(rxvq);
> + if (unlikely(virtqueue_kick_prepare(vq)))
> + virtqueue_notify(vq);
> + }
> +
> nb_used = virtqueue_nused(vq);
>
> rte_compiler_barrier();
> @@ -102,12 +108,6 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>
> rte_prefetch0(rused);
>
> - if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
> - virtio_rxq_rearm_vec(rxvq);
> - if (unlikely(virtqueue_kick_prepare(vq)))
> - virtqueue_notify(vq);
> - }
> -
> nb_total = nb_used;
> ref_rx_pkts = rx_pkts;
> for (nb_pkts_received = 0;
Reviewed-by: David Christensen <drc at linux.vnet.ibm.com>
More information about the stable
mailing list