datapath: Backport eth_proto_is_802_3().
authorJoe Stringer <joestringer@nicira.com>
Tue, 21 Jul 2015 22:12:32 +0000 (15:12 -0700)
committerJoe Stringer <joestringer@nicira.com>
Thu, 30 Jul 2015 23:42:07 +0000 (16:42 -0700)
Backport of upstream commit 2c7a88c252bf3381958cf716f31b6b2e0f2f3fa7:
"etherdev: Fix sparse error, make test usable by other functions"

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
datapath/linux/compat/include/linux/etherdevice.h

index c6e8e92..c9c0a99 100644 (file)
@@ -51,4 +51,17 @@ static inline void ether_addr_copy(u8 *dst, const u8 *src)
 }
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+#define eth_proto_is_802_3 rpl_eth_proto_is_802_3
+static inline bool eth_proto_is_802_3(__be16 proto)
+{
+#ifndef __BIG_ENDIAN
+       /* if CPU is little endian mask off bits representing LSB */
+       proto &= htons(0xFF00);
+#endif
+       /* cast both to u16 and compare since LSB can be ignored */
+       return (__force u16)proto >= (__force u16)htons(ETH_P_802_3_MIN);
+}
+#endif
+
 #endif