diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/uverbs.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 44 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 1 |
3 files changed, 46 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); | |||
195 | IB_UVERBS_DECLARE_CMD(detach_mcast); | 195 | IB_UVERBS_DECLARE_CMD(detach_mcast); |
196 | IB_UVERBS_DECLARE_CMD(create_srq); | 196 | IB_UVERBS_DECLARE_CMD(create_srq); |
197 | IB_UVERBS_DECLARE_CMD(modify_srq); | 197 | IB_UVERBS_DECLARE_CMD(modify_srq); |
198 | IB_UVERBS_DECLARE_CMD(query_srq); | ||
198 | IB_UVERBS_DECLARE_CMD(destroy_srq); | 199 | IB_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 | ||
1927 | ssize_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 | |||
1966 | out: | ||
1967 | return ret ? ret : in_len; | ||
1968 | } | ||
1969 | |||
1926 | ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file, | 1970 | ssize_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 | ||