netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Sven Van Asbroeck <thesven73@gmail.com>, Andrew Lunn <andrew@lunn.ch>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Bryan Whitehead <bryan.whitehead@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	David S Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net v1 2/2] lan743x: boost performance: limit PCIe bandwidth requirement
Date: Tue, 8 Dec 2020 15:36:20 -0800	[thread overview]
Message-ID: <3aed88da-8e82-3bd0-6822-d30f1bd5ec9e@gmail.com> (raw)
In-Reply-To: <CAGngYiVp2u-A07rrkbeJCbqPW9efjkJUNC+NBxrtCM2JtXGpVA@mail.gmail.com>

On 12/8/20 3:02 PM, Sven Van Asbroeck wrote:
> Hi Andrew,
> 
> On Tue, Dec 8, 2020 at 5:51 PM Andrew Lunn <andrew@lunn.ch> wrote:
>>
>>>
>>> So I assumed that it's a PCIe dma bandwidth issue, but I could be wrong -
>>> I didn't do any PCIe bandwidth measurements.
>>
>> Sometimes it is actually cache operations which take all the
>> time. This needs to invalidate the cache, so that when the memory is
>> then accessed, it get fetched from RAM. On SMP machines, cache
>> invalidation can be expensive, due to all the cross CPU operations.
>> I've actually got better performance by building a UP kernel on some
>> low core count ARM CPUs.
>>
>> There are some tricks which can be played. Do you actually need all
>> 9K? Does the descriptor tell you actually how much is used? You can
>> get a nice speed up if you just unmap 64 bytes for a TCP ACK, rather
>> than the full 9K.
>>
> 
> Thank you for the suggestion! The original driver developer chose 9K because
> presumably that's the largest frame size supported by the chip.
> 
> Yes, I believe the chip will tell us via the descriptor how much it has
> written, I would have to double-check. I was already looking for a
> "trick" to transfer only the required number of bytes, but I was led to
> believe that dma_map_single() and dma_unmap_single() always needed to match.
> 
> So:
> dma_map_single(9K) followed by dma_unmap_single(9K) is correct, and
> dma_map_single(9K) followed by dma_unmap_single(1500 bytes) means trouble.
> 
> How can we get around that?

dma_sync_single_for_{cpu,device} is what you would need in order to make
a partial cache line invalidation. You would still need to unmap the
same address+length pair that was used for the initial mapping otherwise
the DMA-API debugging will rightfully complain.
-- 
Florian

  parent reply	other threads:[~2020-12-08 23:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06  3:44 [PATCH net v1 1/2] lan743x: improve performance: fix rx_napi_poll/interrupt ping-pong Sven Van Asbroeck
2020-12-06  3:44 ` [PATCH net v1 2/2] lan743x: boost performance: limit PCIe bandwidth requirement Sven Van Asbroeck
2020-12-08 19:43   ` Jakub Kicinski
2020-12-08 21:54     ` Sven Van Asbroeck
2020-12-08 22:51       ` Andrew Lunn
2020-12-08 23:02         ` Sven Van Asbroeck
2020-12-08 23:07           ` Jakub Kicinski
2020-12-08 23:36           ` Florian Fainelli [this message]
2020-12-09  1:22             ` Andrew Lunn
2020-12-09  3:49             ` Sven Van Asbroeck
2020-12-09 14:09               ` Andrew Lunn
2020-12-17  0:57                 ` Sven Van Asbroeck
2020-12-17  1:01                   ` Florian Fainelli
2020-12-17  3:18                     ` Sven Van Asbroeck
2020-12-08 23:13       ` Jakub Kicinski
2020-12-08 19:50 ` [PATCH net v1 1/2] lan743x: improve performance: fix rx_napi_poll/interrupt ping-pong Jakub Kicinski
2020-12-08 22:23   ` Sven Van Asbroeck
2020-12-08 23:29     ` Jakub Kicinski
2020-12-08 23:50       ` Eric Dumazet
2020-12-09  0:17         ` Sven Van Asbroeck

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=3aed88da-8e82-3bd0-6822-d30f1bd5ec9e@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=bryan.whitehead@microchip.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=thesven73@gmail.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).