[ofw] [Patch][IPoIB_NDIS6_CM] More printing facilities

Alex Naslednikov xalex at mellanox.co.il
Mon Dec 27 05:42:46 PST 2010


Applied at 3048

-----Original Message-----
From: Alex Naslednikov 
Sent: Wednesday, December 22, 2010 12:41 PM
To: Alex Naslednikov; ofw at lists.openfabrics.org
Subject: [ofw][Patch][IPoIB_NDIS6_CM] More printing facilities

Added more tracing facilities
Signed-off by: Alexander Naslednikov (xalex at mellanox.co.il)

Index: ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp
===================================================================
--- ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp	(revision 3033)
+++ ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp	(working copy)
@@ -411,6 +411,82 @@
 	IN PNDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO p_lso_info,
 	IN				NET_BUFFER					*p_netbuf);
 
+static inline void
+	ipoib_print_ip_hdr( 
+	IN				ip_hdr_t*	const 			p_ip_hdr )
+{
+	IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,
+			("IP Header:\n ver_hl=%d\tsvc_type=%d\n "
+			 "length=%04X\tid=%d\n"
+			 "offset=%d\tttl=%d\n "
+			 "prot=%d\tchksum=%d\n "
+			 "src_ip=%d.%d.%d.%d\tdst_ip=%d.%d.%d.%d\n",
+				p_ip_hdr->ver_hl,
+				p_ip_hdr->svc_type,
+				cl_ntoh16( p_ip_hdr->length ),
+				cl_ntoh16( p_ip_hdr->id ),
+				cl_ntoh16( p_ip_hdr->offset ),
+				p_ip_hdr->ttl,
+				p_ip_hdr->prot,
+				cl_ntoh16( p_ip_hdr->chksum ),
+				((UCHAR*) (void*) & (p_ip_hdr->src_ip))[0],
+				((UCHAR*) (void*) & (p_ip_hdr->src_ip))[1],
+				((UCHAR*) (void*) & (p_ip_hdr->src_ip))[2],
+				((UCHAR*) (void*) & (p_ip_hdr->src_ip))[3],
+				((UCHAR*) (void*) & (p_ip_hdr->dst_ip))[0],
+				((UCHAR*) (void*) & (p_ip_hdr->dst_ip))[1],
+				((UCHAR*) (void*) & (p_ip_hdr->dst_ip))[2],
+				((UCHAR*) (void*) & (p_ip_hdr->dst_ip))[3]) ); }
+
+static const char src_hw_str[] = "src_hw_addr"; static const char 
+dest_hw_str[] = "dest_hw_addr";
+
+static inline void
+	ipoib_print_ib_hw_addr(
+	IN				UCHAR*		const	p_hw_addr,
+	IN				const char*	const	hw_addr_str ) 
+{
+	IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,
+		("%s =%02x %02x %02x %02x %02x %02x %02x %02x %02x "
+		 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x \n",
+		hw_addr_str,
+		p_hw_addr[0], p_hw_addr[1], p_hw_addr[2], p_hw_addr[3],
+		p_hw_addr[4], p_hw_addr[5], p_hw_addr[6], p_hw_addr[7],
+		p_hw_addr[8], p_hw_addr[9], p_hw_addr[10], p_hw_addr[11],
+		p_hw_addr[12], 	p_hw_addr[13], p_hw_addr[14], p_hw_addr[15],
+		p_hw_addr[15], 	p_hw_addr[17], p_hw_addr[18], p_hw_addr[19]) 
+	);
+}
+
+static inline void
+	ipoib_print_arp_hdr(
+	IN				ipoib_arp_pkt_t *	const			p_ib_arp )
+{
+		IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,
+					("ARP packet:\n"
+					"hw_type=%d\tprot_type=%d\thw_size=%d\n"
+					"prot_size=%d\top=%d\t"
+					"src_ip=%d.%d.%d.%d\tdst_ip=%d.%d.%d.%d\n",
+						p_ib_arp->hw_type,
+					p_ib_arp->prot_type,
+					p_ib_arp->hw_size,
+					p_ib_arp->prot_size,
+					p_ib_arp->op,
+					((UCHAR*) (void*)(&p_ib_arp->src_ip))[0],
+					((UCHAR*) (void*)(&p_ib_arp->src_ip))[1],
+					((UCHAR*) (void*)(&p_ib_arp->src_ip))[2],
+					((UCHAR*) (void*)(&p_ib_arp->src_ip))[3],
+					((UCHAR*) (void*)(&p_ib_arp->dst_ip))[0],
+					((UCHAR*) (void*)(&p_ib_arp->dst_ip))[1],
+					((UCHAR*) (void*)(&p_ib_arp->dst_ip))[2],
+					((UCHAR*) (void*)(&p_ib_arp->dst_ip))[3])
+					);
+		ipoib_print_ib_hw_addr( (UCHAR*) (void*) &p_ib_arp->src_hw, src_hw_str );
+		ipoib_print_ib_hw_addr( (UCHAR*) (void*) &p_ib_arp->dst_hw , 
+dest_hw_str );
+		
+}
+
 //TODO CM Restore
 #if 0
 
