[Openib-windows] [PATCH] IPOIB counters

Yossi Leybovich sleybo at mellanox.co.il
Tue Nov 15 06:23:33 PST 2005


Fab

While trying to fix the IPoIB counters I found the following bugs:

1. send length in the WC is not valid ( Mellanox PRM state that byte_cnt
field is valid only in rcv operation (or send of RDMA READ))
    so the field length in the WC is not valid in send operation .
    To fix the statistic I Query the NDIS packet for total length of the
packet
2. On the recv flow all the packets were counting as multicast or
broadcast packets
the problem was in the if statement, the code use p_endpt but should use
"p_endpt->h_mcast"
3. On the recv flow the IPoIB report on length + 40bytes (I saw it on
simple ping test , instead of size of 74 it report 114) 
These bytes are from the GRH data in the begging of the buffer.
I think that its more clean to remove the GRH bytes in the start of the
function 
And in that way you don't have to carry them to all the if statements
and you report the right length to NDIS.

I check the patch over ping and it works

10x
Yossi 

Singed-off-by:Yossi Leybovich (sleybo at mellanox.co.il)
Index: ulp/ipoib/kernel/ipoib_port.c
===================================================================
--- ulp/ipoib/kernel/ipoib_port.c	(revision 720)
+++ ulp/ipoib/kernel/ipoib_port.c	(working copy)
@@ -1730,9 +1740,9 @@
 			continue;
 		}
 
-		len = p_wc->length;
+		len = p_wc->length - sizeof(ib_grh_t);
 
-		if( len < (sizeof(ib_grh_t) + sizeof(ipoib_hdr_t)) )
+		if( len < sizeof(ipoib_hdr_t))
 		{
 			IPOIB_TRACE( IPOIB_DBG_ERROR,
 				("Received ETH packet < min size\n") );
@@ -1773,7 +1783,7 @@
 		{
 		case ETH_PROT_TYPE_IP:
 			if( len <
-				(sizeof(ib_grh_t) + sizeof(ipoib_hdr_t)
+ sizeof(ip_hdr_t)) )
+				sizeof(ipoib_hdr_t) + sizeof(ip_hdr_t))
 			{
 				IPOIB_TRACE( IPOIB_DBG_ERROR,
 					("Received IP packet < min
size\n") );
@@ -1792,8 +1802,8 @@
 			}
 
 			/* First packet of a UDP transfer. */
-			if( len < (sizeof(ib_grh_t) +
sizeof(ipoib_hdr_t) +
-				sizeof(ip_hdr_t) + sizeof(udp_hdr_t)) )
+			if( len < sizeof(ipoib_hdr_t) +
+				sizeof(ip_hdr_t) + sizeof(udp_hdr_t))
 			{
 				IPOIB_TRACE( IPOIB_DBG_ERROR,
 					("Received UDP packet < min
size\n") );
@@ -1807,8 +1817,8 @@
 				(p_ipoib->type.ip.prot.udp.hdr.dst_port
== DHCP_PORT_CLIENT &&
 				p_ipoib->type.ip.prot.udp.hdr.src_port
== DHCP_PORT_SERVER) )
 			{
-				if( len < (sizeof(ib_grh_t) +
sizeof(ipoib_hdr_t) +
-					sizeof(ip_hdr_t) +
sizeof(udp_hdr_t) + DHCP_MIN_SIZE ))
+				if( len < sizeof(ipoib_hdr_t) +
+					sizeof(ip_hdr_t) +
sizeof(udp_hdr_t) + DHCP_MIN_SIZE )
 				{
 					IPOIB_TRACE( IPOIB_DBG_ERROR,
 						("Received DHCP < min
size\n") );
@@ -1862,7 +1872,7 @@
 		{
 			p_desc->len =
 				len + sizeof(eth_hdr_t) -
sizeof(ipoib_hdr_t);
-			if( p_dst )
+			if( p_dst->h_mcast)
 			{
 				if(
p_dst->dgid.multicast.raw_group_id[10] == 0xFF &&
 
p_dst->dgid.multicast.raw_group_id[11] == 0xFF &&
@@ -3612,6 +3635,7 @@
 	ib_wc_t				wc[MAX_SEND_WC], *p_wc, *p_free;
 	cl_qlist_t			done_list;
 	NDIS_PACKET			*p_packet;
+	uintn_t			Length;
 	ipoib_endpt_t		*p_endpt;
 	send_buf_t			*p_send_buf;
 	ip_stat_sel_t		type;
@@ -3681,8 +3705,10 @@
 				{
 					type = IP_STAT_UCAST_BYTES;
 				}
-				ipoib_inc_send_stat( p_port->p_adapter,
type,
-					p_wc->length -
sizeof(ipoib_hdr_t) + sizeof(eth_hdr_t) );
+				NdisQueryPacket(p_packet, NULL, NULL,
NULL, &Length);
+				ipoib_inc_send_stat( p_port->p_adapter,
type, Length );
 				NdisMSendComplete(
p_port->p_adapter->h_adapter,
 					p_packet, NDIS_STATUS_SUCCESS );
 				break;
Index: kernel/ipoib_endpoint.c
===================================================================
--- kernel/ipoib_endpoint.c	(revision 720)
+++ kernel/ipoib_endpoint.c	(working copy)
@@ -89,7 +89,7 @@
 			sizeof(ipoib_endpt_t)) );
 		return NULL;
 	}
-
+	cl_memclr(p_endpt, sizeof(ipoib_endpt_t));
 	cl_obj_construct( &p_endpt->obj, IPOIB_OBJ_ENDPOINT );
 
 	status = cl_obj_init( &p_endpt->obj, CL_DESTROY_ASYNC,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_counters.patch
Type: application/octet-stream
Size: 2518 bytes
Desc: ipoib_counters.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20051115/5267e79d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_counters2.patch
Type: application/octet-stream
Size: 429 bytes
Desc: ipoib_counters2.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20051115/5267e79d/attachment-0001.obj>


More information about the ofw mailing list