From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F9631F00924; Thu, 3 Dec 2026 15:51:50 +0000 (UTC) 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== Subject: Re: [PATCH net-next v24 07/14] virtio_net: Create a FF group for ethtool steering From: netdev-bot+sashiko@kernel.org To: shshitrit@nvidia.com 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 Date: Thu, 03 Dec 2026 15:51:49 +0000 Message-ID: <179631310987.3146.7301573743614179602@kernel.org> In-Reply-To: <20261202150502.3350030-8-shshitrit@nvidia.com> References: <20261202150502.3350030-8-shshitrit@nvidia.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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, > + ðtool_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