Subject: Re: [net-next,05/10] devlink: support index-based lookup via bus_name/dev_name handle

From: Jakub Kicinski <[email-masked]>
Date: Tue, 24 Feb 2026 18:23:17 -0800

This is an AI-generated review of your patch. The human sending this
email says "FYI"

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
devlink: support index-based lookup via bus_name/dev_name handle

Devlink instances without a backing device use bus_name
"devlink_index" and dev_name set to the decimal index string.
When user space sends this handle, detect the pattern and perform
a direct xarray lookup by index instead of iterating all instances.

> diff --git a/net/devlink/netlink.c b/net/devlink/netlink.c
> index b73cec31089f..127f337489c0 100644
> --- a/net/devlink/netlink.c
> +++ b/net/devlink/netlink.c
> @@ -200,6 +200,15 @@ devlink_get_from_attrs_lock(struct net *net, struct nlattr **attrs,
>  	busname = nla_data(attrs[DEVLINK_ATTR_BUS_NAME]);
>  	devname = nla_data(attrs[DEVLINK_ATTR_DEV_NAME]);
>
> +	if (!strcmp(busname, DEVLINK_INDEX_BUS_NAME)) {
                                  ^^^^^^^^^^^^^^^^^^^^^^^^

Where is DEVLINK_INDEX_BUS_NAME defined? This constant is referenced
here but doesn't appear to be defined anywhere in the codebase.

I searched include/net/, include/uapi/, and net/devlink/ directories and
couldn't find this symbol defined. This will cause a compilation failure.

Based on the commit message mentioning 'devlink_index' as the bus_name
pattern, should this constant be defined somewhere like:

    #define DEVLINK_INDEX_BUS_NAME "devlink_index"

or was it intended to be defined in a previous commit in the series?

> +		if (kstrtoul(devname, 10, &index))
> +			return ERR_PTR(-EINVAL);
> +		devlink = devlinks_xa_lookup_get(net, index);
> +		if (!devlink)
> +			return ERR_PTR(-ENODEV);
> +		goto found;
> +	}
> +
>  	devlinks_xa_for_each_registered_get(net, index, devlink) {
>  		if (strcmp(devlink->bus_name, busname) == 0 &&
>  		    strcmp(devlink->dev_name, devname) == 0)