<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>core kernel changes for query SRQ</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">Add support to uverbs to handle querying userspace SRQs (Shared</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">Receive Queue), including adding an ABI for marshalling requests and</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">responses. The kernel midlayer already has ib_query_srq().</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">Signed-off-by: Dotan Barak <dotanb@mellanox.co.il></FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">Index: last_stable/drivers/infiniband/core/uverbs.h</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">===================================================================</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">--- last_stable.orig/drivers/infiniband/core/uverbs.h 2006-02-07 17:04:05.000000000 +0200</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+++ last_stable/drivers/infiniband/core/uverbs.h 2006-02-08 09:51:59.000000000 +0200</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">@@ -201,6 +201,7 @@ IB_UVERBS_DECLARE_CMD(attach_mcast);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> IB_UVERBS_DECLARE_CMD(detach_mcast);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> IB_UVERBS_DECLARE_CMD(create_srq);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> IB_UVERBS_DECLARE_CMD(modify_srq);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+IB_UVERBS_DECLARE_CMD(query_srq);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> IB_UVERBS_DECLARE_CMD(destroy_srq);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> </FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> #endif /* UVERBS_H */</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">Index: last_stable/drivers/infiniband/core/uverbs_cmd.c</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">===================================================================</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">--- last_stable.orig/drivers/infiniband/core/uverbs_cmd.c 2006-02-07 17:04:05.000000000 +0200</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+++ last_stable/drivers/infiniband/core/uverbs_cmd.c 2006-02-08 09:56:04.000000000 +0200</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">@@ -2,6 +2,7 @@</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * Copyright (c) 2005 Topspin Communications. All rights reserved.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * Copyright (c) 2005 PathScale, Inc. All rights reserved.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ * Copyright (c) 2006 Mellanox Technologies. All rights reserved.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> *</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * This software is available to you under a choice of one of two</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * licenses. You may choose to be licensed under the terms of the GNU</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">@@ -1823,6 +1824,49 @@ out:</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> return ret ? ret : in_len;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> }</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> </FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ssize_t ib_uverbs_query_srq(struct ib_uverbs_file *file,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ const char __user *buf,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ int in_len, int out_len)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+{</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ struct ib_uverbs_query_srq cmd;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ struct ib_uverbs_query_srq_resp resp;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ struct ib_srq_attr attr;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ struct ib_srq *srq;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ int ret;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ if (out_len < sizeof resp)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ return -ENOSPC;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ if (copy_from_user(&cmd, buf, sizeof cmd))</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ return -EFAULT;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ mutex_lock(&ib_uverbs_idr_mutex);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ srq = idr_find(&ib_uverbs_srq_idr, cmd.srq_handle);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ if (!srq || srq->uobject->context != file->ucontext) {</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ ret = -EINVAL;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ goto out;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ }</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ ret = ib_query_srq(srq, &attr);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+out:</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ mutex_unlock(&ib_uverbs_idr_mutex);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ if (!ret) {</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ memset(&resp, 0, sizeof resp);</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ resp.max_wr = attr.max_wr;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ resp.max_sge = attr.max_sge;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ resp.srq_limit = attr.srq_limit;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ if (copy_to_user((void __user *) (unsigned long) cmd.response,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ &resp, sizeof resp))</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ ret = -EFAULT;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ }</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ return ret ? ret : in_len;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+}</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> const char __user *buf, int in_len,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> int out_len)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">Index: last_stable/drivers/infiniband/core/uverbs_main.c</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">===================================================================</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">--- last_stable.orig/drivers/infiniband/core/uverbs_main.c 2006-02-07 21:13:38.000000000 +0200</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+++ last_stable/drivers/infiniband/core/uverbs_main.c 2006-02-08 09:56:39.000000000 +0200</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">@@ -107,6 +107,7 @@ static ssize_t (*uverbs_cmd_table[])(str</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> [IB_USER_VERBS_CMD_DETACH_MCAST] = ib_uverbs_detach_mcast,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> [IB_USER_VERBS_CMD_CREATE_SRQ] = ib_uverbs_create_srq,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> [IB_USER_VERBS_CMD_MODIFY_SRQ] = ib_uverbs_modify_srq,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ [IB_USER_VERBS_CMD_QUERY_SRQ] = ib_uverbs_query_srq,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> [IB_USER_VERBS_CMD_DESTROY_SRQ] = ib_uverbs_destroy_srq,</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> };</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> </FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">Index: last_stable/drivers/infiniband/include/rdma/ib_user_verbs.h</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">===================================================================</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">--- last_stable.orig/drivers/infiniband/include/rdma/ib_user_verbs.h 2006-02-07 17:04:01.000000000 +0200</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+++ last_stable/drivers/infiniband/include/rdma/ib_user_verbs.h 2006-02-08 09:58:01.000000000 +0200</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">@@ -2,6 +2,7 @@</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * Copyright (c) 2005 Topspin Communications. All rights reserved.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * Copyright (c) 2005 PathScale, Inc. All rights reserved.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ * Copyright (c) 2006 Mellanox Technologies. All rights reserved.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> *</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * This software is available to you under a choice of one of two</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> * licenses. You may choose to be licensed under the terms of the GNU</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">@@ -610,6 +611,20 @@ struct ib_uverbs_modify_srq {</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> __u64 driver_data[0];</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> };</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> </FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+struct ib_uverbs_query_srq {</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ __u64 response;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ __u32 srq_handle;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ __u32 reserved;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ __u64 driver_data[0];</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+};</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+struct ib_uverbs_query_srq_resp {</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ __u32 max_wr;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ __u32 max_sge;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ __u32 srq_limit;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+ __u32 reserved;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+};</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New">+</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> struct ib_uverbs_destroy_srq {</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> __u64 response;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Courier New"> __u32 srq_handle;</FONT></P>
<BR>
<BR>
<P DIR=LTR><B><I><FONT COLOR="#008080" SIZE=6 FACE="Script">Dotan Barak</FONT></I></B></P>
<P DIR=LTR><FONT FACE="Times New Roman">Software Verification Engineer</FONT></P>
<P DIR=LTR><FONT FACE="Times New Roman">Mellanox Technologies</FONT></P>
<P DIR=LTR><FONT FACE="Times New Roman">Tel: +972-4-9097200 Ext: 231 Fax: +972-4-9593245</FONT></P>
<P DIR=LTR><FONT FACE="Times New Roman">P.O. Box 86 Yokneam 20692 ISRAEL.</FONT></P>
<P DIR=LTR><FONT FACE="Times New Roman">Home: +972-77-8841095 Cell: 0</FONT><FONT SIZE=2 FACE="Arial">52-4222383</FONT></P>
<P DIR=LTR><FONT COLOR="#008080" SIZE=2 FACE="Arial">[ May the fork be with you ]</FONT></P>
</BODY>
</HTML>