[ofw] [PATCH] 6 of 6 ipoib_ndis6_cm - conditionalize and move debug code to debug file

Smith, Stan stan.smith at intel.com
Tue Jun 28 14:38:43 PDT 2011


Migrate debug code into ipoib_debug.cpp and make conditional on EXTRA_DEBUG==1; trim the default compilation base.
Remove unused (commented out) code.

Signed-off-by: stan smith <stan.smith at intel.com>

--- C:/Users/scsmith/AppData/Local/Temp/ipoib_cm.cpp-revBASE.svn000.tmp.cpp	Tue Jun 28 14:07:03 2011
+++ C:/Users/scsmith/Documents/openIB-windows/SVN/gen1/trunk/ulp/ipoib_NDIS6_CM/kernel/ipoib_cm.cpp	Tue Jun 28 11:02:01 2011
@@ -215,6 +215,35 @@
 
 
 
+char *get_eth_packet_type_str(net16_t pkt_type)
+{
+	static char what[28];
+
+	switch( pkt_type )
+	{
+	  case ETH_PROT_TYPE_IP:  
+		return "ETH_PROT_IP";
+
+	  case ETH_PROT_TYPE_IPV6:  
+		return "ETH_PROT_IPV6";
+
+	  case ETH_PROT_TYPE_ARP:  
+		return "ETH_PROT_ARP";
+
+	  case ETH_PROT_TYPE_RARP:  
+		return "ETH_PROT_RARP";
+
+	  case ETH_PROT_VLAN_TAG:  
+		return "ETH_PROT_VLAN_TAG";
+
+	  default:
+		break;
+	}
+	StringCchPrintf(what,sizeof(what),"Unknown Eth packet type 0x%x",pkt_type);
+	return what;
+}
+
+
 char *cm_get_state_str( cm_state_t s )
 {
 	static char what[28];
@@ -247,7 +276,7 @@
 	return what;
 }
 
-#if DBG
+#if EXTRA_DBG
 
 void
 decode_enet_pkt(char *preFix, void *hdr, int len, char *postFix)
@@ -299,71 +328,6 @@
 #endif
 
 
-#if 0
-
-static void
-decode_NBL(
-	IN		char const				*preFix,
-	IN		ipoib_port_t			*p_port,
-	IN		NET_BUFFER_LIST 		*p_net_buffer_list ) 
-{
-	ipoib_cm_recv_desc_t	*p_desc;
-	NET_BUFFER_LIST			*cur_NBL, *next_NBL;
-	LONG					NBL_cnt = 0;
-	PNET_BUFFER				NB;
-	ULONG					len, off, i;
-
-	IPOIB_ENTER(IPOIB_DBG_RECV);
-
-	for (cur_NBL = p_net_buffer_list; cur_NBL != NULL; cur_NBL = next_NBL, NBL_cnt++)
-	{
-		next_NBL = NET_BUFFER_LIST_NEXT_NBL(cur_NBL);
-		/* Get the port and descriptor from the NET_BUFFER_LIST. */
-		CL_ASSERT(p_port == IPOIB_PORT_FROM_NBL(cur_NBL));
-		p_desc = IPOIB_CM_RECV_FROM_NBL(cur_NBL);
-#if 0
-		decode_enet_pkt( "\n%s", preFix,
-						 p_desc->p_alloc_buf,
-						 p_desc->len,
-						 NULL );
-#endif
-		IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_CM,
-			("%s[%d] curNBL %p p_desc->len %d NblFlags %#x\n",
-				preFix,
-				NBL_cnt,
-				cur_NBL,
-				p_desc->len,
-				NET_BUFFER_LIST_NBL_FLAGS(cur_NBL)) );
-
-		NB = NET_BUFFER_LIST_FIRST_NB(cur_NBL);
-		for(i = 1; NB;i++)
-		{
-			MDL		*p_mdl;
-			PUCHAR	p_head;
-			UINT	mdl_len;
-
-			p_head=NULL;
-			p_mdl = NET_BUFFER_FIRST_MDL(NB);	
-			NdisQueryMdl( p_mdl, &p_head, &mdl_len, NormalPagePriority );
-			if( p_head )
-			{
-				len = NET_BUFFER_DATA_LENGTH(NB);
-				off = NET_BUFFER_DATA_OFFSET(NB);
-				IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_CM,
-					(" NB[%d] off %lu len %lu mdl_len %u\n",
-						i,off,len,mdl_len) );
-						//(p_head+off),
-						//(p_desc->p_buf - DATA_OFFSET)) );
-				CL_ASSERT( len == p_desc->len );
-				CL_ASSERT( (p_head+off) == (p_desc->p_buf - DATA_OFFSET));
-				decode_enet_pkt( "\nEdata:", (p_head + off), mdl_len, NULL );
-			}
-			NB=NET_BUFFER_NEXT_NB(NB);
-		}
-	}
-}
-#endif
-
 static ib_api_status_t
 __cm_create_qp( 
 	IN		ipoib_port_t*			p_port,
@@ -2521,8 +2485,6 @@
 
 	cl_spinlock_release( &p_port->cm_buf_mgr.lock);
 
-	//cl_spinlock_acquire( &p_port->recv_lock );
-
 	do
 	{
  		/* Approximate the number of posted receive buffers needed in order to
@@ -2570,7 +2532,6 @@
 			/* normal all-done loop exit */
 			break;
 		}
-		//cl_spinlock_release( &p_port->recv_lock );
 
 		cl_perf_start( CMRecvNdisIndicate );
 		
@@ -2634,11 +2595,9 @@
 			ipoib_free_received_NBL( p_port, p_endpt->cm_recv.NBL );
 			cl_spinlock_release( &p_port->recv_lock );
 		}
-		//cl_spinlock_acquire( &p_port->recv_lock );
 
 	} while( NBL_cnt );
 
-	//cl_spinlock_release( &p_port->recv_lock );
 
 	if (p_free )
 	{




More information about the ofw mailing list