aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Romanovsky <leon@kernel.org>2016-09-22 10:31:11 -0400
committerDoug Ledford <dledford@redhat.com>2016-10-07 16:54:34 -0400
commit3085e29e2f832cbf77ddeeffe715809a31254b5f (patch)
tree06ee2da9f806241efee6e705023dbb5caf4762e7
parentbd99fdea420b00925e9b83a50f2ccc5e1f07ef7d (diff)
IB/mlx5: Move and decouple user vendor structures
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>
-rw-r--r--MAINTAINERS1
-rw-r--r--drivers/infiniband/hw/mlx5/cq.c1
-rw-r--r--drivers/infiniband/hw/mlx5/main.c1
-rw-r--r--drivers/infiniband/hw/mlx5/mlx5_ib.h37
-rw-r--r--drivers/infiniband/hw/mlx5/mr.c1
-rw-r--r--drivers/infiniband/hw/mlx5/qp.c1
-rw-r--r--drivers/infiniband/hw/mlx5/srq.c1
-rw-r--r--include/uapi/rdma/Kbuild1
-rw-r--r--include/uapi/rdma/mlx5-abi.h (renamed from drivers/infiniband/hw/mlx5/user.h)45
9 files changed, 42 insertions, 47 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 87e23cda8dc1..e76efbc414cd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7819,6 +7819,7 @@ Q: http://patchwork.ozlabs.org/project/netdev/list/
7819S: Supported 7819S: Supported
7820F: drivers/net/ethernet/mellanox/mlx5/core/ 7820F: drivers/net/ethernet/mellanox/mlx5/core/
7821F: include/linux/mlx5/ 7821F: include/linux/mlx5/
7822F: include/uapi/rdma/mlx5-abi.h
7822 7823
7823MELLANOX MLX5 IB driver 7824MELLANOX MLX5 IB driver
7824M: Matan Barak <matanb@mellanox.com> 7825M: Matan Barak <matanb@mellanox.com>
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index 35a9f718e669..1188fef08450 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -35,7 +35,6 @@
35#include <rdma/ib_user_verbs.h> 35#include <rdma/ib_user_verbs.h>
36#include <rdma/ib_cache.h> 36#include <rdma/ib_cache.h>
37#include "mlx5_ib.h" 37#include "mlx5_ib.h"
38#include "user.h"
39 38
40static void mlx5_ib_cq_comp(struct mlx5_core_cq *cq) 39static void mlx5_ib_cq_comp(struct mlx5_core_cq *cq)
41{ 40{
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 29878aa716ee..f4160d56dc4f 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -54,7 +54,6 @@
54#include <linux/in.h> 54#include <linux/in.h>
55#include <linux/etherdevice.h> 55#include <linux/etherdevice.h>
56#include <linux/mlx5/fs.h> 56#include <linux/mlx5/fs.h>
57#include "user.h"
58#include "mlx5_ib.h" 57#include "mlx5_ib.h"
59 58
60#define DRIVER_NAME "mlx5_ib" 59#define DRIVER_NAME "mlx5_ib"
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 40fe1a65402b..1df8a67d4f02 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -44,6 +44,7 @@
44#include <linux/types.h> 44#include <linux/types.h>
45#include <linux/mlx5/transobj.h> 45#include <linux/mlx5/transobj.h>
46#include <rdma/ib_user_verbs.h> 46#include <rdma/ib_user_verbs.h>
47#include <rdma/mlx5-abi.h>
47 48
48#define mlx5_ib_dbg(dev, format, arg...) \ 49#define mlx5_ib_dbg(dev, format, arg...) \
49pr_debug("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ 50pr_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,
955 956
956 return 0; 957 return 0;
957} 958}
959
960static inline int get_qp_user_index(struct mlx5_ib_ucontext *ucontext,
961 struct mlx5_ib_create_qp *ucmd,
962 int inlen,
963 u32 *user_index)
964{
965 u8 cqe_version = ucontext->cqe_version;
966
967 if (field_avail(struct mlx5_ib_create_qp, uidx, inlen) &&
968 !cqe_version && (ucmd->uidx == MLX5_IB_DEFAULT_UIDX))
969 return 0;
970
971 if (!!(field_avail(struct mlx5_ib_create_qp, uidx, inlen) !=
972 !!cqe_version))
973 return -EINVAL;
974
975 return verify_assign_uidx(cqe_version, ucmd->uidx, user_index);
976}
977
978static inline int get_srq_user_index(struct mlx5_ib_ucontext *ucontext,
979 struct mlx5_ib_create_srq *ucmd,
980 int inlen,
981 u32 *user_index)
982{
983 u8 cqe_version = ucontext->cqe_version;
984
985 if (field_avail(struct mlx5_ib_create_srq, uidx, inlen) &&
986 !cqe_version && (ucmd->uidx == MLX5_IB_DEFAULT_UIDX))
987 return 0;
988
989 if (!!(field_avail(struct mlx5_ib_create_srq, uidx, inlen) !=
990 !!cqe_version))
991 return -EINVAL;
992
993 return verify_assign_uidx(cqe_version, ucmd->uidx, user_index);
994}
958#endif /* MLX5_IB_H */ 995#endif /* MLX5_IB_H */
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 873d81dbde41..d4ad672b905b 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -40,7 +40,6 @@
40#include <rdma/ib_umem_odp.h> 40#include <rdma/ib_umem_odp.h>
41#include <rdma/ib_verbs.h> 41#include <rdma/ib_verbs.h>
42#include "mlx5_ib.h" 42#include "mlx5_ib.h"
43#include "user.h"
44 43
45enum { 44enum {
46 MAX_PENDING_REG_MR = 8, 45 MAX_PENDING_REG_MR = 8,
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 2ec88c649ac0..9d97a71a1335 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -35,7 +35,6 @@
35#include <rdma/ib_cache.h> 35#include <rdma/ib_cache.h>
36#include <rdma/ib_user_verbs.h> 36#include <rdma/ib_user_verbs.h>
37#include "mlx5_ib.h" 37#include "mlx5_ib.h"
38#include "user.h"
39 38
40/* not supported currently */ 39/* not supported currently */
41static int wq_signature; 40static int wq_signature;
diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
index ed6ac52355f1..3857dbd9c956 100644
--- a/drivers/infiniband/hw/mlx5/srq.c
+++ b/drivers/infiniband/hw/mlx5/srq.c
@@ -38,7 +38,6 @@
38#include <rdma/ib_user_verbs.h> 38#include <rdma/ib_user_verbs.h>
39 39
40#include "mlx5_ib.h" 40#include "mlx5_ib.h"
41#include "user.h"
42 41
43/* not supported currently */ 42/* not supported currently */
44static int srq_signature; 43static int srq_signature;
diff --git a/include/uapi/rdma/Kbuild b/include/uapi/rdma/Kbuild
index 4edb0f2b4f9f..e9b0ca24f29d 100644
--- a/include/uapi/rdma/Kbuild
+++ b/include/uapi/rdma/Kbuild
@@ -7,3 +7,4 @@ header-y += rdma_netlink.h
7header-y += rdma_user_cm.h 7header-y += rdma_user_cm.h
8header-y += hfi/ 8header-y += hfi/
9header-y += rdma_user_rxe.h 9header-y += rdma_user_rxe.h
10header-y += mlx5-abi.h
diff --git a/drivers/infiniband/hw/mlx5/user.h b/include/uapi/rdma/mlx5-abi.h
index 0e49d5b30a4c..f5d0f4e83b59 100644
--- a/drivers/infiniband/hw/mlx5/user.h
+++ b/include/uapi/rdma/mlx5-abi.h
@@ -30,13 +30,11 @@
30 * SOFTWARE. 30 * SOFTWARE.
31 */ 31 */
32 32
33#ifndef MLX5_IB_USER_H 33#ifndef MLX5_ABI_USER_H
34#define MLX5_IB_USER_H 34#define MLX5_ABI_USER_H
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37 37
38#include "mlx5_ib.h"
39
40enum { 38enum {
41 MLX5_QP_FLAG_SIGNATURE = 1 << 0, 39 MLX5_QP_FLAG_SIGNATURE = 1 << 0,
42 MLX5_QP_FLAG_SCATTER_CQE = 1 << 1, 40 MLX5_QP_FLAG_SCATTER_CQE = 1 << 1,
@@ -50,7 +48,6 @@ enum {
50 MLX5_WQ_FLAG_SIGNATURE = 1 << 0, 48 MLX5_WQ_FLAG_SIGNATURE = 1 << 0,
51}; 49};
52 50
53
54/* Increment this value if any changes that break userspace ABI 51/* Increment this value if any changes that break userspace ABI
55 * compatibility are made. 52 * compatibility are made.
56 */ 53 */
@@ -249,40 +246,4 @@ struct mlx5_ib_modify_wq {
249 __u32 comp_mask; 246 __u32 comp_mask;
250 __u32 reserved; 247 __u32 reserved;
251}; 248};
252 249#endif /* MLX5_ABI_USER_H */
253static inline int get_qp_user_index(struct mlx5_ib_ucontext *ucontext,
254 struct mlx5_ib_create_qp *ucmd,
255 int inlen,
256 u32 *user_index)
257{
258 u8 cqe_version = ucontext->cqe_version;
259
260 if (field_avail(struct mlx5_ib_create_qp, uidx, inlen) &&
261 !cqe_version && (ucmd->uidx == MLX5_IB_DEFAULT_UIDX))
262 return 0;
263
264 if (!!(field_avail(struct mlx5_ib_create_qp, uidx, inlen) !=
265 !!cqe_version))
266 return -EINVAL;
267
268 return verify_assign_uidx(cqe_version, ucmd->uidx, user_index);
269}
270
271static inline int get_srq_user_index(struct mlx5_ib_ucontext *ucontext,
272 struct mlx5_ib_create_srq *ucmd,
273 int inlen,
274 u32 *user_index)
275{
276 u8 cqe_version = ucontext->cqe_version;
277
278 if (field_avail(struct mlx5_ib_create_srq, uidx, inlen) &&
279 !cqe_version && (ucmd->uidx == MLX5_IB_DEFAULT_UIDX))
280 return 0;
281
282 if (!!(field_avail(struct mlx5_ib_create_srq, uidx, inlen) !=
283 !!cqe_version))
284 return -EINVAL;
285
286 return verify_assign_uidx(cqe_version, ucmd->uidx, user_index);
287}
288#endif /* MLX5_IB_USER_H */