[openib-general] [PATCH][4/5] ib_get_dma_mr(): use in IPoIB

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


Index: infiniband/ulp/ipoib/ipoib_verbs.c
===================================================================
--- infiniband/ulp/ipoib/ipoib_verbs.c	(revision 952)
+++ infiniband/ulp/ipoib/ipoib_verbs.c	(working copy)
@@ -201,24 +201,10 @@
 	if (ib_req_notify_cq(priv->cq, IB_CQ_NEXT_COMP))
 		goto out_free_cq;
 
-	{
-		/* XXX we assume physical memory starts at address 0. */
-		struct ib_phys_buf buffer_list = {
-			.addr = 0,
-			.size = (unsigned long) high_memory - PAGE_OFFSET
-		};
-		u64 dummy_iova = 0;
-
-		priv->mr = ib_reg_phys_mr(priv->pd, &buffer_list,
-					  1,	/* list_len */
-					  IB_ACCESS_LOCAL_WRITE,
-					  &dummy_iova);
-		if (IS_ERR(priv->mr)) {
-			printk(KERN_WARNING "%s: ib_reg_phys_mr failed\n", ca->name);
-			goto out_free_cq;
-		}
-
-		priv->lkey = priv->mr->lkey;
+	priv->mr = ib_get_dma_mr(priv->pd, IB_ACCESS_LOCAL_WRITE);
+	if (IS_ERR(priv->mr)) {
+		printk(KERN_WARNING "%s: ib_reg_phys_mr failed\n", ca->name);
+		goto out_free_cq;
 	}
 
 	return 0;
Index: infiniband/ulp/ipoib/ipoib.h
===================================================================
--- infiniband/ulp/ipoib/ipoib.h	(revision 996)
+++ infiniband/ulp/ipoib/ipoib.h	(working copy)
@@ -121,7 +121,6 @@
 	struct ib_mr  	 *mr;
 	struct ib_cq  	 *cq;
 	struct ib_qp  	 *qp;
-	u32           	  lkey;
 	u32           	  qkey;
 
 	union ib_gid local_gid;
Index: infiniband/ulp/ipoib/ipoib_ib.c
===================================================================
--- infiniband/ulp/ipoib/ipoib_ib.c	(revision 986)
+++ infiniband/ulp/ipoib/ipoib_ib.c	(working copy)
@@ -36,7 +36,7 @@
 	struct ib_sge list = {
 		.addr    = addr,
 		.length  = IPOIB_BUF_SIZE,
-		.lkey    = priv->lkey,
+		.lkey    = priv->mr->lkey,
 	};
 	struct ib_recv_wr param = {
 		.wr_id 	    = work_request_id,
@@ -238,7 +238,7 @@
 	struct ib_sge list = {
 		.addr    = addr,
 		.length  = len,
-		.lkey    = priv->lkey,
+		.lkey    = priv->mr->lkey,
 	};
 	struct ib_send_wr param = {
 		.wr_id = work_request_id,




More information about the general mailing list