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

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


Pull in change from trunk for reporting bus relations.

The current code passes the bus filter instance's CA GUID and then does a lookup based on the GUID to find that instance's port and IOU managers for reporting bus relations.  This patch pulls in a change from the trunk where the bus filter instance is passed in, removing the need to perform the lookup.

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

diff -dwup3 -X excl.txt -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_iou_mgr.c .\core\bus\kernel\bus_iou_mgr.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_iou_mgr.c	Fri Aug 03 17:54:45 2012
+++ .\core\bus\kernel\bus_iou_mgr.c	Thu Jul 26 16:18:08 2012
@@ -515,52 +515,25 @@ iou_mgr_pnp_cb(
  */
 #pragma prefast(suppress: 28167, "The irql level is restored here")
 NTSTATUS iou_mgr_get_bus_relations(
-	IN		const	net64_t						ca_guid,
+	IN				bus_filter_t*				p_bfi,
 	IN				IRP* const					p_irp )
 {
 	NTSTATUS			status;
-	bus_filter_t		*p_bfi;
-	iou_mgr_t			*p_iou_mgr;
-	DEVICE_RELATIONS	*p_rel;
 
 	BUS_ENTER( BUS_DBG_PNP );
 
-	BUS_PRINT(BUS_DBG_PNP, ("CA_guid %I64x\n",ca_guid));
-
-	/* special case guid == 0 - walk all bus filter instances */
-	if ( ca_guid == 0ULL ) {
-		for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {
-			p_iou_mgr = p_bfi->p_iou_mgr;
-			if ( !p_iou_mgr )
-				continue;
-			cl_mutex_acquire( &p_iou_mgr->pdo_mutex );
-			status = bus_get_relations( &p_iou_mgr->iou_list, ca_guid, p_irp );
-			cl_mutex_release( &p_iou_mgr->pdo_mutex );
-		}
-		p_rel = (DEVICE_RELATIONS*)p_irp->IoStatus.Information;
-		if ( p_rel ) {
-			BUS_PRINT(BUS_DBG_PNP, ("CA_guid 0 Reports %d relations\n", p_rel->Count));
-		}
-		BUS_EXIT( BUS_DBG_PNP );
-		return STATUS_SUCCESS;
-	}
+	BUS_PRINT(BUS_DBG_PNP, ("CA_guid %I64x\n",p_bfi->ca_guid));
 
-	p_bfi = get_bfi_by_ca_guid(ca_guid);
-	if (p_bfi == NULL) {
-		BUS_TRACE_EXIT(BUS_DBG_PNP,
-								("NULL p_bfi from ca_guid %I64x ?\n",ca_guid));
-		return STATUS_UNSUCCESSFUL;
-	}
-	p_iou_mgr = p_bfi->p_iou_mgr;
+	CL_ASSERT( p_bfi->ca_guid );
 
 	BUS_PRINT(BUS_DBG_PNP, ("%s for ca_guid %I64x iou_mgr %p\n",
-							p_bfi->whoami, ca_guid, p_iou_mgr) );
-	if (!p_iou_mgr)
+							p_bfi->whoami, p_bfi->ca_guid, p_bfi->p_iou_mgr) );
+	if (!p_bfi->p_iou_mgr)
 		return STATUS_NO_SUCH_DEVICE;
 
-	cl_mutex_acquire( &p_iou_mgr->pdo_mutex );
-	status = bus_get_relations( &p_iou_mgr->iou_list, ca_guid, p_irp );
-	cl_mutex_release( &p_iou_mgr->pdo_mutex );
+	cl_mutex_acquire( &p_bfi->p_iou_mgr->pdo_mutex );
+	status = bus_get_relations( &p_bfi->p_iou_mgr->iou_list, p_bfi->ca_guid, p_irp );
+	cl_mutex_release( &p_bfi->p_iou_mgr->pdo_mutex );
 
 	BUS_EXIT( BUS_DBG_PNP );
 	return status;
