Skip to contentSkip to conversation

Move mlx5 vendor specific to UAPI directory

RFC In review Leon Romanovsky 4 participants 11 messages Sep 14, 2016 – Sep 15, 2016 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Move mlx5 vendor specific to UAPI directory

The consolidate library revealed the fact that vendor specific structures and defines are copy/pasted between kernel and user-space, instead of sharing.

This RFC was tested by compilation only and not-ready for merge yet.

Leon Romanovsky (3):
IB/mlx5: Move and decouple user vendor structures IB/core: Export mlx5 vendor specific strucutres
MAINTAINERS: Add mlx5 uapi file

 MAINTAINERS                            |   1 +
 drivers/infiniband/hw/mlx5/cq.c        |   1 -
 drivers/infiniband/hw/mlx5/main.c      |   1 -
 drivers/infiniband/hw/mlx5/mlx5_ib.h   |  37 +++++
 drivers/infiniband/hw/mlx5/mr.c        |   1 -
 drivers/infiniband/hw/mlx5/qp.c        |   1 -
 drivers/infiniband/hw/mlx5/srq.c       |   1 -
 drivers/infiniband/hw/mlx5/user.h      | 281 ---------------------------------
 include/uapi/rdma/Kbuild               |   1 +
 include/uapi/rdma/providers/Kbuild     |   2 +
 include/uapi/rdma/providers/mlx5-abi.h | 242 ++++++++++++++++++++++++++++
 11 files changed, 283 insertions(+), 286 deletions(-)
 delete mode 100644 drivers/infiniband/hw/mlx5/user.h
 create mode 100644 include/uapi/rdma/providers/Kbuild
 create mode 100644 include/uapi/rdma/providers/mlx5-abi.h

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1473841649-8923-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw

RFC 1/3 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.

---
 drivers/infiniband/hw/mlx5/cq.c        |   1 -
 drivers/infiniband/hw/mlx5/main.c      |   1 -
 drivers/infiniband/hw/mlx5/mlx5_ib.h   |  37 +++++
 drivers/infiniband/hw/mlx5/mr.c        |   1 -
 drivers/infiniband/hw/mlx5/qp.c        |   1 -
 drivers/infiniband/hw/mlx5/srq.c       |   1 -
 drivers/infiniband/hw/mlx5/user.h      | 281 ---------------------------------
 include/uapi/rdma/providers/mlx5-abi.h | 242 ++++++++++++++++++++++++++++
 8 files changed, 279 insertions(+), 286 deletions(-)
 delete mode 100644 drivers/infiniband/hw/mlx5/user.h
 create mode 100644 include/uapi/rdma/providers/mlx5-abi.h
