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

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

 



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

Jason Gunthorpe (20):
  qedr: Move qedr to exclusively use the kernel uapi headers
  rxe: Move rxe to exclusively use the kernel uapi headers
  mlx4: Use kernel uapi headers
  mlx4: Move mlx4 to exclusively use the kernel uapi headers
  mlx5: Use kernel uapi headers
  mlx5: Use kernel uapi header structs
  mlx5: Do not use internal ABI structures in place of kernel ABI
  mlx5: Move mlx5 to exclusively use the kernel uapi headers
  nes: Use kernel uapi headers
  nes: Move nes to exclusively use the kernel uapi headers
  cxgb4: Use kernel uapi headers
  cxgb4: Move cxgb4 to exclusively use the kernel uapi headers
  mthca: Use kernel uapi headers
  mthca: Move mthca to exclusively use the kernel uapi headers
  vmw_pvrdma: Use new kABI macros
  hns: Move hns to exclusively use the kernel uapi headers
  bnxt_re: Use kernel uapi headers
  bnxt: Move bnxt to exclusively use the kernel uapi headers
  i40iw: Use kernel uapi headers
  i40iw: Move i40iw to exclusively use the kernel uapi headers

 buildlib/make_abi_structs.py                       |   6 +-
 kernel-headers/CMakeLists.txt                      |  11 +
 providers/bnxt_re/bnxt_re-abi.h                    |  68 +---
 providers/bnxt_re/main.c                           |   6 +-
 providers/bnxt_re/verbs.c                          |  30 +-
 providers/cxgb4/cxgb4-abi.h                        |  85 ++---
 providers/cxgb4/dev.c                              |   2 +-
 providers/cxgb4/verbs.c                            |   8 +-
 providers/hns/hns_roce_u_abi.h                     |  44 +--
 providers/i40iw/i40iw-abi.h                        |  81 +----
 providers/i40iw/i40iw_umain.c                      |   2 +-
 providers/i40iw/i40iw_uverbs.c                     |   6 +-
 providers/mlx4/mlx4-abi.h                          | 198 ++----------
 providers/mlx4/mlx4.c                              |   4 +-
 providers/mlx4/srq.c                               |   2 +-
 providers/mlx4/verbs.c                             |  28 +-
 providers/mlx5/mlx5-abi.h                          | 356 +++------------------
 providers/mlx5/mlx5.c                              |  20 +-
 providers/mlx5/mlx5.h                              |   6 -
 providers/mlx5/verbs.c                             |  89 +++---
 providers/mthca/mthca-abi.h                        |  87 +----
 providers/mthca/mthca.c                            |   2 +-
 providers/mthca/verbs.c                            |  16 +-
 providers/nes/nes-abi.h                            |  90 +-----
 providers/nes/nes_umain.c                          |   2 +-
 providers/nes/nes_uverbs.c                         |  10 +-
 providers/qedr/qelr_abi.h                          |  91 +-----
 providers/qedr/qelr_main.c                         |   5 +-
 providers/qedr/qelr_verbs.c                        |  18 +-
 providers/rxe/rxe-abi.h                            |  46 +--
 providers/rxe/rxe.c                                |   4 +-
 providers/rxe/rxe.h                                |   8 +-
 providers/vmw_pvrdma/cq.c                          |   6 +-
 .../vmw_pvrdma/{pvrdma-abi-fix.h => pvrdma-abi.h}  |  45 +--
 providers/vmw_pvrdma/pvrdma.h                      |   2 +-
 providers/vmw_pvrdma/pvrdma_main.c                 |   2 +-
 providers/vmw_pvrdma/qp.c                          |  16 +-
 providers/vmw_pvrdma/verbs.c                       |   2 +-
 38 files changed, 366 insertions(+), 1138 deletions(-)
 rename providers/vmw_pvrdma/{pvrdma-abi-fix.h => pvrdma-abi.h} (74%)

-- 
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



[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