Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: chenguang.zhao@linux.dev
Cc: kuba@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	zhaochenguang@kylinos.cn
Subject: Re: [PATCH net-next] netdevsim: add debugfs knobs to fail net-shaper ops
Date: Thu, 03 Dec 2026 17:27:52 +0000	[thread overview]
Message-ID: <179631887253.3146.4402323430500483472@kernel.org> (raw)
In-Reply-To: <20261201022735.3588142-1-chenguang.zhao@linux.dev>

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

      reply	other threads:[~2026-12-03 17:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  2:27 [PATCH net-next] netdevsim: add debugfs knobs to fail net-shaper ops Chenguang Zhao
2026-12-03 17:27 ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179631887253.3146.4402323430500483472@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenguang.zhao@linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zhaochenguang@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox