[ofw] patch: [ipoib] Add code to track the adapters (for debugging only)

Tzachi Dar tzachid at mellanox.co.il
Thu Oct 8 04:29:58 PDT 2009


This code is being used for easier debugging. It allows one to connect
to a live system with a local kernel debugger and see the adapters
state.
 
Thanks
Tzachi
 
Index:
Q:/projMLNX_WinOF_2.0.7/MLNX_WinOF_2-0/ulp/ipoib/kernel/ipoib_driver.c
===================================================================
---
Q:/projMLNX_WinOF_2.0.7/MLNX_WinOF_2-0/ulp/ipoib/kernel/ipoib_driver.c
(revision 4898)
+++
Q:/projMLNX_WinOF_2.0.7/MLNX_WinOF_2-0/ulp/ipoib/kernel/ipoib_driver.c
(revision 4899)
@@ -133,6 +133,47 @@
 #define MAX_GUID_MAX 0xFC
 
 
+#define MAX_CARDS 8
+ipoib_adapter_t   *g_NIC[MAX_CARDS] = { NULL }  ;
+
+static void AddNewAdapter(ipoib_adapter_t* pAdapter)
+{
+ UINT i;
+   
+ for(i=0 ; i < MAX_CARDS; i++)
+ {
+  if (g_NIC[i] == pAdapter)
+  {
+   CL_ASSERT(FALSE);
+   return;
+  }
+ }
+
+ for(i=0 ; i < MAX_CARDS; i++)
+ {
+  if (g_NIC[i] == NULL)
+  {
+   g_NIC[i] = pAdapter;
+   return;
+  }
+ }
+}
+
+
+static void RemoveAdapter(ipoib_adapter_t* pAdapter)
+{
+ UINT i;
+ for(i=0 ; i < MAX_CARDS; i++)
+ {
+  if (g_NIC[i] == pAdapter)
+  {
+   g_NIC[i] = NULL;
+   return;
+  }
+ }
+}
+
+
 /* Global driver debug level */
 uint32_t  g_ipoib_dbg_level = TRACE_LEVEL_ERROR;
 uint32_t  g_ipoib_dbg_flags = 0x00000fff;
@@ -792,6 +833,8 @@
   return NDIS_STATUS_FAILURE;
  }
 
+ AddNewAdapter(p_adapter);
+
  ipoib_ref_ibat();
 
  IPOIB_EXIT( IPOIB_DBG_INIT );
@@ -824,6 +867,8 @@
 
  ipoib_destroy_adapter( p_adapter );
 
+ RemoveAdapter(p_adapter);
+
  IPOIB_EXIT( IPOIB_DBG_INIT );
 }
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20091008/c1dd375c/attachment.html>


More information about the ofw mailing list