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 A8EA2C44529 for ; Mon, 20 Jul 2026 19:33:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4FE2C60711; Mon, 20 Jul 2026 19:33:04 +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 Rci-oGZXTiB8; Mon, 20 Jul 2026 19:33:03 +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 6B9D3606EF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1784575983; bh=mipM1cLecOb4t56l8llNyfwcJ8p4RmBXYxGw64Z8Tfc=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UwY2kT0RtEMQgZGYGfyI7KumN+mAwaK3IKJZNQmEI9pcP1y/rKvzVsWJcUQbtKodZ 6c5k4rFwOPlIDl10vP5IidvAxZkyphxTJyCwjO7T6PfkMGC293LT7FacYZOBCuazBE A9HKkULlsiYhs8C5nH04PyFtXidn0LR9xftpUP3Vu3aLdDEyS2ae30a8EPC9bHsboY W5rT1mPA6s1ALiQvbU7smLw4V2To8+i/tYa0uEt/8mnVta0Wt6JXgAKWAcMezoKk6W /RtaDqXlBnOmOSpHLEAD7uIBAC6yMLKO5iyOy5oRWFxR9nP6RVatb6C4uekma152vL zvlgKKFobjAyQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 6B9D3606EF; Mon, 20 Jul 2026 19:33:03 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists1.osuosl.org (Postfix) with ESMTP id 67B71DB4 for ; Mon, 20 Jul 2026 19:33:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 595914017B for ; Mon, 20 Jul 2026 19:33:02 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id XSx3WrZ6HRX9 for ; Mon, 20 Jul 2026 19:33:01 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:3b::1; helo=mail-pz2-x01.google.com; envelope-from=sdf.kernel@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 596D44016F DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 596D44016F Received: from mail-pz2-x01.google.com (mail-pz2-x01.google.com [IPv6:2607:f8b0:4864:3b::1]) by smtp2.osuosl.org (Postfix) with ESMTPS id 596D44016F for ; Mon, 20 Jul 2026 19:33:01 +0000 (UTC) Received: by mail-pz2-x01.google.com with SMTP id 41be03b00d2f7-ca00ea47337so2890546a12.0 for ; Mon, 20 Jul 2026 12:33:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784575980; x=1785180780; h=in-reply-to:content-disposition:content-type:mime-version :references: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=mipM1cLecOb4t56l8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LoBC9JQ== X-Received: by 2002:a05:6a00:80a:b0:847:97a4:d6b3 with SMTP id d2e1a72fcca58-84c2922630cmr15623327b3a.16.1784575980551; Mon, 20 Jul 2026 12:33:00 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:1::]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84c2f1601d6sm5999817b3a.50.2026.07.20.12.32.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 12:33:00 -0700 (PDT) Date: Mon, 20 Jul 2026 12:32:55 -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 , Maciej Fijalkowski , Jonathan Corbet , Shuah Khan , Kumar Kartikeya Dwivedi , Emil Tsalapatis , Vladimir Vdovin , Jakub Sitnicki , netdev@vger.kernel.org, bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org Message-ID: References: <20260715-bpf-xdp-meta-rxcksum-v5-0-623d5c0d0ab7@kernel.org> <20260715-bpf-xdp-meta-rxcksum-v5-8-623d5c0d0ab7@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784575980; x=1785180780; darn=lists.osuosl.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=mipM1cLecOb4t56l8llNyfwcJ8p4RmBXYxGw64Z8Tfc=; b=WAvPno7oo9E/5i0hieqUbEv9OH8o38N2o6/ewcEtRCCPl0biBPBRuqlYYsUV1a3t9+ vwPXuKoF2vhAWItJH44A19bSvR9Pl4qTvD4SOafo712RSH4vO1EpRsxxElCAVn//L4a1 PrUyXMQG55wSDLHijLjkwHo2aeCg/NRcKulURd+2tyxUgf2Aopr7UbvnswWZlLvxkSCK VbRjYUiE2ciOH4rB9xSHXLm6uNeabOQnQVZlBvOXWyy+52lJfpyTDfmv+Y8SKN6WdNC9 q976ACuHWUvM8aAnvyalR9LP3SEG0uz7x95cg4Lnsa4HFQR+yGP4NVTZonRbfKcqoqsU nyjg== X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=WAvPno7o Subject: Re: [Intel-wired-lan] [PATCH bpf-next v5 8/8] selftests: net: add test for XDP_PASS skb checksum invalidation 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 07/16, Lorenzo Bianconi wrote: > On Jul 16, Stanislav Fomichev wrote: > > On 07/15, Lorenzo Bianconi wrote: > > > Add a test that verifies skb->ip_summed is set to CHECKSUM_NONE > > > when a device running in XDP mode creates an skb from a xdp_buff > > > if the attached ebpf program returns an XDP_PASS. > > > The test attaches an XDP program returning XDP_PASS, and a TC > > > ingress program that runs the bpf_skb_rx_checksum() kfunc to > > > inspect the resulting skb. After XDP_PASS the driver must invalidate > > > any previously computed hardware RX checksum since XDP may have > > > modified the packet data. > > > The BPF program counts packets per checksum type in a map, and the > > > test runner verifies that after sending traffic the CHECKSUM_NONE > > > counter is non-zero while CHECKSUM_UNNECESSARY and CHECKSUM_COMPLETE > > > counters are zero. > > > > > > Signed-off-by: Lorenzo Bianconi > > > --- > > > Documentation/networking/xdp-rx-metadata.rst | 5 ++ > > > .../selftests/drivers/net/hw/xdp_metadata.py | 55 +++++++++++++++- > > > .../selftests/net/lib/skb_metadata_csum.bpf.c | 73 ++++++++++++++++++++++ > > > 3 files changed, 132 insertions(+), 1 deletion(-) > > > > > > diff --git a/Documentation/networking/xdp-rx-metadata.rst b/Documentation/networking/xdp-rx-metadata.rst > > > index 93918b3769a3..7434ac98242a 100644 > > > --- a/Documentation/networking/xdp-rx-metadata.rst > > > +++ b/Documentation/networking/xdp-rx-metadata.rst > > > @@ -90,6 +90,11 @@ conversion, and the XDP metadata is not used by the kernel when building > > > ``skbs``. However, TC-BPF programs can access the XDP metadata area using > > > the ``data_meta`` pointer. > > > > [..] > > > > > +If a driver is running in XDP mode, any existing hardware RX checksum > > > +(``CHECKSUM_UNNECESSARY`` or ``CHECKSUM_COMPLETE``) must be invalidated > > > +by setting ``skb->ip_summed`` to ``CHECKSUM_NONE`` before passing the > > > +skb to the kernel, since XDP may have modified the packet data. > > > + > > > In the future, we'd like to support a case where an XDP program > > > can override some of the metadata used for building ``skbs``. > > > > Sorry for keeping nitpicking on this, but I'm still not convinced that > > it is what we currently do. From my previous reply: > > no worries :) > My current take-away from the previous discussion is we just need to document > what would be the driver expected behaviour adding a kselftest for it (without > modifying any driver). > > > > > > > Looking at a few drivers: > > > > - bnxt (bnxt_rx_pkt) does UNNECESSARY - ok > > > > - mlx5 (mlx5e_handle_csum) does UNNECESSARY and skips COMPLETE if there is > > > > bpf prog attached > > > > - fbnic (fbnic_rx_csum) - can do COMPLETE even with xdp attached? > > > > - gve (gve_rx) - can do COMPLETE even with xdp attached? > > > > (although for gve I might be wrong, there is also gve_rx_skb_csum that only > > does UNNECESSARY). > > > > I'd wait for Jakub to chime in, but it feels like we should just document > > what we currently do as a recommended approach: for the drivers > > that support COMPLETE, do not report it when the bpf program is attached. > > Both NONE and UNNECESSARY are ok. > > I am not completely sure the UNNECESSARY case is different from the COMPLETE > one. What are we supposed to do if the driver reports UNNECESSARY and the ebpf > program modifies some fields covered by the rx-checksum? For unnecessary, I think the safe expectation is that the bpf program will update the value of the checksum in the packet if it touches the data? > > Also, did you run this test on real HW? NIPA now has HW tests, maybe it > > makes sense to route this series via net-next to get the real coverage? > > What about splitting this series and have two different series: > - bpf-next: add xdp rx kfunc and related selftest > - net-next: add kselftest for the driver expected behaviour. > > What do you think? I'd post everything to net-next to get the HW coverage. Once you get all the acks we can ask the maintainers' guidance.