IB/ipath: Fix ib_ipath driver to work with SRP
authorRalph Campbell <ralphc@pathscale.com>
Tue, 18 Jul 2006 01:19:54 +0000 (18:19 -0700)
committerRoland Dreier <rolandd@cisco.com>
Mon, 24 Jul 2006 16:18:07 +0000 (09:18 -0700)
I am still working on a proposal to remove the phys_to_virt() calls
in the ib_ipath driver.  In the mean time, this patch allows SRP
to work by fixing the R_Key check and conversion from IB address
to kernel virtual address.  It also returns the correct page size
for FMRs.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ipath/ipath_keys.c
drivers/infiniband/hw/ipath/ipath_verbs.c

index 46773c673a1af9f587eef5e9fd743503b98f476b..a5ca279370aa2a34004cf3ea3f88043985987b10 100644 (file)
@@ -197,6 +197,21 @@ int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,
        size_t off;
        int ret;
 
+       /*
+        * We use RKEY == zero for physical addresses
+        * (see ipath_get_dma_mr).
+        */
+       if (rkey == 0) {
+               sge->mr = NULL;
+               sge->vaddr = phys_to_virt(vaddr);
+               sge->length = len;
+               sge->sge_length = len;
+               ss->sg_list = NULL;
+               ss->num_sge = 1;
+               ret = 1;
+               goto bail;
+       }
+
        mr = rkt->table[(rkey >> (32 - ib_ipath_lkey_table_size))];
        if (unlikely(mr == NULL || mr->lkey != rkey)) {
                ret = 0;
index 56ac336dd1ecb59560c2e018402dd82fd4201d83..70bce7a8d53843882a1ee62b4bde1f6a45ade9a3 100644 (file)
@@ -627,6 +627,7 @@ static int ipath_query_device(struct ib_device *ibdev,
        props->device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR |
                IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT |
                IB_DEVICE_SYS_IMAGE_GUID;
+       props->page_size_cap = PAGE_SIZE;
        props->vendor_id = ipath_layer_get_vendorid(dev->dd);
        props->vendor_part_id = ipath_layer_get_deviceid(dev->dd);
        props->hw_ver = ipath_layer_get_pcirev(dev->dd);