๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26482

Re: [PATCH net-next v24 07/14] virtio_net: Create a FF group for ethtool steering

#26482
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 15:51
180 lines
14081 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 2 ยท 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] virtnet_ff_cleanup() in drivers/net/virtio_net.c wraps the
  result of virtio_admin_obj_destroy() in WARN_ON_ONCE(err).
- [Medium] This patch adds a new step to virtnet_ff_init():
  virtio_admin_obj_create() for the ethtool FF group.
- [Low] The commit message only says the ethtool group is created during
  initialization.

--

virtio_net: Create a FF group for ethtool steering

This commit creates one flow filter group for ethtool steering rules in
virtnet_ff_init() and destroys it in virtnet_ff_cleanup(). It also clamps
the groups_limit programmed into the device to VIRTNET_FF_MAX_GROUPS. It
adds the VIRTIO_NET_RESOURCE_OBJ_FF_GROUP uapi definitions as well.

> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 03aea14da492e..d5ca5a4d4378c 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c

[ ... ]

> @@ -5924,6 +5928,12 @@ static int virtnet_ff_init(struct virtnet_ff *ff, struct virtio_device *vdev)
>  		goto err_ff_action;
>  	}
>  
> +	if (le32_to_cpu(ff->ff_caps->groups_limit) < VIRTNET_FF_MAX_GROUPS) {
> +		err = -ENOSPC;
> +		goto err_ff_action;
> +	}
> +	ff->ff_caps->groups_limit = cpu_to_le32(VIRTNET_FF_MAX_GROUPS);
> +

[Severity: Low]
The commit message only says the group is created during initialization.
This hunk also changes what gets programmed into the device with
VIRTIO_NET_FF_RESOURCE_CAP. groups_limit is now overwritten with
VIRTNET_FF_MAX_GROUPS instead of keeping the value read from the device.

That reverses the earlier "virtio_net: Query and set flow filter caps"
patch in this series ("For now setting what was read is sufficient").
Could the commit message mention this?

Also, can the -ENOSPC branch ever be taken? With VIRTNET_FF_MAX_GROUPS
set to 1, the only value below it is 0. An earlier check in
virtnet_ff_init() already rejects 0:

	if (!le32_to_cpu(ff->ff_caps->groups_limit) ||
	    ...
		err = -EINVAL;
		goto err_ff;
	}

