> 
> 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 <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>

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





-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to