All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V1 libibverbs 0/7] RSS support
@ 2016-09-14 13:56 Yishai Hadas
       [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Yishai Hadas @ 2016-09-14 13:56 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

Hi Doug,

Sending V1 to address the symbol table note that Jason pointed
on, no other changes from V0, details below.

The series was tested successfully with mlx5 driver (lib, kernel) and can be
accessed also from my openfabrics GIT at:
git://openfabrics.org/~yishaih/libibverbs.git branch: rss_v1

This patch-set exposes to user space the required objects and verbs in order to
allow verbs based solution to utilize the RSS offload capability.

The kernel part for the 5 first patches was already accepted into 4.8, the
capabilities patch (#6) was sent few weeks ago into 4.9, reviewed by Sagi
Grimberg and waits to your acceptance. The last patch adds and updates relevant
man pages.

Yishai

In General:
RSS (Receive Side Scaling) technology allows to spread incoming 
traffic between different receive descriptor queues.
Assigning each queue to different CPU core allows to better load 
balance the incoming traffic and improve performance.

Extra details can be found in each commit message. 

Patches:
#1: Introduces Work Queue object and its verbs.
#2: Introduces Receive Work Queue indirection table and its verbs.
#3: Extends create QP to get a Receive-Work-Queue-indirection table.
#4: Extends create QP to get RX hash data.
#5: Tracks asynchronous events on a work queue.
#6: Exposes RSS related capabilities.
#7: Updates man pages for RSS usage.

Changes from V0:
patches 1 & 2: Use IBVERBS_1.3 as the symbol label.

Yishai Hadas (7):
  Introduce Work Queue object and its verbs
  Introduce Receive Work Queue indirection table and its verbs
  Extend create QP to get a Receive Work Queue indirection table
  Extend create QP to get RX hash data
  Track asynchronous events on a work queue
  Expose RSS related capabilities
  Update man pages for RSS usage

 Makefile.am                    |  10 +-
 examples/devinfo.c             |  24 ++++
 include/infiniband/driver.h    |  23 ++++
 include/infiniband/kern-abi.h  |  92 +++++++++++++-
 include/infiniband/verbs.h     | 282 ++++++++++++++++++++++++++++++++++++++++-
 man/ibv_create_qp_ex.3         |  14 +-
 man/ibv_create_rwq_ind_table.3 |  58 +++++++++
 man/ibv_create_wq.3            |  59 +++++++++
 man/ibv_modify_wq.3            |  43 +++++++
 man/ibv_query_device_ex.3      |  10 ++
 src/cmd.c                      | 213 ++++++++++++++++++++++++++++++-
 src/device.c                   |  15 +++
 src/libibverbs.map             |   9 ++
 13 files changed, 842 insertions(+), 10 deletions(-)
 create mode 100644 man/ibv_create_rwq_ind_table.3
 create mode 100644 man/ibv_create_wq.3
 create mode 100644 man/ibv_modify_wq.3

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V1 libibverbs 1/7] Introduce Work Queue object and its verbs
       [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-09-14 13:56   ` Yishai Hadas
       [not found]     ` <1473861388-22064-2-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-09-14 13:56   ` [PATCH V1 libibverbs 2/7] Introduce Receive Work Queue indirection table " Yishai Hadas
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Yishai Hadas @ 2016-09-14 13:56 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

Introduce Work Queue object and its create/destroy/modify verbs.

QP can be created without internal WQs "packaged" inside it,
this QP can be configured to use "external" WQ object as its
receive/send queue.

WQ is a necessary component for RSS technology since RSS mechanism
is supposed to distribute the traffic between multiple Receive Work
Queues.

WQ associated (many to one) with Completion Queue and it owns WQ
properties (PD, WQ size, etc.).
WQ has a type, this patch introduces the IBV_WQT_RQ (i.e.receive
queue), it may be extend to others such as IBV_WQT_SQ. (send queue).

WQ from type IBV_WQT_RQ contains receive work requests and as such
exposes post receive function to be used to post a list of work
requests (WRs) to its receive queue.

PD is an attribute of a work queue (i.e. send/receive queue), it's
used by the hardware for security validation before scattering to a
memory region which is pointed by the WQ. For that, an external WQ
object
needs a PD, letting the hardware makes that validation.

When accessing a memory region that is pointed by the WQ its PD
is used and not the QP's PD, this behavior is similar to a SRQ and a QP.

WQ context is subject to a well-defined state transitions done by
the modify_wq verb.
When WQ is created its initial state becomes IBV_WQS_RESET.
>From IBV_WQS_RESET it can be modified to itself or to IBV_WQS_RDY.
>From IBV_WQS_RDY it can be modified to itself, to IBV_WQS_RESET
      or to IBV_WQS_ERR.
>From IBV_WQS_ERR it can be modified to IBV_WQS_RESET.

Note: transition to IBV_WQS_ERR might occur implicitly in case there
      was some HW error.

Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 include/infiniband/driver.h   |  14 ++++
 include/infiniband/kern-abi.h |  49 ++++++++++++-
 include/infiniband/verbs.h    | 160 ++++++++++++++++++++++++++++++++++++++++++
 src/cmd.c                     |  98 ++++++++++++++++++++++++++
 src/libibverbs.map            |   7 ++
 5 files changed, 327 insertions(+), 1 deletion(-)

diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h
index 65fa44f..706445b 100644
--- a/include/infiniband/driver.h
+++ b/include/infiniband/driver.h
@@ -236,6 +236,20 @@ int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t l
 struct ibv_flow *ibv_cmd_create_flow(struct ibv_qp *qp,
 				     struct ibv_flow_attr *flow_attr);
 int ibv_cmd_destroy_flow(struct ibv_flow *flow_id);
+int ibv_cmd_create_wq(struct ibv_context *context,
+		      struct ibv_wq_init_attr *wq_init_attr,
+		      struct ibv_wq *wq,
+		      struct ibv_create_wq *cmd,
+		      size_t cmd_core_size,
+		      size_t cmd_size,
+		      struct ibv_create_wq_resp *resp,
+		      size_t resp_core_size,
+		      size_t resp_size);
+
+int ibv_cmd_modify_wq(struct ibv_wq *wq, struct ibv_wq_attr *attr,
+		      struct ibv_modify_wq *cmd, size_t cmd_core_size,
+		      size_t cmd_size);
+int ibv_cmd_destroy_wq(struct ibv_wq *wq);
 
 int ibv_dontfork_range(void *base, size_t size);
 int ibv_dofork_range(void *base, size_t size);
diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h
index f70fa44..081918f 100644
--- a/include/infiniband/kern-abi.h
+++ b/include/infiniband/kern-abi.h
@@ -116,7 +116,10 @@ enum {
 						IB_USER_VERBS_CMD_CREATE_CQ,
 	IB_USER_VERBS_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_EXTENDED_MASK +
 					IB_USER_VERBS_CMD_THRESHOLD,
-	IB_USER_VERBS_CMD_DESTROY_FLOW
+	IB_USER_VERBS_CMD_DESTROY_FLOW,
+	IB_USER_VERBS_CMD_CREATE_WQ,
+	IB_USER_VERBS_CMD_MODIFY_WQ,
+	IB_USER_VERBS_CMD_DESTROY_WQ
 };
 
 /*
@@ -1125,6 +1128,9 @@ enum {
 	IB_USER_VERBS_CMD_QUERY_DEVICE_EX_V2 = -1,
 	IB_USER_VERBS_CMD_CREATE_QP_EX_V2 = -1,
 	IB_USER_VERBS_CMD_CREATE_CQ_EX_V2 = -1,
+	IB_USER_VERBS_CMD_CREATE_WQ_V2 = -1,
+	IB_USER_VERBS_CMD_MODIFY_WQ_V2 = -1,
+	IB_USER_VERBS_CMD_DESTROY_WQ_V2 = -1,
 };
 
 struct ibv_modify_srq_v3 {
@@ -1159,4 +1165,45 @@ struct ibv_create_srq_resp_v5 {
 	__u32 srq_handle;
 };
 
+struct ibv_create_wq {
+	struct ex_hdr hdr;
+	__u32 comp_mask;
+	__u32 wq_type;
+	__u64 user_handle;
+	__u32 pd_handle;
+	__u32 cq_handle;
+	__u32 max_wr;
+	__u32 max_sge;
+};
+
+struct ibv_create_wq_resp {
+	__u32 comp_mask;
+	__u32 response_length;
+	__u32 wq_handle;
+	__u32 max_wr;
+	__u32 max_sge;
+	__u32 wqn;
+};
+
+struct ibv_destroy_wq {
+	struct ex_hdr hdr;
+	__u32 comp_mask;
+	__u32 wq_handle;
+};
+
+struct ibv_destroy_wq_resp {
+	__u32 comp_mask;
+	__u32 response_length;
+	__u32 events_reported;
+	__u32 reserved;
+};
+
+struct ibv_modify_wq  {
+	struct ex_hdr hdr;
+	__u32 attr_mask;
+	__u32 wq_handle;
+	__u32 wq_state;
+	__u32 curr_wq_state;
+};
+
 #endif /* KERN_ABI_H */
diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index ec541e3..c549bd3 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -612,6 +612,46 @@ struct ibv_srq_init_attr_ex {
 	struct ibv_cq	       *cq;
 };
 
+enum ibv_wq_type {
+	IBV_WQT_RQ
+};
+
+enum ibv_wq_init_attr_mask {
+	IBV_WQ_INIT_ATTR_RESERVED	= 1 << 0,
+};
+
+struct ibv_wq_init_attr {
+	void		       *wq_context;
+	enum ibv_wq_type	wq_type;
+	uint32_t		max_wr;
+	uint32_t		max_sge;
+	struct	ibv_pd	       *pd;
+	struct	ibv_cq	       *cq;
+	uint32_t		comp_mask;
+};
+
+enum ibv_wq_state {
+	IBV_WQS_RESET,
+	IBV_WQS_RDY,
+	IBV_WQS_ERR,
+	IBV_WQS_UNKNOWN
+};
+
+enum ibv_wq_attr_mask {
+	IBV_WQ_ATTR_STATE	= 1 << 0,
+	IBV_WQ_ATTR_CURR_STATE	= 1 << 1,
+	IBV_WQ_ATTR_RESERVED	= 1 << 2
+};
+
+struct ibv_wq_attr {
+	/* enum ibv_wq_attr_mask */
+	uint32_t		attr_mask;
+	/* Move the WQ to this state */
+	enum	ibv_wq_state	wq_state;
+	/* Assume this is the current WQ state */
+	enum	ibv_wq_state	curr_wq_state;
+};
+
 enum ibv_qp_type {
 	IBV_QPT_RC = 2,
 	IBV_QPT_UC,
@@ -849,6 +889,35 @@ struct ibv_srq {
 	uint32_t		events_completed;
 };
 
+/*
+ * Work Queue. QP can be created without internal WQs "packaged" inside it,
+ * this QP can be configured to use "external" WQ object as its
+ * receive/send queue.
+ * WQ associated (many to one) with Completion Queue it owns WQ properties
+ * (PD, WQ size etc).
+ * WQ of type IBV_WQT_RQ:
+ * - Contains receive WQEs, in this case its PD serves as scatter as well.
+ * - Exposes post receive function to be used to post a list of work
+ *   requests (WRs) to its receive queue.
+ */
+struct ibv_wq {
+	struct ibv_context     *context;
+	void		       *wq_context;
+	struct	ibv_pd	       *pd;
+	struct	ibv_cq	       *cq;
+	uint32_t		wq_num;
+	uint32_t		handle;
+	enum ibv_wq_state       state;
+	enum ibv_wq_type	wq_type;
+	int (*post_recv)(struct ibv_wq *current,
+			 struct ibv_recv_wr *recv_wr,
+			 struct ibv_recv_wr **bad_recv_wr);
+	pthread_mutex_t		mutex;
+	pthread_cond_t		cond;
+	uint32_t		events_completed;
+	uint32_t		comp_mask;
+};
+
 struct ibv_qp {
 	struct ibv_context     *context;
 	void		       *qp_context;
@@ -997,6 +1066,13 @@ static inline uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex *cq)
 	return cq->read_completion_ts(cq);
 }
 
+static inline int ibv_post_wq_recv(struct ibv_wq *wq,
+				   struct ibv_recv_wr *recv_wr,
+				   struct ibv_recv_wr **bad_recv_wr)
+{
+	return wq->post_recv(wq, recv_wr, bad_recv_wr);
+}
+
 struct ibv_ah {
 	struct ibv_context     *context;
 	struct ibv_pd	       *pd;
@@ -1263,6 +1339,10 @@ enum verbs_context_mask {
 
 struct verbs_context {
 	/*  "grows up" - new fields go here */
+	int (*destroy_wq)(struct ibv_wq *wq);
+	int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr);
+	struct ibv_wq * (*create_wq)(struct ibv_context *context,
+				     struct ibv_wq_init_attr *wq_init_attr);
 	int (*query_rt_values)(struct ibv_context *context,
 			       struct ibv_values_ex *values);
 	struct ibv_cq_ex *(*create_cq_ex)(struct ibv_context *context,
@@ -1872,6 +1952,86 @@ int ibv_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
  */
 int ibv_destroy_qp(struct ibv_qp *qp);
 
+/*
+ * ibv_create_wq - Creates a WQ associated with the specified protection
+ * domain.
+ * @context: ibv_context.
+ * @wq_init_attr: A list of initial attributes required to create the
+ * WQ. If WQ creation succeeds, then the attributes are updated to
+ * the actual capabilities of the created WQ.
+ *
+ * wq_init_attr->max_wr and wq_init_attr->max_sge determine
+ * the requested size of the WQ, and set to the actual values allocated
+ * on return.
+ * If ibv_create_wq() succeeds, then max_wr and max_sge will always be
+ * at least as large as the requested values.
+ *
+ * Return Value
+ * ibv_create_wq() returns a pointer to the created WQ, or NULL if the request
+ * fails.
+ */
+static inline struct ibv_wq *ibv_create_wq(struct ibv_context *context,
+					   struct ibv_wq_init_attr *wq_init_attr)
+{
+	struct verbs_context *vctx = verbs_get_ctx_op(context, create_wq);
+	struct ibv_wq *wq;
+
+	if (!vctx) {
+		errno = ENOSYS;
+		return NULL;
+	}
+
+	wq = vctx->create_wq(context, wq_init_attr);
+	if (wq) {
+		wq->events_completed = 0;
+		pthread_mutex_init(&wq->mutex, NULL);
+		pthread_cond_init(&wq->cond, NULL);
+	}
+
+	return wq;
+}
+
+/*
+ * ibv_modify_wq - Modifies the attributes for the specified WQ.
+ * @wq: The WQ to modify.
+ * @wq_attr: On input, specifies the WQ attributes to modify.
+ *    wq_attr->attr_mask: A bit-mask used to specify which attributes of the WQ
+ *    are being modified.
+ * On output, the current values of selected WQ attributes are returned.
+ *
+ * Return Value
+ * ibv_modify_wq() returns 0 on success, or the value of errno
+ * on failure (which indicates the failure reason).
+ *
+*/
+static inline int ibv_modify_wq(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr)
+{
+	struct verbs_context *vctx = verbs_get_ctx_op(wq->context, modify_wq);
+
+	if (!vctx)
+		return ENOSYS;
+
+	return vctx->modify_wq(wq, wq_attr);
+}
+
+/*
+ * ibv_destroy_wq - Destroys the specified WQ.
+ * @ibv_wq: The WQ to destroy.
+ * Return Value
+ * ibv_destroy_wq() returns 0 on success, or the value of errno
+ * on failure (which indicates the failure reason).
+*/
+static inline int ibv_destroy_wq(struct ibv_wq *wq)
+{
+	struct verbs_context *vctx;
+
+	vctx = verbs_get_ctx_op(wq->context, destroy_wq);
+	if (!vctx)
+		return ENOSYS;
+
+	return vctx->destroy_wq(wq);
+}
+
 /**
  * ibv_post_send - Post a list of work requests to a send queue.
  *
diff --git a/src/cmd.c b/src/cmd.c
index 4b3304f..6599eca 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1659,3 +1659,101 @@ int ibv_cmd_destroy_flow(struct ibv_flow *flow_id)
 	free(flow_id);
 	return ret;
 }
+
+int ibv_cmd_create_wq(struct ibv_context *context,
+		      struct ibv_wq_init_attr *wq_init_attr,
+		      struct ibv_wq *wq,
+		      struct ibv_create_wq *cmd,
+		      size_t cmd_core_size,
+		      size_t cmd_size,
+		      struct ibv_create_wq_resp *resp,
+		      size_t resp_core_size,
+		      size_t resp_size)
+{
+	int err;
+
+	if (wq_init_attr->comp_mask >= IBV_WQ_INIT_ATTR_RESERVED)
+		return EINVAL;
+
+	IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size,
+			       CREATE_WQ, resp,
+			       resp_core_size, resp_size);
+
+	cmd->user_handle   = (uintptr_t)wq;
+	cmd->pd_handle           = wq_init_attr->pd->handle;
+	cmd->cq_handle   = wq_init_attr->cq->handle;
+	cmd->wq_type = wq_init_attr->wq_type;
+	cmd->max_sge = wq_init_attr->max_sge;
+	cmd->max_wr = wq_init_attr->max_wr;
+	cmd->comp_mask = 0;
+
+	err = write(context->cmd_fd, cmd, cmd_size);
+	if (err != cmd_size)
+		return errno;
+
+	(void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+
+	if (resp->response_length < resp_core_size)
+		return EINVAL;
+
+	wq->handle  = resp->wq_handle;
+	wq_init_attr->max_wr = resp->max_wr;
+	wq_init_attr->max_sge = resp->max_sge;
+	wq->wq_num = resp->wqn;
+	wq->context = context;
+	wq->cq = wq_init_attr->cq;
+	wq->pd = wq_init_attr->pd;
+	wq->wq_type = wq_init_attr->wq_type;
+
+	return 0;
+}
+
+int ibv_cmd_modify_wq(struct ibv_wq *wq, struct ibv_wq_attr *attr,
+		      struct ibv_modify_wq *cmd, size_t cmd_core_size,
+		      size_t cmd_size)
+{
+	if (attr->attr_mask >= IBV_WQ_ATTR_RESERVED)
+		return EINVAL;
+
+	memset(cmd, 0, cmd_core_size);
+	IBV_INIT_CMD_EX(cmd, cmd_size, MODIFY_WQ);
+
+	cmd->curr_wq_state = attr->curr_wq_state;
+	cmd->wq_state = attr->wq_state;
+	cmd->wq_handle = wq->handle;
+	cmd->attr_mask = attr->attr_mask;
+
+	if (write(wq->context->cmd_fd, cmd, cmd_size) != cmd_size)
+		return errno;
+
+	if (attr->attr_mask & IBV_WQ_ATTR_STATE)
+		wq->state = attr->wq_state;
+
+	return 0;
+}
+
+int ibv_cmd_destroy_wq(struct ibv_wq *wq)
+{
+	struct ibv_destroy_wq cmd;
+	struct ibv_destroy_wq_resp resp;
+	int ret = 0;
+
+	memset(&cmd, 0, sizeof(cmd));
+	memset(&resp, 0, sizeof(resp));
+
+	IBV_INIT_CMD_RESP_EX(&cmd, sizeof(cmd), DESTROY_WQ, &resp, sizeof(resp));
+	cmd.wq_handle = wq->handle;
+
+	if (write(wq->context->cmd_fd, &cmd, sizeof(cmd)) != sizeof(cmd))
+		return errno;
+
+	if (resp.response_length < sizeof(resp))
+		return EINVAL;
+
+	pthread_mutex_lock(&wq->mutex);
+	while (wq->events_completed != resp.events_reported)
+		pthread_cond_wait(&wq->cond, &wq->mutex);
+	pthread_mutex_unlock(&wq->mutex);
+
+	return ret;
+}
diff --git a/src/libibverbs.map b/src/libibverbs.map
index 5134bd9..78a06dd 100644
--- a/src/libibverbs.map
+++ b/src/libibverbs.map
@@ -118,5 +118,12 @@ IBVERBS_1.1 {
 		ibv_cmd_create_qp_ex2;
 		ibv_cmd_open_qp;
 		ibv_cmd_rereg_mr;
+};
+
+IBVERBS_1.3 {
+        global:
+		ibv_cmd_create_wq;
+		ibv_cmd_modify_wq;
+		ibv_cmd_destroy_wq;
 
 } IBVERBS_1.0;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V1 libibverbs 2/7] Introduce Receive Work Queue indirection table and its verbs
       [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-09-14 13:56   ` [PATCH V1 libibverbs 1/7] Introduce Work Queue object and its verbs Yishai Hadas
@ 2016-09-14 13:56   ` Yishai Hadas
  2016-09-14 13:56   ` [PATCH V1 libibverbs 3/7] Extend create QP to get a Receive Work Queue indirection table Yishai Hadas
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Yishai Hadas @ 2016-09-14 13:56 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

Introduce Receive Work Queue (WQ) indirection table and its
create/destroy verbs. This object can be used to spread incoming
traffic to different receive Work Queues.

A Receive WQ indirection table points to variable size of WQs.  This
table is given to a QP in downstream patches.

Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 include/infiniband/driver.h   | 11 ++++++-
 include/infiniband/kern-abi.h | 29 +++++++++++++++++-
 include/infiniband/verbs.h    | 71 +++++++++++++++++++++++++++++++++++++++++++
 src/cmd.c                     | 68 +++++++++++++++++++++++++++++++++++++++++
 src/libibverbs.map            |  2 ++
 5 files changed, 179 insertions(+), 2 deletions(-)

diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h
index 706445b..72866a0 100644
--- a/include/infiniband/driver.h
+++ b/include/infiniband/driver.h
@@ -250,7 +250,16 @@ int ibv_cmd_modify_wq(struct ibv_wq *wq, struct ibv_wq_attr *attr,
 		      struct ibv_modify_wq *cmd, size_t cmd_core_size,
 		      size_t cmd_size);
 int ibv_cmd_destroy_wq(struct ibv_wq *wq);
-
+int ibv_cmd_create_rwq_ind_table(struct ibv_context *context,
+				 struct ibv_rwq_ind_table_init_attr *init_attr,
+				 struct ibv_rwq_ind_table *rwq_ind_table,
+				 struct ibv_create_rwq_ind_table *cmd,
+				 size_t cmd_core_size,
+				 size_t cmd_size,
+				 struct ibv_create_rwq_ind_table_resp *resp,
+				 size_t resp_core_size,
+				 size_t resp_size);
+int ibv_cmd_destroy_rwq_ind_table(struct ibv_rwq_ind_table *rwq_ind_table);
 int ibv_dontfork_range(void *base, size_t size);
 int ibv_dofork_range(void *base, size_t size);
 
diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h
index 081918f..674045b 100644
--- a/include/infiniband/kern-abi.h
+++ b/include/infiniband/kern-abi.h
@@ -119,7 +119,9 @@ enum {
 	IB_USER_VERBS_CMD_DESTROY_FLOW,
 	IB_USER_VERBS_CMD_CREATE_WQ,
 	IB_USER_VERBS_CMD_MODIFY_WQ,
-	IB_USER_VERBS_CMD_DESTROY_WQ
+	IB_USER_VERBS_CMD_DESTROY_WQ,
+	IB_USER_VERBS_CMD_CREATE_RWQ_IND_TBL,
+	IB_USER_VERBS_CMD_DESTROY_RWQ_IND_TBL,
 };
 
 /*
@@ -1131,6 +1133,8 @@ enum {
 	IB_USER_VERBS_CMD_CREATE_WQ_V2 = -1,
 	IB_USER_VERBS_CMD_MODIFY_WQ_V2 = -1,
 	IB_USER_VERBS_CMD_DESTROY_WQ_V2 = -1,
+	IB_USER_VERBS_CMD_CREATE_RWQ_IND_TBL_V2 = -1,
+	IB_USER_VERBS_CMD_DESTROY_RWQ_IND_TBL_V2 = -1,
 };
 
 struct ibv_modify_srq_v3 {
@@ -1206,4 +1210,27 @@ struct ibv_modify_wq  {
 	__u32 curr_wq_state;
 };
 
+struct ibv_create_rwq_ind_table {
+	struct ex_hdr hdr;
+	__u32 comp_mask;
+	__u32 log_ind_tbl_size;
+	/* Following are wq handles based on log_ind_tbl_size, must be 64 bytes aligned.
+	 * __u32 wq_handle1
+	 * __u32 wq_handle2
+	 */
+};
+
+struct ibv_create_rwq_ind_table_resp {
+	__u32 comp_mask;
+	__u32 response_length;
+	__u32 ind_tbl_handle;
+	__u32 ind_tbl_num;
+};
+
+struct ibv_destroy_rwq_ind_table {
+	struct ex_hdr hdr;
+	__u32 comp_mask;
+	__u32 ind_tbl_handle;
+};
+
 #endif /* KERN_ABI_H */
diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index c549bd3..491e254 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -652,6 +652,34 @@ struct ibv_wq_attr {
 	enum	ibv_wq_state	curr_wq_state;
 };
 
+/*
+ * Receive Work Queue Indirection Table.
+ * It's used in order to distribute incoming packets between different
+ * Receive Work Queues. Associating Receive WQs with different CPU cores
+ * allows to workload the traffic between different CPU cores.
+ * The Indirection Table can contain only WQs of type IBV_WQT_RQ.
+*/
+struct ibv_rwq_ind_table {
+	struct ibv_context *context;
+	int ind_tbl_handle;
+	int ind_tbl_num;
+	uint32_t comp_mask;
+};
+
+enum ibv_ind_table_init_attr_mask {
+	IBV_CREATE_IND_TABLE_RESERVED = (1 << 0)
+};
+
+/*
+ * Receive Work Queue Indirection Table attributes
+ */
+struct ibv_rwq_ind_table_init_attr {
+	uint32_t log_ind_tbl_size;
+	/* Each entry is a pointer to a Receive Work Queue */
+	struct ibv_wq **ind_tbl;
+	uint32_t comp_mask;
+};
+
 enum ibv_qp_type {
 	IBV_QPT_RC = 2,
 	IBV_QPT_UC,
@@ -1339,6 +1367,9 @@ enum verbs_context_mask {
 
 struct verbs_context {
 	/*  "grows up" - new fields go here */
+	int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table);
+	struct ibv_rwq_ind_table *(*create_rwq_ind_table)(struct ibv_context *context,
+							  struct ibv_rwq_ind_table_init_attr *init_attr);
 	int (*destroy_wq)(struct ibv_wq *wq);
 	int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr);
 	struct ibv_wq * (*create_wq)(struct ibv_context *context,
@@ -2032,6 +2063,46 @@ static inline int ibv_destroy_wq(struct ibv_wq *wq)
 	return vctx->destroy_wq(wq);
 }
 
+/*
+ * ibv_create_rwq_ind_table - Creates a receive work queue Indirection Table
+ * @context: ibv_context.
+ * @init_attr: A list of initial attributes required to create the Indirection Table.
+ * Return Value
+ * ibv_create_rwq_ind_table returns a pointer to the created
+ * Indirection Table, or NULL if the request fails.
+ */
+static inline struct ibv_rwq_ind_table *ibv_create_rwq_ind_table(struct ibv_context *context,
+								 struct ibv_rwq_ind_table_init_attr *init_attr)
+{
+	struct verbs_context *vctx;
+
+	vctx = verbs_get_ctx_op(context, create_rwq_ind_table);
+	if (!vctx) {
+		errno = ENOSYS;
+		return NULL;
+	}
+
+	return vctx->create_rwq_ind_table(context, init_attr);
+}
+
+/*
+ * ibv_destroy_rwq_ind_table - Destroys the specified Indirection Table.
+ * @rwq_ind_table: The Indirection Table to destroy.
+ * Return Value
+ * ibv_destroy_rwq_ind_table() returns 0 on success, or the value of errno
+ * on failure (which indicates the failure reason).
+*/
+static inline int ibv_destroy_rwq_ind_table(struct ibv_rwq_ind_table *rwq_ind_table)
+{
+	struct verbs_context *vctx;
+
+	vctx = verbs_get_ctx_op(rwq_ind_table->context, destroy_rwq_ind_table);
+	if (!vctx)
+		return ENOSYS;
+
+	return vctx->destroy_rwq_ind_table(rwq_ind_table);
+}
+
 /**
  * ibv_post_send - Post a list of work requests to a send queue.
  *
diff --git a/src/cmd.c b/src/cmd.c
index 6599eca..11f5de9 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1757,3 +1757,71 @@ int ibv_cmd_destroy_wq(struct ibv_wq *wq)
 
 	return ret;
 }
+
+int ibv_cmd_create_rwq_ind_table(struct ibv_context *context,
+				 struct ibv_rwq_ind_table_init_attr *init_attr,
+				 struct ibv_rwq_ind_table *rwq_ind_table,
+				 struct ibv_create_rwq_ind_table *cmd,
+				 size_t cmd_core_size,
+				 size_t cmd_size,
+				 struct ibv_create_rwq_ind_table_resp *resp,
+				 size_t resp_core_size,
+				 size_t resp_size)
+{
+	int err, i;
+	uint32_t required_tbl_size, alloc_tbl_size;
+	uint32_t *tbl_start;
+	int num_tbl_entries;
+
+	if (init_attr->comp_mask >= IBV_CREATE_IND_TABLE_RESERVED)
+		return EINVAL;
+
+	alloc_tbl_size = cmd_core_size - sizeof(*cmd);
+	num_tbl_entries = 1 << init_attr->log_ind_tbl_size;
+
+	/* Data must be u64 aligned */
+	required_tbl_size = (num_tbl_entries * sizeof(uint32_t)) < sizeof(uint64_t) ?
+			sizeof(uint64_t) : (num_tbl_entries * sizeof(uint32_t));
+
+	if (alloc_tbl_size < required_tbl_size)
+		return EINVAL;
+
+	tbl_start = (uint32_t *)((uint8_t *)cmd + sizeof(*cmd));
+	for (i = 0; i < num_tbl_entries; i++)
+		tbl_start[i] = init_attr->ind_tbl[i]->handle;
+
+	IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size,
+			       CREATE_RWQ_IND_TBL, resp,
+			       resp_core_size, resp_size);
+	cmd->log_ind_tbl_size = init_attr->log_ind_tbl_size;
+	cmd->comp_mask = 0;
+
+	err = write(context->cmd_fd, cmd, cmd_size);
+	if (err != cmd_size)
+		return errno;
+
+	(void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+
+	if (resp->response_length < resp_core_size)
+		return EINVAL;
+
+	rwq_ind_table->ind_tbl_handle = resp->ind_tbl_handle;
+	rwq_ind_table->ind_tbl_num = resp->ind_tbl_num;
+	rwq_ind_table->context = context;
+	return 0;
+}
+
+int ibv_cmd_destroy_rwq_ind_table(struct ibv_rwq_ind_table *rwq_ind_table)
+{
+	struct ibv_destroy_rwq_ind_table cmd;
+	int ret = 0;
+
+	memset(&cmd, 0, sizeof(cmd));
+	IBV_INIT_CMD_EX(&cmd, sizeof(cmd), DESTROY_RWQ_IND_TBL);
+	cmd.ind_tbl_handle = rwq_ind_table->ind_tbl_handle;
+
+	if (write(rwq_ind_table->context->cmd_fd, &cmd, sizeof(cmd)) != sizeof(cmd))
+		ret = errno;
+
+	return ret;
+}
diff --git a/src/libibverbs.map b/src/libibverbs.map
index 78a06dd..4de9d64 100644
--- a/src/libibverbs.map
+++ b/src/libibverbs.map
@@ -125,5 +125,7 @@ IBVERBS_1.3 {
 		ibv_cmd_create_wq;
 		ibv_cmd_modify_wq;
 		ibv_cmd_destroy_wq;
+		ibv_cmd_create_rwq_ind_table;
+		ibv_cmd_destroy_rwq_ind_table;
 
 } IBVERBS_1.0;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V1 libibverbs 3/7] Extend create QP to get a Receive Work Queue indirection table
       [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-09-14 13:56   ` [PATCH V1 libibverbs 1/7] Introduce Work Queue object and its verbs Yishai Hadas
  2016-09-14 13:56   ` [PATCH V1 libibverbs 2/7] Introduce Receive Work Queue indirection table " Yishai Hadas
@ 2016-09-14 13:56   ` Yishai Hadas
  2016-09-14 13:56   ` [PATCH V1 libibverbs 4/7] Extend create QP to get RX hash data Yishai Hadas
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Yishai Hadas @ 2016-09-14 13:56 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

Extend create QP to get a Receive Work Queue indirection table,
this is needed to enable RSS on some set of Receive Work Queues.

Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 include/infiniband/kern-abi.h |  6 ++++++
 include/infiniband/verbs.h    |  4 +++-
 src/cmd.c                     | 28 +++++++++++++++++++++++-----
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h
index 674045b..9f7964e 100644
--- a/include/infiniband/kern-abi.h
+++ b/include/infiniband/kern-abi.h
@@ -657,11 +657,17 @@ struct ibv_create_qp_resp {
 	__u32 reserved;
 };
 
+enum ibv_create_qp_ex_kernel_mask {
+	IBV_CREATE_QP_EX_KERNEL_MASK_IND_TABLE = 1 << 0,
+};
+
 struct ibv_create_qp_ex {
 	struct ex_hdr	hdr;
 	struct ibv_create_qp_common base;
 	__u32 comp_mask;
 	__u32 create_flags;
+	__u32 ind_tbl_handle;
+	__u32 reserved1;
 };
 
 struct ibv_create_qp_resp_ex {
diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 491e254..284bac5 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -712,7 +712,8 @@ enum ibv_qp_init_attr_mask {
 	IBV_QP_INIT_ATTR_XRCD		= 1 << 1,
 	IBV_QP_INIT_ATTR_CREATE_FLAGS	= 1 << 2,
 	IBV_QP_INIT_ATTR_MAX_TSO_HEADER = 1 << 3,
-	IBV_QP_INIT_ATTR_RESERVED	= 1 << 4
+	IBV_QP_INIT_ATTR_IND_TABLE	= 1 << 4,
+	IBV_QP_INIT_ATTR_RESERVED	= 1 << 5
 };
 
 enum ibv_qp_create_flags {
@@ -734,6 +735,7 @@ struct ibv_qp_init_attr_ex {
 	struct ibv_xrcd	       *xrcd;
 	uint32_t                create_flags;
 	uint16_t		max_tso_header;
+	struct ibv_rwq_ind_table       *rwq_ind_tbl;
 };
 
 enum ibv_qp_open_attr_mask {
diff --git a/src/cmd.c b/src/cmd.c
index 11f5de9..21f972a 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -830,12 +830,22 @@ static int create_qp_ex_common(struct verbs_qp *qp,
 			return EINVAL;
 
 		cmd->pd_handle	= qp_attr->pd->handle;
-		cmd->send_cq_handle = qp_attr->send_cq->handle;
+		if (qp_attr->comp_mask & IBV_QP_INIT_ATTR_IND_TABLE) {
+			if (cmd->max_recv_wr || cmd->max_recv_sge ||
+			    cmd->recv_cq_handle || qp_attr->srq)
+				return EINVAL;
+
+			/* send_cq is optinal */
+			if (qp_attr->cap.max_send_wr)
+				cmd->send_cq_handle = qp_attr->send_cq->handle;
+		} else {
+			cmd->send_cq_handle = qp_attr->send_cq->handle;
 
-		if (qp_attr->qp_type != IBV_QPT_XRC_SEND) {
-			cmd->recv_cq_handle = qp_attr->recv_cq->handle;
-			cmd->srq_handle = qp_attr->srq ? qp_attr->srq->handle :
-							 0;
+			if (qp_attr->qp_type != IBV_QPT_XRC_SEND) {
+				cmd->recv_cq_handle = qp_attr->recv_cq->handle;
+				cmd->srq_handle = qp_attr->srq ? qp_attr->srq->handle :
+								 0;
+			}
 		}
 	}
 
@@ -933,6 +943,14 @@ int ibv_cmd_create_qp_ex2(struct ibv_context *context,
 		cmd->create_flags = qp_attr->create_flags;
 	}
 
+	if (qp_attr->comp_mask & IBV_QP_INIT_ATTR_IND_TABLE) {
+		if (cmd_core_size < offsetof(struct ibv_create_qp_ex, ind_tbl_handle) +
+				    sizeof(cmd->ind_tbl_handle))
+			return EINVAL;
+		cmd->ind_tbl_handle = qp_attr->rwq_ind_tbl->ind_tbl_handle;
+		cmd->comp_mask = IBV_CREATE_QP_EX_KERNEL_MASK_IND_TABLE;
+	}
+
 	err = write(context->cmd_fd, cmd, cmd_size);
 	if (err != cmd_size)
 		return errno;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V1 libibverbs 4/7] Extend create QP to get RX hash data
       [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-09-14 13:56   ` [PATCH V1 libibverbs 3/7] Extend create QP to get a Receive Work Queue indirection table Yishai Hadas
@ 2016-09-14 13:56   ` Yishai Hadas
  2016-09-14 13:56   ` [PATCH V1 libibverbs 5/7] Track asynchronous events on a work queue Yishai Hadas
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Yishai Hadas @ 2016-09-14 13:56 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

Extend create QP to get RX hash data, this is needed
to enable RSS based on some RX configuration.

Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 include/infiniband/verbs.h | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 284bac5..88ac4bb 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -214,6 +214,30 @@ struct ibv_tso_caps {
 	uint32_t supported_qpts;
 };
 
+/* RX Hash function flags */
+enum ibv_rx_hash_function_flags {
+	IBV_RX_HASH_FUNC_TOEPLITZ	= 1 << 0,
+};
+
+/*
+ * RX Hash fields enable to set which incoming packet's field should
+ * participates in RX Hash. Each flag represent certain packet's field,
+ * when the flag is set the field that is represented by the flag will
+ * participate in RX Hash calculation.
+ * Note: *IPV4 and *IPV6 flags can't be enabled together on the same QP
+ * and *TCP and *UDP flags can't be enabled together on the same QP.
+*/
+enum ibv_rx_hash_fields {
+	IBV_RX_HASH_SRC_IPV4	= 1 << 0,
+	IBV_RX_HASH_DST_IPV4	= 1 << 1,
+	IBV_RX_HASH_SRC_IPV6	= 1 << 2,
+	IBV_RX_HASH_DST_IPV6	= 1 << 3,
+	IBV_RX_HASH_SRC_PORT_TCP	= 1 << 4,
+	IBV_RX_HASH_DST_PORT_TCP	= 1 << 5,
+	IBV_RX_HASH_SRC_PORT_UDP	= 1 << 6,
+	IBV_RX_HASH_DST_PORT_UDP	= 1 << 7
+};
+
 struct ibv_device_attr_ex {
 	struct ibv_device_attr	orig_attr;
 	uint32_t		comp_mask;
@@ -713,7 +737,8 @@ enum ibv_qp_init_attr_mask {
 	IBV_QP_INIT_ATTR_CREATE_FLAGS	= 1 << 2,
 	IBV_QP_INIT_ATTR_MAX_TSO_HEADER = 1 << 3,
 	IBV_QP_INIT_ATTR_IND_TABLE	= 1 << 4,
-	IBV_QP_INIT_ATTR_RESERVED	= 1 << 5
+	IBV_QP_INIT_ATTR_RX_HASH	= 1 << 5,
+	IBV_QP_INIT_ATTR_RESERVED	= 1 << 6
 };
 
 enum ibv_qp_create_flags {
@@ -721,6 +746,15 @@ enum ibv_qp_create_flags {
 	IBV_QP_CREATE_SCATTER_FCS		= 1 << 8,
 };
 
+struct ibv_rx_hash_conf {
+	/* enum ibv_rx_hash_function_flags */
+	uint8_t	rx_hash_function;
+	uint8_t	rx_hash_key_len;
+	uint8_t	*rx_hash_key;
+	/* enum ibv_rx_hash_fields */
+	uint64_t	rx_hash_fields_mask;
+};
+
 struct ibv_qp_init_attr_ex {
 	void		       *qp_context;
 	struct ibv_cq	       *send_cq;
@@ -736,6 +770,7 @@ struct ibv_qp_init_attr_ex {
 	uint32_t                create_flags;
 	uint16_t		max_tso_header;
 	struct ibv_rwq_ind_table       *rwq_ind_tbl;
+	struct ibv_rx_hash_conf	rx_hash_conf;
 };
 
 enum ibv_qp_open_attr_mask {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V1 libibverbs 5/7] Track asynchronous events on a work queue
       [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2016-09-14 13:56   ` [PATCH V1 libibverbs 4/7] Extend create QP to get RX hash data Yishai Hadas
@ 2016-09-14 13:56   ` Yishai Hadas
  2016-09-14 13:56   ` [PATCH V1 libibverbs 6/7] Expose RSS related capabilities Yishai Hadas
  2016-09-14 13:56   ` [PATCH V1 libibverbs 7/7] Update man pages for RSS usage Yishai Hadas
  6 siblings, 0 replies; 9+ messages in thread
From: Yishai Hadas @ 2016-09-14 13:56 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

Add support to track asynchronous events on a work queue object.
For now only IBV_EVENT_WQ_FATAL is applicable.

Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 include/infiniband/verbs.h |  2 ++
 src/device.c               | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 88ac4bb..eab5d1b 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -341,6 +341,7 @@ enum ibv_event_type {
 	IBV_EVENT_QP_LAST_WQE_REACHED,
 	IBV_EVENT_CLIENT_REREGISTER,
 	IBV_EVENT_GID_CHANGE,
+	IBV_EVENT_WQ_FATAL,
 };
 
 struct ibv_async_event {
@@ -348,6 +349,7 @@ struct ibv_async_event {
 		struct ibv_cq  *cq;
 		struct ibv_qp  *qp;
 		struct ibv_srq *srq;
+		struct ibv_wq  *wq;
 		int		port_num;
 	} element;
 	enum ibv_event_type	event_type;
diff --git a/src/device.c b/src/device.c
index e520295..82d928a 100644
--- a/src/device.c
+++ b/src/device.c
@@ -298,6 +298,9 @@ int __ibv_get_async_event(struct ibv_context *context,
 		event->element.srq = (void *) (uintptr_t) ev.element;
 		break;
 
+	case IBV_EVENT_WQ_FATAL:
+		event->element.wq = (void *) (uintptr_t) ev.element;
+		break;
 	default:
 		event->element.port_num = ev.element;
 		break;
@@ -357,6 +360,18 @@ void __ibv_ack_async_event(struct ibv_async_event *event)
 		return;
 	}
 
+	case IBV_EVENT_WQ_FATAL:
+	{
+		struct ibv_wq *wq = event->element.wq;
+
+		pthread_mutex_lock(&wq->mutex);
+		++wq->events_completed;
+		pthread_cond_signal(&wq->cond);
+		pthread_mutex_unlock(&wq->mutex);
+
+		return;
+	}
+
 	default:
 		return;
 	}
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V1 libibverbs 6/7] Expose RSS related capabilities
       [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (4 preceding siblings ...)
  2016-09-14 13:56   ` [PATCH V1 libibverbs 5/7] Track asynchronous events on a work queue Yishai Hadas
@ 2016-09-14 13:56   ` Yishai Hadas
  2016-09-14 13:56   ` [PATCH V1 libibverbs 7/7] Update man pages for RSS usage Yishai Hadas
  6 siblings, 0 replies; 9+ messages in thread
From: Yishai Hadas @ 2016-09-14 13:56 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

Expose RSS related capabilities, it includes:

- QP types that support RSS on the device.
- Max number of receive work queue indirection tables that
  could be opened on the device.
- Max size of a receive work queue indirection table.
- Max number of work queues of receive type that
  could be opened on the device.

- Bit mask of the supported types of hash functions.
- Bit mask of the supported RX fields that can participate
  in the RX hashing.

Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 examples/devinfo.c            | 24 ++++++++++++++++++++++++
 include/infiniband/kern-abi.h | 10 ++++++++++
 include/infiniband/verbs.h    | 10 ++++++++++
 src/cmd.c                     | 19 +++++++++++++++++++
 4 files changed, 63 insertions(+)

diff --git a/examples/devinfo.c b/examples/devinfo.c
index c497650..1d0c2db 100644
--- a/examples/devinfo.c
+++ b/examples/devinfo.c
@@ -364,6 +364,28 @@ static void print_tso_caps(const struct ibv_tso_caps *caps)
 	}
 }
 
+static void print_rss_caps(const struct ibv_rss_caps *caps)
+{
+	uint32_t unknown_general_caps = ~(1 << IBV_QPT_RAW_PACKET |
+					  1 << IBV_QPT_UD);
+	printf("\trss_caps:\n");
+	printf("\t\tmax_rwq_indirection_tables:\t\t\t%u\n", caps->max_rwq_indirection_tables);
+	printf("\t\tmax_rwq_indirection_table_size:\t\t\t%u\n", caps->max_rwq_indirection_table_size);
+	printf("\t\trx_hash_function:\t\t\t\t0x%x\n", caps->rx_hash_function);
+	printf("\t\trx_hash_fields_mask:\t\t\t\t0x%" PRIX64 "\n", caps->rx_hash_fields_mask);
+
+	if (caps->supported_qpts) {
+		printf("\t\tsupported_qp:\n");
+		if (ibv_is_qpt_supported(caps->supported_qpts, IBV_QPT_RAW_PACKET))
+			printf("\t\t\t\t\tSUPPORT_RAW_PACKET\n");
+		if (ibv_is_qpt_supported(caps->supported_qpts, IBV_QPT_UD))
+			printf("\t\t\t\t\tSUPPORT_UD\n");
+		if (caps->supported_qpts & unknown_general_caps)
+			printf("\t\t\t\t\tUnknown flags: 0x%" PRIX32 "\n",
+			       caps->supported_qpts & unknown_general_caps);
+	}
+}
+
 static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port)
 {
 	struct ibv_context *ctx;
@@ -465,6 +487,8 @@ static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port)
 		printf("\tdevice_cap_flags_ex:\t\t0x%" PRIX64 "\n", device_attr.device_cap_flags_ex);
 		print_device_cap_flags_ex(device_attr.device_cap_flags_ex);
 		print_tso_caps(&device_attr.tso_caps);
+		print_rss_caps(&device_attr.rss_caps);
+		printf("\tmax_wq_type_rq:\t\t\t%u\n", device_attr.max_wq_type_rq);
 	}
 
 	for (port = 1; port <= device_attr.orig_attr.phys_port_cnt; ++port) {
diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h
index 9f7964e..381fd50 100644
--- a/include/infiniband/kern-abi.h
+++ b/include/infiniband/kern-abi.h
@@ -271,6 +271,13 @@ struct ibv_odp_caps_resp {
 	__u32 reserved;
 };
 
+struct ibv_rss_caps_resp {
+	__u32 supported_qpts;
+	__u32 max_rwq_indirection_tables;
+	__u32 max_rwq_indirection_table_size;
+	__u32 reserved;
+};
+
 struct ibv_query_device_resp_ex {
 	struct ibv_query_device_resp base;
 	__u32 comp_mask;
@@ -279,6 +286,9 @@ struct ibv_query_device_resp_ex {
 	__u64 timestamp_mask;
 	__u64 hca_core_clock;
 	__u64 device_cap_flags_ex;
+	struct ibv_rss_caps_resp rss_caps;
+	__u32  max_wq_type_rq;
+	__u32 reserved;
 };
 
 struct ibv_query_port {
diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index eab5d1b..e994c21 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -238,6 +238,14 @@ enum ibv_rx_hash_fields {
 	IBV_RX_HASH_DST_PORT_UDP	= 1 << 7
 };
 
+struct ibv_rss_caps {
+	uint32_t supported_qpts;
+	uint32_t max_rwq_indirection_tables;
+	uint32_t max_rwq_indirection_table_size;
+	uint64_t rx_hash_fields_mask; /* enum ibv_rx_hash_fields */
+	uint8_t  rx_hash_function; /* enum ibv_rx_hash_function_flags */
+};
+
 struct ibv_device_attr_ex {
 	struct ibv_device_attr	orig_attr;
 	uint32_t		comp_mask;
@@ -246,6 +254,8 @@ struct ibv_device_attr_ex {
 	uint64_t		hca_core_clock;
 	uint64_t		device_cap_flags_ex;
 	struct ibv_tso_caps	tso_caps;
+	struct ibv_rss_caps     rss_caps;
+	uint32_t		max_wq_type_rq;
 };
 
 enum ibv_mtu {
diff --git a/src/cmd.c b/src/cmd.c
index 21f972a..11f6509 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -213,6 +213,25 @@ int ibv_cmd_query_device_ex(struct ibv_context *context,
 			attr->device_cap_flags_ex = resp->device_cap_flags_ex;
 	}
 
+	if (attr_size >= offsetof(struct ibv_device_attr_ex, rss_caps) +
+			 sizeof(attr->rss_caps)) {
+		if (resp->response_length >=
+		    offsetof(struct ibv_query_device_resp_ex, rss_caps) +
+		    sizeof(resp->rss_caps)) {
+			attr->rss_caps.supported_qpts = resp->rss_caps.supported_qpts;
+			attr->rss_caps.max_rwq_indirection_tables = resp->rss_caps.max_rwq_indirection_tables;
+			attr->rss_caps.max_rwq_indirection_table_size = resp->rss_caps.max_rwq_indirection_table_size;
+		}
+	}
+
+	if (attr_size >= offsetof(struct ibv_device_attr_ex, max_wq_type_rq) +
+			 sizeof(attr->max_wq_type_rq)) {
+		if (resp->response_length >=
+		    offsetof(struct ibv_query_device_resp_ex, max_wq_type_rq) +
+		    sizeof(resp->max_wq_type_rq))
+			attr->max_wq_type_rq = resp->max_wq_type_rq;
+	}
+
 	return 0;
 }
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V1 libibverbs 7/7] Update man pages for RSS usage
       [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (5 preceding siblings ...)
  2016-09-14 13:56   ` [PATCH V1 libibverbs 6/7] Expose RSS related capabilities Yishai Hadas
@ 2016-09-14 13:56   ` Yishai Hadas
  6 siblings, 0 replies; 9+ messages in thread
From: Yishai Hadas @ 2016-09-14 13:56 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

Update man pages for RSS usage, it includes:
- Add man pages for the new related verbs.
- Update  man/ibv_create_qp_ex and man/ibv_query_device_ex
  to include the related RSS stuff.

Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 Makefile.am                    | 10 +++++--
 man/ibv_create_qp_ex.3         | 14 +++++++++-
 man/ibv_create_rwq_ind_table.3 | 58 +++++++++++++++++++++++++++++++++++++++++
 man/ibv_create_wq.3            | 59 ++++++++++++++++++++++++++++++++++++++++++
 man/ibv_modify_wq.3            | 43 ++++++++++++++++++++++++++++++
 man/ibv_query_device_ex.3      | 10 +++++++
 6 files changed, 191 insertions(+), 3 deletions(-)
 create mode 100644 man/ibv_create_rwq_ind_table.3
 create mode 100644 man/ibv_create_wq.3
 create mode 100644 man/ibv_modify_wq.3

diff --git a/Makefile.am b/Makefile.am
index 5349314..1361e96 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,7 +66,9 @@ man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
     man/ibv_get_srq_num.3 man/ibv_open_qp.3 man/ibv_query_device_ex.3	\
     man/ibv_alloc_mw.3 man/ibv_bind_mw.3 man/ibv_inc_rkey.3		\
     man/ibv_rereg_mr.3 man/ibv_create_cq_ex.3				\
-    man/ibv_query_rt_values_ex.3 man/ibv_xsrq_pingpong.1
+    man/ibv_query_rt_values_ex.3 man/ibv_xsrq_pingpong.1		\
+    man/ibv_create_wq.3 man/ibv_modify_wq.3				\
+    man/ibv_create_rwq_ind_table.3
 
 DEBIAN = debian/changelog debian/compat debian/control debian/copyright \
     debian/ibverbs-utils.install debian/libibverbs1.install \
@@ -104,6 +106,8 @@ install-data-hook:
 	$(RM) ibv_close_xrcd.3 && \
 	$(RM) ibv_dealloc_mw.3 && \
 	$(RM) ibv_destroy_flow.3 && \
+	$(RM) ibv_destroy_wq.3 && \
+	$(RM) ibv_destroy_rwq_ind_table.3 && \
 	$(LN_S) ibv_get_async_event.3 ibv_ack_async_event.3 && \
 	$(LN_S) ibv_get_cq_event.3 ibv_ack_cq_events.3 && \
 	$(LN_S) ibv_open_device.3 ibv_close_device.3 && \
@@ -123,4 +127,6 @@ install-data-hook:
 	$(LN_S) ibv_rate_to_mbps.3 mbps_to_ibv_rate.3 && \
 	$(LN_S) ibv_open_xrcd.3 ibv_close_xrcd.3 && \
 	$(LN_S) ibv_alloc_mw.3 ibv_dealloc_mw.3 && \
-	$(LN_S) ibv_create_flow.3 ibv_destroy_flow.3
+	$(LN_S) ibv_create_flow.3 ibv_destroy_flow.3 && \
+	$(LN_S) ibv_create_wq.3 ibv_destroy_wq.3 && \
+	$(LN_S) ibv_create_rwq_ind_table.3 ibv_destroy_rwq_ind_table.3
diff --git a/man/ibv_create_qp_ex.3 b/man/ibv_create_qp_ex.3
index a2a67a4..08cb92c 100644
--- a/man/ibv_create_qp_ex.3
+++ b/man/ibv_create_qp_ex.3
@@ -35,6 +35,8 @@ struct ibv_pd          *pd;		/* PD to be associated with the QP */
 struct ibv_xrcd        *xrcd;		/* XRC domain to be associated with the target QP */
 enum ibv_qp_create_flags create_flags;	/* Creation flags for this QP */
 uint16_t                max_tso_header; /* Maximum TSO header size */
+struct ibv_rwq_ind_table *rwq_ind_tbl;  /* Indirection table to be associated with the QP */
+struct ibv_rx_hash_conf  rx_hash_conf;  /* RX hash configuration to be used */
 .in -8
 };
 .sp
@@ -48,6 +50,15 @@ uint32_t                max_recv_sge;   /* Requested max number of s/g elements
 uint32_t                max_inline_data;/* Requested max number of data (bytes) that can be posted inline to the SQ, otherwise 0 */
 .in -8
 };
+.nf
+struct ibv_rx_hash_conf {
+.in +8
+uint8_t                rx_hash_function;       /* RX hash function, use enum ibv_rx_hash_function_flags */
+uint8_t                rx_hash_key_len;        /* RX hash key length */
+uint8_t                *rx_hash_key;           /* RX hash key data */
+uint64_t               rx_hash_fields_mask;    /* RX fields that should participate in the hashing, use enum ibv_rx_hash_fields */
+.in -8
+};
 .fi
 .PP
 The function
@@ -78,7 +89,8 @@ fails if the QP is attached to a multicast group.
 .SH "SEE ALSO"
 .BR ibv_alloc_pd (3),
 .BR ibv_modify_qp (3),
-.BR ibv_query_qp (3)
+.BR ibv_query_qp (3),
+.BR ibv_create_rwq_ind_table (3)
 .SH "AUTHORS"
 .TP
 Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
diff --git a/man/ibv_create_rwq_ind_table.3 b/man/ibv_create_rwq_ind_table.3
new file mode 100644
index 0000000..2b060b5
--- /dev/null
+++ b/man/ibv_create_rwq_ind_table.3
@@ -0,0 +1,58 @@
+.\" -*- nroff -*-
+.\"
+.TH CREATE_RWQ_IND_TBL 3  2016-07-27 libibverbs "Libibverbs Programmer's Manual"
+.SH "NAME"
+ibv_create_rwq_ind_table, ibv_destroy_rwq_ind_table  \- create or destroy a Receive Work Queue Indirection Table (RWQ IND TBL).
+.SH "SYNOPSIS"
+.nf
+.B #include <infiniband/verbs.h>
+.sp
+.BI "struct ibv_rwq_ind_table *ibv_create_rwq_ind_table(struct ibv_context " "*context,"
+.BI "                                                           struct ibv_rwq_ind_table_init_attr " "*init_attr" );
+.sp
+.BI "int ibv_destroy_rwq_ind_table(struct ibv_rwq_ind_table " "*rwq_ind_table" );
+.fi
+.SH "DESCRIPTION"
+.B ibv_create_rwq_ind_table()
+creates a RWQ IND TBL associated with the ibv_context
+.I context\fR.
+The argument
+.I init_attr
+is an ibv_rwq_ind_table_init_attr struct, as defined in <infiniband/verbs.h>.
+.PP
+.nf
+struct ibv_rwq_ind_table_init_attr {
+.in +8
+uint32_t        log_ind_tbl_size;     /* Log, base 2, of Indirection table size */
+struct          ibv_wq **ind_tbl;     /* Each entry is a pointer to Receive Work Queue */
+uint32_t        comp_mask;            /* Identifies valid fields. Use ibv_ind_table_init_attr_mask */
+.in -8
+};
+.fi
+.PP
+The function
+.B ibv_create_rwq_ind_table()
+will create a RWQ IND TBL that holds a table of Receive Work Queue.
+For further usage of the created object see below
+.I NOTES\fR.
+.PP
+.B ibv_destroy_rwq_ind_table()
+destroys the RWQ IND TBL
+.I rwq_ind_table\fR.
+.SH "RETURN VALUE"
+.B ibv_create_rwq_ind_table()
+returns a pointer to the created RWQ IND TBL, or NULL if the request fails.
+.PP
+.B ibv_destroy_rwq_ind_table()
+returns 0 on success, or the value of errno on failure (which indicates the failure reason).
+.SH "NOTES"
+The created object should be used as part of
+.I ibv_create_qp_ex()
+to enable dispatching of incoming packets based on some RX hash configuration.
+.SH "SEE ALSO"
+.BR ibv_create_wq (3),
+.BR ibv_modify_wq (3),
+.BR ibv_create_qp_ex (3),
+.SH "AUTHORS"
+.TP
+Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
diff --git a/man/ibv_create_wq.3 b/man/ibv_create_wq.3
new file mode 100644
index 0000000..1ee584a
--- /dev/null
+++ b/man/ibv_create_wq.3
@@ -0,0 +1,59 @@
+.\" -*- nroff -*-
+.\"
+.TH IBV_CREATE_WQ 3 2016-07-27 libibverbs "Libibverbs Programmer's Manual"
+.SH "NAME"
+ibv_create_wq, ibv_destroy_wq \- create or destroy a Work Queue (WQ).
+.SH "SYNOPSIS"
+.nf
+.B #include <infiniband/verbs_exp.h>
+.sp
+.BI "struct ibv_wq *ibv_create_wq(struct ibv_context " "*context,"
+.BI "                                     struct ibv_wq_init_attr " "*wq_init_attr" );
+.sp
+.BI "int ibv_destroy_wq(struct ibv_wq " "*wq" );
+.fi
+.SH "DESCRIPTION"
+.B ibv_create_wq()
+creates a WQ associated with the ibv_context
+.I context\fR.
+The argument
+.I wq_init_attr
+is an ibv_wq_init_attr struct, as defined in <infiniband/verbs.h>.
+.PP
+.nf
+struct ibv_wq_init_attr {
+.in +8
+void                      *wq_context;    /* Associated context of the WQ */
+enum ibv_wq_type           wq_type;       /* WQ type */
+uint32_t                   max_wr;        /* Requested max number of outstanding WRs in the WQ */
+uint32_t                   max_sge;       /* Requested max number of scatter/gather (s/g) elements per WR in the WQ */
+struct  ibv_pd            *pd;            /* PD to be associated with the WQ */
+struct  ibv_cq            *cq;            /* CQ to be associated with the WQ */
+uint32_t                   comp_mask;     /* Identifies valid fields. Use ibv_wq_init_attr_mask */
+.in -8
+};
+.fi
+.PP
+The function
+.B ibv_create_wq()
+will update the
+.I wq_init_attr\fB\fR->max_wr
+and
+.I wq_init_attr\fB\fR->max_sge
+fields with the actual \s-1WQ\s0 values of the WQ that was created;
+the values will be greater than or equal to the values requested.
+.PP
+.B ibv_destroy_wq()
+destroys the WQ
+.I wq\fR.
+.SH "RETURN VALUE"
+.B ibv_create_wq()
+returns a pointer to the created WQ, or NULL if the request fails.
+.PP
+.B ibv_destroy_wq()
+returns 0 on success, or the value of errno on failure (which indicates the failure reason).
+.SH "SEE ALSO"
+.BR ibv_modify_wq (3),
+.SH "AUTHORS"
+.TP
+Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
diff --git a/man/ibv_modify_wq.3 b/man/ibv_modify_wq.3
new file mode 100644
index 0000000..cf37864
--- /dev/null
+++ b/man/ibv_modify_wq.3
@@ -0,0 +1,43 @@
+.\" -*- nroff -*-
+.\"
+.TH IBV_MODIFY_WQ 3 2016-07-27 libibverbs "Libibverbs Programmer's Manual"
+.SH "NAME"
+ibv_modify_wq \- Modify a Work Queue (WQ).
+.SH "SYNOPSIS"
+.nf
+.B #include <infiniband/verbs.h>
+.sp
+.BI "struct int ibv_modify_wq(struct ibv_wq " "*wq,"
+.BI "                             struct ibv_wq_attr " "*wq_attr" );
+.sp
+.fi
+.SH "DESCRIPTION"
+.B ibv_modify_wq()
+modifys a WQ
+.I wq\fR.
+The argument
+.I wq_attr
+is an ibv_wq_attr struct, as defined in <infiniband/verbs.h>.
+.PP
+.nf
+struct ibv_wq_attr {
+.in +8
+uint32_t                attr_mask;     /* Use enum ibv_wq_attr_mask */
+enum ibv_wq_state       wq_state;      /* Move to this state */
+enum ibv_wq_state       curr_wq_state; /* Assume this is the current state */
+.in -8
+};
+.fi
+.PP
+The function
+.B ibv_modify_wq()
+will modify the WQ based on the given
+.I wq_attr\fB\fR->attr_mask
+.SH "RETURN VALUE"
+returns 0 on success, or the value of errno on failure (which indicates the failure reason).
+.SH "SEE ALSO"
+.BR ibv_create_wq (3),
+.BR ibv_destroy_wq (3),
+.SH "AUTHORS"
+.TP
+Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
diff --git a/man/ibv_query_device_ex.3 b/man/ibv_query_device_ex.3
index d06b40f..88c8ce4 100644
--- a/man/ibv_query_device_ex.3
+++ b/man/ibv_query_device_ex.3
@@ -28,6 +28,8 @@ uint64_t               completion_timestamp_mask;  /* Completion timestamp mask
 uint64_t               hca_core_clock;             /* The frequency (in kHZ) of the HCA (0 = unsupported) */
 uint64_t               device_cap_flags_ex;        /* Extended device capability flags */
 struct ibv_tso_caps    tso_caps;                   /* TCP segmentation offload capabilities */
