Skip to contentSkip to conversation

rxe: API extensions

PATCH New Bob Pearson 1 participant 5 messages Sep 18, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

v5 cover rxe: API extensions

This patch series implements the user space changes matching the v5 kernel extensions.

It is an extension of an earlier patch set (v4) that implemented memory windows.

The current set (v5) also implements:
ibv_device_query_ex
ibv_create_cq_ex
ibv_create_qp_ex

Bob Pearson (4):
rdma-core/providers/rxe: Implement MW commands
rxe: added extended query device verb
rxe: added support for extended CQ operations
rxe: added support for extended QP operations

 kernel-headers/rdma/rdma_user_rxe.h |  68 ++-
 providers/rxe/CMakeLists.txt        |   5 +
 providers/rxe/rxe-abi.h             |  16 +-
 providers/rxe/rxe.c                 | 624 ++++-----------------
 providers/rxe/rxe.h                 |  98 +++-
 providers/rxe/rxe_cq.c              | 449 +++++++++++++++
 providers/rxe/rxe_dev.c             | 146 +++++
 providers/rxe/rxe_mw.c              | 149 +++++
 providers/rxe/rxe_qp.c              | 810 ++++++++++++++++++++++++++++
 providers/rxe/rxe_queue.h           |  42 +-
 providers/rxe/rxe_sq.c              | 319 +++++++++++
 11 files changed, 2198 insertions(+), 528 deletions(-)
 create mode 100644 providers/rxe/rxe_cq.c
 create mode 100644 providers/rxe/rxe_dev.c
 create mode 100644 providers/rxe/rxe_mw.c
 create mode 100644 providers/rxe/rxe_qp.c
 create mode 100644 providers/rxe/rxe_sq.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v5 1/4 rxe: Implement MW commands

Implemented
ibv_alloc_mw
ibv_dealloc_mw
ibv_bind_mw
post bind mw operations
post invalidate rkey commands
access MW and MR rkeys for RDMA write, read, and atomic

Depends on matching kernel patch set

---
 kernel-headers/rdma/rdma_user_rxe.h |  50 ++++-
 providers/rxe/CMakeLists.txt        |   2 +
 providers/rxe/rxe-abi.h             |   4 +
 providers/rxe/rxe.c                 | 293 +++++--------------------
 providers/rxe/rxe.h                 |  44 ++++
 providers/rxe/rxe_mw.c              | 149 +++++++++++++
 providers/rxe/rxe_sq.c              | 319 ++++++++++++++++++++++++++++
 7 files changed, 622 insertions(+), 239 deletions(-)
 create mode 100644 providers/rxe/rxe_mw.c
 create mode 100644 providers/rxe/rxe_sq.c
kernel-headers/rdma/rdma_user_rxe.h +46 -4
index aae2e696..d4912568 100644
@@ -93,14 +93,46 @@ struct rxe_send_wr {
 			__u32	remote_qkey;
 			__u16	pkey_index;
 		} ud;
-		/* reg is only used by the kernel and is not part of the uapi */
+		struct {
+			__aligned_u64	addr;
+			__aligned_u64	length;
+			union {
+				__u32		mr_index;
+				__aligned_u64	reserved1;
+			};
+			union {
+				__u32		mw_index;
+				__aligned_u64	reserved2;
+			};
+			__u32	rkey;
+			__u32	access;
+			__u32	flags;
+		} umw;
+		/* The following are only used by the kernel
+		 * and are not part of the uapi
+		 */
+		struct {
+			__aligned_u64	addr;
+			__aligned_u64	length;
+			union {
+				struct ib_mr	*mr;
+				__aligned_u64	reserved1;
+			};
+			union {
+				struct ib_mw	*mw;
+				__aligned_u64	reserved2;
+			};
+			__u32	rkey;
+			__u32	access;
+			__u32	flags;
+		} kmw;
 		struct {
 			union {
 				struct ib_mr *mr;
 				__aligned_u64 reserved;
 			};
-			__u32        key;
-			__u32        access;
+			__u32	     key;
+			__u32	     access;
 		} reg;
 	} wr;
 };
