aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonatan Cohen <yonatanc@mellanox.com>2017-11-13 03:51:16 -0500
committerDoug Ledford <dledford@redhat.com>2017-11-13 16:59:22 -0500
commit18bd90729237dc6ddbad01bc9618148224f03590 (patch)
treef3c00ca494484a90d359c971bdfeeca826ee231f
parentb0e9df6da25890448ebd134b7f647f16bced9abc (diff)
IB/uverbs: Add CQ moderation capability to query_device
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 CQEs to accumulate before generating an event. cq_period is a 16 bits number that determines 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@mellanox.com> Reviewed-by: Majd Dibbiny <majd@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c9
-rw-r--r--include/rdma/ib_verbs.h6
-rw-r--r--include/uapi/rdma/ib_user_verbs.h7
3 files changed, 22 insertions, 0 deletions
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,
3852 resp.tm_caps.max_sge = attr.tm_caps.max_sge; 3852 resp.tm_caps.max_sge = attr.tm_caps.max_sge;
3853 resp.tm_caps.flags = attr.tm_caps.flags; 3853 resp.tm_caps.flags = attr.tm_caps.flags;
3854 resp.response_length += sizeof(resp.tm_caps); 3854 resp.response_length += sizeof(resp.tm_caps);
3855
3856 if (ucore->outlen < resp.response_length + sizeof(resp.cq_moderation_caps))
3857 goto end;
3858
3859 resp.cq_moderation_caps.max_cq_moderation_count =
3860 attr.cq_caps.max_cq_moderation_count;
3861 resp.cq_moderation_caps.max_cq_moderation_period =
3862 attr.cq_caps.max_cq_moderation_period;
3863 resp.response_length += sizeof(resp.cq_moderation_caps);
3855end: 3864end:
3856 err = ib_copy_to_udata(ucore, &resp, resp.response_length); 3865 err = ib_copy_to_udata(ucore, &resp, resp.response_length);
3857 return err; 3866 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 {
315 IB_CQ_MODERATE = 1 << 0, 315 IB_CQ_MODERATE = 1 << 0,
316}; 316};
317 317
318struct ib_cq_caps {
319 u16 max_cq_moderation_count;
320 u16 max_cq_moderation_period;
321};
322
318struct ib_device_attr { 323struct ib_device_attr {
319 u64 fw_ver; 324 u64 fw_ver;
320 __be64 sys_image_guid; 325 __be64 sys_image_guid;
@@ -365,6 +370,7 @@ struct ib_device_attr {
365 u32 max_wq_type_rq; 370 u32 max_wq_type_rq;
366 u32 raw_packet_caps; /* Use ib_raw_packet_caps enum */ 371 u32 raw_packet_caps; /* Use ib_raw_packet_caps enum */
367 struct ib_tm_caps tm_caps; 372 struct ib_tm_caps tm_caps;
373 struct ib_cq_caps cq_caps;
368}; 374};
369 375
370enum ib_mtu { 376enum 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 {
125 __u64 cq_handle; 125 __u64 cq_handle;
126}; 126};
127 127
128struct ib_uverbs_cq_moderation_caps {
129 __u16 max_cq_moderation_count;
130 __u16 max_cq_moderation_period;
131 __u32 reserved;
132};
133
128/* 134/*
129 * All commands from userspace should start with a __u32 command field 135 * All commands from userspace should start with a __u32 command field
130 * followed by __u16 in_words and out_words fields (which give the 136 * followed by __u16 in_words and out_words fields (which give the
@@ -263,6 +269,7 @@ struct ib_uverbs_ex_query_device_resp {
263 __u32 max_wq_type_rq; 269 __u32 max_wq_type_rq;
264 __u32 raw_packet_caps; 270 __u32 raw_packet_caps;
265 struct ib_uverbs_tm_caps tm_caps; 271 struct ib_uverbs_tm_caps tm_caps;
272 struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
266}; 273};
267 274
268struct ib_uverbs_query_port { 275struct ib_uverbs_query_port {