]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
IB/mlx5: Move and decouple user vendor structures
authorLeon Romanovsky <leon@kernel.org>
Thu, 22 Sep 2016 14:31:11 +0000 (17:31 +0300)
committerDoug Ledford <dledford@redhat.com>
Fri, 7 Oct 2016 20:54:34 +0000 (16:54 -0400)
This patch decouples and moves vendors specific structures to
common UAPI folder which will be visible to all consumers.

These structures are used by user-space library driver
(libmlx5) and currently manually copied to that library.

This move will allow cross-compile against these files and
simplify introduction of vendor specific data.

Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
MAINTAINERS
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/mr.c
drivers/infiniband/hw/mlx5/qp.c
drivers/infiniband/hw/mlx5/srq.c
include/uapi/rdma/Kbuild
include/uapi/rdma/mlx5-abi.h [moved from drivers/infiniband/hw/mlx5/user.h with 84% similarity]

index 87e23cda8dc1a611a60cec381a9d98a72f30d4b6..e76efbc414cd8c70f6dbc486940eb9fb12fc2ac0 100644 (file)
@@ -7819,6 +7819,7 @@ Q:        http://patchwork.ozlabs.org/project/netdev/list/
 S:     Supported
 F:     drivers/net/ethernet/mellanox/mlx5/core/
 F:     include/linux/mlx5/
+F:     include/uapi/rdma/mlx5-abi.h
 
 MELLANOX MLX5 IB driver
 M:     Matan Barak <matanb@mellanox.com>
index 35a9f718e66948804c44117f65d584a9c4739f95..1188fef08450dd5e4696956139965bfe83c9ab7b 100644 (file)
@@ -35,7 +35,6 @@
 #include <rdma/ib_user_verbs.h>
 #include <rdma/ib_cache.h>
 #include "mlx5_ib.h"