drivers/infiniband/hw/mlx5/cq.c +0 -1
index 308a358..20a6184 100644
@@ -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)
 {
drivers/infiniband/hw/mlx5/main.c +0 -1
index 1b4094b..30354ce 100644
@@ -53,7 +53,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"
drivers/infiniband/hw/mlx5/mlx5_ib.h +37 -0
index 372385d..b8e349a 100644
@@ -44,6 +44,7 @@
 #include <linux/types.h>
 #include <linux/mlx5/transobj.h>
 #include <rdma/ib_user_verbs.h>
+#include <rdma/providers/mlx5-abi.h>
 
 #define mlx5_ib_dbg(dev, format, arg...)				\
 pr_debug("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__,	\
@@ -946,4 +947,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 */
drivers/infiniband/hw/mlx5/mr.c +0 -1
index 4b02130..0cd22cb 100644
@@ -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,
drivers/infiniband/hw/mlx5/qp.c +0 -1
index 0dd7d93..8c76531 100644
@@ -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;
drivers/infiniband/hw/mlx5/srq.c +0 -1
index ed6ac52..3857dbd 100644
@@ -38,7 +38,6 @@
 #include <rdma/ib_user_verbs.h>
 
 #include "mlx5_ib.h"
-#include "user.h"
 
 /* not supported currently */
 static int srq_signature;
drivers/infiniband/hw/mlx5/user.h deleted +0 -281

281 lines not on this page · raw message

include/uapi/rdma/providers/mlx5-abi.h new file +242 -0

242 lines not on this page · raw message

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

RFC 2/3 IB/core: Export mlx5 vendor specific strucutres

In reply to a message not in the archive
---
 include/uapi/rdma/Kbuild           | 1 +
 include/uapi/rdma/providers/Kbuild | 2 ++
 2 files changed, 3 insertions(+)
 create mode 100644 include/uapi/rdma/providers/Kbuild
include/uapi/rdma/Kbuild +1 -0
index 4edb0f2..e804cc3 100644
@@ -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 += providers/
include/uapi/rdma/providers/Kbuild new file +2 -0
new file mode 100644
index 0000000..d863744
@@ -0,0 +1,2 @@
+# UAPI Header export list
+header-y += mlx5-abi.h

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1473841649-8923-3-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#5 lore raw

Re: [RFC rdma-next 2/3] IB/core: Export mlx5 vendor specific strucutres

include/uapi/rdma/Kbuild header-y += rdma_netlink.h · line 10

Quoted 8 lines

index 4edb0f2..e804cc3 100644

include/uapi/rdma/Kbuild +1 -0
@@ -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 += providers/

Can we avoid the horrible providers name? The directories for drivers in the source tree so far are called hw/ and sw/ so we should stick to that here as well.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: [RFC rdma-next 2/3] IB/core: Export mlx5 vendor specific strucutres

Quoted 4 lines · Christoph Hellwig
Quoted 4 lines

index 4edb0f2..e804cc3 100644

include/uapi/rdma/Kbuild +0 -0
@@ -7,3 +7,4 @@ header-y += rdma_netlink.h
Quoted 8 lines

include/uapi/rdma/Kbuild header-y += rdma_netlink.h · line 10

Quoted 4 lines
include/uapi/rdma/Kbuild +1 -0
 header-y += rdma_user_cm.h
 header-y += hfi/
 header-y += rdma_user_rxe.h
+header-y += providers/

Can we avoid the horrible providers name? The directories for drivers in the source tree so far are called hw/ and sw/ so we should stick to that here as well.

I don't like providers name too, but I don't want to stick to drivers/.../{hw|sw} either. Any redesign there will lead to disconnection between UAPI directory and internal structure.

#8 lore raw

Re: [RFC rdma-next 2/3] IB/core: Export mlx5 vendor specific strucutres

In reply to a message not in the archive
Quoted 11 lines · Christoph Hellwig

include/uapi/rdma/Kbuild header-y += rdma_netlink.h · line 10

Quoted 7 lines

index 4edb0f2..e804cc3 100644
+++ b/include/uapi/rdma/Kbuild

include/uapi/rdma/Kbuild +1 -0
@@ -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 += providers/

Can we avoid the horrible providers name? The directories for drivers in the source tree so far are called hw/ and sw/ so we should stick to that here as well.

I also don't like the provider name, it is not consistent with Linux.

Not sure hw/sw is any better, other subsystems don't split their drivers like that.

Just driver/?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

RFC 3/3 MAINTAINERS: Add mlx5 uapi file

In reply to a message not in the archive
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index db814a8..f0b82b9 100644
@@ -7828,6 +7828,7 @@ Q:	http://patchwork.kernel.org/project/linux-rdma/list/
 S:	Supported
 F:	drivers/infiniband/hw/mlx5/
 F:	include/linux/mlx5/
+F:	include/uapi/rdma/providers/mlx5-abi.h
 
 MELEXIS MLX90614 DRIVER
 M:	Crt Mori <[email protected]>

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
In reply to a message not in the archive
Quoted 5 lines · Leon Romanovsky

The consolidate library revealed the fact that vendor specific structures and defines are copy/pasted between kernel and user-space, instead of sharing.

This RFC was tested by compilation only and not-ready for merge yet.

Yah, this is exactly what I had in mind. We need to give this treatment to all the drivers :|

Quoted 4 lines

Leon Romanovsky (3):
IB/mlx5: Move and decouple user vendor structures IB/core: Export mlx5 vendor specific strucutres
MAINTAINERS: Add mlx5 uapi file

One patch is probably enough, 3 patches per driver is going to be alot.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20160914172145.GI16014-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

#12 lore raw

----- Original Message -----

Quoted 21 lines

From: "Jason Gunthorpe" <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: "Leon Romanovsky" <[email protected]>
Cc: [email protected], [email protected]
Sent: Wednesday, September 14, 2016 1:21:45 PM
Subject: Re: [RFC rdma-next 0/3] Move mlx5 vendor specific to UAPI directory

Quoted 5 lines · Leon Romanovsky

The consolidate library revealed the fact that vendor specific structures and defines are copy/pasted between kernel and user-space, instead of sharing.

This RFC was tested by compilation only and not-ready for merge yet.

Yah, this is exactly what I had in mind. We need to give this treatment to all the drivers :|

Quoted 4 lines

Leon Romanovsky (3):
IB/mlx5: Move and decouple user vendor structures IB/core: Export mlx5 vendor specific strucutres
MAINTAINERS: Add mlx5 uapi file

Quoted 9 lines

One patch is probably enough, 3 patches per driver is going to be alot.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Leon, I have not kept up with testing all the mlx5 changes and latest patches. Going to wait until this settles then will take snapshot and start testing.

Thanks
Laurence
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1495514480.6044744.1473882367077.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#14 lore raw
Quoted 27 lines · Laurence Oberman

----- Original Message -----

Quoted 24 lines

From: "Jason Gunthorpe" <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: "Leon Romanovsky" <[email protected]>
Cc: [email protected], [email protected]
Sent: Wednesday, September 14, 2016 1:21:45 PM
Subject: Re: [RFC rdma-next 0/3] Move mlx5 vendor specific to UAPI directory

Quoted 5 lines · Leon Romanovsky

The consolidate library revealed the fact that vendor specific structures and defines are copy/pasted between kernel and user-space, instead of sharing.

This RFC was tested by compilation only and not-ready for merge yet.

Yah, this is exactly what I had in mind. We need to give this treatment to all the drivers :|

Quoted 4 lines

Leon Romanovsky (3):
IB/mlx5: Move and decouple user vendor structures IB/core: Export mlx5 vendor specific strucutres
MAINTAINERS: Add mlx5 uapi file

One patch is probably enough, 3 patches per driver is going to be alot.

Quoted 8 lines
Quoted 6 lines

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Leon, I have not kept up with testing all the mlx5 changes and latest patches. Going to wait until this settles then will take snapshot and start testing.

Thanks Laurence,

I will set the topic branch when I'll create patches for all drivers. I don't expect any additional testing to compilations and header installations.

At the end, It is simple file moves from one place to another without any functional changes.

Quoted 3 lines

Thanks
Laurence

#15 lore raw
In reply to a message not in the archive
Quoted 9 lines · Jason Gunthorpe
Quoted 5 lines · Leon Romanovsky

The consolidate library revealed the fact that vendor specific structures and defines are copy/pasted between kernel and user-space, instead of sharing.

This RFC was tested by compilation only and not-ready for merge yet.

Yah, this is exactly what I had in mind. We need to give this treatment to all the drivers :|

Are we fine with the names (include/uapi/rdma/providers/*-abi.h)?

Quoted 8 lines
Quoted 5 lines

Leon Romanovsky (3):
IB/mlx5: Move and decouple user vendor structures IB/core: Export mlx5 vendor specific strucutres
MAINTAINERS: Add mlx5 uapi file

One patch is probably enough, 3 patches per driver is going to be alot.

At the end, I will do one patch per-driver and one global patch for MAINTAINERS file.

Quoted 2 lines

Jason