i40e: prefetch next mbuf in Rx init loop
authorDamjan Marion <damarion@cisco.com>
Wed, 10 Jun 2015 22:19:25 +0000 (00:19 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 10 Jul 2015 17:17:17 +0000 (19:17 +0200)
This patch improves performance of Rx with i40e devices.

Signed-off-by: Damjan Marion <damarion@cisco.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
[Thomas: apply Helin's comments]

drivers/net/i40e/i40e_rxtx.c

index 6daf1dc..21b8edd 100644 (file)
@@ -813,6 +813,10 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)
 
        rxdp = &rxq->rx_ring[alloc_idx];
        for (i = 0; i < rxq->rx_free_thresh; i++) {
+               if (likely(i < (rxq->rx_free_thresh - 1)))
+                       /* Prefetch next mbuf */
+                       rte_prefetch0(rxep[i + 1].mbuf);
+
                mb = rxep[i].mbuf;
                rte_mbuf_refcnt_set(mb, 1);
                mb->next = NULL;