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 Jason Gunthorpe (8): Update kernel headers verbs: Use kabi for IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION rxe: Get rid of rxe_get_context_resp Allow static_assert to be used verbs: Remove bogus padding from ibv_dealloc_mw verbs: Provide infrastructure to remove kernel headers copies verbs: Replace more of kern-abi.h with kernel headers verbs: Use kabi for create_qp CMakeLists.txt | 13 + buildlib/fixup-include/assert.h | 10 + buildlib/make_abi_structs.py | 56 ++++ kernel-headers/CMakeLists.txt | 35 +++ kernel-headers/kern-abi.c | 1 + kernel-headers/rdma/ib_user_verbs.h | 5 +- kernel-headers/rdma/mlx4-abi.h | 14 + kernel-headers/rdma/rdma_user_ioctl.h | 4 +- libibverbs/CMakeLists.txt | 1 + libibverbs/cmd.c | 18 +- libibverbs/cmd_cq.c | 2 +- libibverbs/cmd_fallback.c | 4 +- libibverbs/ibverbs.h | 4 +- libibverbs/kern-abi.h | 573 +++++++++++----------------------- providers/mlx4/verbs.c | 5 +- providers/mlx5/verbs.c | 5 +- providers/rxe/rxe-abi.h | 5 - 17 files changed, 327 insertions(+), 428 deletions(-) create mode 100644 buildlib/fixup-include/assert.h create mode 100644 buildlib/make_abi_structs.py create mode 100644 kernel-headers/kern-abi.c -- 2.16.1 -- 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