All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Yonatan Cohen <yonatanc-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-next v1 4/6] IB/uverbs: Add CQ moderation capability to query_device
Date: Sun, 29 Oct 2017 15:51:38 +0200	[thread overview]
Message-ID: <20171029135140.32649-5-leon@kernel.org> (raw)
In-Reply-To: <20171029135140.32649-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

From: Yonatan Cohen <yonatanc-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The query_device function can now obtain the maximum values for
cq_max_count and cq_period, needed for CQ moderation.
cq_max_count is a 16 bits number that determines the number
of cookies to accumulate before generating an event.
cq_period is a 16 bits number that detemines the timeout in micro
seconds from the last event generated, upon which a new event will
be generated even if cq_max_count was not reached.

Signed-off-by: Yonatan Cohen <yonatanc-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/core/uverbs_cmd.c | 9 +++++++++
 include/rdma/ib_verbs.h              | 6 ++++++
 include/uapi/rdma/ib_user_verbs.h    | 7 +++++++
 3 files changed, 22 insertions(+)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 3c2673cd4090..53143e4b1c50 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3852,6 +3852,15 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 	resp.tm_caps.max_sge		= attr.tm_caps.max_sge;
 	resp.tm_caps.flags		= attr.tm_caps.flags;
 	resp.response_length += sizeof(resp.tm_caps);
+
+	if (ucore->outlen < resp.response_length + sizeof(resp.cq_moderation_caps))
+		goto end;
+
+	resp.cq_moderation_caps.max_cq_moderation_count  =
+		attr.cq_caps.max_cq_moderation_count;
+	resp.cq_moderation_caps.max_cq_moderation_period =
+		attr.cq_caps.max_cq_moderation_period;
+	resp.response_length += sizeof(resp.cq_moderation_caps);
 end:
 	err = ib_copy_to_udata(ucore, &resp, resp.response_length);
 	return err;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 8e0d3780ce4e..0b484c023fa9 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -315,6 +315,11 @@ enum ib_cq_attr_mask {
 	IB_CQ_MODERATE = 1 << 0,
 };
 
+struct ib_cq_caps {
+	u16     max_cq_moderation_count;
+	u16     max_cq_moderation_period;
+};
+
 struct ib_device_attr {
 	u64			fw_ver;
 	__be64			sys_image_guid;
@@ -365,6 +370,7 @@ struct ib_device_attr {
 	u32			max_wq_type_rq;
 	u32			raw_packet_caps; /* Use ib_raw_packet_caps enum */
 	struct ib_tm_caps	tm_caps;
+	struct ib_cq_caps       cq_caps;
 };
 
 enum ib_mtu {
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index cfa09d6095d6..5186fb12629b 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -125,6 +125,12 @@ struct ib_uverbs_comp_event_desc {
 	__u64 cq_handle;
 };
 
+struct ib_uverbs_cq_moderation_caps {
+	__u16     max_cq_moderation_count;
+	__u16     max_cq_moderation_period;
+	__u32     reserved;
+};
+
 /*
  * All commands from userspace should start with a __u32 command field
  * followed by __u16 in_words and out_words fields (which give the
@@ -263,6 +269,7 @@ struct ib_uverbs_ex_query_device_resp {
 	__u32  max_wq_type_rq;
 	__u32 raw_packet_caps;
 	struct ib_uverbs_tm_caps tm_caps;
+	struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
 };
 
 struct ib_uverbs_query_port {
-- 
2.14.2

--
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

  parent reply	other threads:[~2017-10-29 13:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29 13:51 [PATCH rdma-next v1 0/6] Expose CQ moderation to user space Leon Romanovsky
     [not found] ` <20171029135140.32649-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-10-29 13:51   ` [PATCH rdma-next v1 1/6] IB/uverbs: Allow CQ moderation with modify CQ Leon Romanovsky
     [not found]     ` <20171029135140.32649-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-10-29 17:43       ` Jason Gunthorpe
     [not found]         ` <20171029174345.GC4488-uk2M96/98Pc@public.gmane.org>
2017-10-29 18:28           ` Leon Romanovsky
     [not found]             ` <20171029182808.GN16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-30 14:48               ` Jason Gunthorpe
     [not found]                 ` <20171030144807.GA12392-uk2M96/98Pc@public.gmane.org>
2017-10-30 15:28                   ` Leon Romanovsky
     [not found]                     ` <20171030152815.GA16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-30 15:52                       ` Jason Gunthorpe
     [not found]                         ` <20171030155236.GC12392-uk2M96/98Pc@public.gmane.org>
2017-10-30 19:09                           ` Leon Romanovsky
     [not found]                             ` <20171030190952.GC16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-30 23:07                               ` Jason Gunthorpe
     [not found]                                 ` <20171030230753.GB4081-uk2M96/98Pc@public.gmane.org>
2017-10-31  5:08                                   ` Leon Romanovsky
     [not found]                                     ` <20171031050802.GE16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-31 11:31                                       ` Yishai Hadas
     [not found]                                         ` <13d687d9-80b4-621e-87bf-c6045da98c0c-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-10-31 15:40                                           ` Jason Gunthorpe
     [not found]                                             ` <20171031154046.GB9852-uk2M96/98Pc@public.gmane.org>
2017-10-31 17:06                                               ` Yishai Hadas
     [not found]                                                 ` <6e7e94e2-9b50-bfa4-a06a-b2452e1bc8a5-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-11-01 18:06                                                   ` Jason Gunthorpe
     [not found]                                                     ` <20171101180616.GI1030-uk2M96/98Pc@public.gmane.org>
2017-11-01 18:41                                                       ` Yishai Hadas
2017-11-10 19:15                       ` Doug Ledford
     [not found]                         ` <1510341329.3735.19.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-10 21:16                           ` Jason Gunthorpe
2017-11-11  8:09                           ` Leon Romanovsky
     [not found]                             ` <20171111080943.GT18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-11 15:45                               ` Jason Gunthorpe
2017-10-29 13:51   ` [PATCH rdma-next v1 2/6] IB/mlx4: Exposing modify CQ callback to uverbs layer Leon Romanovsky
2017-10-29 13:51   ` [PATCH rdma-next v1 3/6] IB/mlx5: " Leon Romanovsky
2017-10-29 13:51   ` Leon Romanovsky [this message]
2017-10-29 13:51   ` [PATCH rdma-next v1 5/6] IB/mlx4: Add CQ moderation capability to query_device Leon Romanovsky
2017-10-29 13:51   ` [PATCH rdma-next v1 6/6] IB/mlx5: " Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171029135140.32649-5-leon@kernel.org \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=yonatanc-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.