From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796242592; b=2mxzAjQIc6vCu/OEBr6NEw5XA9FXJYBr36lhFl6q4QmEFjxfIkG+aVvVBrXxSyziOGjs gmfbbtzoPREcNLVTB3JwZQD9BoNM5v2t5zL6TT1v3pYUJ68Ko58L+AKlH8XCp8cqMpXvw BTvIQmC9ReITQUwKNJnuZvbK/xtFLYuXKiovgnTZx6rrlB6EEfHdWn3z7szk+AT6qcgn3 OlZWE9yraBk/IRr4diy9IEEnZPHmrFySJADA28Z24shZIYFG9K4jVUXvKdAyLGSaGpg69 YeIDi+KgvzE8G74y1/zEQH8WSv5MKpqQ8jDnegwutw0dw1KtOf8/af/Ju2r2224+dJQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796242592; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc: Subject:Message-ID:Mail-Followup-To:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=0dInoXB9sRw319l/BFACsS/7JgK/RAH7inWs3YFAHUY=; b=iWTuQE9aejNYrmVbMFpG/aPk+IY+ftDdj1Qr7VnKbZiMZK/pcZ2cpa5gf8Bo8qD7I0JE Y1IpX+IDNBoqb/MthkDq69Qnp8UPpiJKt0ft2qJC1BjCUklxQ8HNW6Ptrh6gQQqJARqTo ezMstCrmc5cyQMR15A7xCV/v6wRnqazqk25T6Iehrsp8Wwmd5FrMCRjlUC0RfC/Ik5Wym 4/IKb2CiAMop+vncW6MS23Z1mDIyqXWmnAjIcXU4mkFhRKtU5B9Qwnhi1Ovm11t7yeQa0 zzk35s47fMwPFdT7T9N0qy6pgkltnf59qooPoO+lQhcvbh6F8nd9gVoLNc87YQaeEZA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=dama.to; spf=none smtp.mailfrom=dama.to; dkim=pass header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=ilthQ40q; arc=none smtp.remote-ip=209.85.214.182 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEE67606A6B8 for ; Wed, 2 Dec 2026 20:16:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AEE67606A6B8 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=ilthQ40q Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2f0213202fdso69631385ad.3 for ; Wed, 02 Dec 2026 12:16:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20260707.gappssmtp.com; s=20260707; t=1796242590; x=1796847390; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=0dInoXB9sRw319l/BFACsS/7JgK/RAH7inWs3YFAHUY=; b=ilthQ40qctJLv289XKHtjSFwY71BZzAzPnbTHsWO/7TCDuxrADMKEUDd1K+G679Z2p R3xHjqYPXZfJJ2undMH8U5E3AAKe6eNV4nKXn3U2QloPSf010ZRgJO48zCuWXnZCnF1R vK7zhFl52Sl5t5xChMemwJTY7Z+SJ6CSu6Q1UAS5tNQ5EpZfhjpzcWPly4eS1P907adJ yC/reldvosbfHXCclB9fba2eNxtTY8tEF1MTYZ7bGW4QFqcGmanG6pWSl5PUbXKR+4Tw s313f5r2OPVdxI8GmCacoaSSqYLD3/bFnCBYbpCYRBZoCK+peQMxyi71MvH56kXHF0xm noGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796242590; x=1796847390; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=0dInoXB9sRw319l/BFACsS/7JgK/RAH7inWs3YFAHUY=; b=OAzSiUG8rZlksFOIKK9k1PShW0ycn1rO5Rh7QVllieNMf998uu0m0r3kJOmO6o/nJ/ ENDUwiE3sSACGlgBHLNv/LIaB3wMUAt42CGKc7vWMtPOJURZbyhYD4YSjR/D9jsnMWOh LsT1BFdBEnO7XSAAPUw944/howddYqSPBEOjdotMhL6Lt+c63kpfEBRseNeo3pcWtkJx 8QTPoetNLrfhcWrzPsqwrbSTtMaZgDF4CihFL2tMtbBtrrlEHemvyfQsp2tjxIXrejn0 INb6GcDE6Y7yCr1SfVcFU3ftaqvKJsqfW1Xr2UTs9Yo0S/TTuq/i7GsMhhuIzmWVzLWG VDOA== X-Gm-Message-State: APuU4Z8jM+CAVrRMMmkRKLdMvFsK60iv82PT6yA3bTRiyR7sMag/v/2c qREsEOvDVpqtAltPuSpj2OU0vJXlqFBLTUeyaSje12nqK1r9bNtMJOxKU1hePwySaqQ= X-Gm-Gg: AZFdTZcMoJpaUi145WE4uXMGlcJJNuJuFugqLNVK27A/pypEppS0scbc+O/rhfVhoq6 mWpg7ZPyf5i6uJ2IUAXfoyRUm5eNFZlyI1Ao4GTAAz4Q4BWo9fIRiIZteeehpiu3qIO+GHOQ8WY HSKhWkGTdHHE4SIAVXMhrXcuBkQjVOnwhBHqQX3P563GznunHlnGPUE7VJKcSujmtP9KYRtUBPZ CgCE4KhRvCjIeuvoFBBDUr8BUYNYtN7ldVQKAh4bNVQ43/01nFUprk6ymu8n2P8Eolo5ptDm2rS JzxhvfK2cbRNpQ9TRp2zQXPMk29eLJfeO+E0ai0Xs8QEjLyhM1v3PSkYJVGX2QHYMY0a9wHwv10 bP0iRhVxHNnS9ACBuNH8o9alChGsp1h+gZtUgp6MuN0BxOxwaBgyHPDk39Ua/XLY+vv4wND8LK2 IAE3BitrcnW3KHsP2u6YaIc/XrEKX/0TRqguTMpEZPMoB+mSblJ3BB60Vk+IsY7ngrlcDqJXtLX IhFTxVao/IRZ6dfCM0/o7jn69vwb6fwqU6yJ6RFwK+/avCu1YF86B+DWal1RuOq4LfjTqJRoasU 11G+j7FghjCsfvcuymijWTz77j/wUnHaE4/9/9IFHg== X-Received: by 2002:a17:902:f550:b0:2f1:9311:2da6 with SMTP id d9443c01a7336-2f193112eafmr3072325ad.59.1796242590515; Wed, 02 Dec 2026 12:16:30 -0800 (PST) Received: from localhost ([2a03:2880:2ff:74::]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f15beedb08sm40884095ad.51.2026.12.02.12.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 12:16:29 -0800 (PST) Date: Wed, 2 Dec 2026 12:16:29 -0800 From: Joe Damato To: Antonio Quartulli Cc: netdev@vger.kernel.org, saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com, leon@kernel.org, dtatulea@nvidia.com, cratiu@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2] net/mlx5e: Prefetch the packet a few strides ahead in the linear MPWQE path Message-ID: Mail-Followup-To: Joe Damato , Antonio Quartulli , netdev@vger.kernel.org, saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com, leon@kernel.org, dtatulea@nvidia.com, cratiu@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261104195241.1883539-1-antonio@mandelbit.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261104195241.1883539-1-antonio@mandelbit.com> On Wed, Nov 04, 2026 at 08:52:41PM +0100, Antonio Quartulli wrote: > Without cache injection (DDIO/SDCI), the first accesses to a received > packet's headers and skb_shared_info are DRAM misses, and the > net_prefetch() in mlx5e_skb_from_cqe_mpwrq_linear() is too late to hide > them. This caps the packet rate of a queue. > > In the linear striding RQ path a packet takes one stride and the device > fills the strides in order, so the packet MLX5E_RX_PREFETCH_DIST (4) > strides ahead is known without its CQE: prefetch its headers and page, > and the line its skb_shared_info will use if it has the length of the > current packet, as in bulk flows. That line matters when every packet > becomes its own skb: TCP inside an ovpn UDP tunnel gains 34% with it and > 4% without. > > AMD Ryzen 9 9950X, ConnectX-5 Ex, one RX queue on a dedicated CPU, > MTU 1500, mean of 3 runs: > > before after > UDP 512B flood, pktgen 2.52 Mpps 3.44 Mpps +36% > TCP, 1 stream 44.6 Gb/s 48.0 Gb/s +8% > NAPI CPU cycles/packet 1334 715 -46% > XDP_DROP reading the packet, > NAPI CPU cycles/packet 409 280 -32% > XDP_TX, NAPI CPU cycles/packet 829 554 -33% > > With the change, the XDP packet rates were limited by the sender, so > cycles per packet are compared. > > Suggested-by: Alexei Starovoitov > Signed-off-by: Antonio Quartulli > --- > v2: > - prefetch the packet MLX5E_RX_PREFETCH_DIST strides ahead instead of > looking at the CQE ahead (Alexei); no CQE peek, RQ state bit or wq.h > helper any more, and it also works with CQE compression (with it on: > UDP floods +26%, TCP +6%, where v1 did nothing) > - also prefetch the skb_shared_info line, guessing the length from the > current packet: without it, TCP inside a VPN tunnel (one skb per > record) gained 4% instead of 34% > - XDP numbers added; XDP_DROP without touching the packet is unchanged, > and the XDP packet rates were capped by the sender (12-16 Mpps), so > cycles per packet are quoted > v1: https://lore.kernel.org/netdev/20261103235823.536706-1-antonio@openvpn.net/ > > Notes: > - Distance: with v1, 4, 6 and 8 were within 3% of each other. > - The prefetches are issued before the stride ahead is synced for the > CPU; if the device hasn't written it yet (low rate), they are wasted. > - No prefetch for the first 4 strides of a WQE. > - Measured on one system only (Zen 5 desktop, no cache injection, > CX-5 Ex); numbers from DDIO/SDCI systems and CX-6/CX-7 would be > welcome. > > .../net/ethernet/mellanox/mlx5/core/en_rx.c | 32 +++++++++++++++++++ > 1 file changed, 32 insertions(+) FWIW, I was looking at the same issue on a CX7 machine and started to cook up a patch very similar to yours, but ultimately got distracted and didn't think such a change would be palpable to the maintainers :P I probably won't be able to test this for a few days, but I am very happy to this code making its way into the driver! Thanks for doing this. If I get a chance to test before this is applied, I'll reply with CX-7 data. Reviewed-by: Joe Damato