]> err.no Git - linux-2.6/blobdiff - drivers/infiniband/hw/ipath/ipath_keys.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6] / drivers / infiniband / hw / ipath / ipath_keys.c
index 851763d7d2db23f4ff522578812b8d89968e49f6..8f32b17a5eed019d304a4b3c4283019274e69170 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 QLogic, Inc. All rights reserved.
+ * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved.
  * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -61,7 +61,7 @@ int ipath_alloc_lkey(struct ipath_lkey_table *rkt, struct ipath_mregion *mr)
                r = (r + 1) & (rkt->max - 1);
                if (r == n) {
                        spin_unlock_irqrestore(&rkt->lock, flags);
-                       ipath_dbg(KERN_INFO "LKEY table full\n");
+                       ipath_dbg("LKEY table full\n");
                        ret = 0;
                        goto bail;
                }
@@ -128,11 +128,16 @@ int ipath_lkey_ok(struct ipath_qp *qp, struct ipath_sge *isge,
        int ret;
 
        /*
-        * We use LKEY == zero to mean a physical kmalloc() address.
-        * This is a bit of a hack since we rely on dma_map_single()
-        * being reversible by calling bus_to_virt().
+        * We use LKEY == zero for kernel virtual addresses
+        * (see ipath_get_dma_mr and ipath_dma.c).
         */
        if (sge->lkey == 0) {
+               struct ipath_pd *pd = to_ipd(qp->ibqp.pd);
+
+               if (pd->user) {
+                       ret = 0;
+                       goto bail;
+               }
                isge->mr = NULL;
                isge->vaddr = (void *) sge->addr;
                isge->length = sge->length;
@@ -206,6 +211,12 @@ int ipath_rkey_ok(struct ipath_qp *qp, struct ipath_sge_state *ss,
         * (see ipath_get_dma_mr and ipath_dma.c).
         */
        if (rkey == 0) {
+               struct ipath_pd *pd = to_ipd(qp->ibqp.pd);
+
+               if (pd->user) {
+                       ret = 0;
+                       goto bail;
+               }
                sge->mr = NULL;
                sge->vaddr = (void *) vaddr;
                sge->length = len;