--- C:/Documents and Settings/scsmith/Local Settings/Temp/ipoib_port.cpp-revBASE.svn000.tmp.cpp	Wed Dec 22 10:27:58 2010
+++ C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp	Wed Dec 22 10:14:28 2010
@@ -375,7 +375,6 @@
 	IN	ULONG				compl_flags,
 	IN	boolean_t			bLock	);
 
-
 static inline NDIS_STATUS
 __send_mgr_queue(
 	IN				ipoib_port_t* const			p_port,
@@ -1140,7 +1139,6 @@
 			p_port->p_adapter->params.recv_chksum_offload = CSUM_DISABLED;
 	}
 
-
 	// Now, params struct contains the intersection between the user definition
 	// and actual HW capabilites
 	// Remember these values for NDIS OID requests
@@ -1909,7 +1907,6 @@
 	NET_BUFFER_LIST		*cur_net_buffer_list, *next_net_buffer_list;
 	LONG				NBL_cnt = 0;
 
-	
 	for (cur_net_buffer_list = p_net_buffer_lists;
 		 cur_net_buffer_list != NULL;
 		 cur_net_buffer_list = next_net_buffer_list)
@@ -2194,7 +2191,7 @@
 				
 		} else {
 			/* If shortage >0, we already set the status to
-			   NDIS_RECEIVE_FLAGS_RESOURCES.  That is, IPoIB driver regain
+			   NDIS_RECEIVE_FLAGS_RESOURCES.  That is, IPoIB driver regains
 			   ownership of the NET_BUFFER_LIST structures immediately.
 			 */
 			res = shutter_add( &p_port->p_adapter->recv_shutter, 1 );
@@ -2246,7 +2243,7 @@
 	if (p_free )
 	{
 		/*
-		 * Rearm after filtering to prevent contention on the enpoint maps
+		 * Rearm after filtering to prevent contention on the endpoint maps
 		 * and eliminate the possibility of having a call to
 		 * __endpt_mgr_insert find a duplicate.
 		 */
@@ -2510,8 +2507,8 @@
 			cl_qlist_insert_tail( p_bad_list, &p_desc->item.list_item );
 			ipoib_port_deref( p_port, ref_recv_inv_len );
 			continue;
-			
 		}
+
 		/* Successful completion.  Get the receive information. */
 		p_desc->ndis_csum.Value = ( ( p_wc->recv.ud.recv_opt & IB_RECV_OPT_CSUM_MASK ) >> 8 );
 		p_desc->len = len + 14 - 4 ;
@@ -3509,7 +3506,6 @@
 		//__send_complete_net_buffer(s_buf, NDIS_STATUS_RESET_IN_PROGRESS,send_complete_flags,TRUE);
 		__send_complete_net_buffer(s_buf, NDIS_STATUS_FAILURE,send_complete_flags,TRUE);
 	}
-  
 }
 
 static void
@@ -4039,7 +4035,7 @@
 			cl_qlist_insert_head( &p_port->send_mgr.pending_list,
 				(cl_list_item_t*)s_buf  );
 			IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_MCAST,
-				("We insert this item back to the pending list: %p \n",
+				("Insert item back to the pending list: %p \n",
 				p_net_buffer_list));
 			ret = false;
 			goto send_end;
@@ -4099,8 +4095,8 @@
 			MDL					*p_ip_hdr_mdl;
 			UINT				ip_hdr_mdl_len;
 			
-			IPOIB_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_MCAST,
-				("Sent a Multicast NBL=%p\n", p_net_buffer_list) );
+			IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_MCAST,
+				("Send a Multicast NBL=%p\n", p_net_buffer_list) );
 		
 			g_ipoib_send_mcast++;
 			
@@ -4137,7 +4133,6 @@
 			}
 			p_eth_hdr->dst.addr[1] = ((unsigned char*)&p_ip_hdr->dst_ip)[0] & 0x0f;
 			p_eth_hdr->dst.addr[3] = ((unsigned char*)&p_ip_hdr->dst_ip)[1];
-
 		}
 
 mc_end:
@@ -4331,7 +4326,6 @@
 
 	DataOffset= (ULONG)(NET_BUFFER_CURRENT_MDL_OFFSET(s_buf->p_curr_nb)); 
 	
-	
 	/*
 	 * Skip the Ethernet or LSO header.  It is contained at N+1 first elements (N>=0),
 	 * while (N+1) element may contain only part of it
@@ -4342,7 +4336,6 @@
 		// skip the current element and increment the index
 		total_offset -= p_sgl->Elements[i++].Length;
 	}
-
 	
 	if (total_offset > 0 )
 	{
@@ -4448,6 +4441,7 @@
 		status = __send_mgr_filter_udp( p_ip_hdr, p_mdl,
 										(buf_len - hdr_size), prot, s_buf );
 		cl_perf_stop( &p_port->p_adapter->perf, FilterUdp );
+
 		if( status == NDIS_STATUS_PENDING )
 		{  /* not DHCP packet, keep going */
 			if( ETH_IS_MULTICAST( p_eth_hdr->dst.addr ) )
