infiniband: sg chaining support
[linux-2.6-block.git] / drivers / infiniband / hw / ipath / ipath_dma.c
index f87f003e3ef887845d6d0da293b7df24f6874da4..22709a4f8fc89304672b12de18f29d8f2a981871 100644 (file)
@@ -30,6 +30,7 @@
  * SOFTWARE.
  */
 
+#include <linux/scatterlist.h>
 #include <rdma/ib_verbs.h>
 
 #include "ipath_verbs.h"
@@ -96,17 +97,18 @@ static void ipath_dma_unmap_page(struct ib_device *dev,
        BUG_ON(!valid_dma_direction(direction));
 }
 
-static int ipath_map_sg(struct ib_device *dev, struct scatterlist *sg, int nents,
-                       enum dma_data_direction direction)
+static int ipath_map_sg(struct ib_device *dev, struct scatterlist *sgl,
+                       int nents, enum dma_data_direction direction)
 {
+       struct scatterlist *sg;
        u64 addr;
        int i;
        int ret = nents;
 
        BUG_ON(!valid_dma_direction(direction));
 
-       for (i = 0; i < nents; i++) {
-               addr = (u64) page_address(sg[i].page);
+       for_each_sg(sgl, sg, nents, i) {
+               addr = (u64) page_address(sg->page);
                /* TODO: handle highmem pages */
                if (!addr) {
                        ret = 0;