@@ -112,7 +144,7 @@ struct rxe_sge {
 };
 
 struct mminfo {
-	__aligned_u64  		offset;
+	__aligned_u64		offset;
 	__u32			size;
 	__u32			pad;
 };
@@ -175,4 +207,14 @@ struct rxe_modify_srq_cmd {
 	__aligned_u64 mmap_info_addr;
 };
 
+struct rxe_reg_mr_resp {
+	__u32 index;
+	__u32 reserved;
+};
+
+struct rxe_alloc_mw_resp {
+	__u32 index;
+	__u32 reserved;
+};
+
 #endif /* RDMA_USER_RXE_H */
providers/rxe/CMakeLists.txt +2 -0
index d8f32651..ec4f005d 100644
@@ -1,3 +1,5 @@
 rdma_provider(rxe
   rxe.c
+  rxe_sq.c
+  rxe_mw.c
   )
providers/rxe/rxe-abi.h +4 -0
index b4680a24..2fc09483 100644
@@ -49,5 +49,9 @@ DECLARE_DRV_CMD(urxe_modify_srq, IB_USER_VERBS_CMD_MODIFY_SRQ,
 		rxe_modify_srq_cmd, empty);
 DECLARE_DRV_CMD(urxe_resize_cq, IB_USER_VERBS_CMD_RESIZE_CQ,
 		empty, rxe_resize_cq_resp);
+DECLARE_DRV_CMD(urxe_reg_mr, IB_USER_VERBS_CMD_REG_MR,
+		empty, rxe_reg_mr_resp);
+DECLARE_DRV_CMD(urxe_alloc_mw, IB_USER_VERBS_CMD_ALLOC_MW,
+		empty, rxe_alloc_mw_resp);
 
 #endif /* RXE_ABI_H */
providers/rxe/rxe.c +58 -235

452 lines not on this page · raw message

providers/rxe/rxe.h +44 -0

54 lines not on this page · raw message

providers/rxe/rxe_mw.c new file +149 -0

149 lines not on this page · raw message

providers/rxe/rxe_sq.c new file +319 -0

319 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH v5 2/4 rxe: add extended query device verb

In reply to Bob Pearson

Added ibv_query_device_ex verb.

---
 providers/rxe/CMakeLists.txt |   1 +
 providers/rxe/rxe.c          |  62 +--------------
 providers/rxe/rxe.h          |  12 +++
 providers/rxe/rxe_dev.c      | 146 +++++++++++++++++++++++++++++++++++
 4 files changed, 160 insertions(+), 61 deletions(-)
 create mode 100644 providers/rxe/rxe_dev.c
providers/rxe/CMakeLists.txt +1 -0
index ec4f005d..96052555 100644
@@ -1,5 +1,6 @@
 rdma_provider(rxe
   rxe.c
+  rxe_dev.c
   rxe_sq.c
   rxe_mw.c
   )
providers/rxe/rxe.c +1 -61

74 lines not on this page · raw message

providers/rxe/rxe.h +12 -0
index 6dfca0ab..11f337ee 100644
@@ -155,6 +155,18 @@ static inline struct rxe_mw *to_rmw(struct ibv_mw *ibmw)
 	return to_rxxx(mw, mw);
 }
 
+/* rxe_dev.c */
+int rxe_query_device(struct ibv_context *context,
+		     struct ibv_device_attr *attr);
+int rxe_query_device_ex(struct ibv_context *context,
+			const struct ibv_query_device_ex_input *input,
+			struct ibv_device_attr_ex *attr,
+			size_t attr_size);
+int rxe_query_port(struct ibv_context *context, uint8_t port,
+		   struct ibv_port_attr *attr);
+struct ibv_pd *rxe_alloc_pd(struct ibv_context *context);
+int rxe_dealloc_pd(struct ibv_pd *pd);
+
 /* rxe_mw.c */
 struct ibv_mw *rxe_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type);
 int rxe_dealloc_mw(struct ibv_mw *mw);
providers/rxe/rxe_dev.c new file +146 -0

