From: Jasper Tran O'Leary <[email protected]>
When a GQI Rx queue is started, gve_rxq_mbufs_alloc() fills every slot
of the software ring with an mbuf but posts only nb_rx_desc - 1 buffers
to the device. The first refill then begins at the last slot of the
ring and stores a newly allocated mbuf there without freeing the one
the initial fill left in it. One mbuf per queue is lost every time a
queue is started and goes on to receive traffic.
Allocate nb_rx_desc - 1 mbufs up front. This is the number of buffers
posted to the device, and it is what the fallback path taken when the
bulk allocation fails already allocates.
Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
Cc: [email protected]
Signed-off-by: Jasper Tran O'Leary <[email protected]>
Signed-off-by: Joshua Washington <[email protected]>
---
drivers/net/gve/gve_rx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
index 05430621de..f0ad420992 100644
--- a/drivers/net/gve/gve_rx.c
+++ b/drivers/net/gve/gve_rx.c
@@ -487,7 +487,7 @@ gve_rxq_mbufs_alloc(struct gve_rx_queue *rxq)
uint16_t i;
int diag;
- diag = rte_pktmbuf_alloc_bulk(rxq->mpool, &rxq->sw_ring[0],
rxq->nb_rx_desc);
+ diag = rte_pktmbuf_alloc_bulk(rxq->mpool, &rxq->sw_ring[0],
rxq->nb_rx_desc - 1);
if (diag < 0) {
for (i = 0; i < rxq->nb_rx_desc - 1; i++) {
nmb = rte_pktmbuf_alloc(rxq->mpool);
--
2.56.1.915.g69d5ec7298-goog