[ofw] [Patch 9/62] Reference implementation of NDv2

Fab Tillier ftillier at microsoft.com
Wed Feb 20 17:20:21 PST 2013


Remove udata parameter from ibv_reg_mr functions.  Add a new flag, IB_ACCESS_ADDR_IS_MDL, to support passing an MDL as input.

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mlx4_ib.h .\hw\mlx4\kernel\bus\ib\mlx4_ib.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mlx4_ib.h	Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\mlx4_ib.h	Thu Jul 26 15:31:14 2012
@@ -379,8 +379,7 @@ struct ib_mr *mlx4_ib_get_dma_mr(struct 
 int mlx4_ib_umem_write_mtt(struct mlx4_ib_dev *dev, struct mlx4_mtt *mtt,
 			   struct ib_umem *umem);
 struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
-				  u64 virt_addr, int access_flags,
-				  struct ib_udata *udata);
+				  u64 virt_addr, int access_flags);
 struct ib_mr *mlx4_ib_reg_krnl_mr(struct ib_pd *pd, PMDL p_mdl, u64 length,
 				  int access_flags);
 
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mr.c .\hw\mlx4\kernel\bus\ib\mr.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mr.c	Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\mr.c	Wed May 23 15:14:37 2012
@@ -126,8 +126,7 @@ out:
 }
 
 struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
