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

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


Pass ib_ucontext to ib_umem_map so that KPROCESSOR_MODE can be used.

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\cq.c .\hw\mlx4\kernel\bus\ib\cq.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\cq.c	Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\cq.c	Sat Jun 23 14:15:09 2012
@@ -230,7 +230,7 @@ struct ib_cq *mlx4_ib_create_cq_internal
 		// add mapping to user's arm_sn variable
 		// we have no way pass the completion event to provider library
 		// so we'll increment user's arm_sn in kernel
-		err = ib_umem_map( ucmd.arm_sn_addr, sizeof(int), 
+		err = ib_umem_map( context, ucmd.arm_sn_addr, sizeof(int),
 			IB_ACCESS_LOCAL_WRITE, &cq->mcq.mdl, &cq->mcq.p_u_arm_sn );
 		if (err) {
 			MLX4_PRINT(TRACE_LEVEL_ERROR, MLX4_DBG_DRV,
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\inc\l2w_umem.h .\hw\mlx4\kernel\inc\l2w_umem.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\inc\l2w_umem.h	Thu Mar 29 00:15:29 2012
+++ .\hw\mlx4\kernel\inc\l2w_umem.h	Wed May 23 15:14:37 2012
@@ -22,6 +22,7 @@ struct ib_umem {
 dma_addr_t ib_umem_get_dma(struct ib_umem *p_ib_umem);
 
 int ib_umem_map(
+	IN		struct ib_ucontext *context,
 	IN		u64 va,
 	IN		u64 size,
 	IN		ib_access_t acc,
diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\l2w\l2w_umem.c .\hw\mlx4\kernel\l2w\l2w_umem.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\l2w\l2w_umem.c	Thu Mar 29 00:15:27 2012
+++ .\hw\mlx4\kernel\l2w\l2w_umem.c	Thu May 24 13:05:42 2012
@@ -124,6 +124,7 @@ dma_addr_t ib_umem_get_dma(struct ib_ume
 
 // Returns: 0 on success, -ENOMEM or -EACCESS or -EFAULT on error
 int ib_umem_map(
+	IN		struct ib_ucontext *context,
 	IN		u64 va,
 	IN		u64 size,
 	IN		ib_access_t acc,
@@ -134,6 +135,13 @@ int ib_umem_map(
 	int rc = 0;
 	LOCK_OPERATION lock_op = (acc & IB_AC_LOCAL_WRITE) ? IoModifyAccess : IoReadAccess;
 
+	if( context->x.mode == KernelMode )
+	{
+		*kva = (volatile u32 *)(ULONG_PTR)va;
+		*mdl = NULL;
+		return 0;
+	}
+
 	p_mdl = IoAllocateMdl( (PVOID)(ULONG_PTR)va, (ULONG)size, FALSE,FALSE,NULL);
 	if (p_mdl == NULL) {
 		rc = -ENOMEM;
@@ -174,7 +182,7 @@ void ib_umem_unmap(
 	IN PMDL p_mdl,
 	IN volatile u32 *kva)
 {
-	if (kva) {
+	if (p_mdl) {
 		MmUnmapLockedPages( (PVOID)kva, p_mdl );
 		MmUnlockPages(p_mdl);
 		IoFreeMdl(p_mdl);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.11.patch
Type: application/octet-stream
Size: 2416 bytes
Desc: ndv2.11.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/3115c55b/attachment.obj>


More information about the ofw mailing list