On an ip header there are 3 bits flags and 13 bits of offset.
We used to look at them as one word, which cause us not to use flags well.

The following code fixes this.

Thanks
Tzachi


Index: inc/kernel/ip_packet.h
===================================================================
--- inc/kernel/ip_packet.h           (revision 7290)
+++ inc/kernel/ip_packet.h        (working copy)
@@ -221,7 +221,7 @@
               uint8_t                 svc_type;
               net16_t                                length;
               net16_t                                id;
-              net16_t                                offset;
+             net16_t                                offset_flags;
               uint8_t                 ttl;
               uint8_t                 prot;
               net16_t                                chksum;
@@ -264,6 +264,10 @@
* SEE ALSO
*            IB Network Drivers, eth_hdr_t, arp_pkt_t, tcp_hdr_t, udp_hdr_t
*********/
+
+#define OFFSET_MASK  0x1fff
+
+
#include <complib/cl_packoff.h>
 #include <complib/cl_packon.h>
Index: ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp
===================================================================
--- ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp                (revision 7290)
+++ ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp             (working copy)
@@ -441,7 +441,7 @@
                                                               
p_ip_hdr->svc_type,
                                                               cl_ntoh16( 
p_ip_hdr->length ),
                                                               cl_ntoh16( 
p_ip_hdr->id ),
-                                                              cl_ntoh16( 
p_ip_hdr->offset ),
+                                                             cl_ntoh16( 
p_ip_hdr->offset_flags ),
                                                               p_ip_hdr->ttl,
                                                               p_ip_hdr->prot,
                                                               cl_ntoh16( 
p_ip_hdr->chksum ),
@@ -2821,7 +2821,7 @@
                                                               break;
                                               }
-                                              if( p_ipoib->type.ip.hdr.offset 
||
+                                             if( 
(cl_ntoh16(p_ipoib->type.ip.hdr.offset_flags) & OFFSET_MASK) ||
                                                                
p_ipoib->type.ip.hdr.prot != IP_PROT_UDP )
                                               {
                                                               /* Unfiltered.   
 Setup the ethernet header and report. */
@@ -5102,7 +5102,7 @@
               PERF_DECLARE( FilterDhcp );
               IPOIB_ENTER( IPOIB_DBG_SEND );
-              if ( (ethertype == ETH_PROT_TYPE_IP) && 
((ip_hdr_t*)p_ip_hdr)->offset > 0 )
+             if ( (ethertype == ETH_PROT_TYPE_IP) && 
(cl_ntoh16(((ip_hdr_t*)p_ip_hdr)->offset_flags) & OFFSET_MASK) > 0 )
               {
                               /* This is a fragmented part of UDP packet
                                * Only first packet will contain UDP header in 
such case
_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to