Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21931
b: refs/heads/master
c: 8bdb0e8
h: refs/heads/master
i:
  21929: b5de761
  21927: 5ded107
v: v3
  • Loading branch information
Dotan Barak authored and Roland Dreier committed Mar 20, 2006
1 parent e666e64 commit b82111c
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ccc9a24e01258a31ee2b964215e4ddddd2a02c4
refs/heads/master: 8bdb0e8632e0f5061bd18b6934346cb609490135
1 change: 1 addition & 0 deletions trunk/drivers/infiniband/core/uverbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ IB_UVERBS_DECLARE_CMD(attach_mcast);
IB_UVERBS_DECLARE_CMD(detach_mcast);
IB_UVERBS_DECLARE_CMD(create_srq);
IB_UVERBS_DECLARE_CMD(modify_srq);
IB_UVERBS_DECLARE_CMD(query_srq);
IB_UVERBS_DECLARE_CMD(destroy_srq);

#endif /* UVERBS_H */
44 changes: 44 additions & 0 deletions trunk/drivers/infiniband/core/uverbs_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2005 Topspin Communications. All rights reserved.
* Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
* Copyright (c) 2005 PathScale, Inc. All rights reserved.
* Copyright (c) 2006 Mellanox Technologies. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
Expand Down Expand Up @@ -1923,6 +1924,49 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file,
return ret ? ret : in_len;
}

ssize_t ib_uverbs_query_srq(struct ib_uverbs_file *file,
const char __user *buf,
int in_len, int out_len)
{
struct ib_uverbs_query_srq cmd;
struct ib_uverbs_query_srq_resp resp;
struct ib_srq_attr attr;
struct ib_srq *srq;
int ret;

if (out_len < sizeof resp)
return -ENOSPC;

if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT;

mutex_lock(&ib_uverbs_idr_mutex);

srq = idr_find(&ib_uverbs_srq_idr, cmd.srq_handle);
if (srq && srq->uobject->context == file->ucontext)
ret = ib_query_srq(srq, &attr);
else
ret = -EINVAL;

mutex_unlock(&ib_uverbs_idr_mutex);

if (ret)
goto out;

memset(&resp, 0, sizeof resp);

resp.max_wr = attr.max_wr;
resp.max_sge = attr.max_sge;
resp.srq_limit = attr.srq_limit;

if (copy_to_user((void __user *) (unsigned long) cmd.response,
&resp, sizeof resp))
ret = -EFAULT;

out:
return ret ? ret : in_len;
}

ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file,
const char __user *buf, int in_len,
int out_len)
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file,
[IB_USER_VERBS_CMD_DETACH_MCAST] = ib_uverbs_detach_mcast,
[IB_USER_VERBS_CMD_CREATE_SRQ] = ib_uverbs_create_srq,
[IB_USER_VERBS_CMD_MODIFY_SRQ] = ib_uverbs_modify_srq,
[IB_USER_VERBS_CMD_QUERY_SRQ] = ib_uverbs_query_srq,
[IB_USER_VERBS_CMD_DESTROY_SRQ] = ib_uverbs_destroy_srq,
};

Expand Down
15 changes: 15 additions & 0 deletions trunk/include/rdma/ib_user_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2005 Topspin Communications. All rights reserved.
* Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
* Copyright (c) 2005 PathScale, Inc. All rights reserved.
* Copyright (c) 2006 Mellanox Technologies. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
Expand Down Expand Up @@ -613,6 +614,20 @@ struct ib_uverbs_modify_srq {
__u64 driver_data[0];
};

struct ib_uverbs_query_srq {
__u64 response;
__u32 srq_handle;
__u32 reserved;
__u64 driver_data[0];
};

struct ib_uverbs_query_srq_resp {
__u32 max_wr;
__u32 max_sge;
__u32 srq_limit;
__u32 reserved;
};

struct ib_uverbs_destroy_srq {
__u64 response;
__u32 srq_handle;
Expand Down

0 comments on commit b82111c

Please sign in to comment.