Make it easier for the compiler to optimize IP_IS_FRAGMENT.
authorBen Pfaff <blp@nicira.com>
Mon, 4 Aug 2008 21:21:34 +0000 (14:21 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 4 Aug 2008 21:46:01 +0000 (14:46 -0700)
include/packets.h

index 177bc30..ea73cb1 100644 (file)
@@ -177,7 +177,7 @@ BUILD_ASSERT_DECL(VLAN_ETH_HEADER_LEN == sizeof(struct vlan_eth_header));
 #define IP_MORE_FRAGMENTS 0x2000 /* More fragments. */
 #define IP_FRAG_OFF_MASK  0x1fff /* Fragment offset. */
 #define IP_IS_FRAGMENT(ip_frag_off) \
-        (ntohs(ip_frag_off) & (IP_MORE_FRAGMENTS | IP_FRAG_OFF_MASK))
+        ((ip_frag_off) & htons(IP_MORE_FRAGMENTS | IP_FRAG_OFF_MASK))
 
 #define IP_HEADER_LEN 20
 struct ip_header {