Netdev List
 help / color / mirror / Atom feed
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
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	[thread overview]
Message-ID: <179631310987.3146.7301573743614179602@kernel.org> (raw)
In-Reply-To: <20261202150502.3350030-8-shshitrit@nvidia.com>

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

  reply	other threads:[~2026-12-03 15:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 15:04 [PATCH net-next v24 00/14] virtio_net: Add ethtool flow rules support Shahar Shitrit
2026-12-02 15:04 ` [PATCH net-next v24 01/14] virtio_pci: Remove supported_caps cache and build assert Shahar Shitrit
2026-12-02 15:04 ` [PATCH net-next v24 02/14] virtio_pci: Fix sleeping under spinlock in admin command path Shahar Shitrit
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:04 ` [PATCH net-next v24 03/14] virtio: Add config_op for admin commands Shahar Shitrit
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:04 ` [PATCH net-next v24 04/14] virtio: Expose generic device capability operations Shahar Shitrit
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:04 ` [PATCH net-next v24 05/14] virtio: Expose object create and destroy API Shahar Shitrit
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:04 ` [PATCH net-next v24 06/14] virtio_net: Query and set flow filter caps Shahar Shitrit
2026-12-03 13:16   ` Michael S. Tsirkin
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:04 ` [PATCH net-next v24 07/14] virtio_net: Create a FF group for ethtool steering Shahar Shitrit
2026-12-03 15:51   ` netdev-bot+sashiko [this message]
2026-12-02 15:04 ` [PATCH net-next v24 08/14] ethtool: Introduce ethtool_flow_type_mask() Shahar Shitrit
2026-12-02 15:04 ` [PATCH net-next v24 09/14] virtio_net: Implement layer 2 ethtool flow rules Shahar Shitrit
2026-12-03 13:19   ` Michael S. Tsirkin
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:04 ` [PATCH net-next v24 10/14] virtio_net: Use existing classifier if possible Shahar Shitrit
2026-12-03 13:20   ` Michael S. Tsirkin
2026-12-02 15:04 ` [PATCH net-next v24 11/14] virtio_net: Implement IPv4 ethtool flow rules Shahar Shitrit
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:05 ` [PATCH net-next v24 12/14] virtio_net: Add support for IPv6 ethtool steering Shahar Shitrit
2026-12-02 15:05 ` [PATCH net-next v24 13/14] virtio_net: Add support for TCP and UDP ethtool rules Shahar Shitrit
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:05 ` [PATCH net-next v24 14/14] virtio_net: Add get ethtool flow rules ops Shahar Shitrit
2026-12-03 15:51   ` netdev-bot+sashiko
2026-12-02 15:08 ` [PATCH net-next v24 00/14] virtio_net: Add ethtool flow rules support netdev-bot+sinfo
     [not found]   ` <BL0PR12MB5505B05C081539D249C49DCCDA4B2@BL0PR12MB5505.namprd12.prod.outlook.com>
2026-12-03 11:06     ` Shahar Shitrit

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=179631310987.3146.7301573743614179602@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=danielj@nvidia.com \
    --cc=edumazet@google.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=kevin.tian@intel.com \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parav@nvidia.com \
    --cc=shshitrit@nvidia.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=yohadt@nvidia.com \
    /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