@@ -4525,7 +4519,7 @@
 
 send_gen:
 	cl_perf_start( SendTcp );
-	status = __send_gen(  s_buf, 0 );
+	status = __send_gen( s_buf, 0 );
 	cl_perf_stop( &p_port->p_adapter->perf, SendTcp );
 
 	IPOIB_EXIT( IPOIB_DBG_SEND );
@@ -4719,8 +4713,6 @@
 		}
 	}
 	/* Get the UDP header and check the destination port numbers. */
-	
-	
 		 
 	if( buf_len < sizeof(udp_hdr_t) )
 	{
@@ -5162,7 +5154,7 @@
 	IN				eth_hdr_t* const			p_eth_hdr,
 		OUT			ipoib_endpt_t** const		pp_endpt )
 {
-	NDIS_STATUS			status;
+	NDIS_STATUS		status;
 
 	PERF_DECLARE( GetEndpt );
 
@@ -5223,7 +5215,7 @@
 	IN				eth_hdr_t* const			p_eth_hdr,
 	IN				MDL* const					p_mdl,
 	IN		const	size_t						mdl_len,
-	IN				ipoib_send_NB_SG			*s_buf)
+	IN				ipoib_send_NB_SG			*s_buf )
 {
 	NDIS_STATUS			status;
 	int32_t				hdr_idx;
@@ -5341,7 +5333,7 @@
 					( p_checksum_list_info->Transmit.IsIPv4  || 
 					p_checksum_list_info->Transmit.IsIPv6  ))
 				{
-					// Set transimition checksum offloading
+					// Set transmit checksum offloading
 					if( p_checksum_list_info->Transmit.IpHeaderChecksum )
 					{
 						p_desc->send_wr[i].wr.send_opt |= IB_SEND_OPT_TX_IP_CSUM;
@@ -5394,7 +5386,7 @@
 
 	IPOIB_ENTER( IPOIB_DBG_SEND );
 
-	ipoib_send_NB_SG * s_buf = IPOIB_INFO_FROM_NB(p_netbuf);
+	ipoib_send_NB_SG  *s_buf = IPOIB_INFO_FROM_NB(p_netbuf);
 	ipoib_send_desc_t *p_desc = p_port->p_desc;
 
 	//TODO What if first NB was inserted to pending list ????
@@ -6862,6 +6854,7 @@
 	cl_atomic_dec( &p_port->endpt_rdr );
 	cl_obj_unlock( &p_port->obj );
 
+	IPOIB_EXIT( IPOIB_DBG_ENDPT );
 	return status;
 }
 
@@ -7111,7 +7104,6 @@
 	p_port->state = IB_QPS_INIT;
 	cl_obj_unlock( &p_port->obj );  
 
-
 	/* Wait for all work requests to get flushed. */
 	while( p_port->recv_mgr.depth || p_port->send_mgr.depth )
 		cl_thread_suspend( 0 );
@@ -7218,8 +7210,8 @@
 	cl_memclr( &av_attr, sizeof(ib_av_attr_t) );
 	av_attr.port_num = p_port->port_num;
 	av_attr.sl = 0;
-	IPOIB_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_ENDPT,
-		(" av_attr.dlid = p_port_info->base_lid = %d\n",
+	IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_ENDPT,
+		(" av_attr.dlid = p_port_info->base_lid = %x\n",
 			cl_ntoh16( p_port_info->base_lid ) ));
 	av_attr.dlid = p_port_info->base_lid;
 	av_attr.static_rate = p_port->ib_mgr.rate;
@@ -7893,7 +7885,7 @@
 
 ib_api_status_t
 ipoib_port_join_mcast(
-	IN				ipoib_port_t* const			p_port,
+	IN				ipoib_port_t* const		p_port,
 	IN		const	mac_addr_t				mac,
 	IN		const	uint8_t					state)
 {
@@ -7960,7 +7952,7 @@
 	}
 	else
 	{
-		/* Handle non IP mutlicast MAC addresses. */
+		/* Handle non IP multicast MAC addresses. */
 		/* Update the signature to use the lower 2 bytes of the OpenIB OUI. */
 		mcast_req.member_rec.mgid.raw[2] = 0x14;
 		mcast_req.member_rec.mgid.raw[3] = 0x05;
