]> git.droids-corp.org - dpdk.git/commitdiff
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 7e4f6620ad59e254ab51236abf4505f21ab82c19..1d6cda15080bffb5f352d5557a9f7299a01ccba0 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 e510f9bf37ff95c550b56417512be73cba6320ba..ed6e9249d79d2a6b0af03e4c9c405de7c84552d9 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 3a96b3df54e2ba146f08ae980940801b43d5323f..d8cd069c7782c6759da0709e2b62f81bc899665b 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 3b7fffb79ecb24e74bd3110bc4d292ce59868d97..07a399afdbf62c14e992c16f97dda7fcf4bc69f7 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 154889d1466ac8d6fd7de6b354375ee9356b5795..c10f4b54b4e966d578a6880da6c8bf256539fe9b 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 *);