From: Steve Wise <swise@opengridcomputing.com>
To: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: netdev@vger.kernel.org, Roland Dreier <rdreier@cisco.com>,
Divy Le Ray <divy@chelsio.com>,
linux-kernel@vger.kernel.org,
openib-general <openib-general@openib.org>
Subject: Re: [openib-general] [PATCH 1/10] cxgb3 - main header files
Date: Tue, 09 Jan 2007 13:39:22 -0600 [thread overview]
Message-ID: <1168371562.17406.3.camel@stevo-desktop> (raw)
In-Reply-To: <1168354013.4628.14.camel@stevo-desktop>
>
> In the interest of expediting this I'll go implement it...
>
> Steve.
>
Here it is. I think this is the correct way to solve the issue (now
that I've implemented it :). This is a delta from the driver patch
series just for reviewing purposes.
commit e6053f2aee764b21e28cbb19f52995cb413cf733
Author: Steve Wise <swise@opengridcomputing.com>
Date: Tue Jan 9 13:06:13 2007 -0600
Chelsio-specific solution for copying in the user cq_index.
- at cq_create time, user lib passes in the address of its cq rptr u32.
- kernel saves this address in the iwch_cq struct.
- kernel copies in the rptr value in iwch_req_notify_cq().
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index ab99202..28be418 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -143,6 +143,7 @@ static struct ib_cq *iwch_create_cq(stru
struct iwch_dev *rhp;
struct iwch_cq *chp;
struct iwch_create_cq_resp uresp;
+ struct iwch_create_cq_req ureq;
PDBG("%s ib_dev %p entries %d\n", __FUNCTION__, ibdev, entries);
rhp = to_iwch_dev(ibdev);
@@ -150,6 +151,14 @@ static struct ib_cq *iwch_create_cq(stru
if (!chp)
return ERR_PTR(-ENOMEM);
+ if (context) {
+ if (ib_copy_from_udata(&ureq, udata, sizeof (ureq))) {
+ kfree(chp);
+ return ERR_PTR(-EFAULT);
+ }
+ chp->user_rptr_addr = (u32 *)(unsigned long)ureq.user_rptr_addr;
+ }
+
if (t3a_device(rhp)) {
/*
@@ -269,15 +278,14 @@ static int iwch_resize_cq(struct ib_cq *
return ret;
}
-static int iwch_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify,
- struct ib_udata *udata)
+static int iwch_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
{
struct iwch_dev *rhp;
struct iwch_cq *chp;
enum t3_cq_opcode cq_op;
int err;
unsigned long flag;
- struct iwch_req_notify_cq ucmd;
+ u32 rptr;
chp = to_iwch_cq(ibcq);
rhp = chp->rhp;
@@ -285,11 +293,11 @@ static int iwch_arm_cq(struct ib_cq *ibc
cq_op = CQ_ARM_SE;
else
cq_op = CQ_ARM_AN;
- if (udata && t3b_device(rhp)) {
- if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd))
+ if (chp->user_rptr_addr) {
+ if (get_user(rptr, chp->user_rptr_addr))
return -EFAULT;
spin_lock_irqsave(&chp->lock, flag);
- chp->cq.rptr = ucmd.rptr;
+ chp->cq.rptr = rptr;
} else
spin_lock_irqsave(&chp->lock, flag);
PDBG("%s rptr 0x%x\n", __FUNCTION__, chp->cq.rptr);
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h b/drivers/infiniband/hw/cxgb3/iwch_provider.h
index f339427..d9d94e3 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h
@@ -105,6 +105,7 @@ struct iwch_cq {
spinlock_t lock;
atomic_t refcnt;
wait_queue_head_t wait;
+ u32 *user_rptr_addr;
};
static inline struct iwch_cq *to_iwch_cq(struct ib_cq *ibcq)
diff --git a/drivers/infiniband/hw/cxgb3/iwch_user.h b/drivers/infiniband/hw/cxgb3/iwch_user.h
index 4e4b9c9..e8ff061 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_user.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_user.h
@@ -42,6 +42,9 @@ #define IWCH_UVERBS_ABI_VERSION 1
* In particular do not use pointer types -- pass pointers in __u64
* instead.
*/
+struct iwch_create_cq_req {
+ __u64 user_rptr_addr;
+};
struct iwch_create_cq_resp {
__u64 physaddr;
@@ -61,8 +64,4 @@ struct iwch_create_qp_resp {
struct iwch_reg_user_mr_resp {
__u32 pbl_addr;
};
-
-struct iwch_req_notify_cq {
- __u32 rptr;
-};
#endif
next prev parent reply other threads:[~2007-01-09 19:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-20 12:41 [PATCH 1/10] cxgb3 - main header files Divy Le Ray
2006-12-26 20:57 ` Jeff Garzik
2006-12-27 8:52 ` Divy Le Ray
2006-12-27 9:03 ` Arjan van de Ven
2007-01-09 10:19 ` Divy Le Ray
2007-01-09 10:28 ` Jeff Garzik
2007-01-09 13:38 ` Steve Wise
2007-01-09 13:57 ` Michael S. Tsirkin
2007-01-09 14:46 ` Steve Wise
2007-01-09 19:39 ` Steve Wise [this message]
2007-01-09 18:29 ` Caitlin Bestler
2007-01-09 16:28 ` Roland Dreier
2007-01-09 16:41 ` Jeff Garzik
2007-01-09 17:09 ` Roland Dreier
2007-01-19 3:05 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1168371562.17406.3.camel@stevo-desktop \
--to=swise@opengridcomputing.com \
--cc=divy@chelsio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@mellanox.co.il \
--cc=netdev@vger.kernel.org \
--cc=openib-general@openib.org \
--cc=rdreier@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).