>  	err = virtio_admin_cap_set(vdev,
>  				   VIRTIO_NET_FF_RESOURCE_CAP,
>  				   ff->ff_caps,
> @@ -5969,6 +5979,19 @@ static int virtnet_ff_init(struct virtnet_ff *ff, struct virtio_device *vdev)
>  	if (err)
>  		goto err_ff_action;
>  
> +	ethtool_group.group_priority = cpu_to_le16(VIRTNET_FF_ETHTOOL_GROUP_PRIORITY);
> +
> +	/* Use priority for the object ID. */
> +	err = virtio_admin_obj_create(vdev,
> +				      VIRTIO_NET_RESOURCE_OBJ_FF_GROUP,
> +				      VIRTNET_FF_ETHTOOL_GROUP_PRIORITY,
> +				      VIRTIO_ADMIN_GROUP_TYPE_SELF,
> +				      0,
> +				      &ethtool_group,
> +				      sizeof(ethtool_group));
> +	if (err)
> +		goto err_ff_action;

[Severity: Medium]
Unlike the earlier CAP_SET calls, this one asks the device to allocate
an object, so a device-side resource error is a realistic result. One
example is a resource exhaustion status when FF resources are shared
between functions. Should that error make the whole interface fail?

Both callers of virtnet_ff_init() accept only -EOPNOTSUPP.

virtnet_probe():

	err = virtnet_ff_init(&vi->ff, vi->vdev);
	if (err && err != -EOPNOTSUPP) {
		rtnl_unlock();
		goto free_unregister_netdev;
	}

virtnet_restore_up():

	err = virtnet_ff_init(&vi->ff, vi->vdev);
	if (err && err != -EOPNOTSUPP) {
		rtnl_unlock();
		virtnet_freeze_down(vi->vdev);
		remove_vq_common(vi);
		return err;
	}

If the device fails to create this group, which is only needed for the
optional ethtool steering feature, the virtio-net interface is lost at
probe or after resume. The device does not just run without flow
steering. The commit message does not mention this new failure mode.

> +
>  	ff->vdev = vdev;
>  	ff->ff_supported = true;
>  
> @@ -5993,9 +6016,18 @@ static int virtnet_ff_init(struct virtnet_ff *ff, struct virtio_device *vdev)
>  
>  static void virtnet_ff_cleanup(struct virtnet_ff *ff)
>  {
> +	int err;
> +
>  	if (!ff->ff_supported)
>  		return;
>  
> +	err = virtio_admin_obj_destroy(ff->vdev,
> +				       VIRTIO_NET_RESOURCE_OBJ_FF_GROUP,
> +				       VIRTNET_FF_ETHTOOL_GROUP_PRIORITY,
> +				       VIRTIO_ADMIN_GROUP_TYPE_SELF,
> +				       0);
> +	WARN_ON_ONCE(err);

[Severity: Medium]
Is WARN_ON_ONCE() the right choice here? The device and the transport
control this return value, and cleanup continues the same way whatever
it is.

On a surprise hot-unplug, virtio_pci_remove() marks the device broken
before the driver's remove runs. The admin vq is broken too:

virtio_pci_remove()
    if (!pci_device_is_present(pci_dev))
        virtio_break_device(&vp_dev->vdev);
    unregister_virtio_device()
        virtnet_remove()
            virtnet_ff_cleanup()
                virtio_admin_obj_destroy()
                    vp_modern_admin_cmd_exec()
                        virtqueue_exec_admin_cmd()
                            if (virtqueue_is_broken(vq))
                                return -EIO;

The same thing happens in these cases:

- The device advertises RESOURCE_OBJ_CREATE but not
  RESOURCE_OBJ_DESTROY in supported_cmds, so
  virtqueue_exec_admin_cmd() returns -EOPNOTSUPP.
- The device returns any non-OK admin status.
- The kzalloc() in virtio_admin_obj_destroy() fails.

Each of these gives a WARN splat, or a panic with panic_on_warn.
vp_modern_admin_cmd_exec() already logs the failure with dev_err().

A later patch in the series adds the same WARN_ON_ONCE(err) around
classifier destroy.

> +
>  	kfree(ff->ff_actions);
>  	kfree(ff->ff_mask);
>  	kfree(ff->ff_caps);

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202150502.3350030-1-shshitrit%40nvidia.com
Technical Details
Message-ID: <179631310987.3146.7301573743614179602@kernel.org>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376735-linux-kernel-netdev=dewy.ru
References: <20261202150502.3350030-8-shshitrit@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376735-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v24 07/14] virtio_net: Create a FF group for
 ethtool steering
Date: Thu, 03 Dec 2026 15:51:49 +0000
Organization: Usenet Network
Message-ID: <179631310987.3146.7301573743614179602@kernel.org>
References: <20261202150502.3350030-8-shshitrit@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2534093"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:b0Durt+6fIWYdvCYYtEPhfK/tUQ= sha256:N7DN5XhAPTYqiGsV22+h7koMyARkbrfSQL4wa40q58A=
	sha1:q1fkZc/b+b/JOMUxHIoaKfNghOU= sha256:ljhYrJbaV7i1LxEonxpEKsu4JWHnIIaeWMN0K+17HM8=
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 3446F1179C2; Thu,  3 Dec 2026 18:52:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.64
X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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 BahiYWiNabaF;
	Thu,  3 Dec 2026 18:52:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376735-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 4405A1179BA; Thu,  3 Dec 2026 18:51:58 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 9EA992C21A; Thu,  3 Dec 2026 15:51:52 +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=1796313112;
	b=wwKATPidymwwyAL7qJ1t8MlADwWzdMIyL+4aqYuTB/BIOHZnRM0OZMv80QO2KkdWNaUZ
	 e1OS7jRvWSomiRkMxCtm1W/3kcyDBpBqWv0dn+S/J2vaaJAXPqJPeOihN95cC+RDOH0S/
	 sp2O4kPIwHGuqotf9azeTgfM7fliZLqsaaSq0ZavH9swYU7c2dYqizmq9vD21ymVkXggf
	 cxnHNXsrXz0uXwg69IZcS0/PhAUg6D3+sN8BZ2qaXDfCP3LnMatbePc8nRpiuSfsvwnQK
	 BA+grLj+TRsyDxNTZeFTbyD5efFiqObe+Sgn9yNrnJm8w8SHw/MB+IEVQhNrYjxR0Ig==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796313112;
	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=2Kv/nMw7iiHkK0gFSoc2yc/j0xxBvgbsCTcEitTnMwY=;
	b=x2Im+onIYoc4QGD+NO5DlSwdc+3IFnwKN5OrH1NNtEifGC84KpxPQjxO3nasZ6BwVZCD
	 ziusoKKR4GhpeN31U0Yh9kiZGXwCYzEwWBdAZOOywqSjnBAKLPUcP28RTP+epCuiPeQ5B
	 2wuHeBVSg+RYWTWwlSu7XgSuX+lRxxl6A+fQqYHvb0sjSrHuG7Fkf6PM+0sHqbXtWCWxK
	 zDZLjdBqKjx5R4ltxcKv6FGeG46QvbWIQAlHUnLf0Is2F0J+iDIKeAtYNZuygmQCPE7Ye
	 gwXJnPgRPe5/FccVdyJVKW1R0CU9DaLMh0DyY+M0Ut3OYkko6784+Qn35ciATHRju9w==
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=n4JMOqlw;
	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 7776F606A681;
	Thu,  3 Dec 2026 15:51:52 +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=n4JMOqlw
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=1796313111;
	b=tSh2sA6G2UBgN6hJIeZrl9bZjY97y5B6YK5YlFrK4m+exhO1QFPyZopbVnOQrSGCh2aT
	 9WMXmMbgKlQLG72bLPndGNajddVzuPzUGOqUPtLWOZSaBf+v1VXyFXZEb8XqRlmRok1xF
	 mF25ECk2BcwOjcxcUAxAV85H8lGpwiaIIeDZp9yUXkgwPZxOPoXHwTECyp6/anSUVzWZF
	 AZYzIs3v+DU9mM20Qlj02TepSZi1DhJR2ICuu9GnwpCG1qXI0MZq0SXRbcMZb12WrjGtg
	 uxXuYGgmWJykcmHB3ykymC/lKiAYNdBdQlqVHKn5HxBYCxKv5dslWW/nI6UicX2o08w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796313111;
	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=2Kv/nMw7iiHkK0gFSoc2yc/j0xxBvgbsCTcEitTnMwY=;
	b=FgknvBwY7emZ06cwYXfpKUFrKUMEgkGpuqCqgBx5kZyTnpODUzgk+896v7KWDMlOYD9d
	 jKPfdzE8SUbbVECV/W7cK51LiQIBaWH6xeCP5psf5944CmBp7jxhbxBiUE/am8pzvf6WM
	 8oM2icxdAJ/o+XA5W95B3ZUQutjsXsOON1+u3Zqt0Uv1olUl+0JHHHTZ+ODdRdn1msrzN
	 ir+tB198Rk2slb4AR+xd6c4tvOabp/F5t2tY7R7EwgURVuHUCvXS250jUojbk0f8A/4Z4
	 8XM2AXYLmtCkogd/KZfVnEevTnQoL+hQts4LP8bEwcCghyEnulhBL0TARZR/goftCGQ==
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=n4JMOqlw;
	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 960D7606A32D;
	Thu,  3 Dec 2026 15:51:51 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F9631F00924;
	Thu,  3 Dec 2026 15:51:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796313111;
	bh=2Kv/nMw7iiHkK0gFSoc2yc/j0xxBvgbsCTcEitTnMwY=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=n4JMOqlw/74mc6wTvw33le77Yemlquon3fATfYMj2Meyo9+yXYcr09Ejl3Ydmk2g1
	 V2fAj+F7473SSNrbvVI5mYgY2h+yDetwK7kKdS/616G0F08oIme6vOQQDB6XufVgpc
	 EYouzGS1EixkdM4grhB8FPcFVdzmxa9YgwtY3zTPnWjNXkv2EwK7XpZP94PCJtw6Ad
	 LgIikch1Yz6V7WUKBKO9dDBdbNa01TzWcxrA/vtmONupwBvITGGzinaDK5oAKM6oho
	 O8fcuCsdvkDUxtTR8Xn9LEJasPZW0iFfNUwdBklowD6d8TfQ4iTXty6JwmJlJzUmT6
	 9kMqJumYWBHRQ==
X-Cc: netdev@vger.kernel.org, mst@redhat.com, jasowang@redhat.com,
 pabeni@redhat.com, virtualization@lists.linux.dev, parav@nvidia.com,
 yohadt@nvidia.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com,
 jgg@ziepe.ca, kevin.tian@intel.com, kuba@kernel.org, andrew+netdev@lunn.ch,
 edumazet@google.com, danielj@nvidia.com
X-In-Reply-To: <20261202150502.3350030-8-shshitrit@nvidia.com>
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