From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-00190b01.pphosted.com (mx0a-00190b01.pphosted.com [67.231.149.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D10583E9C33; Wed, 12 Aug 2026 08:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786523520; cv=none; b=ifaKkEtHTC8VUuAqW13CW4wYFLVRTMVGgEBI+71jsNth1Qip73MVs5PS6PosYac8Lvv5xEpQ3Gzctx82SfMhIfQVoWiQbARoEKrmp+87lmU2Op5otgBDMrEOKTuNOW9ly9eVeQQrX12+bAj7zfyCqlCpAMfCqtjVtaW7Fvoilr0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786523520; c=relaxed/simple; bh=NEVQVToT8Vam4863RdlV/e9Pq1I6UIN76hmp9hRwY/Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lz7g2SAONoybNvQP/6KA/NXhmq/WGSaCT3tQHfJNorXIvscgrcYZ76IA5ibSIcr4u1SyPWS4uzkC9lKevxti6s2VNLlJWNaf0NcOoyemJxlTtUdK0u7pWBezuQGSLbb4k30VFIrLG3/lXkOHdLPRgEcGm9KTozn0vVBI50UDEL0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=akamai.com; spf=pass smtp.mailfrom=akamai.com; dkim=pass (2048-bit key) header.d=akamai.com header.i=@akamai.com header.b=ghPrHwHo; arc=none smtp.client-ip=67.231.149.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=akamai.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=akamai.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=akamai.com header.i=@akamai.com header.b="ghPrHwHo" Received: from pps.filterd (m0122333.ppops.net [127.0.0.1]) by mx0a-00190b01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67C6308F1881032; Wed, 12 Aug 2026 09:31:30 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=apr2026.eng; bh=4odN+gYXR EBbfQsfgb783k4mWD0CS4ksGzbbyR7JBSE=; b=ghPrHwHoA7Pw0XBGprOoYHIx2 GcPUI/q/NnpBe0PRyUTxJ+0Hs+RdC7em7dU9j0agklmnv9C1k//cOB3AAVj+Kymh +d1wQJRoDC85NhQ9+lYDad7V9YHk/0yRMt3FG+Kh8RIHbgX6sn8Y2p/5DBApKROU FHt989Md+0ioymzkXX3w9QFfTPZKdf9qJHo4b3SYOxcR4Nk2VeNvID2dYfHM3/6B qdyuxqAWBphhNXsh7j5vCjnXiDxtUWtOUTkP9EQlN808bM8D18JmvM2JfALKkvb5 iBSqK4eII+t46OPJ/f4SCC0Z2gCdF5ab1oUQiQNYncPqzI84VNGUGVWhf80HQ== Received: from prod-mail-ppoint5 (prod-mail-ppoint5.akamai.com [184.51.33.60]) by mx0a-00190b01.pphosted.com (PPS) with ESMTPS id 4fwuq5d09c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2026 09:31:30 +0100 (BST) Received: from pps.filterd (prod-mail-ppoint5.akamai.com [127.0.0.1]) by prod-mail-ppoint5.akamai.com (8.18.1.7/8.18.1.7) with ESMTP id 67C8JpMV031168; Wed, 12 Aug 2026 01:31:29 -0700 Received: from prod-mail-relay01.akamai.com ([172.27.118.31]) by prod-mail-ppoint5.akamai.com (PPS) with ESMTP id 4fx2e7xnun-1; Wed, 12 Aug 2026 01:31:28 -0700 (PDT) Received: from muc-lhvdhd.munich.corp.akamai.com (muc-lhvdhd.munich.corp.akamai.com [172.29.0.147]) by prod-mail-relay01.akamai.com (Postfix) with ESMTP id 42A6484; Wed, 12 Aug 2026 08:31:27 +0000 (UTC) From: Nick Hudson To: bpf@vger.kernel.org, netdev@vger.kernel.org, Willem de Bruijn , Martin KaFai Lau Cc: Nick Hudson , Max Tottenham , Anna Glasgall , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , linux-kernel@vger.kernel.org Subject: [PATCH bpf-next v7 3/6] bpf: add BPF_F_ADJ_ROOM_DECAP_* flags for tunnel decapsulation Date: Wed, 12 Aug 2026 09:31:12 +0100 Message-Id: <20260812083115.73100-4-nhudson@akamai.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260812083115.73100-1-nhudson@akamai.com> References: <20260812083115.73100-1-nhudson@akamai.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-12_02,2026-08-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608120066 X-Proofpoint-ORIG-GUID: Dk7o4SQX3XXsp-xuFpXD34RKIVY_rcik X-Proofpoint-Spam-Info: AW1haW4tMjYwODEyMDA2NyBTYWx0ZWRfXx90l4aISHTLJ TrAvnuRQSACTdYPa95ki7w3V0YVKaGzXrZigPZffmy6z1ok9K0BEFo7v7xbudJv7chfXx0NJVAr gZCBKQQjMsFvfapy4VApb2t8wDuMvno= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODEyMDA2NyBTYWx0ZWRfXxK4e5hKELLuu mOM9qIkczIbTHRW+tDbnoy/rPUFQ5Sb7FomKIZPgo8ilZa+84Jw3psfEPv7o4iUacBtYPLWvpOp lORNO0b18wRhVelgFVL23BHF8PvwzTqBHe4+HSoBDrw7NhjtUg81N7R5hhg+0sTXz3PBCkAx7uB hFoVVAmGhFKry/is04GhUzM26HyoBIJfqiP9VbwQx/WH9OZ7XVULjbmOywD18kjdaAI7gdTA/E0 pFjEbU3DKkXFNPuBdawzpTJchf2ffh1EfVJuVWA4C0Z+zKw4T5zXFABGtbnVE8B7rKNWOc7Kr8p 1YMU40kMYo6Gkqjub7kCr2FbceBThIyc0wOi6MuY64Gb8V8TJxdWLRcDT6EmYftixXpPnu4EXPi tYVa0rYvg/eYdqi5A1rY96/hHTCdlmM67eTjKBPg43O8s4xY9S9DXL1EUyhpS4LsMPETZR+Hqqh lUIoszMp/zf80RoUdiA== X-Authority-Analysis: v=2.4 cv=GvZyPE1C c=1 sm=1 tr=0 ts=6a7c2f62 cx=c_pps a=NpDlK6FjLPvvy7XAFEyJFw==:117 a=NpDlK6FjLPvvy7XAFEyJFw==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Ifg-1AOnLHOf1gn6spyb:22 a=5uIk5skAYop0meUMGpPt:22 a=X7Ea-ya5AAAA:8 a=1XWaLZrsAAAA:8 a=KfGVUnEDJfcTcdlxACkA:9 X-Proofpoint-GUID: Dk7o4SQX3XXsp-xuFpXD34RKIVY_rcik X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-12_02,2026-08-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 spamscore=0 bulkscore=0 impostorscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606160001 definitions=main-2608120067 Add new bpf_skb_adjust_room() decapsulation flags: - BPF_F_ADJ_ROOM_DECAP_L4_GRE - BPF_F_ADJ_ROOM_DECAP_L4_UDP - BPF_F_ADJ_ROOM_DECAP_IPXIP4 - BPF_F_ADJ_ROOM_DECAP_IPXIP6 These flags let BPF programs describe which tunnel layer is being removed, so later changes can update tunnel-related GSO state accordingly during decapsulation. This patch only introduces the UAPI flag definitions and helper documentation. Co-developed-by: Max Tottenham Signed-off-by: Max Tottenham Co-developed-by: Anna Glasgall Signed-off-by: Anna Glasgall Signed-off-by: Nick Hudson Reviewed-by: Willem de Bruijn --- include/uapi/linux/bpf.h | 34 ++++++++++++++++++++++++++++++++-- tools/include/uapi/linux/bpf.h | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index f6c9dc856858..732b35cc08d1 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -3038,8 +3038,34 @@ union bpf_attr { * * * **BPF_F_ADJ_ROOM_DECAP_L3_IPV4**, * **BPF_F_ADJ_ROOM_DECAP_L3_IPV6**: - * Indicate the new IP header version after decapsulating the outer - * IP header. Used when the inner and outer IP versions are different. + * Indicate the new IP header version after decapsulating the + * outer IP header. Used when the inner and outer IP versions + * are different. These flags only trigger a protocol change + * without clearing any tunnel-specific GSO flags. + * + * * **BPF_F_ADJ_ROOM_DECAP_L4_GRE**: + * Clear GRE tunnel GSO flags (SKB_GSO_GRE and SKB_GSO_GRE_CSUM) + * when decapsulating a GRE tunnel. + * + * * **BPF_F_ADJ_ROOM_DECAP_L4_UDP**: + * Clear UDP tunnel GSO flags (SKB_GSO_UDP_TUNNEL and + * SKB_GSO_UDP_TUNNEL_CSUM) when decapsulating a UDP tunnel. + * + * * **BPF_F_ADJ_ROOM_DECAP_IPXIP4**: + * Clear IPIP/SIT tunnel GSO flag (SKB_GSO_IPXIP4) when decapsulating + * a tunnel with an outer IPv4 header (IPv4-in-IPv4 or IPv6-in-IPv4). + * + * * **BPF_F_ADJ_ROOM_DECAP_IPXIP6**: + * Clear IPv6 encapsulation tunnel GSO flag (SKB_GSO_IPXIP6) when + * decapsulating a tunnel with an outer IPv6 header (IPv6-in-IPv6 + * or IPv4-in-IPv6). + * + * When using the decapsulation flags above, the skb->encapsulation + * flag is automatically cleared if all tunnel-specific GSO flags + * (SKB_GSO_UDP_TUNNEL, SKB_GSO_UDP_TUNNEL_CSUM, SKB_GSO_GRE, + * SKB_GSO_GRE_CSUM, SKB_GSO_IPXIP4, SKB_GSO_IPXIP6) have been + * removed from the packet. This handles cases where all tunnel + * layers have been decapsulated. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers @@ -6293,6 +6319,10 @@ enum bpf_adj_room_flags { BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6), BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = (1ULL << 7), BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = (1ULL << 8), + BPF_F_ADJ_ROOM_DECAP_L4_GRE = (1ULL << 9), + BPF_F_ADJ_ROOM_DECAP_L4_UDP = (1ULL << 10), + BPF_F_ADJ_ROOM_DECAP_IPXIP4 = (1ULL << 11), + BPF_F_ADJ_ROOM_DECAP_IPXIP6 = (1ULL << 12), }; enum { diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index f6c9dc856858..732b35cc08d1 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -3038,8 +3038,34 @@ union bpf_attr { * * * **BPF_F_ADJ_ROOM_DECAP_L3_IPV4**, * **BPF_F_ADJ_ROOM_DECAP_L3_IPV6**: - * Indicate the new IP header version after decapsulating the outer - * IP header. Used when the inner and outer IP versions are different. + * Indicate the new IP header version after decapsulating the + * outer IP header. Used when the inner and outer IP versions + * are different. These flags only trigger a protocol change + * without clearing any tunnel-specific GSO flags. + * + * * **BPF_F_ADJ_ROOM_DECAP_L4_GRE**: + * Clear GRE tunnel GSO flags (SKB_GSO_GRE and SKB_GSO_GRE_CSUM) + * when decapsulating a GRE tunnel. + * + * * **BPF_F_ADJ_ROOM_DECAP_L4_UDP**: + * Clear UDP tunnel GSO flags (SKB_GSO_UDP_TUNNEL and + * SKB_GSO_UDP_TUNNEL_CSUM) when decapsulating a UDP tunnel. + * + * * **BPF_F_ADJ_ROOM_DECAP_IPXIP4**: + * Clear IPIP/SIT tunnel GSO flag (SKB_GSO_IPXIP4) when decapsulating + * a tunnel with an outer IPv4 header (IPv4-in-IPv4 or IPv6-in-IPv4). + * + * * **BPF_F_ADJ_ROOM_DECAP_IPXIP6**: + * Clear IPv6 encapsulation tunnel GSO flag (SKB_GSO_IPXIP6) when + * decapsulating a tunnel with an outer IPv6 header (IPv6-in-IPv6 + * or IPv4-in-IPv6). + * + * When using the decapsulation flags above, the skb->encapsulation + * flag is automatically cleared if all tunnel-specific GSO flags + * (SKB_GSO_UDP_TUNNEL, SKB_GSO_UDP_TUNNEL_CSUM, SKB_GSO_GRE, + * SKB_GSO_GRE_CSUM, SKB_GSO_IPXIP4, SKB_GSO_IPXIP6) have been + * removed from the packet. This handles cases where all tunnel + * layers have been decapsulated. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers @@ -6293,6 +6319,10 @@ enum bpf_adj_room_flags { BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6), BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = (1ULL << 7), BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = (1ULL << 8), + BPF_F_ADJ_ROOM_DECAP_L4_GRE = (1ULL << 9), + BPF_F_ADJ_ROOM_DECAP_L4_UDP = (1ULL << 10), + BPF_F_ADJ_ROOM_DECAP_IPXIP4 = (1ULL << 11), + BPF_F_ADJ_ROOM_DECAP_IPXIP6 = (1ULL << 12), }; enum { -- 2.34.1