Article View: linux.kernel.netdev
Article #20498Re: [PATCH net-next v12 1/4] net: xdp: add __xdp_build_skb_from_buff() helper
From: Nicolai Buchwitz
Date: Sun, 22 Nov 2026 19:21
Date: Sun, 22 Nov 2026 19:21
28 lines
10463 bytes
10463 bytes
On 21.11.2026 18:28, Lorenzo Bianconi wrote: > xdp_build_skb_from_buff() always calls eth_type_trans() on the skb it > builds, which pulls the Ethernet header and advances skb->data. Drivers > that still need to process the L2 header before protocol parsing > therefore cannot use the helper. > > stmmac is such a driver: its software VLAN path (stmmac_rx_vlan()) > reads > the VLAN tag at skb->data and shifts the MAC addresses over it, so it > has > to run before eth_type_trans(). > > Split the implementation into __xdp_build_skb_from_buff(), which builds > the skb (including the recycle mark, the Rx queue index and the frags > info) but leaves skb->dev, skb->protocol, skb->pkt_type and the mac > header unset, so the caller must initialize them, usually by calling > eth_type_trans(). Make xdp_build_skb_from_buff() a static inline > wrapper > that still calls eth_type_trans() as before, preserving the behavior of > existing in-tree users. A follow-up patch will let stmmac use it. > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com> > --- > [...] Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Technical Details
Message-ID:
<c25a973e6efd6f626bb65d4f2500559b@tipi-net.de>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368795-linux-kernel-netdev=dewy.ruReferences:
<20261121-stmmac-rx-mb-v12-0-3ae2f3bce174@oss.qualcomm.com> <20261121-stmmac-rx-mb-v12-1-3ae2f3bce174@oss.qualcomm.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368795-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v12 1/4] net: xdp: add __xdp_build_skb_from_buff() helper Date: Sun, 22 Nov 2026 20:21:49 +0100 Organization: Usenet Network Message-ID: <c25a973e6efd6f626bb65d4f2500559b@tipi-net.de> References: <20261121-stmmac-rx-mb-v12-0-3ae2f3bce174@oss.qualcomm.com> <20261121-stmmac-rx-mb-v12-1-3ae2f3bce174@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3707072"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:jk1PZsQNQxTzC5pPbulZnqJvOp0= sha256:tEeuWFEwV0vvjzZljqn79/zJAcfNXYGQPgsRtkKVmGA= sha1:+MEtYFvt63MyXnmtrFPDLuF0cCo= sha256:4Bznzb3BIMPR60uXRGg6Zi8PlIcUBuk2iQ6VpqBVlkc= 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 20BC9125D82; Sun, 22 Nov 2026 22:22:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=tipi-net.de 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 5Dn9fjeRvkPs; Sun, 22 Nov 2026 22:22:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368795-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 5A587125D7A; Sun, 22 Nov 2026 22:22:02 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id C43BB29825; Sun, 22 Nov 2026 19:22:00 +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=1795375320; b=L2d/qOUx/P66PssLhS65+bSn/w125Zf/l0G8ktNDv+X1eWkM6lRoN/+hBm5G/SSFAFeX Gn6JjoaTdDndQwsis4BGe6pgvj/iwhOI67cjNiml7QbBQ+mmGSJRySq5EGvSKsSoHN5Z5 rvXFEGXN8i561IIlSaQeTvB2I6HBuSbZaiZDcDWMolt9kf4bKWISmB2o5AjbJKX/OrvU3 vLuNyLZZ8/YKohz0rbMvDvnqUOtjvowJ0JZoNfzNRUcWx+41JoBmhBixwJXX9oqzE785r 4grWGy26SzIv2qg9ojpj3DonZAqf88nGHJ9tk3rgJDS5aR4+gZQkGz92iMrK4n3ZnVg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795375320; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Date:From:To:Cc: Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=h5MusH8IV9Na7fO3T7L7n/MZBiLsXQrVcpOP8ORgtoc=; b=BqqSpi8lPFoQIQ+AtYlmCcNzRUUZkjNAtBoNIR9djo1e+YisKc0OkRcx1YtvQwd11pRL /RPiJUHr0r9RaYcV+Sul8wWklyQTUA7hEAb/g6Buh/kmgQVPe7QWnCE4AHMHpOX561bIP u6GoNiQSnIDq5Ok2LL9cBGIyZ0hUIOYlbk4CqgkD59TMvIe8uKLRvsM1/tMZekyGlHsD1 rqtdDbv1TeNJ0+LbSDuI0cZ2/YuNpumVCoVcZnF+NplbIhGh/Q5HlEbklSuA5RUYdVjYb NNvVEgwJAPwtFmvoB8yYaeqf3dAeDVZt0zCiKHBd4yiiCOlPZsXWOsu2317yXwPoVSA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=rEM2Jbmk; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; 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 856B8606A332; Sun, 22 Nov 2026 19:22:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=rEM2Jbmk X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795375319; b=VXvKB6DBgplTNECWSWMJSgU5qz4j0aPB3xh7OHAMBZB+F0GTHV5mcWhMtUlnxKe7GpuL O1Am3ZXcHXHDbr7dzZiOQTlyQ+GGPh4BnJ2qZajrSEfLNzucHWaDxPSacMUqM/uAi1gEm +PzaGz3q40EZqKqFeIEoSwNXKeeUuYjOt/TR6wBwgGQblhP4+3bffs+jeUn7eRYkT0n54 oQmwBHR9uT6yvctQNaImGR/lCvvX46pXNMhT3B2FDq9SYd5nu3N6hTwOorWcBv//u1msD o+igPpeuRpi5kMY5x7rdqqnE85+4dC4b0U3BexYCWSrBwA1FbBb/frg/ooyxb5DV/xA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795375319; h=DMARC-Filter:Received:DKIM-Signature:MIME-Version:Date:From:To:Cc: Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=h5MusH8IV9Na7fO3T7L7n/MZBiLsXQrVcpOP8ORgtoc=; b=i57i4+fYlXR7GsPDAyMqf3J73QquVfKOUW/n8wt4S78rPOGA7qO/vzsjAGHAhBn0K+cU zRxyINqZALw3cBDku6dG0ollhyrqc4lerrgngp1zaVFRRvMwgmSyaS2oXom1h+N8lldPZ 0aEKqwE1JFCp+4m4hmXwf6yFv5UcAcidrco9VfS19MkLLXsapfIA5j3c8+9yv81wQAW/y +Y56f2CqIgT2fSJoxbB5FgqL8fULZt/7X8ZZBA4dtsza3tME9VxFDjwgVRxcUCLC6du32 aENCvmnH8bjcBFbz72Svz9r+naxaXmuKZammDMyU9QyR3/n/7Mnbn9xfnB/HzVZOU9g== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=rEM2Jbmk; arc=none smtp.remote-ip=194.13.80.246 X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBBB8606A320; Sun, 22 Nov 2026 19:21:57 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DBBB8606A320 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A7CC2A157F; Sun, 22 Nov 2026 20:21:49 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1795375314; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=h5MusH8IV9Na7fO3T7L7n/MZBiLsXQrVcpOP8ORgtoc=; b=rEM2JbmkBa5fn4Vr1bG3w+4KkTPOAyz4FjLeNzEe61DQJc+Etd7NYYpXSy2cZPxq62ikrp 0htLJW1yFWzYssVcDR8hRqht9XJdgfvfhU1+W5bXxbGuAUgirDLsELaS0hHJiU+Od3mxlk RFyL3goVG+an5Y6mklDhT4zVnsftanFz3bNj9Roc5HTGF4c5E3uumqmfxsWGLrklI0Fdci Xe2NPEkIZv4MM2IXFaYcY8xm6h7zloBkAxWdfCtt/ciFwfqjeVDmKlas2yf6JaQpzaP+b3 5OC8zYeZqPYllx+O5TMe9S4sfqUXzzdxsvCzf9hQmlWKT1OKiw6WdSBayo0J9A== 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-Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, Jose Abreu <Jose.Abreu@synopsys.com>, Ong Boon Leong <boon.leong.ong@intel.com>, Simon Horman <horms@kernel.org>, Andrii Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>, Kumar Kartikeya Dwivedi <memxor@gmail.com>, Martin KaFai Lau <martin.lau@linux.dev>, Song Liu <song@kernel.org>, Yonghong Song <yonghong.song@linux.dev>, Jiri Olsa <jolsa@kernel.org>, Emil Tsalapatis <emil@etsalapatis.com>, Ihor Solodrai <ihor.solodrai@linux.dev>, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org X-In-Reply-To: <20261121-stmmac-rx-mb-v12-1-3ae2f3bce174@oss.qualcomm.com> X-Sender: nb@tipi-net.de X-Last-TLS-Session-Version: TLSv1.3