-#include "user.h"
 
 static void mlx5_ib_cq_comp(struct mlx5_core_cq *cq)
 {
index 29878aa716ee3ae4445083006d1b2cce7dc931a6..f4160d56dc4f3b43f65c25969c8bd34c1f371d43 100644 (file)
@@ -54,7 +54,6 @@
 #include <linux/in.h>
 #include <linux/etherdevice.h>
 #include <linux/mlx5/fs.h>
-#include "user.h"
 #include "mlx5_ib.h"
 
 #define DRIVER_NAME "mlx5_ib"
index 40fe1a65402b13ad1586f3d66f12f2a962e71480..1df8a67d4f02328a6a2e9e47094ffd0dbfe6fbfd 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/types.h>
 #include <linux/mlx5/transobj.h>
 #include <rdma/ib_user_verbs.h>
+#include <rdma/mlx5-abi.h>
 
 #define mlx5_ib_dbg(dev, format, arg...)                               \
 pr_debug("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__,   \
@@ -955,4 +956,40 @@ static inline int verify_assign_uidx(u8 cqe_version, u32 cmd_uidx,
 
        return 0;
 }
+
+static inline int get_qp_user_index(struct mlx5_ib_ucontext *ucontext,
+                                   struct mlx5_ib_create_qp *ucmd,
+                                   int inlen,
+                                   u32 *user_index)
+{
+       u8 cqe_version = ucontext->cqe_version;
+
+       if (field_avail(struct mlx5_ib_create_qp, uidx, inlen) &&
+           !cqe_version && (ucmd->uidx == MLX5_IB_DEFAULT_UIDX))
+               return 0;
+
+       if (!!(field_avail(struct mlx5_ib_create_qp, uidx, inlen) !=
+              !!cqe_version))
+               return -EINVAL;
+
+       return verify_assign_uidx(cqe_version, ucmd->uidx, user_index);
+}
+
+static inline int get_srq_user_index(struct mlx5_ib_ucontext *ucontext,
+                                    struct mlx5_ib_create_srq *ucmd,
+                                    int inlen,
+                                    u32 *user_index)
+{
+       u8 cqe_version = ucontext->cqe_version;
+
+       if (field_avail(struct mlx5_ib_create_srq, uidx, inlen) &&
+           !cqe_version && (ucmd->uidx == MLX5_IB_DEFAULT_UIDX))
+               return 0;
+
+       if (!!(field_avail(struct mlx5_ib_create_srq, uidx, inlen) !=
+              !!cqe_version))
+               return -EINVAL;
+
+       return verify_assign_uidx(cqe_version, ucmd->uidx, user_index);
+}
 #endif /* MLX5_IB_H */
index 873d81dbde41fec277d1a178946403ae37249244..d4ad672b905bf0068b59b2ebffe8de8a85f035e1 100644 (file)
@@ -40,7 +40,6 @@
 #include <rdma/ib_umem_odp.h>
 #include <rdma/ib_verbs.h>
 #include "mlx5_ib.h"
-#include "user.h"
 
 enum {
        MAX_PENDING_REG_MR = 8,
index 2ec88c649ac035365bd271ae7d11f110ae146333..9d97a71a13353073893439af11efec77282540f5 100644 (file)
@@ -35,7 +35,6 @@
 #include <rdma/ib_cache.h>
 #include <rdma/ib_user_verbs.h>
 #include "mlx5_ib.h"
-#include "user.h"
 
 /* not supported currently */
 static int wq_signature;
index ed6ac52355f1b9ddc81d4d8a13cdf16d1904c0e6..3857dbd9c95604d8169e3078a82c22d0f2ca4c95 100644 (file)
@@ -38,7 +38,6 @@
 #include <rdma/ib_user_verbs.h>
 
 #include "mlx5_ib.h"
-#include "user.h"
 
 /* not supported currently */
 static int srq_signature;
index 4edb0f2b4f9f73fcab7c85081cee0729e6c231a3..e9b0ca24f29dcc0d7ef2e3a1a9d269f281137eac 100644 (file)
@@ -7,3 +7,4 @@ header-y += rdma_netlink.h
 header-y += rdma_user_cm.h
 header-y += hfi/
 header-y += rdma_user_rxe.h
+header-y += mlx5-abi.h
similarity index 84%
rename from drivers/infiniband/hw/mlx5/user.h
rename to include/uapi/rdma/mlx5-abi.h
index 0e49d5b30a4c5a96bae0d00a390da514cf1dce63..f5d0f4e83b59f4f507ad0e2da87bd4611b64e1be 100644 (file)
  * SOFTWARE.
  */
 
-#ifndef MLX5_IB_USER_H
-#define MLX5_IB_USER_H
+#ifndef MLX5_ABI_USER_H
+#define MLX5_ABI_USER_H
 
 #include <linux/types.h>
 
-#include "mlx5_ib.h"
-
 enum {
        MLX5_QP_FLAG_SIGNATURE          = 1 << 0,
        MLX5_QP_FLAG_SCATTER_CQE        = 1 << 1,
@@ -50,7 +48,6 @@ enum {
        MLX5_WQ_FLAG_SIGNATURE          = 1 << 0,
 };
 
-
 /* Increment this value if any changes that break userspace ABI
  * compatibility are made.
  */
@@ -249,40 +246,4 @@ struct mlx5_ib_modify_wq {
        __u32   comp_mask;
        __u32   reserved;
 };
-
-static inline int get_qp_user_index(struct mlx5_ib_ucontext *ucontext,
-                                   struct mlx5_ib_create_qp *ucmd,
-                                   int inlen,
-                                   u32 *user_index)
-{
-       u8 cqe_version = ucontext->cqe_version;
-
-       if (field_avail(struct mlx5_ib_create_qp, uidx, inlen) &&
-           !cqe_version && (ucmd->uidx == MLX5_IB_DEFAULT_UIDX))
-               return 0;
-
-       if (!!(field_avail(struct mlx5_ib_create_qp, uidx, inlen) !=
-              !!cqe_version))
-               return -EINVAL;
-
-       return verify_assign_uidx(cqe_version, ucmd->uidx, user_index);
-}
-
-static inline int get_srq_user_index(struct mlx5_ib_ucontext *ucontext,
-                                    struct mlx5_ib_create_srq *ucmd,
-                                    int inlen,
-                                    u32 *user_index)
-{
-       u8 cqe_version = ucontext->cqe_version;
-
-       if (field_avail(struct mlx5_ib_create_srq, uidx, inlen) &&
-           !cqe_version && (ucmd->uidx == MLX5_IB_DEFAULT_UIDX))
-               return 0;
-
-       if (!!(field_avail(struct mlx5_ib_create_srq, uidx, inlen) !=
-              !!cqe_version))
-               return -EINVAL;
-
-       return verify_assign_uidx(cqe_version, ucmd->uidx, user_index);
-}
-#endif /* MLX5_IB_USER_H */
+#endif /* MLX5_ABI_USER_H */