app/testpmd: prefetch data in the forwarding loop
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Tue, 3 May 2016 14:07:45 +0000 (19:37 +0530)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 8 Jun 2016 20:38:53 +0000 (22:38 +0200)
prefetch the next packet data address in advance in forwarding loop
for performance improvement.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
app/test-pmd/csumonly.c
app/test-pmd/icmpecho.c
app/test-pmd/macfwd-retry.c
app/test-pmd/macfwd.c
app/test-pmd/macswap.c

index 7e4f662..1d6cda1 100644 (file)
@@ -676,6 +676,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
        info.tso_segsz = txp->tso_segsz;
 
        for (i = 0; i < nb_rx; i++) {
+               if (likely(i < nb_rx - 1))
+                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1],
+                                                      void *));
 
                ol_flags = 0;
                info.is_tunnel = 0;
index e510f9b..ed6e924 100644 (file)
@@ -346,6 +346,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
        fs->rx_packets += nb_rx;
        nb_replies = 0;
        for (i = 0; i < nb_rx; i++) {
+               if (likely(i < nb_rx - 1))
+                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1],
+                                                      void *));
                pkt = pkts_burst[i];
                eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
                eth_type = RTE_BE_TO_CPU_16(eth_h->ether_type);
index 3a96b3d..d8cd069 100644 (file)
@@ -117,6 +117,9 @@ pkt_burst_mac_retry_forward(struct fwd_stream *fs)
 #endif
        fs->rx_packets += nb_rx;
        for (i = 0; i < nb_rx; i++) {
+               if (likely(i < nb_rx - 1))
+                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1],
+                                                      void *));
                mb = pkts_burst[i];
                eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);
                ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
index 3b7fffb..07a399a 100644 (file)
@@ -113,6 +113,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
        if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
                ol_flags |= PKT_TX_QINQ_PKT;
        for (i = 0; i < nb_rx; i++) {
+               if (likely(i < nb_rx - 1))
+                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1],
+                                                      void *));
                mb = pkts_burst[i];
                eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);
                ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
index 154889d..c10f4b5 100644 (file)
@@ -113,6 +113,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
        if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
                ol_flags |= PKT_TX_QINQ_PKT;
        for (i = 0; i < nb_rx; i++) {
+               if (likely(i < nb_rx - 1))
+                       rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1],
+                                                      void *));
                mb = pkts_burst[i];
                eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);