+struct ibv_rss_caps    rss_caps;                   /* RSS capabilities */
+uint32_t               max_wq_type_rq;             /* Max Work Queue from type RQ */
 .in -8
 };
 
@@ -57,6 +59,14 @@ struct ibv_tso_caps {
         uint32_t supported_qpts; /* Bitmap showing which QP types are supported by TSO operation. */
 };
 
+struct ibv_rss_caps {
+        uint32_t supported_qpts;                   /* Bitmap showing which QP types are supported RSS */
+        uint32_t max_rwq_indirection_tables;       /* Max receive work queue indirection tables */
+        uint32_t max_rwq_indirection_table_size;   /* Max receive work queue indirection table size */
+        uint64_t rx_hash_fields_mask;              /* Mask with enum ibv_rx_hash_fields to know which incoming packet's field can participates in the RX hash */
+        uint8_t  rx_hash_function;                 /* Mask with enum ibv_rx_hash_function_flags to know which hash functions are supported */
+};
+
 .fi
 .SH "RETURN VALUE"
 .B ibv_query_device_ex()
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH V1 libibverbs 1/7] Introduce Work Queue object and its verbs
       [not found]     ` <1473861388-22064-2-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-09-14 17:05       ` Jason Gunthorpe
  0 siblings, 0 replies; 9+ messages in thread
