From: David Miller <davem@davemloft.net>
To: mcroce@redhat.com
Cc: netdev@vger.kernel.org, antoine.tenart@bootlin.com,
maxime.chevallier@bootlin.com, mw@semihalf.com,
stefanc@marvell.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] mvpp2: prefetch frame header
Date: Wed, 23 Oct 2019 20:28:13 -0700 (PDT) [thread overview]
Message-ID: <20191023.202813.607713311547571229.davem@davemloft.net> (raw)
In-Reply-To: <20191022141438.22002-1-mcroce@redhat.com>
From: Matteo Croce <mcroce@redhat.com>
Date: Tue, 22 Oct 2019 16:14:38 +0200
> When receiving traffic, eth_type_trans() is high up on the perf top list,
> because it's the first function which access the packet data.
>
> Move the DMA unmap a bit higher, and put a prefetch just after it, so we
> have more time to load the data into the cache.
>
> The packet rate increase is about 13% with a tc drop test: 1620 => 1830 kpps
>
> Signed-off-by: Matteo Croce <mcroce@redhat.com>
> ---
> drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 111b3b8239e1..17378e0d8da1 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -2966,6 +2966,11 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
> continue;
> }
>
> + dma_unmap_single(dev->dev.parent, dma_addr,
> + bm_pool->buf_size, DMA_FROM_DEVICE);
> +
> + prefetch(data);
> +
> if (bm_pool->frag_size > PAGE_SIZE)
> frag_size = 0;
> else
You cannot unmap it this early, because of all of the err_drop_frame
code paths that might be taken next. The DMA mapping must stay in place
in those cases.
next prev parent reply other threads:[~2019-10-24 3:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 14:14 [PATCH net-next] mvpp2: prefetch frame header Matteo Croce
2019-10-24 3:28 ` David Miller [this message]
2019-10-24 17:04 ` Matteo Croce
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=20191023.202813.607713311547571229.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=antoine.tenart@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mcroce@redhat.com \
--cc=mw@semihalf.com \
--cc=netdev@vger.kernel.org \
--cc=stefanc@marvell.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).