aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/core/uverbs.h1
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c44
-rw-r--r--drivers/infiniband/core/uverbs_main.c1
-rw-r--r--include/rdma/ib_user_verbs.h15
4 files changed, 61 insertions, 0 deletions
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index 89c798eb5749..3372d67ff139 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -195,6 +195,7 @@ IB_UVERBS_DECLARE_CMD(attach_mcast);
195IB_UVERBS_DECLARE_CMD(detach_mcast); 195IB_UVERBS_DECLARE_CMD(detach_mcast);
196IB_UVERBS_DECLARE_CMD(create_srq); 196IB_UVERBS_DECLARE_CMD(create_srq);
197IB_UVERBS_DECLARE_CMD(modify_srq); 197IB_UVERBS_DECLARE_CMD(modify_srq);
198IB_UVERBS_DECLARE_CMD(query_srq);
198IB_UVERBS_DECLARE_CMD(destroy_srq); 199IB_UVERBS_DECLARE_CMD(destroy_srq);
199 200
200#endif /* UVERBS_H */ 201#endif /* UVERBS_H */
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 4cbef8c06634..38a66fbef36d 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -2,6 +2,7 @@
2 * Copyright (c) 2005 Topspin Communications. All rights reserved. 2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. 3 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
4 * Copyright (c) 2005 PathScale, Inc. All rights reserved. 4 * Copyright (c) 2005 PathScale, Inc. All rights reserved.
5 * Copyright (c) 2006 Mellanox Technologies. All rights reserved.
5 * 6 *
6 * This software is available to you under a choice of one of two 7 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU 8 * licenses. You may choose to be licensed under the terms of the GNU
@@ -1923,6 +1924,49 @@ out:
1923 return ret ? ret : in_len; 1924 return ret ? ret : in_len;
1924} 1925}
1925 1926
1927ssize_t ib_uverbs_query_srq(struct ib_uverbs_file *file,
1928 const char __user *buf,
1929 int in_len, int out_len)
1930{
1931 struct ib_uverbs_query_srq cmd;
1932 struct ib_uverbs_query_srq_resp resp;
1933 struct ib_srq_attr attr;
1934 struct ib_srq *srq;
1935 int ret;
1936
1937 if (out_len < sizeof resp)
1938 return -ENOSPC;
1939
1940 if (copy_from_user(&cmd, buf, sizeof cmd))
1941 return -EFAULT;
1942
1943 mutex_lock(&ib_uverbs_idr_mutex);
1944
1945 srq = idr_find(&ib_uverbs_srq_idr, cmd.srq_handle);
1946 if (srq && srq->uobject->context == file->ucontext)
1947 ret = ib_query_srq(srq, &attr);
1948 else
1949 ret = -EINVAL;
1950
1951 mutex_unlock(&ib_uverbs_idr_mutex);
1952
1953 if (ret)
1954 goto out;
1955
1956 memset(&resp, 0, sizeof resp);
1957
1958 resp.max_wr = attr.max_wr;
1959 resp.max_sge = attr.max_sge;
1960 resp.srq_limit = attr.srq_limit;
1961
1962 if (copy_to_user((void __user *) (unsigned long) cmd.response,
1963 &resp, sizeof resp))
1964 ret = -EFAULT;
1965
1966out:
1967 return ret ? ret : in_len;
1968}
1969
1926ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file, 1970ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file,
1927 const char __user *buf, int in_len, 1971 const char __user *buf, int in_len,
1928 int out_len) 1972 int out_len)
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 91e4750fa319..ff092a0a94da 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -108,6 +108,7 @@ static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file,
108 [IB_USER_VERBS_CMD_DETACH_MCAST] = ib_uverbs_detach_mcast, 108 [IB_USER_VERBS_CMD_DETACH_MCAST] = ib_uverbs_detach_mcast,
109 [IB_USER_VERBS_CMD_CREATE_SRQ] = ib_uverbs_create_srq, 109 [IB_USER_VERBS_CMD_CREATE_SRQ] = ib_uverbs_create_srq,
110 [IB_USER_VERBS_CMD_MODIFY_SRQ] = ib_uverbs_modify_srq, 110 [IB_USER_VERBS_CMD_MODIFY_SRQ] = ib_uverbs_modify_srq,
111 [IB_USER_VERBS_CMD_QUERY_SRQ] = ib_uverbs_query_srq,
111 [IB_USER_VERBS_CMD_DESTROY_SRQ] = ib_uverbs_destroy_srq, 112 [IB_USER_VERBS_CMD_DESTROY_SRQ] = ib_uverbs_destroy_srq,
112}; 113};
113 114
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
index 58662c34a3de..0edd3a6fe8f5 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/rdma/ib_user_verbs.h
@@ -2,6 +2,7 @@
2 * Copyright (c) 2005 Topspin Communications. All rights reserved. 2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. 3 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
4 * Copyright (c) 2005 PathScale, Inc. All rights reserved. 4 * Copyright (c) 2005 PathScale, Inc. All rights reserved.
5 * Copyright (c) 2006 Mellanox Technologies. All rights reserved.
5 * 6 *
6 * This software is available to you under a choice of one of two 7 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU 8 * licenses. You may choose to be licensed under the terms of the GNU
@@ -613,6 +614,20 @@ struct ib_uverbs_modify_srq {
613 __u64 driver_data[0]; 614 __u64 driver_data[0];
614}; 615};
615 616
617struct ib_uverbs_query_srq {
618 __u64 response;
619 __u32 srq_handle;
620 __u32 reserved;
621 __u64 driver_data[0];
622};
623
624struct ib_uverbs_query_srq_resp {
625 __u32 max_wr;
626 __u32 max_sge;
627 __u32 srq_limit;
628 __u32 reserved;
629};
630
616struct ib_uverbs_destroy_srq { 631struct ib_uverbs_destroy_srq {
617 __u64 response; 632 __u64 response;
618 __u32 srq_handle; 633 __u32 srq_handle;