๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26520

Re: [PATCH net-next] netdevsim: add debugfs knobs to fail net-shaper ops

#26520
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 17:27
116 lines
11919 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch adds three netdevsim debugfs knobs for fault
  injection: fail_shaper_set, fail_shaper_del and fail_shaper_group.
- [Low] The commit message says the net-shaper core "never rolls back a
  driver failure against netdevsim" and adds all three knobs as the fix.

--

netdevsim: add debugfs knobs to fail net-shaper ops

This commit adds three per-PF debugfs bools to netdevsim:
fail_shaper_set, fail_shaper_del and fail_shaper_group. Each one makes
the matching net-shaper driver callback return -EINVAL with an extack
message. The goal is to let the net-shaper core's failure handling be
tested against netdevsim.

> nsim_shaper_set(), nsim_shaper_del() and nsim_shaper_group() always
> return success, so the net-shaper core never rolls back a driver
> failure against netdevsim. Add per-PF debugfs bools that make those
> callbacks return -EINVAL.

[Severity: Low]
Is this rollback rationale accurate for the del knob?

The core only calls net_shaper_rollback() after a failed ops->set in
net_shaper_nl_set_doit(), and in the rollback label after a failed
ops->group. A failed ops->delete just returns the error:

net/shaper/shaper.c:__net_shaper_delete() {
    ...
	ret = ops->delete(binding, &handle, extack);
	if (ret < 0)
		return ret;
    ...
}

So fail_shaper_del never reaches any rollback logic. It only checks that
the error gets back to userspace, plus whatever partial state the core
leaves behind. For a NODE delete, for example, net_shaper_pre_del_node()
has already run before __net_shaper_delete() fails.

Could the commit message describe what each knob actually covers?

> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index 0372a9bd63bbb..fce044a455be7 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c

[ ... ]

> @@ -1193,6 +1229,15 @@ struct netdevsim *nsim_create(struct nsim_dev *nsim_dev,
>  					 &nsim_qreset_fops);
>  	ns->vlan_dfs = debugfs_create_file("vlan", 0400, nsim_dev_port->ddir,
>  					   ns, &nsim_vlan_fops);
> +	if (nsim_dev_port_is_pf(nsim_dev_port)) {
> +		debugfs_create_bool("fail_shaper_set", 0600, nsim_dev_port->ddir,
> +				    &ns->fail_shaper_set);
> +		debugfs_create_bool("fail_shaper_del", 0600, nsim_dev_port->ddir,
> +				    &ns->fail_shaper_del);
> +		debugfs_create_bool("fail_shaper_group", 0600,
> +				    nsim_dev_port->ddir,
> +				    &ns->fail_shaper_group);
> +	}

[Severity: Medium]
Should this come with a selftest that uses the new knobs?

Documentation/process/maintainer-netdev.rst says:

  netdevsim is reserved for use by upstream tests only, so any
  new netdevsim features must be accompanied by selftests under
  tools/testing/selftests/.

At this commit, a grep for fail_shaper only matches
drivers/net/netdevsim/netdev.c and netdevsim.h. Nothing under
tools/testing/selftests/ uses it.

The text below the --- line says the goal is to test the net-shaper
rollback, but no upstream test runs these paths:

net/shaper/shaper.c:net_shaper_nl_set_doit() {
    ...
	ret = ops->set(binding, &shaper, info->extack);
	if (ret) {
		net_shaper_rollback(binding);
		return ret;
	}
    ...
}

The rollback label after a failed ops->group is in the same state.

tools/testing/selftests/drivers/net/shaper.py already runs against
netdevsim through NetDrvEnv. Could the set and group failure cases be
added there, checking that the hierarchy is unchanged after a failed
request?