-				  u64 virt_addr, int access_flags,
-				  struct ib_udata *udata)
+				  u64 virt_addr, int access_flags)
 {
 	struct mlx4_ib_dev *dev = to_mdev(pd->device);
 	struct mlx4_ib_mr *mr;
@@ -135,8 +134,6 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct
 	int err;
 	int n;
 
-	UNUSED_PARAM(udata);
-
 	if (mlx4_is_barred(pd->device->dma_device))
 		return (ib_mr *)ERR_PTR(-EFAULT);
 	
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\inc\ib_verbs.h .\hw\mlx4\kernel\bus\inc\ib_verbs.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\inc\ib_verbs.h	Thu May 31 11:22:18 2012
+++ .\hw\mlx4\kernel\bus\inc\ib_verbs.h	Thu Jul 26 15:31:14 2012
@@ -784,6 +784,7 @@ enum ib_access_flags {
 	IB_ACCESS_REMOTE_READ	= (1<<2),
 	IB_ACCESS_REMOTE_ATOMIC	= (1<<3),
 	IB_ACCESS_MW_BIND	    = (1<<4),
+	IB_ACCESS_ADDR_IS_MDL   = (1<<5),
 	IB_ACCESS_NO_SECURE     = (1<<31)
 };
 
@@ -1100,8 +1101,7 @@ struct ib_device {
 	struct ib_mr *             (*reg_user_mr)(struct ib_pd *pd,
 						  u64 start, u64 length,
 						  u64 virt_addr,
-						  int mr_access_flags,
-						  struct ib_udata *udata);
+						  int mr_access_flags);
 	int                        (*query_mr)(struct ib_mr *mr,
 					       struct ib_mr_attr *mr_attr);
 	int                        (*dereg_mr)(struct ib_mr *mr);
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\hca\hverbs.c .\hw\mlx4\kernel\hca\hverbs.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\hca\hverbs.c	Thu May 31 11:22:19 2012
+++ .\hw\mlx4\kernel\hca\hverbs.c	Thu Jul 26 15:31:14 2012
@@ -69,11 +69,13 @@ struct ib_mr *ib_reg_phys_mr(struct ib_p
 {
 	struct ib_mr *mr;
 
-	if ( pd->device->reg_phys_mr )
+	if ( pd->device->reg_phys_mr ) {
 		mr = pd->device->reg_phys_mr(pd, phys_buf_array, num_phys_buf,
 			mr_access_flags, iova_start);
-	else
+    }
+	else {
 		mr = ERR_PTR(-ENOSYS);
+    }
 
 	if (!IS_ERR(mr)) {
 		mr->device  = pd->device;
@@ -92,20 +94,14 @@ struct ib_mr *ib_reg_phys_mr(struct ib_p
  struct ib_mr *ibv_reg_mr(struct ib_pd *pd, 
 	u64 start, u64 length,
 	u64 virt_addr,
-	int mr_access_flags,
-	ci_umv_buf_t* const p_umv_buf )
+	int mr_access_flags)
 {
 	struct ib_mr *ib_mr;
 	int err;
 	HCA_ENTER(HCA_DBG_MEMORY);
 
-	if (p_umv_buf) {
+	if ((mr_access_flags & IB_ACCESS_ADDR_IS_MDL) == 0) {
-		/* user space call */
-		if (p_umv_buf->command) {
-			err = -ENOSYS;
-			goto err_not_supported;
-		}
-		ib_mr = pd->device->reg_user_mr(pd, start, length, virt_addr, mr_access_flags, NULL);
+		ib_mr = pd->device->reg_user_mr(pd, start, length, virt_addr, mr_access_flags);
 	}
 	else {
 		/* kernel space call */
@@ -128,7 +124,6 @@ struct ib_mr *ib_reg_phys_mr(struct ib_p
 	return ib_mr;
 
 err_reg_user_mr:
-err_not_supported:
 	HCA_EXIT(HCA_DBG_MEMORY);
 	return ERR_PTR(err);
 }
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\hca\hverbs.h .\hw\mlx4\kernel\hca\hverbs.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\hca\hverbs.h	Thu May 31 11:22:19 2012
+++ .\hw\mlx4\kernel\hca\hverbs.h	Wed May 23 18:26:47 2012
@@ -43,8 +43,7 @@
 struct ib_mr *ibv_reg_mr(struct ib_pd *pd, 
 	u64 start, u64 length,
 	u64 virt_addr,
-	int mr_access_flags,
-	ci_umv_buf_t* const p_umv_buf );
+	int mr_access_flags);
 
 struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len);
 
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\hca\mr.c .\hw\mlx4\kernel\hca\mr.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\hca\mr.c	Thu May 31 11:22:19 2012
+++ .\hw\mlx4\kernel\hca\mr.c	Thu May 31 12:35:11 2012
@@ -54,7 +54,7 @@ mlnx_register_mr (
 	int err;
 	struct ib_mr *p_ib_mr;
 	struct ib_pd *p_ib_pd = (struct ib_pd *)h_pd;
-	ci_umv_buf_t umv_buf = { 0, 0, 0, 0, 0 };
+	int access_ctrl;
 
 	HCA_ENTER(HCA_DBG_MEMORY);
 
@@ -81,10 +81,15 @@ mlnx_register_mr (
 		goto err_invalid_access; 
 	}
 
+	access_ctrl = to_qp_acl(p_mr_create->access_ctrl);
+	if (um_call == FALSE) {
+		access_ctrl |= IB_ACCESS_ADDR_IS_MDL;
+	}
+
 	// register mr 
 	p_ib_mr = ibv_reg_mr(p_ib_pd, (ULONG_PTR)p_mr_create->vaddr, 
 		p_mr_create->length, (ULONG_PTR)p_mr_create->vaddr, 
-		to_qp_acl(p_mr_create->access_ctrl), um_call ? &umv_buf : NULL );
+		access_ctrl);
 	if (IS_ERR(p_ib_mr)) {
 		err = PTR_ERR(p_ib_mr);
 		HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_MEMORY,
@@ -96,7 +101,7 @@ mlnx_register_mr (
 	// results
 	*p_lkey = p_ib_mr->lkey;
 	*p_rkey = cl_hton32( p_ib_mr->rkey );
-	if (ph_mr)	*ph_mr = (ib_mr_handle_t)p_ib_mr;
+	*ph_mr = (ib_mr_handle_t)p_ib_mr;
 	status = IB_SUCCESS;
 
 err_reg_mr:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.9.patch
Type: application/octet-stream
Size: 5978 bytes
Desc: ndv2.9.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/45c42063/attachment.obj>


More information about the ofw mailing list