146 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH v5 3/4 rxe: add support for extended CQ operations

In reply to Bob Pearson

Implemented ibv_create_cq_ex verb.
Implemented operations in ibv_cq_ex struct.

---
 kernel-headers/rdma/rdma_user_rxe.h |  44 ++-
 providers/rxe/CMakeLists.txt        |   1 +
 providers/rxe/rxe-abi.h             |  10 +-
 providers/rxe/rxe.c                 | 215 +++++--------
 providers/rxe/rxe.h                 |  21 +-
 providers/rxe/rxe_cq.c              | 449 ++++++++++++++++++++++++++++
 providers/rxe/rxe_queue.h           |  42 ++-
 7 files changed, 617 insertions(+), 165 deletions(-)
 create mode 100644 providers/rxe/rxe_cq.c
kernel-headers/rdma/rdma_user_rxe.h +34 -10
index d4912568..9de469d7 100644
@@ -98,29 +98,27 @@ struct rxe_send_wr {
 			__aligned_u64	length;
 			union {
 				__u32		mr_index;
-				__aligned_u64	reserved1;
+				__aligned_u64   pad1;
 			};
 			union {
 				__u32		mw_index;
-				__aligned_u64	reserved2;
+				__aligned_u64   pad2;
 			};
 			__u32	rkey;
 			__u32	access;
 			__u32	flags;
 		} umw;
-		/* The following are only used by the kernel
-		 * and are not part of the uapi
-		 */
+		/* below are only used by the kernel */
 		struct {
 			__aligned_u64	addr;
 			__aligned_u64	length;
 			union {
 				struct ib_mr	*mr;
-				__aligned_u64	reserved1;
+				__aligned_u64   reserved1;
 			};
 			union {
 				struct ib_mw	*mw;
-				__aligned_u64	reserved2;
+				__aligned_u64   reserved2;
 			};
 			__u32	rkey;
 			__u32	access;
@@ -131,8 +129,8 @@ struct rxe_send_wr {
 				struct ib_mr *mr;
 				__aligned_u64 reserved;
 			};
-			__u32	     key;
-			__u32	     access;
+			__u32        key;
+			__u32        access;
 		} reg;
 	} wr;
 };
@@ -144,7 +142,7 @@ struct rxe_sge {
 };
 
 struct mminfo {
-	__aligned_u64		offset;
+	__aligned_u64  		offset;
 	__u32			size;
 	__u32			pad;
 };
@@ -184,6 +182,32 @@ struct rxe_recv_wqe {
 	struct rxe_dma_info	dma;
 };
 
+struct rxe_uverbs_wc {
+	/* keep these the same as ib_uverbs_wc */
+	__aligned_u64		wr_id;
+	__u32			status;
+	__u32			opcode;
+	__u32			vendor_err;
+	__u32			byte_len;
+	union {
+		__be32		imm_data;
+		__u32		invalidate_rkey;
+	} ex;
+	__u32			qp_num;
+	__u32			src_qp;
+	__u32			wc_flags;
+	__u16			pkey_index;
+	__u16			slid;
+	__u8			sl;
+	__u8			dlid_path_bits;
+	__u8			port_num;
+	__u8			reserved;
+
+	/* any extras go here */
+	__aligned_u64		timestamp;
+	__aligned_u64		realtime;
+};
+
 struct rxe_create_cq_resp {
 	struct mminfo mi;
 };
providers/rxe/CMakeLists.txt +1 -0
index 96052555..0e62aae7 100644
@@ -1,6 +1,7 @@
 rdma_provider(rxe
   rxe.c
   rxe_dev.c
+  rxe_cq.c
   rxe_sq.c
   rxe_mw.c
   )
providers/rxe/rxe-abi.h +6 -4
index 2fc09483..14d0c038 100644
@@ -39,16 +39,18 @@
 #include <rdma/rdma_user_rxe.h>
 #include <kernel-abi/rdma_user_rxe.h>
 
