From: Jesper Dangaard Brouer <hawk@kernel.org>
To: Wei Fang <wei.fang@nxp.com>,
Jesper Dangaard Brouer <jbrouer@redhat.com>,
Jakub Kicinski <kuba@kernel.org>
Cc: "brouer@redhat.com" <brouer@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
Shenwei Wang <shenwei.wang@nxp.com>,
Clark Wang <xiaoning.wang@nxp.com>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH V3 net-next] net: fec: add XDP_TX feature support
Date: Thu, 3 Aug 2023 14:55:37 +0200 [thread overview]
Message-ID: <cc24e860-7d6f-7ec8-49cb-a49cb066f618@kernel.org> (raw)
In-Reply-To: <AM5PR04MB31398ABF941EBDD0907E845B8808A@AM5PR04MB3139.eurprd04.prod.outlook.com>
On 03/08/2023 13.18, Wei Fang wrote:
>> On 03/08/2023 05.58, Wei Fang wrote:
>>>>> } else {
>>>>> - xdp_return_frame(xdpf);
>>>>> + xdp_return_frame_rx_napi(xdpf);
>>>> If you implement Jesper's syncing suggestions, I think you can use
>>>>
>>>> page_pool_put_page(pool, page, 0, true);
>> To Jakub, using 0 here you are trying to bypass the DMA-sync (which is valid
>> as driver knows XDP_TX have already done the sync).
>> The code will still call into DMA-sync calls with zero as size, so wonder if we
>> should detect size zero and skip that call?
>> (I mean is this something page_pool should support.)
>>
[...]
>>
>>
>>>> for XDP_TX here to avoid the DMA sync on page recycle.
>>> I tried Jasper's syncing suggestion and used page_pool_put_page() to
>>> recycle pages, but the results does not seem to improve the
>>> performance of XDP_TX,
>> The optimization will only have effect on those devices which have
>> dev->dma_coherent=false else DMA function [1] (e.g.
>> dma_direct_sync_single_for_device) will skip the sync calls.
>>
>> [1] https://elixir.bootlin.com/linux/v6.5-rc4/source/kernel/dma/direct.h#L63
>>
>> (Cc. Andrew Lunn)
>> Does any of the imx generations have dma-noncoherent memory?
>>
>> And does any of these use the fec NIC driver?
>>
>>> it even degrades the speed.
>>
>> Could be low runs simply be a variation between your test runs?
>>
> Maybe, I just tested once before. So I test several times again, the
> results of the two methods do not seem to be much different so far,
> both about 255000 pkt/s.
>
>> The specific device (imx8mpevk) this was tested on, clearly have
>> dma_coherent=true, or else we would have seen a difference.
>> But the code change should not have any overhead for the
>> dma_coherent=true case, the only extra overhead is the extra empty DMA
>> sync call with size zero (as discussed in top).
>>
> The FEC of i.MX8MP-EVK has dma_coherent=false, and as I mentioned
> above, I did not see an obvious difference in the performance. :(
That is surprising - given the results.
(see below, lack of perf/diff might be caused by Ethernet flow-control).
>
>>> The result of the current modification.
>>> root@imx8mpevk:~# ./xdp2 eth0
>>> proto 17: 260180 pkt/s
>>
>> These results are*significantly* better than reported in patch-1.
>> What happened?!?
>>
> The test environment is slightly different, in patch-1, the FEC port was
> directly connected to the port of another board. But in the latest test,
> the ports of the two boards were connected to a switch, so the ports of
> the two boards are not directly connected.
>
Hmm, I've seen this kind of perf behavior of direct-connected or via
switch before. The mistake I made was, that I had not disabled Ethernet
flow-control. The xdp2 XDP_TX program will swap the mac addresses, and
send the packet back to the packet generator (running pktgen), which
will get overloaded itself and starts sending Ethernet flow-control
pause frames.
Command line to disable:
# ethtool -A eth0 rx off tx off
Can I ask/get you to make sure that Ethernet flow-control is disabled
(on both generator and DUT (to be on safe-side)) and run the test again?
--Jesper
>> e.g.
>> root@imx8mpevk:~# ./xdp2 eth0
>> proto 17: 135817 pkt/s
>> proto 17: 142776 pkt/s
>>
>>> proto 17: 260373 pkt/s
>>> proto 17: 260363 pkt/s
>>> proto 17: 259036 pkt/s
[...]
>>>
>>> After using the sync suggestion, the result shows as follow.
>>> root@imx8mpevk:~# ./xdp2 eth0
>>> proto 17: 255956 pkt/s
>>> proto 17: 255841 pkt/s
>>> proto 17: 255835 pkt/s
next prev parent reply other threads:[~2023-08-03 12:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 6:00 [PATCH V3 net-next] net: fec: add XDP_TX feature support Wei Fang
2023-08-01 15:34 ` Larysa Zaremba
2023-08-01 19:51 ` Jakub Kicinski
2023-08-02 11:46 ` Larysa Zaremba
2023-08-01 21:57 ` Jakub Kicinski
2023-08-02 2:43 ` Wei Fang
2023-08-02 9:26 ` Jesper Dangaard Brouer
2023-08-02 9:59 ` Wei Fang
2023-08-02 12:34 ` Jesper Dangaard Brouer
2023-08-02 12:33 ` Wei Fang
2023-08-04 12:09 ` Jesper Dangaard Brouer
2023-08-07 8:41 ` Wei Fang
2023-08-02 17:47 ` Jakub Kicinski
2023-08-03 3:58 ` Wei Fang
2023-08-03 7:36 ` Jesper Dangaard Brouer
2023-08-03 11:18 ` Wei Fang
2023-08-03 12:55 ` Jesper Dangaard Brouer [this message]
2023-08-04 3:06 ` Wei Fang
2023-08-04 12:36 ` Jesper Dangaard Brouer
2023-08-07 10:30 ` Wei Fang
2023-08-07 13:15 ` Jesper Dangaard Brouer
2023-08-08 5:02 ` Wei Fang
2023-08-08 11:33 ` Jesper Dangaard Brouer
2023-08-09 6:22 ` Wei Fang
2023-08-07 16:33 ` Jakub Kicinski
2023-08-08 0:19 ` Wei Fang
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=cc24e860-7d6f-7ec8-49cb-a49cb066f618@kernel.org \
--to=hawk@kernel.org \
--cc=andrew@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jbrouer@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shenwei.wang@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.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).