From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796242592; b=xGnijGPIc9djFMGYfol0V/rnVz7DHuRFbAnZZiDUVg0oI+Fg/yeXMHFubAinIT53LTt1 8K7iM+fs+9G8CzCM10b2IHZx4xsWPldmEyabwZ4Xmz5q9F7K5QWCsC2ceUZjns+QnynZ9 wIHDBkqbk1Lr3QBtASAp+bltkWwi8NRzgHcldBVNxIhdPnbUJG4J5Ci1FutCHOGK9mTKP bXgVP3aBUncIJ5i9Saahx8wYmejiBBiOvPWWrxU9UBYZqwWyxGKpGxD8QxUnl6crdY6Fh pb5YoKpVf2ZUzBkTYkn5GmPfCUHmaaCrA9SABm1H0TnTclX5ixy2vPiQ9dyw+TCx3Rw== 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-Forwarded-Encrypted: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=Bnwym6fFz/7LiQWVbR5FGVnOHT8x9pCbh37la+rK9egxVI36W3XhwI76oEU4TVhVaX76 F5U5rv7X1o+9/l5kHR9RDN394JyVMPEdBsHM6NJ9wlmAjCgVgpN3frXJo5ykM5Iphmkqd 5Y/3UVxR5jUT3DeNY/aRHiYUxEEZN6oXcJEbzemQ7aXxnDiWhSgS1uOVZIgF95MF24oKr 1hrOFPKHh8YdojrRdUu6P2KC+nQ+BqDN7qrikW5CAN5MR9Cv6isHYE70G1wiW3bvhVE+n shpmvWO3jkLjiLlANGjaK8kLsOD/4kKwL9YpyO3FgiY6GSjmO7p0geEB5f5MtDXTQtg== 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.179 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 ACF3060A2621 for ; Wed, 2 Dec 2026 20:16:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ACF3060A2621 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) 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-f179.google.com with SMTP id d9443c01a7336-2f04ad2c46dso80609595ad.2 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=xJeIrw9/hMK5yt4PBdiv8EHet5+V0Ydm6rdFI0MCxd8n+9w6CSNMy5hz9seRRUjwIx t/boMOHewh0cKzbK1QRq0VJBGPgwgbFzVDpjz9maXMEQkEWvP8kW7S8wZZOr2BYS0gxx SuU+3ogKQcbcAQ1o3FO56awVa6R8PJLVXz0Xy05+73wcCjDjhU/sS/kMvecD+mlkdGWF /vmT93lpUMNwPs2xzVVjIkx08QFa1PtfobgBMUkMIPeLb+wIjBCjT15jWr9WpXGtWjIc 5vzQllCKOKYLyp7U70Z62xvgnoD61F+Ac1lJJqY4EkWFU0ogmfGLfFnHHggeXctJf4tR YA1g== X-Forwarded-Encrypted: i=1; AL+hErHUX5PriE7n/h/iqEuuVV7ycst7Mpxh3LMhyqmB808IeNGPJwNjTy3HLQ91dzUT5gQfu45KcJ/oqPgCaWI=@vger.kernel.org X-Gm-Message-State: APuU4Z+wq/BjW9mujd5pU8DXCp7K/Ghqq6iaYcrDsmgErMMyK2qGsFBW 836R65dFnjtUhy1F4U0GAafQIIKN/DRusLv5rpmUbVBDDARhVvQ7S417dVwpzuK59oA= X-Gm-Gg: AZFdTZde8F2kVasW2HCd5suDPE4wpxhWBVl1i/Fj9x0lnsc+siTV8q8xGtAsPGnxezP /hQShny8d4KnUPOe1ZsveyKhsEUw6FrPpKN41hm7rdNVGfYHdxqHFnxWuXenNxhjmDEgPX52EE+ V07dHFYha6nrwFF6PQnhM1VTFTMvdAxsF7BZAF+KemRqniXcbCTZWzzSfieO/ABQ/T8nPaxjmcA Eqte5ThbA55uj1hCzmGTKjoY+4HzlTOLIZmnWDc84x9oY8UyJlQ6OFJ6+lloaZwsrNP2QP/3PH5 gox1H+mOuHE+1wyZZqwX9VF5J7kwBj5fYmfYWgIDhciwcc0uym5mifjsW1908JJ9cak6otgE/ah Iq+bmLFO3D63/g3xgaHBoTGjFmxO4j8UXBe5YDfPcD8HN62o94vGuo8yCL06LtPqS+FdOIYLdai kA8FlgbxgJDusbKWyKgRQyyek9N+Dd3zZMlbqKrdFo/tCD8j8Pg5pw/w5Hs/RIe0m4woITHZ+CB vG/fb5xUeIExraxTjKj+6W5ga9kR9/c4G8aDiMP6FSAGL8FB0EHADlhSCs/51D8IP1PEYthIhW5 m/h0lMncA89WUecdKDAYcBIgTYoBRXiPoQ9LGP3P0Q== 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: linux-kernel@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