-DECLARE_DRV_CMD(urxe_create_cq, IB_USER_VERBS_CMD_CREATE_CQ,
-		empty, rxe_create_cq_resp);
 DECLARE_DRV_CMD(urxe_create_qp, IB_USER_VERBS_CMD_CREATE_QP,
 		empty, rxe_create_qp_resp);
+DECLARE_DRV_CMD(urxe_create_cq, IB_USER_VERBS_CMD_CREATE_CQ,
+		empty, rxe_create_cq_resp);
+DECLARE_DRV_CMD(urxe_create_cq_ex, IB_USER_VERBS_EX_CMD_CREATE_CQ,
+		empty, rxe_create_cq_resp);
+DECLARE_DRV_CMD(urxe_resize_cq, IB_USER_VERBS_CMD_RESIZE_CQ,
+		empty, rxe_resize_cq_resp);
 DECLARE_DRV_CMD(urxe_create_srq, IB_USER_VERBS_CMD_CREATE_SRQ,
 		empty, rxe_create_srq_resp);
 DECLARE_DRV_CMD(urxe_modify_srq, IB_USER_VERBS_CMD_MODIFY_SRQ,
 		rxe_modify_srq_cmd, empty);
-DECLARE_DRV_CMD(urxe_resize_cq, IB_USER_VERBS_CMD_RESIZE_CQ,
-		empty, rxe_resize_cq_resp);
 DECLARE_DRV_CMD(urxe_reg_mr, IB_USER_VERBS_CMD_REG_MR,
 		empty, rxe_reg_mr_resp);
 DECLARE_DRV_CMD(urxe_alloc_mw, IB_USER_VERBS_CMD_ALLOC_MW,
providers/rxe/rxe.c +73 -142

227 lines not on this page · raw message

providers/rxe/rxe.h +18 -3
index 11f337ee..69ddba55 100644
@@ -57,11 +57,16 @@ struct rxe_context {
 	struct verbs_context	ibv_ctx;
 };
 
+/* common between cq and cq_ex */
 struct rxe_cq {
-	struct ibv_cq		ibv_cq;
+	struct verbs_cq		vcq;
 	struct mminfo		mmap_info;
-	struct rxe_queue		*queue;
+	struct rxe_queue	*queue;
 	pthread_spinlock_t	lock;
+
+	/* new API support */
+	struct rxe_uverbs_wc	*wc;
+	uint32_t		cur_index;
 };
 
 struct rxe_ah {
@@ -127,7 +132,7 @@ static inline struct rxe_device *to_rdev(struct ibv_device *ibdev)
 
 static inline struct rxe_cq *to_rcq(struct ibv_cq *ibcq)
 {
-	return to_rxxx(cq, cq);
+	return container_of(ibcq, struct rxe_cq, vcq.cq);
 }
 
 static inline struct rxe_qp *to_rqp(struct ibv_qp *ibqp)
@@ -167,6 +172,16 @@ int rxe_query_port(struct ibv_context *context, uint8_t port,
 struct ibv_pd *rxe_alloc_pd(struct ibv_context *context);
 int rxe_dealloc_pd(struct ibv_pd *pd);
 
+/* rxe_cq.c */
+struct ibv_cq *rxe_create_cq(struct ibv_context *context, int cqe,
+			     struct ibv_comp_channel *channel,
+			     int comp_vector);
+struct ibv_cq_ex *rxe_create_cq_ex(struct ibv_context *context,
+				   struct ibv_cq_init_attr_ex *attr);
+int rxe_resize_cq(struct ibv_cq *ibcq, int cqe);
+int rxe_destroy_cq(struct ibv_cq *ibcq);
+int rxe_poll_cq(struct ibv_cq *ibcq, int ne, struct ibv_wc *wc);
+
 /* rxe_mw.c */
 struct ibv_mw *rxe_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type);
 int rxe_dealloc_mw(struct ibv_mw *mw);
providers/rxe/rxe_cq.c new file +449 -0

449 lines not on this page · raw message

providers/rxe/rxe_queue.h +36 -6

90 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw

PATCH v5 4/4 rxe: add support for extended QP operations

In reply to Bob Pearson

Added ibv_create_qp_ex verb.
Added WQ operations in verbs_qp struct.

---
 providers/rxe/CMakeLists.txt |   1 +
 providers/rxe/rxe-abi.h      |   2 +
 providers/rxe/rxe.c          | 104 +----
 providers/rxe/rxe.h          |  21 +-
 providers/rxe/rxe_qp.c       | 810 +++++++++++++++++++++++++++++++++++
 5 files changed, 837 insertions(+), 101 deletions(-)
 create mode 100644 providers/rxe/rxe_qp.c
providers/rxe/CMakeLists.txt +1 -0
index 0e62aae7..9d357320 100644
@@ -1,6 +1,7 @@
 rdma_provider(rxe
   rxe.c
   rxe_dev.c
+  rxe_qp.c
   rxe_cq.c
   rxe_sq.c
   rxe_mw.c
providers/rxe/rxe-abi.h +2 -0
index 14d0c038..c9dec140 100644
@@ -41,6 +41,8 @@
 
 DECLARE_DRV_CMD(urxe_create_qp, IB_USER_VERBS_CMD_CREATE_QP,
 		empty, rxe_create_qp_resp);
+DECLARE_DRV_CMD(urxe_create_qp_ex, IB_USER_VERBS_EX_CMD_CREATE_QP,
+		empty, rxe_create_qp_resp);
 DECLARE_DRV_CMD(urxe_create_cq, IB_USER_VERBS_CMD_CREATE_CQ,
 		empty, rxe_create_cq_resp);
 DECLARE_DRV_CMD(urxe_create_cq_ex, IB_USER_VERBS_EX_CMD_CREATE_CQ,
providers/rxe/rxe.c +6 -98

136 lines not on this page · raw message

providers/rxe/rxe.h +18 -3
index 69ddba55..632edf5b 100644
@@ -82,15 +82,19 @@ struct rxe_wq {
 };
 
 struct rxe_qp {
-	struct ibv_qp		ibv_qp;
+	struct verbs_qp		vqp;
 	struct mminfo		rq_mmap_info;
 	struct rxe_wq		rq;
 	struct mminfo		sq_mmap_info;
 	struct rxe_wq		sq;
 	unsigned int		ssn;
+
+	/* new API support */
+	uint32_t		cur_index;
+	int			err;
 };
 
-#define qp_type(qp)		((qp)->ibv_qp.qp_type)
+#define qp_type(qp)		((qp)->vqp.qp.qp_type)
 
 struct rxe_srq {
 	struct ibv_srq		ibv_srq;
@@ -137,7 +141,7 @@ static inline struct rxe_cq *to_rcq(struct ibv_cq *ibcq)
 
 static inline struct rxe_qp *to_rqp(struct ibv_qp *ibqp)
 {
-	return to_rxxx(qp, qp);
+	return container_of(ibqp, struct rxe_qp, vqp.qp);
 }
 
 static inline struct rxe_srq *to_rsrq(struct ibv_srq *ibsrq)
@@ -172,6 +176,17 @@ int rxe_query_port(struct ibv_context *context, uint8_t port,
 struct ibv_pd *rxe_alloc_pd(struct ibv_context *context);
 int rxe_dealloc_pd(struct ibv_pd *pd);
 
+/* rxe_qp.c */
+struct ibv_qp *rxe_create_qp(struct ibv_pd *pd,
+			     struct ibv_qp_init_attr *attr);
+struct ibv_qp *rxe_create_qp_ex(struct ibv_context *context,
+				struct ibv_qp_init_attr_ex *attr);
+int rxe_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+		 int attr_mask, struct ibv_qp_init_attr *init_attr);
+int rxe_modify_qp(struct ibv_qp *ibvqp, struct ibv_qp_attr *attr,
+		  int attr_mask);
+int rxe_destroy_qp(struct ibv_qp *ibv_qp);
+
 /* rxe_cq.c */
 struct ibv_cq *rxe_create_cq(struct ibv_context *context, int cqe,
 			     struct ibv_comp_channel *channel,
providers/rxe/rxe_qp.c new file +810 -0

810 lines not on this page · raw message

Signature · 1 line
2.25.1