From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8643CCAC592 for ; Mon, 22 Sep 2025 15:43:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4051D61AD3; Mon, 22 Sep 2025 15:43:36 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id KyfKv6kfXqog; Mon, 22 Sep 2025 15:43:35 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 89E28614F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1758555815; bh=v3V9jfcj4c/C9kF8Vt1ZcO3ulHKzrInrkcLPZRC1Na4=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TIAcdBmDXUizHVkqQURYg+WFj6c2Eqczwnpv267oiKhVJseuZ9eHaIRKEOghQCqbA GnNryFGpHIlETkxqN5aTkBCV3L+wbn6L1oA4lpJcB0kRw96Hc9u1HW7JxeLwcaWqhN p/3w6Q8Bv9vtYiyzdfOCOzPXztvqM5KRvRoC6vD9IE1AueomfGI7QiEiK9UhlF9Xz7 zxbq3jnERsiHcO5KtFtwA9okAS6PtCWBORxLHB8McAiblAtyly1s/eeU8RH9luEgW8 V5+lC42gIbjw5aSv7lYldK6gmoK9WAbURgZ+N0TZhCrrzP7av8XLerTgInC1myskfn J3JZB8J9BQq3Q== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 89E28614F0; Mon, 22 Sep 2025 15:43:35 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 97294116C for ; Mon, 22 Sep 2025 15:43:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 944AC614F0 for ; Mon, 22 Sep 2025 15:43:34 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 6UkJCez17bp5 for ; Mon, 22 Sep 2025 15:43:34 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::429; helo=mail-pf1-x429.google.com; envelope-from=stfomichev@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org EE86361099 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EE86361099 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by smtp3.osuosl.org (Postfix) with ESMTPS id EE86361099 for ; Mon, 22 Sep 2025 15:43:33 +0000 (UTC) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-77d94c6562fso4461160b3a.2 for ; Mon, 22 Sep 2025 08:43:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758555813; x=1759160613; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=v3V9jfcj4c/C9kF8Vt1ZcO3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u7IajeQN2KE9RvWExElL11NBveS0BM7X31FD2JE+nEoGU9aM/yW8xo80g2B5rVBJ bsn X-Google-Smtp-Source: AGHT+IETBbukUvkAuvQVb1Skx6MlL0Qne0xJdc/u3lmyMRgaNlL6QuTtewx92TllrETSMx2zMBvRAA== X-Received: by 2002:a05:6a20:7d8a:b0:251:c33d:2783 with SMTP id adf61e73a8af0-2925bace118mr16480567637.23.1758555813010; Mon, 22 Sep 2025 08:43:33 -0700 (PDT) Received: from localhost (c-73-158-218-242.hsd1.ca.comcast.net. [73.158.218.242]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-330607eac4esm13558095a91.21.2025.09.22.08.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Sep 2025 08:43:32 -0700 (PDT) Date: Mon, 22 Sep 2025 08:43:32 -0700 From: Stanislav Fomichev To: Lorenzo Bianconi Cc: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Andrew Lunn , Tony Nguyen , Przemek Kitszel , Alexander Lobakin , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Hao Luo , Jiri Olsa , Shuah Khan , netdev@vger.kernel.org, bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org Message-ID: References: <20250920-xdp-meta-rxcksum-v1-0-35e76a8a84e7@kernel.org> <20250920-xdp-meta-rxcksum-v1-2-35e76a8a84e7@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20250920-xdp-meta-rxcksum-v1-2-35e76a8a84e7@kernel.org> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758555813; x=1759160613; darn=lists.osuosl.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=v3V9jfcj4c/C9kF8Vt1ZcO3ulHKzrInrkcLPZRC1Na4=; b=i5Rkk8GuSaHj6ybZtKY93GZk259tuPm3YDmJvrxxPk3hixJNg0E6NITVBLIEN5MrgR 6+ZGZeHPxfYAAbGQrSDCDDgz1AvP1jG/zUwSfg8RFCGZ7VmHXXAKokfP/pLGGa6eq0LP pQXWyEak3jaRCWHl2bbtMxEivXDuUFrizwY33D1vDujKW37M5ecgDP6tNEB5G8goMiKl Wc06GUjeOBOjmxUHTNhHxE+/x64hq+A/NBUKOAwUqNpIBdCAEAMa0zfIgcyyhO5wdcsR 8RLSdJJfAS90TeHLlIiacz53AdY2Y2SJGBlcTrLjou2Xpsl8iWr9Fz3GVp1OeycGHLiA 0BIw== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=i5Rkk8Gu Subject: Re: [Intel-wired-lan] [PATCH RFC bpf-next 2/6] net: xdp: Add xmo_rx_checksum callback X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On 09/20, Lorenzo Bianconi wrote: > Introduce xmo_rx_checksum netdev callback in order allow the eBPF > program bounded to the device to retrieve the RX checksum result computed > by the hw NIC. > > Signed-off-by: Lorenzo Bianconi > --- > include/net/xdp.h | 6 ++++++ > net/core/xdp.c | 29 +++++++++++++++++++++++++++++ > 2 files changed, 35 insertions(+) > > diff --git a/include/net/xdp.h b/include/net/xdp.h > index 6fd294fa6841d59c3d7dc4475e09e731996566b0..481b39976ac8c8d4db2de39055c72ba8d0d511c3 100644 > --- a/include/net/xdp.h > +++ b/include/net/xdp.h > @@ -581,6 +581,10 @@ void xdp_attachment_setup(struct xdp_attachment_info *info, > NETDEV_XDP_RX_METADATA_VLAN_TAG, \ > bpf_xdp_metadata_rx_vlan_tag, \ > xmo_rx_vlan_tag) \ > + XDP_METADATA_KFUNC(XDP_METADATA_KFUNC_RX_CHECKSUM, \ > + NETDEV_XDP_RX_METADATA_CHECKSUM, \ > + bpf_xdp_metadata_rx_checksum, \ > + xmo_rx_checksum) > > enum xdp_rx_metadata { > #define XDP_METADATA_KFUNC(name, _, __, ___) name, > @@ -644,6 +648,8 @@ struct xdp_metadata_ops { > enum xdp_rss_hash_type *rss_type); > int (*xmo_rx_vlan_tag)(const struct xdp_md *ctx, __be16 *vlan_proto, > u16 *vlan_tci); > + int (*xmo_rx_checksum)(const struct xdp_md *ctx, u8 *ip_summed, > + u32 *cksum_meta); > }; > > #ifdef CONFIG_NET > diff --git a/net/core/xdp.c b/net/core/xdp.c > index 9100e160113a9a1e2cb88e7602e85c5f36a9f3b9..3edab2d5e5c7c2013b1ef98c949a83655eb94349 100644 > --- a/net/core/xdp.c > +++ b/net/core/xdp.c > @@ -961,6 +961,35 @@ __bpf_kfunc int bpf_xdp_metadata_rx_vlan_tag(const struct xdp_md *ctx, > return -EOPNOTSUPP; > } > > +/** > + * bpf_xdp_metadata_rx_checksum - Read XDP frame RX checksum. > + * @ctx: XDP context pointer. > + * @ip_summed: Return value pointer indicating checksum result. > + * @cksum_meta: Return value pointer indicating checksum result metadata. > + * > + * In case of success, ``ip_summed`` is set to the RX checksum result. Possible > + * values are: > + * ``CHECKSUM_NONE`` > + * ``CHECKSUM_UNNECESSARY`` > + * ``CHECKSUM_COMPLETE`` > + * ``CHECKSUM_PARTIAL`` What do you think about adding new UAPI enum here? Similar to xdp_rss_hash_type for the hash. The values can match the internal CHECKSUM_XXX ones with (BUILD_BUG_ONs to enforce the relationship). Will be a bit nicer api-wise to have an enum than an opaque u8.