@@ -3566,17 +3642,23 @@
 	{
 	case ETH_PROT_TYPE_IPV6:
 		cl_perf_start( FilterIpV6 );
+		IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,
+			("Current header type is IPv6\n") );
 		status = __send_mgr_filter_ip( p_eth_hdr, p_mdl, buf_len, s_buf );
 		cl_perf_stop( &p_port->p_adapter->perf, FilterIpV6 );
 		break;
 	case ETH_PROT_TYPE_IP:
 		cl_perf_start( FilterIp );
+		IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,
+			("Current header type is IPv4\n") );
 		status = __send_mgr_filter_ip( p_eth_hdr, p_mdl, buf_len, s_buf );
 		cl_perf_stop( &p_port->p_adapter->perf, FilterIp );
 		break;
 
 	case ETH_PROT_TYPE_ARP:
 		cl_perf_start( FilterArp );
+		IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,
+			("Current header type is ARP\n") );
 		status = __send_mgr_filter_arp( p_eth_hdr, p_mdl, buf_len, s_buf );
 		p_desc->send_dir = SEND_UD_QP;
 		cl_perf_stop( &p_port->p_adapter->perf, FilterArp ); @@ -3587,6 +3669,8 @@
 		 * The IPoIB spec doesn't define how to send non IP or ARP packets.
 		 * Just send the payload and hope for the best.
 		 */
+		 IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_SEND,
+			("Unrecognized header type: %d\n",p_eth_hdr->type ) );
 
 		p_desc->send_dir = SEND_UD_QP;
 		cl_perf_start( SendGen );
@@ -3997,8 +4081,8 @@
 	s_buf->p_send_buf = NULL;
 	p_port->p_desc->num_wrs = 1;
 
-	IPOIB_PRINT( TRACE_LEVEL_VERBOSE, IPOIB_DBG_SEND,
-			("\nRECEIVED NB= %p with SG= %p\n********\n", p_netbuf, p_sgl) );
+	IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,
+			("\nRECEIVED NBL= 0x%p, NB= 0x%p with SG= %p\n********\n", 
+p_net_buffer_list, p_netbuf, p_sgl) );
 
 	/* Get the ethernet header so we can find the endpoint. */
 	cl_perf_start( GetEthHdr );
@@ -4427,11 +4511,13 @@
 	{
 		prot = ((ipv6_hdr_t *) p_ip_hdr)->next_header;
 		hdr_size = sizeof(ipv6_hdr_t);
+		 IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,("Got IPV6 
+Header\n" ) );
 	}
 	else //IPv4
 	{
 		prot = ((ip_hdr_t *) p_ip_hdr)->prot;
 		hdr_size = sizeof(ip_hdr_t);
+		ipoib_print_ip_hdr( (ip_hdr_t *) p_ip_hdr );
 	}
 	if( buf_len < hdr_size )
 	{
@@ -5062,6 +5148,7 @@
 						s_buf->p_port->p_adapter->guids.port_guid.guid );
 
 	p_ib_arp->src_ip = p_arp->src_ip;
+	ipoib_print_arp_hdr( p_ib_arp );
 
 	if( cl_memcmp( &p_arp->dst_hw, &null_hw, sizeof(mac_addr_t) ) )
 	{
@@ -6057,8 +6144,10 @@
 						p_wc->wc_type == IB_WC_SEND || p_wc->wc_type == IB_WC_LSO);
 
 			s_buf = (ipoib_send_NB_SG*)(uintn_t)p_wc->wr_id;
-			IPOIB_PRINT(TRACE_LEVEL_VERBOSE, IPOIB_DBG_SEND,
-				("Successfull send completion for NBL=0x%p .\n",  s_buf->p_nbl ));
+			
+			IPOIB_PRINT(TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,
+				("Send completion for NBL=0x%p, NB=0x%p \n",  s_buf->p_nbl, 
+s_buf->p_curr_nb));
+			
 			CL_ASSERT( s_buf );
 
 			p_endpt = s_buf->p_endpt;
@@ -7593,6 +7682,8 @@
 		p_port->p_adapter->hung = TRUE;
 		return;
 	}
+	IPOIB_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,
+			("IB QP was put into IB_QPS_ERROR state\n") );
 
 	KeResetEvent(&p_port->leave_mcast_event);
 
@@ -7791,6 +7882,8 @@
 		cl_memclr( &qp_mod, sizeof(ib_qp_mod_t) );
 		qp_mod.req_state = IB_QPS_ERROR;
 		status = p_port->p_adapter->p_ifc->modify_qp( p_port->ib_mgr.h_qp, &qp_mod );
+		IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,
+			("IB QP was put into IB_QPS_ERROR state\n") );
 		__endpt_mgr_reset_all( p_port );
 
 		ipoib_port_deref( p_port, ref_join_bcast ); @@ -7866,6 +7959,8 @@
 			p_port->p_adapter->p_ifc->get_err_str( status )) );
 		return status;
 	}
+	IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,
+			("IB QP was put into IB_QPS_ERROR state\n") );
 
 	/* Move the QP to RTS. */
 	dgrm_info.port_guid = p_port->p_adapter->guids.port_guid.guid;



More information about the ofw mailing list