Article View: linux.kernel.netdev
Article #25961Re: [PATCH net-next v2] net/mlx5e: Prefetch the packet a few strides ahead in the linear MPWQE path
From: Joe Damato
Date: Wed, 02 Dec 2026 20:16
Date: Wed, 02 Dec 2026 20:16
67 lines
14954 bytes
14954 bytes
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 <ast@kernel.org> > Signed-off-by: Antonio Quartulli <antonio@mandelbit.com> > --- > 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 <joe@dama.to>
Technical Details
Message-ID:
<axB8nZYhDtPe4Ixk@devvm20253.cco0.facebook.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376047-linux-kernel-netdev=dewy.ruReferences:
<20261104195241.1883539-1-antonio@mandelbit.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376047-linux-kernel-netdev=dewy.ru
From: joe@dama.to (Joe Damato)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2] net/mlx5e: Prefetch the packet a few strides
ahead in the linear MPWQE path
Date: Wed, 2 Dec 2026 12:16:29 -0800
Organization: Usenet Network
Message-ID: <axB8nZYhDtPe4Ixk@devvm20253.cco0.facebook.com>
References: <20261104195241.1883539-1-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
logging-data="2051495"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:b1GK1eUFGBBmRqbWSQULHohAwQY= sha256:xozoUFUDjqHZ/My6kp76KErD6ix9FMxzUJHSRa+zl84=
sha1:Xq7xVqu45trz8c6dwHuwGZeuBks= sha256:4/13XAm3WrIQSJaz4ZKzVFWckW1A4NP5u974v2sQX24=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id E327911771B; Wed, 2 Dec 2026 23:17:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=dama-to.20260707.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 5QVfl56gS35A;
Wed, 2 Dec 2026 23:16:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376047-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=dama.to
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 8004911771A; Wed, 2 Dec 2026 23:16:48 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 93DB3290EB; Wed, 2 Dec 2026 20:16:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796242593;
b=3KjzvGO+pBaOZwe2YRiQoitiNZ6rPsuYEK4ho0u57sClueqItzmkdmiKt4xQcUDm/UBL
4vr79LBwezVGGJRNdaItVEP8HkkEGEM+dkFlBrV1OgNTB1yxjqk3XqAQ1wPiBz7N6FOwE
62RtCMtWwu06mjRp+Pf7utJ7S4kgx4Uek2KgxcWwbQuo4yBhcslezvBVp8E1f3WRk6twy
jjKMKqDU73Iclbx/kA9txGl9vE6uW+ALO9Sk7X99EF143dpqWx95WQnmxLvI9ybcusqVN
WrAacOfsPpMTG1WqAnn+80SQBHTa54RBHmGJP27OBVWo5xUFAbbrM4Q8aTsk78OREnw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796242593;
h=X-Original-To:Received: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:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
Content-Disposition:In-Reply-To;
bh=0dInoXB9sRw319l/BFACsS/7JgK/RAH7inWs3YFAHUY=;
b=IFFd85Xo2pTHRoir+rEQjoNPirtaZRqYy3RO4XImewuDgykS0rK9Mbi1364bWH/K7rVS
eBFVb8Ej1DZCKZflrdqkxF8WD9xdHuCsbugDfULu2ovgC3RPyAlRUXEAhjQqqd/3njltu
mLEf3iXbS3tv3o/83KFnStnFrTFa/7yM/9bbK5SGuBd/DlNtcMCPcDEbu0z+Z3Qniku8U
/bGZbdSOsOP/VKIfQugYNZuaBSq/Q9t04ubnevrssTMACRb/+NhOwejongn56oZWO9olJ
zmCbjj9Fr/SDdcAjqo9ErRaVPRjw4OouAumJpBLK+b5oKSrV4P/dd7duukCBJKrDQmA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
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;
dmarc=none header.from=dama.to;
spf=none smtp.mailfrom=dama.to;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 35B2460A2603;
Wed, 2 Dec 2026 20:16:33 +0000 (UTC)
X-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
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.182
X-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==
X-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==
X-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
X-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 <netdev@vger.kernel.org>; Wed, 2 Dec 2026 20:16:31 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AEE67606A6B8
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to
X-Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2f0213202fdso69631385ad.3
for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 12:16:31 -0800 (PST)
X-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=OAzSiUG8rZlksFOIKK9k1PShW0ycn1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
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)
X-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)
X-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
X-Mail-Followup-To: Joe Damato <joe@dama.to>,
Antonio Quartulli <antonio@mandelbit.com>, 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
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261104195241.1883539-1-antonio@mandelbit.com>