int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num,
ÂÂÂÂÂÂÂÂÂ struct scatterlist *sg, u32 sg_cnt, u32 sg_offset,
-ÂÂÂÂÂÂÂ u64 remote_addr, u32 rkey, enum dma_data_direction dir)
+ÂÂÂÂÂÂÂ u64 remote_addr, u32 rkey, enum dma_data_direction dir,
+ÂÂÂÂÂÂÂ unsigned int flags)
 {
ÂÂÂÂÂ struct ib_device *dev = qp->pd->device;
ÂÂÂÂÂ int ret;
-ÂÂÂ ret = ib_dma_map_sg(dev, sg, sg_cnt, dir);
+ÂÂÂ if (flags & RDMA_RW_CTX_FLAG_PCI_P2PDMA)
+ÂÂÂÂÂÂÂ ret = pci_p2pdma_map_sg(dev->dma_device, sg, sg_cnt, dir);
+ÂÂÂ else
+ÂÂÂÂÂÂÂ ret = ib_dma_map_sg(dev, sg, sg_cnt, dir);
+
Why not use is_pci_p2pdma_page(sg) instead of a flag? It would be so
much cleaner...