The problem is the ip_hdr value will not have been programmed on a received packet.
I would recommend taking a look at igb_lro_queue in our igb driver at e1000.sf.net for an example of how to access the iphdr and tcphdr on a packet. What is basically involved is making sure to access it after eth_type_trans has been called and then adjusting the offsets appropriately. Thanks, Alex >-----Original Message----- >From: Nirmal Guhan [mailto:[email protected]] >Sent: Monday, August 30, 2010 6:49 PM >To: [email protected] >Subject: [E1000-devel] igb_main query > >Hi, > >I am trying to read the SKB and see if it is a TCP or UDP packet. >However, ip_hdr(skb), always returns a NULL at igb_clean_rx_irq_adv(). >Wondering if I am missing something very obvious ? > >Please let me know > >THanx >Guest > > if (htons(ETH_P_IP) == skb->protocol) { > struct iphdr *ip = ip_hdr(skb); > if (ip && ((ip->protocol == IPPROTO_TCP) || > (ip->protocol == IPPROTO_UDP))) { > return (FALSE); > } > } > >---------------------------------------------------------------------- >-------- >This SF.net Dev2Dev email is sponsored by: > >Show off your parallel programming skills. >Enter the Intel(R) Threading Challenge 2010. >http://p.sf.net/sfu/intel-thread-sfd >_______________________________________________ >E1000-devel mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/e1000-devel >To learn more about Intel® Ethernet, visit >http://communities.intel.com/community/wired ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
