[Openib-windows] [PATCH] add DebugLevel to ipoib registry

Yossi Leybovich sleybo at mellanox.co.il
Tue Nov 8 01:15:13 PST 2005


Fab

I think this patch will be helpful when debugging the IPoIB.(it helps
me)

Its add DebugLevel parameter to the ipoib service in registry and read
it in DriverEntry. (same as IBAL)

singed-off-by: Yossi Leybovich (sleybo at mellanox.co.il)

Index: ulp/ipoib/kernel/ipoib_driver.c
===================================================================
--- ulp/ipoib/kernel/ipoib_driver.c	(revision 712)
+++ ulp/ipoib/kernel/ipoib_driver.c	(working copy)
@@ -223,7 +223,57 @@
 	IN				ipoib_adapter_t* const
p_adapter );
 
 
+static NTSTATUS
+__ipoib_read_registry(
+	IN				UNICODE_STRING* const
p_registry_path )
+{
+	NTSTATUS						status;
+	/* Remember the terminating entry in the table below. */
+	RTL_QUERY_REGISTRY_TABLE		table[2];
+	UNICODE_STRING				param_path;
 
+	IPOIB_ENTER( IPOIB_DBG_INIT );
+
+
+	RtlInitUnicodeString( &param_path, NULL );
+	param_path.MaximumLength = p_registry_path->Length + 
+		sizeof(L"\\Parameters");
+	param_path.Buffer = cl_zalloc( param_path.MaximumLength );
+	if( !param_path.Buffer )
+	{
+		IPOIB_TRACE_EXIT( IPOIB_DBG_ERROR, 
+			("Failed to allocate parameters path buffer.\n")
);
+		return STATUS_INSUFFICIENT_RESOURCES;
+	}
+
+	RtlAppendUnicodeStringToString( &param_path, p_registry_path );
+	RtlAppendUnicodeToString( &param_path, L"\\Parameters" );
+
+	/*
+	 * Clear the table.  This clears all the query callback
pointers,
+	 * and sets up the terminating table entry.
+	 */
+	cl_memclr( table, sizeof(table) );
+
+	// Setup the table entries.
+	table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
+	table[0].Name = L"DebugFlags";
+	table[0].EntryContext = &g_ipoib_dbg_lvl;
+	table[0].DefaultType = REG_DWORD;
+	table[0].DefaultData = &g_ipoib_dbg_lvl;
+	table[0].DefaultLength = sizeof(ULONG);
+
+	/* Have at it! */
+	status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, 
+		param_path.Buffer, table, NULL, NULL );
+
+	cl_free( param_path.Buffer );
+	IPOIB_EXIT( IPOIB_DBG_INIT );
+	return status;
+}
+
+
+
 VOID DriverUnload (
         IN PDRIVER_OBJECT	pDriverObject
         ) 
@@ -272,6 +322,8 @@
 	status		= NDIS_STATUS_SUCCESS;
 	ndis_handle	= NULL;
 
+	__ipoib_read_registry(p_registry_path);
+	
 	KeInitializeSpinLock( &g_ipoib.lock );
 	InitializeListHead( &g_ipoib.adapter_list );
 
Index: ulp/ipoib/kernel/netipoib.inf
===================================================================
--- ulp/ipoib/kernel/netipoib.inf	(revision 712)
+++ ulp/ipoib/kernel/netipoib.inf	(working copy)
@@ -133,7 +133,11 @@
 ErrorControl    = 1 ;%SERVICE_ERROR_NORMAL%
 ServiceBinary   = %12%\ipoib.sys
 LoadOrderGroup  = NDIS
+AddReg          = ipoib.ParamsReg
 
+[ipoib.Paramreg]
+HKR,"Parameters","DebugFlags",%REG_DWORD_NO_CLOBBER%,0x80000000
+
 [IpoibEventLog]
 AddReg = IpoibAddEventLogReg
 
@@ -188,3 +192,4 @@
 DIRID_SYSTEM         = 11
 DIRID_DRIVERS        = 12
 DIRID_SYSTEM_X86     = 16425
+REG_DWORD_NO_CLOBBER   = 0x00010003
\ No newline at end of file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_debug.patch
Type: application/octet-stream
Size: 2755 bytes
Desc: ipoib_debug.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20051108/e43b3af8/attachment.obj>


More information about the ofw mailing list