>  	return ns;
>  
>  err_free_netdev:

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201022735.3588142-1-chenguang.zhao%40linux.dev
Technical Details
Message-ID: <179631887253.3146.4402323430500483472@kernel.org>
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376783-linux-kernel-netdev=dewy.ru
References: <20261201022735.3588142-1-chenguang.zhao@linux.dev>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376783-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] netdevsim: add debugfs knobs to fail net-shaper ops
Date: Thu, 03 Dec 2026 17:27:52 +0000
Organization: Usenet Network
Message-ID: <179631887253.3146.4402323430500483472@kernel.org>
References: <20261201022735.3588142-1-chenguang.zhao@linux.dev>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2553668"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:R1B6rWszQiT1TFCn8yhM6Luvx7A= sha256:nSvbq1AlqRBdxfxLFC6vmsO18RNxVMEnI2fyvIcLAos=
	sha1:M269doKebygyFGJkmbg73eAwPW4= sha256:W3YnjUEyzo06bclAQn/v/5nth2i2Z1KKJewajggESjE=
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 9537F1179E8; Thu,  3 Dec 2026 20:28:12 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.74
X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
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 Kfe1CYt4XRiz;
	Thu,  3 Dec 2026 20:28:09 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376783-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id EB5A11179D4; Thu,  3 Dec 2026 20:28:00 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 2CC032625A; Thu,  3 Dec 2026 17:27:58 +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=1796318874;
	b=K4ZuqWmqvmeHYNF7sS/arQ1i8Uc9sKPos3w3bAP693aofKLTscRafLeH8O0KqxdN4zLh
	 b0A/WXuXxfK3IFqEuSeKFaaAvjsXVcH7N61D3p/8+6qudItleG5PMaikpvAj5aYeULi3k
	 0/Y6AzFO9g6pjgmhCAoDI+yctU1ZsSdC//PcBaSYPIVe0EqKrz4ymKGov5tepQL9BxX1k
	 3/Vr6q3DQgMrJCpqLiaAl7H7iMUezfQOMFbraqZqozSLnjx8Xtui/Jx4bjzxLMv6SccBV
	 5ooTwZckF+0MaDjVr9H0yesKS3gX98aMEN6jemZIhzyoCfvq32atFxuYoPpPwZF3+uA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796318874;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=hmLZKLB2tMglNXSGIm9+K2eQa/Kozn1ItrrQynH/J1o=;
	b=pqSYf8HMtTtZmaayRx+M1f4e4NiA6Or9I0fQJAl4lMzRAkYh2JIvGBjWXIKJEeyAxTV6
	 0OOpb7EpLpQX8No6i0HIsQSat2PX3LKWHXqqKc9A0Z7remF9L7YAt7/YDOaOx1sBPadjg
	 LfVnVstCytMldn0Qlq+6sepW1nqULQetqM7JqbInC/7YRABCl07LmnfNuav/i+9pK6jXt
	 fn02SYk4EEaokEhFBwY4xPwWPREnVJOO8o061dyUNCoKvRPZ93M2lNjAaImEAYw5cCmqE
	 kUCKYMCwPPQITLnwd+YRh7OXJp2x/Vf8mfEdFtjUDhdmT6YM60DVwF4nQTEZrLrDkwA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CSKowRaU;
	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 A4FD6606A68D;
	Thu,  3 Dec 2026 17:27:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CSKowRaU
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796318873;
	b=evM+TeNG7vpKUc6EcrSaUjYa754F+E2+7UT+bcaLvvbXtMrZrqNBuTGYNy4EHx255iKG
	 m0PekfNsh40ssy16OyyYx+RY9/HK3aCifny7H/OoEeGwcRZ33BGiqnq4dVERCk1oBdzAF
	 zYxRX29E+cq+zKLbNxQjMq98IdLOKsv4bfYsORAfqkl/nZK/1Lxu01kJo8VQ9HeOjhllh
	 ECpuqoEEMmteXtJWLNkAY3F52A1dyDxs3kGbABvkEm+0TygHV66lrwsP2snY2x+9hyTYP
	 y7+NEZsIhhSC+6oqQuurwIPfmfm/1LkZLbx1bH4rb4WWFjPBlSm+MUf5lw76RM1O+qA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796318873;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=hmLZKLB2tMglNXSGIm9+K2eQa/Kozn1ItrrQynH/J1o=;
	b=1ZNDu5iXsSi9+GOwMm9B4wVMp4XfPWufcKLlWEYD1rdK22LKj0dEdald/A2sVnx2ULrO
	 9fjRNLpeiL7LU6ihvRK1WY6ZEonKg++ha03zSRUHUvZbHdH5f8n9S/BXtfLVCYROM96Ku
	 A6MKEc0wyH1OGuPvKPeX0x6UPbqxLR0b+tCtBbO/HHqMLnQadVCzWBtZzuMwpTiqsZYoo
	 md+WCX2jiY/SJ/C1rGSc12WUPZ2jZ+hGbZzT02KJ5wSRloBVg3ccFRkmHdsynqb3gpRV+
	 igT4uV0n6lHUKjnYRm690d6QhFWXOjqFbh9M+4jYyMaye5Kt1COgubDdRDDnaWh7Emg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CSKowRaU;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7498606A33D
	for <netdev@vger.kernel.org>; Thu,  3 Dec 2026 17:27:53 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0640B1F00893;
	Thu,  3 Dec 2026 17:27:52 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796318873;
	bh=hmLZKLB2tMglNXSGIm9+K2eQa/Kozn1ItrrQynH/J1o=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=CSKowRaUmn58o405sv8xU/XglWB0z+Lh5jXiML8t9wJKXus8rUcfP1U00g6UomDlu
	 1ldK5ywnzaIUhVdFL2v8bQTzJjqr14CkDBo8xZG7N55FdNeRmST1ZvlZVsYIaIS//k
	 0RAHrze3vh/xiQ50cheMqriEvE4tOdro/1sCelTVF9d7MwykRGgOi6x0F2ZFkrJuGd
	 9suWDI1hK6e2tEJQQiAKcTQDi3escht+ZEeH8LrHS1CTp5SrWfvTmC0tZzaL9gJFbL
	 xIlYfEbz99RNuBpcTmLa6uI4Ks9dHqhB49MsX2Noxb4tcBk372YAeNNamO5/4Jb/l1
	 6c4u3dprNtwBQ==
X-Cc: kuba@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
 zhaochenguang@kylinos.cn
X-In-Reply-To: <20261201022735.3588142-1-chenguang.zhao@linux.dev>
X-sashiko-severity: Medium
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