[ofw] [Patch][IPoIB_NDIS6_CM] [2/2] DHCP bug fix

Alex Naslednikov xalex at mellanox.co.il
Mon Dec 27 05:43:52 PST 2010


Both patches applied at 3044 and 3045

-----Original Message-----
From: Alex Naslednikov 
Sent: Wednesday, December 22, 2010 12:19 PM
To: Alex Naslednikov; ofw at lists.openfabrics.org
Subject: RE: [ofw][Patch][IPoIB_NDIS6_CM] [2/2] DHCP bug fix 

[INC]
Fixing the declaration according to C ISO standard (and not C++)
Signed-off by: Naslednikov Alexander (xalex at mellanox.co.il)
Index: ip_packet.h
===================================================================
--- ip_packet.h	(revision 7034)
+++ ip_packet.h	(revision 7035)
@@ -602,30 +602,27 @@
 
 }	PACK_SUFFIX udp_pkt_t;
 
+typedef union _ip_payload
+{
+	tcp_hdr_t	tcp;
+	udp_pkt_t	udp;
+
+}	PACK_SUFFIX ip_payload_t;
+
+
 typedef struct _ip_pkt
 {
 	ip_hdr_t		hdr;
+	ip_payload_t	prot;
 	
-	union _ip_payload
-	{
-		tcp_hdr_t	tcp;
-		udp_pkt_t	udp;
 
-	}	PACK_SUFFIX prot;
-
 }	PACK_SUFFIX ip_pkt_t;
 
 typedef struct _ipv6_pkt
 {
 	ipv6_hdr_t		hdr;
-	
-	union _ip_payload
-	{
-		tcp_hdr_t	tcp;
-		udp_pkt_t	udp;
+	ip_payload_t 	prot;
 
-	}	PACK_SUFFIX prot;
-
 }	PACK_SUFFIX ipv6_pkt_t;
 


-----Original Message-----
From: Alex Naslednikov 
Sent: Wednesday, December 22, 2010 12:15 PM
To: ofw at lists.openfabrics.org
Subject: [ofw][Patch][IPoIB_NDIS6_CM] [1/2] DHCP bug fix 

DHCP bug fix caused by IPv6 commit
Signed-off by: Alexander Naslednikov (xalex at mellanox.co.il)

Index: inc/kernel/ip_packet.h
===================================================================
--- inc/kernel/ip_packet.h	(revision 3031)
+++ inc/kernel/ip_packet.h	(working copy)
@@ -604,11 +604,8 @@
 
 typedef struct _ip_pkt
 {
-	union
-	{
-		ip_hdr_t		hdr;
-		ipv6_hdr_t		hdr_ipv6;
-	} PACK_SUFFIX ;
+	ip_hdr_t		hdr;
+	
 	union _ip_payload
 	{
 		tcp_hdr_t	tcp;
@@ -618,6 +615,20 @@
 
 }	PACK_SUFFIX ip_pkt_t;
 
+typedef struct _ipv6_pkt
+{
+	ipv6_hdr_t		hdr;
+	
+	union _ip_payload
+	{
+		tcp_hdr_t	tcp;
+		udp_pkt_t	udp;
+
+	}	PACK_SUFFIX prot;
+
+}	PACK_SUFFIX ipv6_pkt_t;
+
+
 typedef struct _eth_pkt
 {
 	eth_hdr_t	hdr;
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)
@@ -2555,7 +2555,7 @@
 				break;
 			}
 			
-			if( p_ipoib->type.ip.hdr_ipv6.next_header != IP_PROT_UDP )
+			if( p_ipoib->type.ipv6.hdr.next_header != IP_PROT_UDP )
 			{
 				/* Unfiltered.  Setup the ethernet header and report. */
 				cl_perf_start( RecvTcp );
@@ -2563,7 +2563,7 @@
 				cl_perf_stop( &p_port->p_adapter->perf, RecvTcp );
 				break;
 			}
-			//ASSERT( p_ipoib->type.ip.hdr_ipv6.payload_length == sizeof(ipv6_hdr_t) );
+			//ASSERT( p_ipoib->type.ipv6.hdr.payload_length == sizeof(ipv6_hdr_t) );
 
 			/* First packet of a UDP transfer. */
 			if( len <
@@ -2576,10 +2576,10 @@
 			}
 
 			/* Check if DHCP conversion is required. */
-			if( (p_ipoib->type.ip.prot.udp.hdr.dst_port == DHCP_IPV6_PORT_SERVER_OR_AGENT&&
-				p_ipoib->type.ip.prot.udp.hdr.src_port == DHCP_IPV6_PORT_CLIENT) ||
-				(p_ipoib->type.ip.prot.udp.hdr.dst_port == DHCP_IPV6_PORT_CLIENT &&
-				p_ipoib->type.ip.prot.udp.hdr.src_port == DHCP_IPV6_PORT_SERVER_OR_AGENT))
+			if( (p_ipoib->type.ipv6.prot.udp.hdr.dst_port == DHCP_IPV6_PORT_SERVER_OR_AGENT&&
+				p_ipoib->type.ipv6.prot.udp.hdr.src_port == DHCP_IPV6_PORT_CLIENT) ||
+				(p_ipoib->type.ipv6.prot.udp.hdr.dst_port == DHCP_IPV6_PORT_CLIENT &&
+				p_ipoib->type.ipv6.prot.udp.hdr.src_port == DHCP_IPV6_PORT_SERVER_OR_AGENT))
 			{
 				//TODO should be DHCP IPv6
 				if( len < (sizeof(ipoib_hdr_t) + sizeof(ipv6_hdr_t) +
@@ -4766,7 +4766,7 @@
 	//TODO: in this case we limited IP size to 20, but it can be bigger, according to GetIpPayloadPtr
 	if ( prot == ETH_PROT_TYPE_IPV6 ) 
 	{
-		cl_memcpy( &s_buf->p_send_buf->ip.hdr_ipv6, p_ip_hdr , sizeof(ipv6_hdr_t) );
+		cl_memcpy( &s_buf->p_send_buf->ipv6.hdr, p_ip_hdr , sizeof(ipv6_hdr_t) );
 	}
 	else
 	{
Index: ulp/ipoib_NDIS6_CM/kernel/ipoib_port.h
===================================================================
--- ulp/ipoib_NDIS6_CM/kernel/ipoib_port.h	(revision 3031)
+++ ulp/ipoib_NDIS6_CM/kernel/ipoib_port.h	(working copy)
@@ -212,6 +212,7 @@
 		uint8_t			data[MAX_UD_PAYLOAD_MTU];
 		ipoib_arp_pkt_t	arp;
 		ip_pkt_t		ip;
+		ipv6_pkt_t		ipv6;
 
 	}	PACK_SUFFIX type;
 
@@ -299,6 +300,7 @@
 	uint8_t			data[MAX_LSO_PAYLOAD_MTU];
 	ipoib_arp_pkt_t	arp;
 	ip_pkt_t		ip;
+	ipv6_pkt_t		ipv6;
 
 }	PACK_SUFFIX send_buf_t;
 /*



More information about the ofw mailing list