[openib-general] [PATCH][1/5] ib_get_dma_mr(): core

Roland Dreier roland at topspin.com
Wed Oct 20 16:04:44 PDT 2004


Index: infiniband/include/ib_verbs.h
===================================================================
--- infiniband/include/ib_verbs.h	(revision 1024)
+++ infiniband/include/ib_verbs.h	(working copy)
@@ -736,6 +736,8 @@
 						    enum ib_cq_notify cq_notify);
 	int                        (*req_ncomp_notif)(struct ib_cq *cq,
 						      int wc_cnt);
+	struct ib_mr *             (*get_dma_mr)(struct ib_pd *pd,
+						 int mr_access_flags);
 	struct ib_mr *             (*reg_phys_mr)(struct ib_pd *pd,
 						  struct ib_phys_buf *phys_buf_array,
 						  int num_phys_buf,
@@ -924,6 +926,8 @@
 		-ENOSYS;
 }
 
+struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags);
+
 struct ib_mr *ib_reg_phys_mr(struct ib_pd *pd,
 			     struct ib_phys_buf *phys_buf_array,
 			     int num_phys_buf,
Index: infiniband/core/ib_verbs.c
===================================================================
--- infiniband/core/ib_verbs.c	(revision 915)
+++ infiniband/core/ib_verbs.c	(working copy)
@@ -226,6 +226,23 @@
 
 /* Memory regions */
 
+struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags)
+{
+	struct ib_mr *mr;
+
+	mr = pd->device->get_dma_mr(pd, mr_access_flags);
+
+	if (!IS_ERR(mr)) {
+		mr->device = pd->device;
+		mr->pd     = pd;
+		atomic_inc(&pd->usecnt);
+		atomic_set(&mr->usecnt, 0);
+	}
+
+	return mr;
+}
+EXPORT_SYMBOL(ib_get_dma_mr);
+
 struct ib_mr *ib_reg_phys_mr(struct ib_pd *pd,
 			     struct ib_phys_buf *phys_buf_array,
 			     int num_phys_buf,




More information about the general mailing list