DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: <dev@dpdk.org>
Cc: <bruce.richardson@intel.com>, <thomas.monjalon@6wind.com>,
	<pablo.de.lara.guarch@intel.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH v2] app/testpmd: add packet data pointer prefetch in the forwarding loop
Date: Tue, 3 May 2016 19:37:45 +0530	[thread overview]
Message-ID: <1462284465-17663-1-git-send-email-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <1462190377-26865-1-git-send-email-jerin.jacob@caviumnetworks.com>

prefetch the next packet data address in advance in forwarding loop
for performance improvement.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
V2:
Extend the packet data prefetch logic to other similar forwarding modes like
macfwd, macfwd-retry, csumonly, icmpecho as suggested by Pablo
http://dpdk.org/dev/patchwork/patch/12330/
---
 app/test-pmd/csumonly.c     | 3 +++
 app/test-pmd/icmpecho.c     | 3 +++
 app/test-pmd/macfwd-retry.c | 3 +++
 app/test-pmd/macfwd.c       | 3 +++
 app/test-pmd/macswap.c      | 3 +++
 5 files changed, 15 insertions(+)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 7e4f662..1d6cda1 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 e510f9b..ed6e924 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 3a96b3d..d8cd069 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 3b7fffb..07a399a 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 154889d..c10f4b5 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 *);
 
-- 
2.1.0

  parent reply	other threads:[~2016-05-03 14:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-02 11:59 [dpdk-dev] [PATCH] app/testpmd: add packet data prefetch in macswap loop Jerin Jacob
2016-05-02 17:48 ` De Lara Guarch, Pablo
2016-05-03 12:46   ` Jerin Jacob
2016-05-03  9:45 ` Bruce Richardson
2016-05-03  9:48   ` De Lara Guarch, Pablo
2016-05-03 10:16     ` Bruce Richardson
2016-05-03  9:50   ` Ivan Boule
2016-05-03 10:20     ` Bruce Richardson
2016-05-10 12:26       ` Ananyev, Konstantin
2016-05-03 14:07 ` Jerin Jacob [this message]
2016-05-03 14:33   ` [dpdk-dev] [PATCH v2] app/testpmd: add packet data pointer prefetch in the forwarding loop Thomas Monjalon
2016-06-07 11:19   ` De Lara Guarch, Pablo
2016-06-08 15:57     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462284465-17663-1-git-send-email-jerin.jacob@caviumnetworks.com \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=thomas.monjalon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).