Re: [PATCH rdma-core 0/8] Complete removing duplication in libibverbs/kern-abi.h

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

 



On Tue, Mar 13, 2018 at 4:07 PM, Jason Gunthorpe <jgg@xxxxxxxx> wrote:
> From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
>
> This is the last step in the project to remove the kernel header duplication
> from libibverbs/kern-abi.h. After this step is done the drivers can be
> converted to remove their duplication as well.
>
> The basic approach preserves the existing code base by not changing the struct
> tags with the help of a simple pre-processing script run by cmake. The script
> extracts the struct members from the kernel uapi header and emits a series of
> #defines that create a matching anonymous and tagless struct.
>
> The macros then use this to build up the required struct, for instance
> dereg_mr will be built up as:
>
> #define _STRUCT_ib_uverbs_dereg_mr struct { __u32 mr_handle; }
>
> struct ibv_dereg_mr {
>         struct ib_uverbs_cmd_hdr hdr;
>         union {
>                 _STRUCT_ibv_uverbs_dereg_mr;
>                 struct ib_uverbs_dereg_mr core_payload;
>         };
> };
>
> Every struct now gains the 'core_payload' member as a union which is required
> for the new IOCTL conversion, and indirectly uses the kabi data instead of
> duplicating it.
>
> The macros also produce a type database built around the command enum name
> which allows the ultimate driver support to become very simple:
>
> DECLARE_DRV_CMD(urxe_create_cq, IB_USER_VERBS_CMD_CREATE_CQ,
>                 empty, rxe_create_cq_resp);
>
> And finally the macros check the compile to ensure no extra padding is being
> inserted when the core and driver structs are combined into one struct.
>
> A preview of the following series showing the WIP driver changes is available
> here:
>
> https://github.com/jgunthorpe/rdma-plumbing/commits/32compat
>
> This work is required to fix all the 32/64 compat issues by forcing a single
> source for the struct layouts.
>
> This is a PR:
>
> https://github.com/linux-rdma/rdma-core/pull/305

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