diff -dwup3 -X excl.txt -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_iou_mgr.h .\core\bus\kernel\bus_iou_mgr.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_iou_mgr.h	Thu May 31 11:22:15 2012
+++ .\core\bus\kernel\bus_iou_mgr.h	Thu Jul 26 16:17:12 2012
@@ -59,7 +59,7 @@ create_iou_mgr(
 
 NTSTATUS
 iou_mgr_get_bus_relations(
-	IN		const	net64_t						ca_guid,
+	IN			struct _bus_filter_instance*	p_bfi,
 	IN				IRP* const					p_irp );
 
 #endif
diff -dwup3 -X excl.txt -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_pnp.c .\core\bus\kernel\bus_pnp.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_pnp.c	Fri Aug 03 17:54:45 2012
+++ .\core\bus\kernel\bus_pnp.c	Thu Jul 26 16:20:52 2012
@@ -1010,12 +1010,12 @@ fdo_query_bus_relations(
 			ioc_pnp_request_ioc_rescan();
 		}
 
-		status = port_mgr_get_bus_relations( p_bfi->ca_guid, p_irp );
+		status = port_mgr_get_bus_relations( p_bfi, p_irp );
 
 		if( status == STATUS_SUCCESS || 
 			status == STATUS_NO_SUCH_DEVICE )
 		{
-			status = iou_mgr_get_bus_relations( p_bfi->ca_guid, p_irp );
+			status = iou_mgr_get_bus_relations( p_bfi, p_irp );
 		}
 		if( status == STATUS_NO_SUCH_DEVICE )
 			status = STATUS_SUCCESS;
@@ -1502,7 +1502,7 @@ fdo_query_pnp_state(
 	*p_action = IrpSkip;
 
 	BUS_EXIT( BUS_DBG_PNP );
-	return STATUS_SUCCESS;;
+	return STATUS_SUCCESS;
 }
 
 #pragma alloc_text( PAGED , fdo_query_interface )
diff -dwup3 -X excl.txt -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_port_mgr.c .\core\bus\kernel\bus_port_mgr.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_port_mgr.c	Fri Aug 03 17:54:45 2012
+++ .\core\bus\kernel\bus_port_mgr.c	Thu Jul 26 16:38:31 2012
@@ -535,57 +535,25 @@ port_mgr_pnp_cb(
  */
 #pragma prefast(suppress: 28167, "The irql level is restored here")
 NTSTATUS port_mgr_get_bus_relations(
-	IN		const	net64_t						ca_guid,
+	IN				bus_filter_t*				p_bfi,
 	IN				IRP* const					p_irp )
 {
 	NTSTATUS			status;
-	bus_filter_t		*p_bfi;
-	port_mgr_t			*p_port_mgr;
-	DEVICE_RELATIONS	*p_rel;
 
 	BUS_ENTER( BUS_DBG_PNP );
 
-	BUS_PRINT(BUS_DBG_PNP, ("CA_guid %I64x\n",ca_guid));
-
-	/* special case guid == 0 - walk all bus filter instances */
-	if ( ca_guid == 0ULL ) {
-		BUS_PRINT(BUS_DBG_PNP, ("CA_guid 0\n"));
-		for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {
-			p_port_mgr = p_bfi->p_port_mgr;
-			if ( !p_port_mgr )
-				continue;
-			cl_mutex_acquire( &p_port_mgr->pdo_mutex );
-			status = bus_get_relations( &p_port_mgr->port_list,
-										p_bfi->ca_guid,
-										p_irp );
-			cl_mutex_release( &p_port_mgr->pdo_mutex );
-		}
-
-		p_rel = (DEVICE_RELATIONS*)p_irp->IoStatus.Information;
-		if ( p_rel ) {
-			BUS_PRINT(BUS_DBG_PNP, ("CA_guid 0 Reports %d\n", p_rel->Count));
-		}
-		BUS_EXIT( BUS_DBG_PNP );
-		return STATUS_SUCCESS;
-	}
+	BUS_PRINT(BUS_DBG_PNP, ("CA_guid %I64x\n",p_bfi->ca_guid));
 
-	p_bfi = get_bfi_by_ca_guid(ca_guid);
-	if (p_bfi == NULL) {
-		BUS_PRINT(BUS_DBG_PNP,
-			("Null *p_bfi from ca_guid %I64x\n",ca_guid));
-		BUS_EXIT( BUS_DBG_PNP );
-		return STATUS_NO_SUCH_DEVICE;
-	}
-	p_port_mgr = p_bfi->p_port_mgr;
+	CL_ASSERT( p_bfi->ca_guid );
 
 	BUS_PRINT(BUS_DBG_PNP, ("%s for ca_guid %I64x port_mgr %p\n",
-							p_bfi->whoami, ca_guid, p_port_mgr) );
-	if (!p_port_mgr)
+							p_bfi->whoami, p_bfi->ca_guid, p_bfi->p_port_mgr) );
+	if (!p_bfi->p_port_mgr)
 		return STATUS_NO_SUCH_DEVICE;
 
-	cl_mutex_acquire( &p_port_mgr->pdo_mutex );
-	status = bus_get_relations( &p_port_mgr->port_list, ca_guid, p_irp );
-	cl_mutex_release( &p_port_mgr->pdo_mutex );
+	cl_mutex_acquire( &p_bfi->p_port_mgr->pdo_mutex );
+	status = bus_get_relations( &p_bfi->p_port_mgr->port_list, p_bfi->ca_guid, p_irp );
+	cl_mutex_release( &p_bfi->p_port_mgr->pdo_mutex );
 
 	BUS_EXIT( BUS_DBG_PNP );
 	return STATUS_SUCCESS;
@@ -2015,8 +1983,6 @@ port_query_bus_info(
 	//TODO: loaded.
 	p_bus_info->LegacyBusType = Internal;
 
-
-
 	len = sizeof(ULONG);
 
 	status = IoGetDeviceProperty( p_hca_dev, DevicePropertyBusNumber , sizeof(ULONG), &BusNumber, &len );
@@ -2029,7 +1995,6 @@ port_query_bus_info(
 		return status;
 	}
 
-    
 	p_bus_info->BusNumber = BusNumber;
 
 	p_irp->IoStatus.Information = (ULONG_PTR)p_bus_info;
diff -dwup3 -X excl.txt -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_port_mgr.h .\core\bus\kernel\bus_port_mgr.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\bus\kernel\bus_port_mgr.h	Thu May 31 11:22:15 2012
+++ .\core\bus\kernel\bus_port_mgr.h	Thu Jul 26 16:18:31 2012
@@ -64,7 +64,7 @@ create_port_mgr(
 
 NTSTATUS
 port_mgr_get_bus_relations(
-	IN		const	net64_t						ca_guid,
+	IN		struct _bus_filter_instance	*p_bfi,
 	IN				IRP* const					p_irp );
 
 #endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.26.patch
Type: application/octet-stream
Size: 7342 bytes
Desc: ndv2.26.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/b9e23327/attachment.obj>


More information about the ofw mailing list