[dpdk-dev] [PATCH] app/testpmd: add packet data prefetch in macswap loop
Bruce Richardson
bruce.richardson at intel.com
Tue May 3 11:45:16 CEST 2016
On Mon, May 02, 2016 at 05:29:37PM +0530, Jerin Jacob wrote:
> prefetch the next packet data address in advance in macswap loop
> for performance improvement.
>
> Signed-off-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
> ---
> app/test-pmd/macswap.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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 *));
At least on IA platforms, there is no issue with prefetching beyond the end of
the array, since it's only a hint to the cpu. If this is true for other platforms,
then I suggest we just drop the conditional and just always prefetch.
/Bruce
> mb = pkts_burst[i];
> eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);
>
> --
> 2.1.0
>
More information about the dev
mailing list