From: Jason Gunthorpe @ 2016-09-14 17:05 UTC (permalink / raw)
  To: Yishai Hadas
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, majd-VPRAkNaXOzVWk0Htik3J/w,
	talal-VPRAkNaXOzVWk0Htik3J/w, sagi-NQWnxTmZq1alnMjI0IkVqw

On Wed, Sep 14, 2016 at 04:56:22PM +0300, Yishai Hadas wrote:
>  		ibv_cmd_create_qp_ex2;
>  		ibv_cmd_open_qp;
>  		ibv_cmd_rereg_mr;
> +};
> +
> +IBVERBS_1.3 {
> +        global:
> +		ibv_cmd_create_wq;
> +		ibv_cmd_modify_wq;
> +		ibv_cmd_destroy_wq;
>
>  } IBVERBS_1.0;

No, this still isn't right. Please spend some time to learn about this
stuff...

diff --git a/libibverbs/src/libibverbs.map b/libibverbs/src/libibverbs.map
index 2278aba0bb3a..75440b05bc3e 100644
--- a/libibverbs/src/libibverbs.map
+++ b/libibverbs/src/libibverbs.map
@@ -121,3 +121,10 @@ IBVERBS_1.1 {
 		ibv_cmd_rereg_mr;
 
 } IBVERBS_1.0;
