Add extension and XRC QP support
Subsystems (2)
v6 cover Add extension and XRC QP support
From: Sean Hefty <[email protected]>
Extend XRC support to user space through libibverbs. Because XRC requires new verbs and extensions to existing verbs, we first introduce a generic mechanism for extending verbs in a backward compatible manner. XRC support is built on top of that infrastructure.
Changes from v5:
Updated to latest master branch.
Jay Sternberg (1):
libibverbs: Add XRC sample application
Sean Hefty (5):
libibverbs: Introduce XRC domains
livibverbs: Add support for XRC SRQs
libibverbs: Add support for XRC QPs
libibverbs: Add ibv_open_qp
libibverbs: Add man page for ibv_open_qp
Yishai Hadas (1):
Infrastructure to support verbs extensions
Makefile.am | 4 +- examples/xsrq_pingpong.c | 885 +++++++++++++++++++++++++++++++++++++++++ include/infiniband/driver.h | 64 +++ include/infiniband/kern-abi.h | 112 ++++-- include/infiniband/verbs.h | 249 +++++++++++- man/ibv_open_qp.3 | 50 +++ src/cmd.c | 374 ++++++++++++------ src/device.c | 54 ++- src/init.c | 41 ++- src/kern_abi.h | 101 ----- src/libibverbs.map | 8 + 11 files changed, 1647 insertions(+), 295 deletions(-) create mode 100644 examples/xsrq_pingpong.c create mode 100644 man/ibv_open_qp.3 delete mode 100644 src/kern_abi.h
Signature · 6 lines
1.7.3 -- 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): 1370371791-15018-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH v6 1/7 Infrastructure to support verbs extensions
From: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/[email protected]>
Infrastructure to support extended verbs capabilities in a forward/backward manner.
Support for extensions is determeind by the provider calling verbs_register_driver in place of ibv_register_driver. When extensions are enabled, ibverbs sets the current alloc_context / free_context device operations to NULL. These are used to indicate that the struct ibv_device may be cast to struct verbs_device.
With extensions, ibverbs allocates the ibv_context structure and calls into the provider to initialize it. The init call is part of the verbs_device struct.
The abi_compat field of struct ibv_context is used to determine support of verbs extensions. As a result, support for ABI version < 2 is removed (corresponds to kernel releases 2.6.11-2.6.14 no longer being supported). The lowest ABI now supported is 3 (really 4 since 2.6.15 was ABI 4, I don't see that ABI 3 was in a release).
--- include/infiniband/driver.h | 3 + include/infiniband/kern-abi.h | 43 +-------------- include/infiniband/verbs.h | 55 ++++++++++++++++++ src/cmd.c | 125 +---------------------------------------- src/device.c | 54 +++++++++++++---- src/init.c | 41 +++++++++++-- src/kern_abi.h | 101 --------------------------------- src/libibverbs.map | 1 + 8 files changed, 137 insertions(+), 286 deletions(-) delete mode 100644 src/kern_abi.h
include/infiniband/driver.h +3 -0
@@ -55,8 +55,11 @@typedef struct ibv_device *(*ibv_driver_init_func )(const char *uverbs_sys_path,int abi_version); +typedef struct verbs_device *(*verbs_driver_init_func )(const char *uverbs_sys_path, +int abi_version);void ibv_register_driver (const char *name,ibv_driver_init_func init_func); +void verbs_register_driver (const char *name,verbs_driver_init_func init_func);int ibv_cmd_get_context (struct ibv_context *context,struct ibv_get_context *cmd,size_t cmd_size,struct ibv_get_context_resp *resp,size_t resp_size);
include/infiniband/kern-abi.h +1 -42
55 lines not on this page · raw message
include/infiniband/verbs.h +55 -0
79 lines not on this page · raw message
src/cmd.c +2 -123
188 lines not on this page · raw message
src/device.c +41 -13
82 lines not on this page · raw message
src/init.c +34 -7
74 lines not on this page · raw message
src/kern_abi.h deleted +0 -101
101 lines not on this page · raw message
src/libibverbs.map +1 -0
@@ -91,6 +91,7 @@ IBVERBS_1.1 { ibv_dontfork_range; ibv_dofork_range; ibv_register_driver; + verbs_register_driver; ibv_node_type_str; ibv_port_state_str;
Signature · 6 lines
1.7.3 -- 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
PATCH v6 2/7 libibverbs: Introduce XRC domains
In reply to a message not in the archiveFrom: Sean Hefty <[email protected]>
XRC introduces several new concepts and structures, one of which is the XRC domain.
XRC domains: xrcd's are a type of protection domain used to associate shared receive queues with xrc queue pairs. Since xrcd are meant to be shared among multiple processes, we introduce new APIs to open/close xrcd's.
The user to kernel ABI is extended to account for opening/ closing the xrcd.
--- include/infiniband/driver.h | 16 +++++++++++++ include/infiniband/kern-abi.h | 27 +++++++++++++++++++++- include/infiniband/verbs.h | 50 ++++++++++++++++++++++++++++++++++++++-- src/cmd.c | 41 +++++++++++++++++++++++++++++++++ src/libibverbs.map | 3 ++ 5 files changed, 133 insertions(+), 4 deletions(-)
include/infiniband/driver.h +16 -0
@@ -53,6 +53,17 @@*/ #define IBV_DEVICE_LIBRARY_EXTENSION rdmav2 +enum verbs_xrcd_mask { +VERBS_XRCD_HANDLE =1 <<0 , +VERBS_XRCD_RESERVED =1 <<1 +}; + +struct verbs_xrcd { +struct ibv_xrcd xrcd; +uint64_t comp_mask; +uint32_t handle; +}; +typedef struct ibv_device *(*ibv_driver_init_func )(const char *uverbs_sys_path,int abi_version); typedef struct verbs_device *(*verbs_driver_init_func)(const char *uverbs_sys_path,
@@ -78,6 +89,11 @@ int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd, struct ibv_alloc_pd *cmd, size_t cmd_size, struct ibv_alloc_pd_resp *resp, size_t resp_size);int ibv_cmd_dealloc_pd (struct ibv_pd *pd); +int ibv_cmd_open_xrcd (struct ibv_context *context,struct verbs_xrcd *xrcd, +struct ibv_xrcd_init_attr *attr, +struct ibv_open_xrcd *cmd,size_t cmd_size, +struct ibv_open_xrcd_resp *resp,size_t resp_size); +int ibv_cmd_close_xrcd (struct verbs_xrcd *xrcd);#define IBV_CMD_REG_MR_HAS_RESP_PARAMS int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length, uint64_t hca_va, int access,
include/infiniband/kern-abi.h +26 -1
@@ -85,7 +85,9 @@ enum {IB_USER_VERBS_CMD_MODIFY_SRQ ,IB_USER_VERBS_CMD_QUERY_SRQ ,IB_USER_VERBS_CMD_DESTROY_SRQ , - IB_USER_VERBS_CMD_POST_SRQ_RECV +IB_USER_VERBS_CMD_POST_SRQ_RECV , +IB_USER_VERBS_CMD_OPEN_XRCD , + IB_USER_VERBS_CMD_CLOSE_XRCD, };/*
@@ -246,6 +248,27 @@ struct ibv_dealloc_pd {__u32 pd_handle; }; +struct ibv_open_xrcd { +__u32 command; +__u16 in_words; +__u16 out_words; +__u64 response; +__u32 fd; +__u32 oflags; +__u64 driver_data[0 ]; +}; + +struct ibv_open_xrcd_resp { +__u32 xrcd_handle; +}; + +struct ibv_close_xrcd { +__u32 command; +__u16 in_words; +__u16 out_words; +__u32 xrcd_handle; +}; +struct ibv_reg_mr {__u32 command;__u16 in_words;
@@ -804,6 +827,8 @@ enum {* trick opcodes in IBV_INIT_CMD() doesn't break. */ IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL_V2 =-1 , +IB_USER_VERBS_CMD_OPEN_XRCD_V2 =-1 , + IB_USER_VERBS_CMD_CLOSE_XRCD_V2 = -1, }; struct ibv_modify_srq_v3 {
include/infiniband/verbs.h +47 -3
89 lines not on this page · raw message
src/cmd.c +41 -0
47 lines not on this page · raw message
src/libibverbs.map +3 -0
@@ -100,4 +100,7 @@ IBVERBS_1.1 { ibv_rate_to_mbps; mbps_to_ibv_rate; + + ibv_cmd_open_xrcd; + ibv_cmd_close_xrcd; } IBVERBS_1.0;
Signature · 6 lines
1.7.3 -- 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
PATCH v6 3/7 livibverbs: Add support for XRC SRQs
In reply to a message not in the archiveFrom: Sean Hefty <[email protected]>
XRC support requires the use of a new type of SRQ.
XRC shared receive queues: xrc srq's are similar to normal srq's, except that they are bound to an xrcd, rather than to a protection domain. Based on the current spec and implementation, they are only usable with xrc qps. To support xrc srq's, we define a new srq_init_attr structure to include an srq type and other needed information.
The kernel ABI is also updated to allow creating extended SRQs.
--- include/infiniband/driver.h | 27 ++++++++++++++++ include/infiniband/kern-abi.h | 21 ++++++++++++- include/infiniband/verbs.h | 61 +++++++++++++++++++++++++++++++++++- src/cmd.c | 69 +++++++++++++++++++++++++++++++++++++++++ src/libibverbs.map | 2 + 5 files changed, 178 insertions(+), 2 deletions(-)
include/infiniband/driver.h +27 -0
@@ -64,6 +64,23 @@ struct verbs_xrcd {uint32_t handle; }; +enum verbs_srq_mask { +VERBS_SRQ_TYPE =1 <<0 , +VERBS_SRQ_XRCD =1 <<1 , +VERBS_SRQ_CQ =1 <<2 , +VERBS_SRQ_NUM =1 <<3 , +VERBS_SRQ_RESERVED =1 <<4 +}; + +struct verbs_srq { +struct ibv_srq srq; +uint32_t comp_mask; +enum ibv_srq_type srq_type; +struct verbs_xrcd *xrcd; +struct ibv_cq *cq; +uint32_t srq_num; +}; +typedef struct ibv_device *(*ibv_driver_init_func )(const char *uverbs_sys_path,int abi_version); typedef struct verbs_device *(*verbs_driver_init_func)(const char *uverbs_sys_path,
@@ -118,6 +135,10 @@ int ibv_cmd_create_srq(struct ibv_pd *pd, struct ibv_srq *srq, struct ibv_srq_init_attr *attr, struct ibv_create_srq *cmd, size_t cmd_size, struct ibv_create_srq_resp *resp, size_t resp_size); +int ibv_cmd_create_srq_ex (struct ibv_context *context, +struct verbs_srq *srq,struct ibv_srq_init_attr_ex *attr_ex, +struct ibv_create_xsrq *cmd,size_t cmd_size, +struct ibv_create_srq_resp *resp,size_t resp_size); int ibv_cmd_modify_srq(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr, int srq_attr_mask,
@@ -162,4 +183,10 @@ const char *ibv_get_sysfs_path(void);int ibv_read_sysfs_file (const char *dir,const char *file,char *buf,size_t size); +static inline uint32_t verbs_get_srq_num (struct ibv_srq *srq) +{ + struct verbs_srq *vsrq = container_of(srq, struct verbs_srq, srq); +return (vsrq->comp_mask &VERBS_SRQ_NUM ) ? vsrq->srq_num :0 ; +} +#endif /* INFINIBAND_DRIVER_H */
include/infiniband/kern-abi.h +20 -1
@@ -88,6 +88,7 @@ enum {IB_USER_VERBS_CMD_POST_SRQ_RECV ,IB_USER_VERBS_CMD_OPEN_XRCD ,IB_USER_VERBS_CMD_CLOSE_XRCD , + IB_USER_VERBS_CMD_CREATE_XSRQ };/*
@@ -730,11 +731,28 @@ struct ibv_create_srq {__u64 driver_data[0 ]; }; +struct ibv_create_xsrq { +__u32 command; +__u16 in_words; +__u16 out_words; +__u64 response; +__u64 user_handle; +__u32 srq_type; +__u32 pd_handle; +__u32 max_wr; +__u32 max_sge; +__u32 srq_limit; +__u32 reserved; +__u32 xrcd_handle; +__u32 cq_handle; +__u64 driver_data[0 ]; +}; +struct ibv_create_srq_resp {__u32 srq_handle;__u32 max_wr;__u32 max_sge; -__u32 reserved; +__u32 srqn; };struct ibv_modify_srq {
@@ -829,6 +847,7 @@ enum {IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL_V2 =-1 ,IB_USER_VERBS_CMD_OPEN_XRCD_V2 =-1 ,IB_USER_VERBS_CMD_CLOSE_XRCD_V2 =-1 , +IB_USER_VERBS_CMD_CREATE_XSRQ_V2 =-1 }; struct ibv_modify_srq_v3 {
include/infiniband/verbs.h +60 -1
89 lines not on this page · raw message
src/cmd.c +69 -0
75 lines not on this page · raw message
src/libibverbs.map +2 -0
@@ -103,4 +103,6 @@ IBVERBS_1.1 { ibv_cmd_open_xrcd; ibv_cmd_close_xrcd; + ibv_cmd_create_srq_ex; + } IBVERBS_1.0;
Signature · 6 lines
1.7.3 -- 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): 1370371791-15018-4-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH libibverbs v6 3/7] livibverbs: Add support for XRC SRQs
include/infiniband/verbs.h struct ibv_context { · line 797
Quoted 6 lines · On Tue, Jun 04, 2013 at 11:49:47AM -0700…
enum
verbs_context_mask{include/infiniband/verbs.h +2
-1VERBS_CONTEXT_XRCD =1 <<0 , - VERBS_CONTEXT_RESERVED = 1 << 1 +VERBS_CONTEXT_SRQ =1 <<1 , + VERBS_CONTEXT_RESERVED = 1 << 2 };
Why is _RESERVED being re-numbered here? That worries me..
For that matter, what is it for?
Frankly, I would ditch mask for verbs_context op members and other structures that are size based. What does it mean if the size includes get_srq_num, but VERBS_CONTEXT_SRQ is 0 and *get_srq_num is null/non-null?
Simpler rule: If the size says the entry is there, then it is there.
Reserve mask for some other future use.
include/infiniband/verbs.h int ibv_modify_srq(struct ibv_srq *srq, · line 1139
Quoted 8 lines
include/infiniband/verbs.h +8
-0+static inline uint32_t ibv_get_srq_num (struct ibv_srq *srq) +{ +struct verbs_context *vctx =verbs_get_ctx_op (srq->context, get_srq_num); +if (!vctx) { + errno =ENOSYS ; +return 0 ; + } +return vctx->get_srq_num (srq);
Might want to stream line this flow a bit:
static inline struct verbs_context *__verbs_get_ctx_op(struct ibv_context *context,
size_t op)
{
struct verbs_context *vctx = verbs_get_ctx(ctx);
if (vctx && vctx->sz >= sizeof(*vctx) - op &&
*((void **)vctx + op) != NULL)
return vctx;
errno = ENOSYS;
return NULL;
}#define verbs_get_ctx_op(ctx, op) __verbs_get_ctx_op(ctx, offsetof(struct verbs_context, op))
static inline uint32_t ibv_get_srq_num(struct ibv_srq *srq)
{
struct verbs_context *vctx = verbs_get_ctx_op(srq->context,get_srq_num);
if (!vctx)
return 0;
return vctx->get_srq_num(srq);
}src/libibverbs.map IBVERBS_1.1 { · line 108
Quoted 10 lines
src/libibverbs.map +3
-0+++ b/src/libibverbs.map@@ -103,4 +103,6 @@ IBVERBS_1.1 { ibv_cmd_open_xrcd; ibv_cmd_close_xrcd; + ibv_cmd_create_srq_ex; + } IBVERBS_1.0;
Hum, so drivers that implement XRC will need to be paired with a new verbs... Bit disappointing, did we want to try and address that?
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): 20130604204859.GA30182-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
RE: [PATCH libibverbs v6 3/7] livibverbs: Add support for XRC SRQs
Quoted 10 lines
include/infiniband/verbs.h struct ibv_context { · line 797
Quoted 6 lines
enum
verbs_context_mask{include/infiniband/verbs.h +2
-1VERBS_CONTEXT_XRCD =1 <<0 , - VERBS_CONTEXT_RESERVED = 1 << 1 +VERBS_CONTEXT_SRQ =1 <<1 , + VERBS_CONTEXT_RESERVED = 1 << 2 };Why is
_RESERVEDbeing re-numbered here? That worries me..For that matter, what is it for?
I called it reserved, you can call it max. It's to let libibverbs guard against vendor libraries built against future versions of the library, but run against an older one, using something like this:
if (mask >= VERBS_CONTEXT_RESERVED) abort...
Quoted 4 lines
Frankly, I would ditch mask for
verbs_contextop members and other structures that are size based. What does it mean if the size includesget_srq_num, butVERBS_CONTEXT_SRQis 0 and*get_srq_numis null/non-null?
These mask values indicate to libibverbs that it can cast from struct ibv_* to struct verbs_*.
Quoted 5 lines
Quoted 5 lines
src/libibverbs.map +1
-0+++ b/src/libibverbs.map@@ -103,4 +103,6 @@ IBVERBS_1.1 {
Quoted 8 lines
src/libibverbs.map IBVERBS_1.1 { · line 108
Quoted 5 lines
src/libibverbs.map +2
-0ibv_cmd_open_xrcd; ibv_cmd_close_xrcd; + ibv_cmd_create_srq_ex; + } IBVERBS_1.0;Hum, so drivers that implement XRC will need to be paired with a new verbs... Bit disappointing, did we want to try and address that?
The extensions were added specifically to handle XRC.
--
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): 1828884A29C6694DAF28B7E6B8A823736FD2CF92-P5GAC/[email protected]
Re: [PATCH libibverbs v6 3/7] livibverbs: Add support for XRC SRQs
Quoted 9 lines · Sean
Quoted 9 lines
include/infiniband/verbs.h struct ibv_context { · line 797
Quoted 6 lines
enum
verbs_context_mask{include/infiniband/verbs.h +2
-1VERBS_CONTEXT_XRCD =1 <<0 , - VERBS_CONTEXT_RESERVED = 1 << 1 +VERBS_CONTEXT_SRQ =1 <<1 , + VERBS_CONTEXT_RESERVED = 1 << 2 };Why is
_RESERVEDbeing re-numbered here? That worries me..
Quoted 6 lines
Quoted 1 line
For that matter, what is it for?
I called it reserved, you can call it max. It's to let libibverbs guard against vendor libraries built against future versions of the library, but run against an older one, using something like this:
if (mask >= VERBS_CONTEXT_RESERVED) abort...
Hurm, doesn't sound great, all this complexity is trying to avoid aborts.
Better to have the driver set the things it supports during init, and the have verbs mask off the things it doesn't support, so that the result is what both verbs and the driver supports.
If the driver has a problem with missing verbs support then it should deal with it internally. I expect in most cases it isn't an issue since this is just structure over-allocation..
Quoted 7 lines
Quoted 4 lines
Frankly, I would ditch mask for
verbs_contextop members and other structures that are size based. What does it mean if the size includesget_srq_num, butVERBS_CONTEXT_SRQis 0 and*get_srq_numis null/non-null?These mask values indicate to libibverbs that it can cast from struct ibv_* to struct verbs_*.
Okay, that make sense, but verbs_xrcd and verbs_srq don't have an ibv counterpart, so these constants are never used?
A comment would help, and 'verbs_context_mask' is a poor name. It looks like the usual comp_mask stuff applied to the structure it is in.
verbs_supported_extended or something??
Quoted 11 lines
Quoted 10 lines
src/libibverbs.map IBVERBS_1.1 { · line 108
Quoted 7 lines
src/libibverbs.map +2
-0@@ -103,4 +103,6 @@ IBVERBS_1.1 { ibv_cmd_open_xrcd; ibv_cmd_close_xrcd; + ibv_cmd_create_srq_ex; + } IBVERBS_1.0;Hum, so drivers that implement XRC will need to be paired with a new verbs... Bit disappointing, did we want to try and address that?
Quoted 1 line
The extensions were added specifically to handle XRC.
At one point there was a desire to have the drivers able to work with a range of ibverbs, if the driver links to these symbols then it will only dynamic link with the latest ibverbs.
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
PATCH v6 4/7 libibverbs: Add support for XRC QPs
In reply to a message not in the archiveFrom: Sean Hefty <[email protected]>
XRC queue pairs: xrc defines two new types of QPs. The initiator, or send-side, xrc qp behaves similar to a send- only RC qp. xrc send qp's are managed through the existing QP functions. The send_wr structure is extended in a back- wards compatible way to support posting sends on a send xrc qp, which require specifying the remote xrc srq.
The target, or receive-side, xrc qp behaves differently than other implemented qp's. A recv xrc qp can be created, modified, and destroyed like other qp's through the existing calls. The qp_init_attr structure is extended for xrc qp's.
Because xrc recv qp's are bound to an xrcd, rather than a pd, it is intended to be used among multiple processes. Any process with access to an xrcd may allocate and connect an xrc recv qp. The actual xrc recv qp is allocated and managed by the kernel. If the owning process explicit destroys the xrc recv qp, it is destroyed. However, if the xrc recv qp is left open when the user process exits or closes its device, then the lifetime of the xrc recv qp is bound with the lifetime of the xrcd.
--- include/infiniband/driver.h | 14 ++++++ include/infiniband/kern-abi.h | 5 ++ include/infiniband/verbs.h | 54 ++++++++++++++++++++++- src/cmd.c | 94 ++++++++++++++++++++++++++++++++++++++++- src/libibverbs.map | 1 + 5 files changed, 164 insertions(+), 4 deletions(-)
include/infiniband/driver.h +14 -0
@@ -81,6 +81,16 @@ struct verbs_srq {uint32_t srq_num; }; +enum verbs_qp_mask { +VERBS_QP_XRCD =1 <<0 , +VERBS_QP_RESERVED =1 <<1 +}; + +struct verbs_qp { +struct ibv_qp qp; +uint32_t comp_mask; +struct verbs_xrcd *xrcd; +};typedef struct ibv_device *(*ibv_driver_init_func )(const char *uverbs_sys_path,int abi_version); typedef struct verbs_device *(*verbs_driver_init_func)(const char *uverbs_sys_path,
@@ -152,6 +162,10 @@ int ibv_cmd_create_qp(struct ibv_pd *pd, struct ibv_qp *qp, struct ibv_qp_init_attr *attr, struct ibv_create_qp *cmd, size_t cmd_size, struct ibv_create_qp_resp *resp, size_t resp_size); +int ibv_cmd_create_qp_ex (struct ibv_context *context, +struct verbs_qp *qp,struct ibv_qp_init_attr_ex *attr_ex, +struct ibv_create_qp *cmd,size_t cmd_size, +struct ibv_create_qp_resp *resp,size_t resp_size); int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *qp_attr, int attr_mask, struct ibv_qp_init_attr *qp_init_attr,
include/infiniband/kern-abi.h +5 -0
@@ -617,6 +617,11 @@ struct ibv_kern_send_wr {__u32 remote_qkey;__u32 reserved; } ud; +struct { +__u64 reserved[3 ]; +__u32 reserved2; +__u32 remote_srqn; + } xrc; } wr; };
include/infiniband/verbs.h +51 -3
94 lines not on this page · raw message
src/cmd.c +93 -1
106 lines not on this page · raw message
src/libibverbs.map +1 -0
@@ -104,5 +104,6 @@ IBVERBS_1.1 { ibv_cmd_open_xrcd; ibv_cmd_close_xrcd; ibv_cmd_create_srq_ex; + ibv_cmd_create_qp_ex; } IBVERBS_1.0;
Signature · 6 lines
1.7.3 -- 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
PATCH v6 5/7 libibverbs: Add ibv_open_qp
In reply to a message not in the archiveFrom: Sean Hefty <[email protected]>
XRC receive QPs are shareable across multiple processes. Allow any process with access to the xrc domain to open an existing QP. After opening the QP, the process will receive events related to the QP and be able to modify the QP.
--- include/infiniband/driver.h | 4 +++ include/infiniband/kern-abi.h | 20 ++++++++++++++++- include/infiniband/verbs.h | 35 +++++++++++++++++++++++++++++++- src/cmd.c | 45 +++++++++++++++++++++++++++++++++++++++++ src/libibverbs.map | 1 + 5 files changed, 102 insertions(+), 3 deletions(-)
include/infiniband/driver.h +4 -0
@@ -166,6 +166,10 @@ int ibv_cmd_create_qp_ex(struct ibv_context *context, struct verbs_qp *qp, struct ibv_qp_init_attr_ex *attr_ex, struct ibv_create_qp *cmd, size_t cmd_size, struct ibv_create_qp_resp *resp, size_t resp_size); +int ibv_cmd_open_qp (struct ibv_context *context, +struct verbs_qp *qp,struct ibv_qp_open_attr *attr, +struct ibv_open_qp *cmd,size_t cmd_size, +struct ibv_create_qp_resp *resp,size_t resp_size); int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *qp_attr, int attr_mask, struct ibv_qp_init_attr *qp_init_attr,
include/infiniband/kern-abi.h +18 -2
@@ -88,7 +88,8 @@ enum {IB_USER_VERBS_CMD_POST_SRQ_RECV ,IB_USER_VERBS_CMD_OPEN_XRCD ,IB_USER_VERBS_CMD_CLOSE_XRCD , - IB_USER_VERBS_CMD_CREATE_XSRQ +IB_USER_VERBS_CMD_CREATE_XSRQ , + IB_USER_VERBS_CMD_OPEN_QP };/*
@@ -476,6 +477,20 @@ struct ibv_create_qp {__u64 driver_data[0 ]; }; +struct ibv_open_qp { +__u32 command; +__u16 in_words; +__u16 out_words; +__u64 response; +__u64 user_handle; +__u32 pd_handle; +__u32 qpn; +__u8 qp_type; +__u8 reserved[7 ]; +__u64 driver_data[0 ]; +}; + +/* also used for open response */ struct ibv_create_qp_resp {__u32 qp_handle;__u32 qpn;
@@ -852,7 +867,8 @@ enum {IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL_V2 =-1 ,IB_USER_VERBS_CMD_OPEN_XRCD_V2 =-1 ,IB_USER_VERBS_CMD_CLOSE_XRCD_V2 =-1 , -IB_USER_VERBS_CMD_CREATE_XSRQ_V2 =-1 +IB_USER_VERBS_CMD_CREATE_XSRQ_V2 =-1 , +IB_USER_VERBS_CMD_OPEN_QP_V2 =-1 }; struct ibv_modify_srq_v3 {
include/infiniband/verbs.h +34 -1
@@ -520,6 +520,22 @@ struct ibv_qp_init_attr_ex {struct ibv_xrcd *xrcd; }; +enum ibv_qp_open_attr_mask { +IBV_QP_OPEN_ATTR_NUM =1 <<0 , +IBV_QP_OPEN_ATTR_CONTEXT =1 <<1 , +IBV_QP_OPEN_ATTR_XRCD =1 <<2 , +IBV_QP_OPEN_ATTR_TYPE =1 <<3 , +IBV_QP_OPEN_ATTR_RESERVED =1 <<4 + }; + +struct ibv_qp_open_attr { +uint32_t comp_mask; +uint32_t qp_num; +struct ibv_xrcd *xrcd; +void *qp_context; +enum ibv_qp_type qp_type; +}; +enum ibv_qp_attr_mask {IBV_QP_STATE =1 <<0 ,IBV_QP_CUR_STATE =1 <<1 ,
@@ -551,7 +567,8 @@ enum ibv_qp_state {IBV_QPS_RTS ,IBV_QPS_SQD ,IBV_QPS_SQE , -IBV_QPS_ERR +IBV_QPS_ERR , +IBV_QPS_UNKNOWN }; enum ibv_mig_state {
@@ -827,6 +844,8 @@ enum verbs_context_mask {struct verbs_context {/* "grows up" - new fields go here */ +struct ibv_qp * (*open_qp)(struct ibv_context *context, +struct ibv_qp_open_attr *attr);struct ibv_qp * (*create_qp_ex)(struct ibv_context *context,struct ibv_qp_init_attr_ex *qp_init_attr_ex);uint32_t (*get_srq_num)(struct ibv_srq *srq);
@@ -1214,6 +1233,20 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini }/** +* ibv_open_qp - Open a shareable queue pair. +*/ +static inline struct ibv_qp * +ibv_open_qp (struct ibv_context *context,struct ibv_qp_open_attr *qp_open_attr) +{ +struct verbs_context *vctx =verbs_get_ctx_op (context, open_qp); +if (!vctx) { + errno =ENOSYS ; +return NULL ; + } +return vctx->open_qp (context, qp_open_attr); +} + +/** * ibv_modify_qp - Modify a queue pair. */ int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
src/cmd.c +45 -0
51 lines not on this page · raw message
src/libibverbs.map +1 -0
@@ -105,5 +105,6 @@ IBVERBS_1.1 { ibv_cmd_close_xrcd; ibv_cmd_create_srq_ex; ibv_cmd_create_qp_ex; + ibv_cmd_open_qp; } IBVERBS_1.0;
Signature · 6 lines
1.7.3 -- 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
PATCH v6 6/7 libibverbs: Add man page for ibv_open_qp
In reply to a message not in the archiveFrom: Sean Hefty <[email protected]>
--- man/ibv_open_qp.3 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) create mode 100644 man/ibv_open_qp.3
man/ibv_open_qp.3 new file +50 -0
@@ -0,0 +1,50 @@ +.\" -*- nroff -*- +.\" +.TH IBV_OPEN_QP 3 2011-08-12 libibverbs "Libibverbs Programmer's Manual" +.SH "NAME" +ibv_open_qp \- open a shareable queue pair (QP) +.SH "SYNOPSIS" +.nf +.B #include <infiniband/verbs.h> +.sp +.BI "struct ibv_qp *ibv_open_qp(struct ibv_xrcd " "*xrcd" , +.BI " struct ibv_qp_open_attr " "*qp_open_attr" ); +.fi +.SH "DESCRIPTION" +.B ibv_open_qp() +opens an existing queue pair (QP) associated with the extended protection domain +.I xrcd\fR. +The argument +.I qp_open_attr +is an ibv_qp_open_attr struct, as defined in <infiniband/verbs.h>. +.PP +.nf +struct ibv_qp_open_attr { +.in +8 +uint32_t comp_mask; /* Identifies valid fields */ +uint32_t qp_num; /* QP number */ +void *qp_context; /* Associated context of the QP */ +enum ibv_qp_type qp_type; /* QP transport service type */ +.fi +.PP +.B ibv_destroy_qp() +closes the opened QP and destroys the underlying QP if it has no +other references. +.I qp\fR. +.SH "RETURN VALUE" +.B ibv_open_qp() +returns a pointer to the opened QP, or NULL if the request fails. +Check the QP number (\fBqp_num\fR) in the returned QP. +.SH "NOTES" +.B ibv_open_qp() +will fail if a it is asked to open a QP that does not exist within +the xrcd with the specified qp_num and qp_type. +.SH "SEE ALSO" +.BR ibv_alloc_pd (3), +.BR ibv_create_qp (3), +.BR ibv_create_qp_ex (3), +.BR ibv_modify_qp (3), +.BR ibv_query_qp (3) +.SH "AUTHORS" +.TP +Sean Hefty <[email protected]>
Signature · 6 lines
1.7.3 -- 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): 1370371791-15018-7-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH libibverbs v6 6/7] libibverbs: Add man page for ibv_open_qp
Quoted 7 lines · On 6/4/2013 1:49 PM, [email protected] wrote:
From: Sean Hefty <[email protected]>
Signed-off-by Sean Hefty <[email protected]>--- man/ibv_open_qp.3 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-)create mode 100644 man/ibv_open_qp.3
Udate Makefile.am so this gets installed.
There should also be man pages for the other new verbs.
Steve.
--
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
Re: [PATCH libibverbs v6 6/7] libibverbs: Add man page for ibv_open_qp
In reply to a message not in the archiveman/ibv_open_qp.3 line 24
Quoted 3 lines · On Tue, Jun 04, 2013 at 11:49:50AM -0700…
man/ibv_open_qp.3 new file +3
-0+struct ibv_qp_open_attr { +.in +8 +uint32_t comp_mask; /* Identifies valid fields */
Since the user is expected to set comp_mask we should clearly document what it should be set to.
man/ibv_open_qp.3 line 26
Quoted 2 lines
man/ibv_open_qp.3 new file +2
-0+uint32_t qp_num; /* QP number */ +void *qp_context; /* Associated context of the QP */
Would be nice to clarify what this value is too. I took a quick peak and it wasn't clear to me. The XRC example does not use it.
Is it a user defined cookie? If so can we call it a cookie instead?
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): 20130604205413.GB30182-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
RE: [PATCH libibverbs v6 6/7] libibverbs: Add man page for ibv_open_qp
Quoted 7 lines
man/ibv_open_qp.3 line 26
Quoted 2 lines
man/ibv_open_qp.3 new file +2
-0+uint32_t qp_num; /* QP number */ +void *qp_context; /* Associated context of the QP */Would be nice to clarify what this value is too. I took a quick peak and it wasn't clear to me. The XRC example does not use it.
Is it a user defined cookie? If so can we call it a cookie instead?
This is similar to qp_context in ibv_qp_init_attr and ibv_qp, which is also consistent with cq_context and srq_context. It is a user defined context. --
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): 1828884A29C6694DAF28B7E6B8A823736FD2CFAB-P5GAC/[email protected]
Re: [PATCH libibverbs v6 6/7] libibverbs: Add man page for ibv_open_qp
Quoted 11 lines · Sean
Quoted 7 lines
man/ibv_open_qp.3 line 26
Quoted 2 lines
man/ibv_open_qp.3 new file +2
-0+uint32_t qp_num; /* QP number */ +void *qp_context; /* Associated context of the QP */Would be nice to clarify what this value is too. I took a quick peak and it wasn't clear to me. The XRC example does not use it.
Is it a user defined cookie? If so can we call it a cookie instead?
This is similar to
qp_contextinibv_qp_init_attrandibv_qp, which is also consistent withcq_contextandsrq_context. It is a user defined context.
Hum, I honestly had no idea about qp_context in struct ibv_qp, it really is not documented well..
Keep the name, but please clarify what it is:
'User defined opaque value'
Ideally in the other places too..
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
PATCH v6 7/7 libibverbs: Add XRC sample application
In reply to a message not in the archiveFrom: Jay Sternberg <[email protected]>
--- Makefile.am | 4 +- examples/xsrq_pingpong.c | 885 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 888 insertions(+), 1 deletions(-) create mode 100644 examples/xsrq_pingpong.c
Makefile.am +3 -1
@@ -18,7 +18,7 @@ src_libibverbs_la_DEPENDENCIES = $(srcdir)/src/libibverbs.map bin_PROGRAMS = examples/ibv_devices examples/ibv_devinfo \ examples/ibv_asyncwatch examples/ibv_rc_pingpong examples/ibv_uc_pingpong \ - examples/ibv_ud_pingpong examples/ibv_srq_pingpong + examples/ibv_ud_pingpong examples/ibv_srq_pingpong examples/ibv_xsrq_pingpong examples_ibv_devices_SOURCES = examples/device_list.c examples_ibv_devices_LDADD = $(top_builddir)/src/libibverbs.la examples_ibv_devinfo_SOURCES = examples/devinfo.c
@@ -31,6 +31,8 @@ examples_ibv_ud_pingpong_SOURCES = examples/ud_pingpong.c examples/pingpong.c examples_ibv_ud_pingpong_LDADD = $(top_builddir)/src/libibverbs.la examples_ibv_srq_pingpong_SOURCES = examples/srq_pingpong.c examples/pingpong.c examples_ibv_srq_pingpong_LDADD = $(top_builddir)/src/libibverbs.la +examples_ibv_xsrq_pingpong_SOURCES = examples/xsrq_pingpong.c examples/pingpong.c +examples_ibv_xsrq_pingpong_LDADD = $(top_builddir)/src/libibverbs.la examples_ibv_asyncwatch_SOURCES = examples/asyncwatch.c examples_ibv_asyncwatch_LDADD = $(top_builddir)/src/libibverbs.la
examples/xsrq_pingpong.c new file +885 -0
885 lines not on this page · raw message
Signature · 6 lines
1.7.3 -- 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