From nobody Sun Jun 14 20:20:27 2026 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5DE83537D9 for ; Mon, 6 Apr 2026 07:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775460435; cv=none; b=P+DGlWVfq45RgY6iF6ozPXviXMzCgUvEcZTjFZvRxQkXI3I3cBnZinA4B2qLk5R/aONpOdPMztDuRvl8bM/TONS7+K0G5gQkiF7rwosZbhK4KYVAv+e0H8IkcKnKpcmlZqwEMQiiUDKeJBY7/3bubgbfK2J2wmxmZJVXA/iPWgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775460435; c=relaxed/simple; bh=5xf2bbceAjrL9Kn0yXbZUdc9u2qLSvuJAqr0yCPb/MY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bBnMZqIhjY+0B+7kx5lfEOdLagblGH1rx59k/iF42IlCIben0mwSFQPY1lsK1Fh9JkZkIDMagg0Jn0FIsC//dFsa6tJsa1o0CjtiRj9kFD7nhJE0TWcYPre1Ou1SpcOBAq0ZDDHlTI6AoCBywnCQTc+VIIxYKt7RjzMP/OLdy/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=shopee.com; spf=pass smtp.mailfrom=shopee.com; dkim=pass (2048-bit key) header.d=shopee.com header.i=@shopee.com header.b=fhl4ULzz; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=shopee.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shopee.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shopee.com header.i=@shopee.com header.b="fhl4ULzz" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-358d80f60ccso2209027a91.3 for ; Mon, 06 Apr 2026 00:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1775460434; x=1776065234; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/+l8xdJ81rnHVCDBCC4cOrkEDKbX4zpmL1qqNzt32Zg=; b=fhl4ULzzM3JxbZouxPkKN/7rTjYPN3YEpC3ZB6OYTyX4Eb7eWdz0InUBJR2eUpHwBT GM9n+s2IF8A8NQVlD4smGaMYzKRMZyryUeJCwH9cr5CXCNOTL/oJn/c2MLV5NJ8MsnH1 iGWWSCazM5+HYYH5YwgAqQt4dCjkwGCzGeYbQMoF7dlr5z2fJvhglH6j6TV1NdLvJBFo lDoav5ssTuxyaOwadCG4QEu0zGH3Oqc/GNH96JjwPpBDcfKQKIAgOlVFn+FDSV0NbiPN HL4dLsekBNrbAKSdbSxN9NCMwQQgP6JUAzECK7g6yZZfhpa0F9avoVHZrnmph4zfBLF3 BKdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775460434; x=1776065234; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/+l8xdJ81rnHVCDBCC4cOrkEDKbX4zpmL1qqNzt32Zg=; b=I0/o/fZwlNYsIBvgJzFjb0DE4gYOMQzx5imh4dp/MyMUATPPeK834wejxcu3aA4Yey ylh8xlFKdAt0lZ7v4B9+wLdLXUQOBIIzCV7Ci6EohkgovO2+CludUO+GG3VnQYRaNfjc G4jg3V5qJjM6kAn69va798HT/PtRJbODCAbQTIjTiKCu1iPnDVnPBxzfyaICtG32rosE RWSXNTQ5MIKS09kXgWPQlfc0vIOsffWWmSAZvr/3Stke7OTsSrBR3V+WIcACtr7dZB9z RSEP2TzQlJd/ZOUXZy0MI7M0FIQRghNihdDuDsGeAibsLsmGRKLLLCDFRDyohkcXbAV3 C/qg== X-Forwarded-Encrypted: i=1; AJvYcCXAbfvTchvPrO81Bmer80SoZJHv0q6kJZfKTlX5bk7yCu0hGjVE1Agfj7/2/F1mSFxrrKhcB2QzKU0NHfE=@vger.kernel.org X-Gm-Message-State: AOJu0YxvcEVY4QJRDCbEmMQIB2h9Y/LZnV1jWR7sihBefUgL/oCbcnRk p1S4f7f13TFZjg+fsM6DsMghzZiWnHGpFF38bU9BHtrpcy3l6miccUqGGKPIN4Bdry4= X-Gm-Gg: AeBDiev8z8I69Q4PSNmz2DKN7WeCPd9NPXai3I5knUsqffcpmiA9juv5zhNVx/uEDDk FScaVJxg43xBQr2J4T+4NjLvqQmMz0zbHToGgHCA6pJAZqml0jnXktCQfIurRd55zxnaCuE7kOx 9Sh51A3psVhh9tOkjbbG2nu9bq93K5CjCYTLDxSOMK864a2LWJcGpwnDJEIUVRNY2rBgi7aPaAX ldaS7xBTKzfkkjJSp7Nu+a9Nb9FMhhNF48RtlcDHhBmzcJVw0q+MGWy7dNFIk52QTitgYFWzAzu XgARYilpZcvX/oziXqWhJej1LDhbDYXfPDEfsvJf/a7oQkhmuaISIP50l9CLDLpRe2bwYs9sgRU vfur7L0XJ+8yQ+WgfmLqwtTbd+1KaPGbbKko7c+0iIGXMPYPfd71fqo5TZ6Fk9h76ORD6qcGYFV lclCBbMoyffLFnQ3gz6NGLGMkt3SUpY5iOcN5xTVTfne1rBlYXeQ== X-Received: by 2002:a17:90b:384e:b0:35c:d01:d3dc with SMTP id 98e67ed59e1d1-35de68ec479mr10327576a91.18.1775460433873; Mon, 06 Apr 2026 00:27:13 -0700 (PDT) Received: from bms-ytl-d1-app-10-251-178-27 ([147.136.157.0]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35dd367bf24sm12920937a91.9.2026.04.06.00.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2026 00:27:13 -0700 (PDT) From: Leon Hwang To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Leon Hwang , Leon Hwang Subject: [PATCH net-next v2] selftests/drivers/net: Add an xdp test to xdp.py Date: Mon, 6 Apr 2026 15:26:54 +0800 Message-ID: <20260406072655.368173-1-leon.huangfu@shopee.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In "bpf: Disallow freplace on XDP with mismatched xdp_has_frags values" [1], this XDP test is suggested to add to xdp.py. 1. Verify the failure of updating frag-capable prog with non-frag-capable prog, when the frag-capable prog attaches to mtu=3D9k driver. The test has been verified against Mellanox CX6 and Intel 82599ES NICs. With dropping other tests, here is the test log. # ethtool -i eth0 driver: mlx5_core version: 6.19.0-061900-generic # NETIF=3Deth0 python3 xdp.py TAP version 13 1..1 ok 1 xdp.test_xdp_native_update_mb_to_sb # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 # ethtool -i eth0 driver: ixgbe version: 6.19.0-061900-generic # NETIF=3Deth0 python3 xdp.py TAP version 13 1..1 # CMD: ip link set dev eth0 xdpdrv obj /path/to/tools/testing/selftests/n= et/lib/xdp_dummy.bpf.o sec xdp.frags # EXIT: 2 # STDERR: RTNETLINK answers: Invalid argument ok 1 xdp.test_xdp_native_update_mb_to_sb # SKIP device does not support mu= lti-buffer XDP # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0 Links: [1] https://lore.kernel.org/bpf/20260326124205.1a3bb825@kernel.org/ Cc: Leon Hwang Signed-off-by: Leon Hwang --- v1 -> v2: - Update the category in subject from selftests/net to selftests/drivers/ne= t. - Drop _exec_cmd helper. - Recover the original MTU using cfg.dev['mtu'] (per Kuba). - Drop the unnecessary shell=3DTrue arg (per Kuba). - Print error using ksft_pr (per Kuba). - Drop the sb_to_mb case (per Kuba). - Skip test when device supports sb XDP with mtu 9000 (per Kuba,Gemini/sash= iko). v1: https://lore.kernel.org/netdev/20260401052746.314667-1-leon.huangfu@sho= pee.com/ --- tools/testing/selftests/drivers/net/xdp.py | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/drivers/net/xdp.py b/tools/testing/sel= ftests/drivers/net/xdp.py index d86446569f89..864ca4097b87 100755 --- a/tools/testing/selftests/drivers/net/xdp.py +++ b/tools/testing/selftests/drivers/net/xdp.py @@ -13,7 +13,7 @@ from enum import Enum =20 from lib.py import ksft_run, ksft_exit, ksft_eq, ksft_ge, ksft_ne, ksft_pr from lib.py import KsftNamedVariant, ksft_variants -from lib.py import KsftFailEx, NetDrvEpEnv +from lib.py import KsftFailEx, KsftSkipEx, NetDrvEpEnv from lib.py import EthtoolFamily, NetdevFamily, NlError from lib.py import bkg, cmd, rand_port, wait_port_listen from lib.py import ip, defer @@ -693,6 +693,31 @@ def test_xdp_native_qstats(cfg, act): ksft_ge(after['tx-packets'], before['tx-packets']) =20 =20 +def test_xdp_native_update_mb_to_sb(cfg): + obj =3D cfg.net_lib_dir / "xdp_dummy.bpf.o" + mtu =3D 9000 + + ip(f"link set dev {cfg.ifname} mtu {mtu}") + defer(ip, f"link set dev {cfg.ifname} mtu {cfg.dev['mtu']} xdpdrv off") + + attach =3D cmd(f"ip link set dev {cfg.ifname} xdpdrv obj {obj} sec xdp= ", fail=3DFalse) + if attach.ret =3D=3D 0: + raise KsftSkipEx(f"device supports single-buffer XDP with mtu {mtu= }") + + attach =3D cmd(f"ip link set dev {cfg.ifname} xdpdrv obj {obj} sec xdp= .frags", fail=3DFalse) + if attach.ret !=3D 0: + ksft_pr(attach) + raise KsftSkipEx("device does not support multi-buffer XDP") + + # Verify updating mb -> mb program works. + cmd(f"ip -force link set dev {cfg.ifname} xdpdrv obj {obj} sec xdp.fra= gs") + + # Verify updating mb -> sb program does not work. + update =3D cmd(f"ip -force link set dev {cfg.ifname} xdpdrv obj {obj} = sec xdp", fail=3DFalse) + if update.ret =3D=3D 0: + raise KsftFailEx("device unexpectedly updates non-multi-buffer XDP= ") + + def main(): """ Main function to execute the XDP tests. @@ -718,6 +743,7 @@ def main(): test_xdp_native_adjst_head_grow_data, test_xdp_native_adjst_head_shrnk_data, test_xdp_native_qstats, + test_xdp_native_update_mb_to_sb, ], args=3D(cfg,)) ksft_exit() --=20 2.53.0