Re: [PATCH net-next V7 07/14] devlink: Add parent dev to devlink API

From: Cosmin Ratiu

Date: Wed Feb 11 2026 - 11:28:27 EST


On Mon, 2026-02-02 at 20:00 -0800, Jakub Kicinski wrote:
> > + info->user_ptr[1] = parent_devlink;
>
> Let's convert devlink to use proper overlay struct over info->cb ?
> The user_ptr array only has two entries so devlink stuffs all the
> extra pointers into the second slot. But the cb is much larger - 48B
> so we can easily give each of these values a dedicated pointer.

I assume you are referring to info->ctx, added by Paolo as part of the
netshaper series. If that's the case, sure, I'll convert devlink to
that as part of the next version of this series.

>
> > + /* Drop the parent devlink lock but don't release
> > the reference.
> > + * This will keep it alive until the end of the
> > request.
> > + */
>
> To be clear -- devlink instances do not behave like netdev instances.
> netdev instances prevent unregistration of the netdev.
> devlink refs are normal refs, they just keep the memory around.
> If memory serves me..

If no reference is held, a concurrent user op could release the parent
devlink instance altogether, and free its memory, that's the reason for
keeping a ref alive for the duration of this request.

Cosmin.