+
+IBVERBS_1.3 {
+	    global:
+		ibv_cmd_create_wq;
+		ibv_cmd_destroy_wq;
+		ibv_cmd_modify_wq;
+} IBVERBS_1.1;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-09-14 17:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14 13:56 [PATCH V1 libibverbs 0/7] RSS support Yishai Hadas
     [not found] ` <1473861388-22064-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-09-14 13:56   ` [PATCH V1 libibverbs 1/7] Introduce Work Queue object and its verbs Yishai Hadas
     [not found]     ` <1473861388-22064-2-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-09-14 17:05       ` Jason Gunthorpe
2016-09-14 13:56   ` [PATCH V1 libibverbs 2/7] Introduce Receive Work Queue indirection table " Yishai Hadas
2016-09-14 13:56   ` [PATCH V1 libibverbs 3/7] Extend create QP to get a Receive Work Queue indirection table Yishai Hadas
2016-09-14 13:56   ` [PATCH V1 libibverbs 4/7] Extend create QP to get RX hash data Yishai Hadas
2016-09-14 13:56   ` [PATCH V1 libibverbs 5/7] Track asynchronous events on a work queue Yishai Hadas
2016-09-14 13:56   ` [PATCH V1 libibverbs 6/7] Expose RSS related capabilities Yishai Hadas
2016-09-14 13:56   ` [PATCH V1 libibverbs 7/7] Update man pages for RSS usage Yishai Hadas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.