From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Gerhard Engleder <gerhard@engleder-embedded.com>
Cc: <netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
<davem@davemloft.net>, <kuba@kernel.org>, <edumazet@google.com>,
<pabeni@redhat.com>, <bjorn@kernel.org>,
<magnus.karlsson@intel.com>, <jonathan.lemon@gmail.com>
Subject: Re: [PATCH net-next v3 5/6] tsnep: Add XDP socket zero-copy RX support
Date: Thu, 20 Apr 2023 21:46:33 +0200 [thread overview]
Message-ID: <ZEGWmYmsM2uV48Lh@boxer> (raw)
In-Reply-To: <20230418190459.19326-6-gerhard@engleder-embedded.com>
On Tue, Apr 18, 2023 at 09:04:58PM +0200, Gerhard Engleder wrote:
> Add support for XSK zero-copy to RX path. The setup of the XSK pool can
> be done at runtime. If the netdev is running, then the queue must be
> disabled and enabled during reconfiguration. This can be done easily
> with functions introduced in previous commits.
>
> A more important property is that, if the netdev is running, then the
> setup of the XSK pool shall not stop the netdev in case of errors. A
> broken netdev after a failed XSK pool setup is bad behavior. Therefore,
> the allocation and setup of resources during XSK pool setup is done only
> before any queue is disabled. Additionally, freeing and later allocation
> of resources is eliminated in some cases. Page pool entries are kept for
> later use. Two memory models are registered in parallel. As a result,
> the XSK pool setup cannot fail during queue reconfiguration.
>
> In contrast to other drivers, XSK pool setup and XDP BPF program setup
> are separate actions. XSK pool setup can be done without any XDP BPF
> program. The XDP BPF program can be added, removed or changed without
> any reconfiguration of the XSK pool.
>
> Test results with A53 1.2GHz:
>
> xdpsock rxdrop copy mode:
> pps pkts 1.00
> rx 856,054 10,625,775
> Two CPUs with both 100% utilization.
>
> xdpsock rxdrop zero-copy mode:
> pps pkts 1.00
> rx 889,388 4,615,284
> Two CPUs with 100% and 20% utilization.
>
> xdpsock l2fwd copy mode:
> pps pkts 1.00
> rx 248,985 7,315,885
> tx 248,921 7,315,885
> Two CPUs with 100% and 10% utilization.
>
> xdpsock l2fwd zero-copy mode:
> pps pkts 1.00
> rx 254,735 3,039,456
> tx 254,735 3,039,456
> Two CPUs with 100% and 4% utilization.
Thanks for sharing the numbers. This is for 64 byte frames?
>
> Packet rate increases and CPU utilization is reduced in both cases.
> 100% CPU load seems to the base load. This load is consumed by ksoftirqd
> just for dropping the generated packets without xdpsock running.
>
> Using batch API reduced CPU utilization slightly, but measurements are
> not stable enough to provide meaningful numbers.
>
> Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
> ---
> drivers/net/ethernet/engleder/tsnep.h | 13 +-
> drivers/net/ethernet/engleder/tsnep_main.c | 494 ++++++++++++++++++++-
> drivers/net/ethernet/engleder/tsnep_xdp.c | 66 +++
> 3 files changed, 558 insertions(+), 15 deletions(-)
>
(...)
> static const struct net_device_ops tsnep_netdev_ops = {
> .ndo_open = tsnep_netdev_open,
> .ndo_stop = tsnep_netdev_close,
> @@ -1713,6 +2177,7 @@ static const struct net_device_ops tsnep_netdev_ops = {
> .ndo_setup_tc = tsnep_tc_setup,
> .ndo_bpf = tsnep_netdev_bpf,
> .ndo_xdp_xmit = tsnep_netdev_xdp_xmit,
> + .ndo_xsk_wakeup = tsnep_netdev_xsk_wakeup,
> };
>
> static int tsnep_mac_init(struct tsnep_adapter *adapter)
> @@ -1973,7 +2438,8 @@ static int tsnep_probe(struct platform_device *pdev)
>
> netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
> NETDEV_XDP_ACT_NDO_XMIT |
> - NETDEV_XDP_ACT_NDO_XMIT_SG;
> + NETDEV_XDP_ACT_NDO_XMIT_SG |
> + NETDEV_XDP_ACT_XSK_ZEROCOPY;
In theory enabling this feature here before implementing Tx ZC can expose
you to some broken behavior, so just for the sake of completeness, i would
move this to Tx ZC patch.
>
next prev parent reply other threads:[~2023-04-20 19:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 19:04 [PATCH net-next v3 0/6] tsnep: XDP socket zero-copy support Gerhard Engleder
2023-04-18 19:04 ` [PATCH net-next v3 1/6] tsnep: Replace modulo operation with mask Gerhard Engleder
2023-04-20 14:23 ` Maciej Fijalkowski
2023-04-20 15:10 ` Stephen Hemminger
2023-04-20 18:51 ` Gerhard Engleder
2023-04-20 18:40 ` Gerhard Engleder
2023-04-18 19:04 ` [PATCH net-next v3 2/6] tsnep: Rework TX/RX queue initialization Gerhard Engleder
2023-04-18 19:04 ` [PATCH net-next v3 3/6] tsnep: Add functions for queue enable/disable Gerhard Engleder
2023-04-18 19:04 ` [PATCH net-next v3 4/6] tsnep: Move skb receive action to separate function Gerhard Engleder
2023-04-18 19:04 ` [PATCH net-next v3 5/6] tsnep: Add XDP socket zero-copy RX support Gerhard Engleder
2023-04-20 19:46 ` Maciej Fijalkowski [this message]
2023-04-21 18:54 ` Gerhard Engleder
2023-04-18 19:04 ` [PATCH net-next v3 6/6] tsnep: Add XDP socket zero-copy TX support Gerhard Engleder
2023-04-20 20:17 ` Maciej Fijalkowski
2023-04-21 19:02 ` Gerhard Engleder
2023-04-24 12:03 ` Maciej Fijalkowski
2023-04-24 18:40 ` Gerhard Engleder
2023-04-20 20:19 ` [PATCH net-next v3 0/6] tsnep: XDP socket zero-copy support Maciej Fijalkowski
2023-04-21 19:05 ` Gerhard Engleder
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=ZEGWmYmsM2uV48Lh@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gerhard@engleder-embedded.com \
--cc=jonathan.lemon@gmail.com \
--cc=kuba@kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).