Re: [PATCH rdma-core 00/20] Remove uapi structure copies from drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 20, 2018 at 03:18:30PM -0600, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> 
> This converts most of the drivers to have largely empty -abi.h headers that
> contain only simple mechanical declarations, such as:
> 
> DECLARE_DRV_CMD(mlx5_alloc_ucontext, IB_USER_VERBS_CMD_GET_CONTEXT,
> 		mlx5_ib_alloc_ucontext_req_v2, mlx5_ib_alloc_ucontext_resp);
> 
> Similar to the new DECLARE_CMD macro, this automatically constructs a driver
> request and response structure using the kernel uapi headers:
> 
> struct mlx5_alloc_ucontext {
>      struct ibv_get_context ibv_cmd;
>      union {
>           _STRUCT_mlx5_ib_alloc_ucontext_req_v2; // Inlined version of below
>           struct mlx5_ib_alloc_ucontext_req_v2 drv_payload;
>      };
> };
> 
> struct mlx5_alloc_ucontext_resp {
>     struct ib_uverbs_get_context ibv_resp;
>     union {
>         _STRUCT_mlx5_ib_alloc_ucontext_resp; // Inlined version of below
>         struct mlx5_ib_alloc_ucontext_resp drv_payload;
>     };
> };
> 
> As with kern-abi.h, a codegen script is used to produce the STRUCT* macros
> from the real kernel ABI headers.
> 
> Everything is tied together with the enum tag to minimize typing and avoid
> errors, the macros match the correct core structs via the tag to the driver
> structs. This is preparation for a future bulk change to push the new ioctl
> API down into the drivers.
> 
> The macro also contains static_assertions that ensure padding isn't being
> added when the structs are concatenated, which detected several bugs.
> 
> Patches for the remaining drivers are still pending on the kernel changes.
> 
> This work supports the 32/64 compat by forcing the userspace to use the same
> memory layouts as the kernel after the kernel layouts have been validated to
> be good.
> 
> This is a PR:
> 
> https://github.com/linux-rdma/rdma-core/pull/308

Merged

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux