From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796133483; b=1nRE4buYbJPClurmDk96k1UiYhVtyYWyjokECzXAwvGh/VMM9RA//1ByUiy8TlEo2TMu KDsx2w8qndpGx/0YjvCfMb31tu897LSv3svG8FlUwM+tPkwXV9+hsR0adNC7lyqtyYBrg I5Qtr1PMMNWWLvFTyauDa3+o619NN2t2LaIsL1b6pI2pQ6ClO7re93er2QYkKREXnAZML vC5AX5MfKooo53VxLCs5rVn7JC7NWX3LHn24KtTmnPkkD0ustW9jWdymVL8L8JFV8OlrU cSt3E7Oksjwz3/6oJ4+o0jWtYAl/bh9QEyQMm0SQQ6sESXrv9WK9hyupNw9/yalc5PQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796133483; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=b6BcLorqh6FnBWb/McwVoCB6fyYHx4Px5fdpq17GoKw=; b=lvy8JBbHpb944Koq/rHnl6YgIMFVz3FNXZmQEkcdXojVW/JdLFif94xDYRq/r6mbEERe TlkP4UpH3+skI0Zk+l+9H/23P8PxT/eNwuTJZZ64Xtw699diUuUDs8ZGOIv9HC/ZmXwEk jZuNfnb6/GB5zL8khOuAP8ont0hVTf7CDDoNpGHoEuu3mmaAPy6cqND4Rvnnpipkxzo7X jyP4T7GWqb6joGqNXRAFPCJHkS1Yn+5/APe3bvggDuOG5q+WxHeJ2EPRAKEbyC8IEzFXr Ou9fl+PAdw+uiTyMizFG6ZpuSlNMehsWICHBxlLr8R9iItDLoAKBz8fiP5arwI9cw/g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mpsucTkt; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4351606A31A; Tue, 1 Dec 2026 13:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mpsucTkt Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CCD31F008A0; Tue, 1 Dec 2026 13:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796133482; bh=b6BcLorqh6FnBWb/McwVoCB6fyYHx4Px5fdpq17GoKw=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=mpsucTktj6mO8MvWP6aSCL9FAuQu1cZnYAIIGlHR5BYv/+xtP9Y6SEBbCkyGpoIlr WGEFjaMu9WJT7F8VhdchPxb8PrbBCYEcXQ0kxpfFqMwpv1t2DnvWGaaeAotzCFT+0c +JTBvfD7Cx5AKTlaN2o6kQRRWjiXMPhANc9BlQpnjkRATPUHBvHUIqkQULhSUbjwMO CBYPGZqH3tfjGrTLfiMi9wkfXKvn2VQNza6Yc0Ri5frS0SQNqHLih2RlTzqQ5IPhfX OLx3iHQzwo/CeSD2b5IbjzmwlPpkR3yjPazJWEpH1Lwnl3KDmXOuZkRIQi9ZVzHrz8 EFxamiOnrZ58g== Message-ID: Date: Tue, 1 Dec 2026 14:57:51 +0100 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH bpf-next 00/15] xdp: add SKB core extensions to keep RX metadata until skb creation To: Tianyi Gao , Stanislav Fomichev , Jakub Kicinski Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , John Fastabend , Stanislav Fomichev , Lorenzo Bianconi , Vladimir Vdovin , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Andrew Lunn , Donald Hunter , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , Tony Nguyen , Przemek Kitszel , Maciej Fijalkowski , Alexander Lobakin , Magnus Karlsson , Tushar Vyavahare , Jason Xing , Nikolay Aleksandrov , Madalin Bucur , Ioana Ciornei , Jonathan Corbet , Shuah Khan , Shuah Khan , Randy Dunlap , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Chris J Arges , Jakub Sitnicki , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, intel-wired-lan@lists.osuosl.org, llvm@lists.linux.dev, kernel-team@cloudflare.com References: Content-Language: en-US From: Jesper Dangaard Brouer In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/12/26 00:46, Tianyi Gao wrote: > > On 11/11, Stanislav Fomichev wrote: [...] > >> and slowly creeping more features into xdp making it >> more and more like skb. > > I will leave this to Jesper. > Stanislav, you made the key point yourself: an XDP prog that changes the packet needs a way to correct the HW offload info [3]. After a decap, the outer csum status no longer holds, and today BPF cannot flip it to NONE. The prog also cannot change a stripped VLAN tag. So this is not a new feature. It fixes what Jakub called "a known bug" [6]: after XDP changes the packet, the HW offload info is stale, and XDP has no way to tell the kernel which part it changed. And it is not another metadata area. It is part of the xdp_frame. In Alexei's sketch, struct xdp_rx_meta sits right after struct xdp_frame, in the same cache line, and flag bits in xdp->flags say which fields are valid. It also has the same life as the xdp_frame. The prog writes only the values it changed. In my proposal [7], the driver fills the rest after the prog has run, and only for a frame that survives XDP. So XDP_DROP does not touch it, and XDP_DROP performance stays the same. data_meta and this area have different owners and different readers: - data_meta belongs to the BPF progs. They define the format, and BPF progs (XDP, TC) or AF_XDP read it. - This area belongs to the kernel. The kernel defines the format, and the kernel reads it when it builds the skb. So they do not overlap. The kernel cannot use data_meta, because it does not know the format. A driver-local setter would also work, but only while the driver builds the skb itself, on XDP_PASS. It does not work after XDP_REDIRECT: the descriptor is recycled, and cpumap or veth builds the skb on another CPU. And it cannot support the mini-SKB direction [7], where the driver hands the xdp_frame to core code, and core code builds the skb. Core code cannot read driver-local state. A kernel-known area works in all three cases. On feature creep: yes, the xdp_frame grows towards a mini-SKB. But it only gets the fields that the skb needs from the HW offloads: hash, VLAN and csum, and later maybe RX timestamp and RX queue index. These are core skb fields, and they rarely change. So the list is short, and it stays short. --Jesper [3] https://lore.kernel.org/all/amEojEGsIGkUjIWn@devvm7509.cco0.facebook.com/ [6] https://lore.kernel.org/all/20260722113525.34092660@kernel.org/ [7] https://lore.kernel.org/all/b3e67ffc-5610-4598-9291-ee0264983a4a@kernel.org/