net/cxgbe: fix prefetch for non-coalesced Tx packets
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Fri, 27 Sep 2019 20:30:05 +0000 (02:00 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 13:00:57 +0000 (15:00 +0200)
Move prefetch code out of Tx coalesce path to allow prefetching for
non-coalesced Tx packets, as well.

Fixes: bf89cbedd2d9 ("cxgbe: optimize forwarding performance for 40G")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
drivers/net/cxgbe/cxgbe_ethdev.c
drivers/net/cxgbe/sge.c

index 7d7be69..5d74f8b 100644 (file)
@@ -67,6 +67,7 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        struct sge_eth_txq *txq = (struct sge_eth_txq *)tx_queue;
        uint16_t pkts_sent, pkts_remain;
        uint16_t total_sent = 0;
+       uint16_t idx = 0;
        int ret = 0;
 
        CXGBE_DEBUG_TX(adapter, "%s: txq = %p; tx_pkts = %p; nb_pkts = %d\n",
@@ -75,12 +76,16 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        t4_os_lock(&txq->txq_lock);
        /* free up desc from already completed tx */
        reclaim_completed_tx(&txq->q);
+       rte_prefetch0(rte_pktmbuf_mtod(tx_pkts[0], volatile void *));
        while (total_sent < nb_pkts) {
                pkts_remain = nb_pkts - total_sent;
 
                for (pkts_sent = 0; pkts_sent < pkts_remain; pkts_sent++) {
-                       ret = t4_eth_xmit(txq, tx_pkts[total_sent + pkts_sent],
-                                         nb_pkts);
+                       idx = total_sent + pkts_sent;
+                       if ((idx + 1) < nb_pkts)
+                               rte_prefetch0(rte_pktmbuf_mtod(tx_pkts[idx + 1],
+                                                       volatile void *));
+                       ret = t4_eth_xmit(txq, tx_pkts[idx], nb_pkts);
                        if (ret < 0)
                                break;
                }
index 641be96..bf31902 100644 (file)
@@ -1154,7 +1154,6 @@ out_free:
                                txq->stats.mapping_err++;
                                goto out_free;
                        }
-                       rte_prefetch0((volatile void *)addr);
                        return tx_do_packet_coalesce(txq, mbuf, cflits, adap,
                                                     pi, addr, nb_pkts);
                } else {