[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b25e45e0-7c37-4e93-8372-e3fbfc3b7903@intel.com>
Date: Thu, 13 Feb 2025 13:42:44 +0100
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Andy Gospodarek <andrew.gospodarek@...adcom.com>, Aron Silverton
<aron.silverton@...cle.com>, Dan Williams <dan.j.williams@...el.com>, "Daniel
Vetter" <daniel.vetter@...ll.ch>, Dave Jiang <dave.jiang@...el.com>, "David
Ahern" <dsahern@...nel.org>, Andy Gospodarek <gospo@...adcom.com>, "Christoph
Hellwig" <hch@...radead.org>, Itay Avraham <itayavr@...dia.com>, Jiri Pirko
<jiri@...dia.com>, Jonathan Cameron <Jonathan.Cameron@...wei.com>, "Jakub
Kicinski" <kuba@...nel.org>, Leonid Bloch <lbloch@...dia.com>, Leon
Romanovsky <leonro@...dia.com>, <linux-cxl@...r.kernel.org>,
<linux-rdma@...r.kernel.org>, <netdev@...r.kernel.org>, Saeed Mahameed
<saeedm@...dia.com>, "Nelson, Shannon" <shannon.nelson@....com>
Subject: Re: [PATCH v4 02/10] fwctl: Basic ioctl dispatch for the character
device
On 2/7/25 01:13, Jason Gunthorpe wrote:
> Each file descriptor gets a chunk of per-FD driver specific context that
> allows the driver to attach a device specific struct to. The core code
> takes care of the memory lifetime for this structure.
>
> The ioctl dispatch and design is based on what was built for iommufd. The
> ioctls have a struct which has a combined in/out behavior with a typical
> 'zero pad' scheme for future extension and backwards compatibility.
>
> Like iommufd some shared logic does most of the ioctl marshalling and
> compatibility work and tables diatches to some function pointers for
> each unique iotcl.
>
> This approach has proven to work quite well in the iommufd and rdma
> subsystems.
>
> Allocate an ioctl number space for the subsystem.
>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Signed-off-by: Jason Gunthorpe <jgg@...dia.com>
> diff --git a/drivers/fwctl/main.c b/drivers/fwctl/main.c
> index 34946bdc3bf3d7..d561deaf2b86d8 100644
> --- a/drivers/fwctl/main.c
> +++ b/drivers/fwctl/main.c
> @@ -10,6 +10,8 @@
> #include <linux/module.h>
> #include <linux/slab.h>
>
> +#include <uapi/fwctl/fwctl.h>
> +
> enum {
> FWCTL_MAX_DEVICES = 4096,
> };
> @@ -18,20 +20,128 @@ static_assert(FWCTL_MAX_DEVICES < (1U << MINORBITS));
> static dev_t fwctl_dev;
> static DEFINE_IDA(fwctl_ida);
>
> +struct fwctl_ucmd {
> + struct fwctl_uctx *uctx;
> + void __user *ubuffer;
> + void *cmd;
> + u32 user_size;
> +};
> +
> +/* On stack memory for the ioctl structs */
> +union ucmd_buffer {
for most names you follow the usual prefixing rules, would be good
to do for all
Powered by blists - more mailing lists