From: Jerin Jacob Date: Tue, 3 May 2016 14:07:45 +0000 (+0530) Subject: app/testpmd: prefetch data in the forwarding loop X-Git-Tag: spdx-start~6794 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7fdb263bbbda1d3df0e80f708ea472f6706d2eda;p=dpdk.git app/testpmd: prefetch data in the forwarding loop prefetch the next packet data address in advance in forwarding loop for performance improvement. Signed-off-by: Jerin Jacob Acked-by: Pablo de Lara --- diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 7e4f6620ad..1d6cda1508 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -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; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index e510f9bf37..ed6e9249d7 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -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); diff --git a/app/test-pmd/macfwd-retry.c b/app/test-pmd/macfwd-retry.c index 3a96b3df54..d8cd069c77 100644 --- a/app/test-pmd/macfwd-retry.c +++ b/app/test-pmd/macfwd-retry.c @@ -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], diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 3b7fffb79e..07a399afdb 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -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], diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 154889d146..c10f4b54b4 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -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 *);