Subject: Re: [patch net-next] net: devlink: convert port_list into xarray

From: Jakub Kicinski <[email-masked]>
Date: Fri, 4 Nov 2022 19:19:10 -0700

On Fri,  4 Nov 2022 16:14:05 +0100 Jiri Pirko wrote:
> -	list_add_tail(&devlink_port->list, &devlink->port_list);
> +	err = xa_alloc(&devlink->ports, &id, devlink_port, XA_LIMIT(id, id),
> +		       GFP_KERNEL);
> +	if (err) {
> +		mutex_destroy(&devlink_port->reporters_lock);
> +		return err;
> +	}

Odd if there isn't a cleaner API for allocating a specific ID.
Perhaps xa_insert() is what we need?