Re: [PATCH v2 3/8] fwctl: FWCTL_INFO to return basic information about the device

Jonathan Cameron
2024-07-30T17:34:44Z

On Mon, 29 Jul 2024 13:35:13 -0300
Jason Gunthorpe <jgg@nvidia.com> wrote:

> On Fri, Jul 26, 2024 at 04:15:03PM +0100, Jonathan Cameron wrote:
> > On Mon, 24 Jun 2024 19:47:27 -0300
> > Jason Gunthorpe <jgg@nvidia.com> wrote:
> >
> > > Userspace will need to know some details about the fwctl interface being
> > > used to locate the correct userspace code to communicate with the
> > > kernel. Provide a simple device_type enum indicating what the kernel
> > > driver is.
> >
> > As below - maybe consider a UUID?
> > Would let you decouple allocating those with upstreaming drivers.
> > We'll just get annoying races on the enum otherwise as multiple
> > drivers get upstreamed that use this.
>
> I view the coupling as a feature - controlling uABI number assignment
> is one of the subtle motivations the kernel community has typically
> used to encourage upstream participation.

Hmm. I'm not sure it's worth the possible pain if this becomes
popular. Maybe you'll have to run a reservation hotline.

>
> > > +/**
> > > + * struct fwctl_info - ioctl(FWCTL_INFO)
> > > + * @size: sizeof(struct fwctl_info)
> > > + * @flags: Must be 0
> > > + * @out_device_type: Returns the type of the device from enum fwctl_device_type
> >
> > Maybe a UUID? Avoid need to synchronize that list for ever.
> >
> > > + * @device_data_len: On input the length of the out_device_data memory. On
> > > + * output the size of the kernel's device_data which may be larger or
> > > + * smaller than the input. Maybe 0 on input.
> > > + * @out_device_data: Pointer to a memory of device_data_len bytes. Kernel will
> > > + * fill the entire memory, zeroing as required.
> >
> > Why do we need device in names of these two?
>
> I'm not sure I understand this question?
>
> out_device_type returns the "name"
>
> out_device_data returns a struct of data, the layout of the struct is
> defined by out_device_type

What is device in this case? fwctl struct device, hardware device, something else?

I'm not sure what the names give over
fwctl_type, out_data_len, out_data

The first one can't just be type as likely as not out_data contains a
type field specific to the fwctl_device_type.

I don't feel that strongly about this though, so stick to device
if you like. I'll get used to it.

Jonathan

>
> Jason