diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/etherdevice.h | 21 | ||||
-rw-r--r-- | include/linux/netdevice.h | 7 |
2 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 1cb0f0b90926..a1f17abba7dc 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -184,4 +184,25 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2], | |||
184 | } | 184 | } |
185 | #endif /* __KERNEL__ */ | 185 | #endif /* __KERNEL__ */ |
186 | 186 | ||
187 | /** | ||
188 | * compare_ether_header - Compare two Ethernet headers | ||
189 | * @a: Pointer to Ethernet header | ||
190 | * @b: Pointer to Ethernet header | ||
191 | * | ||
192 | * Compare two ethernet headers, returns 0 if equal. | ||
193 | * This assumes that the network header (i.e., IP header) is 4-byte | ||
194 | * aligned OR the platform can handle unaligned access. This is the | ||
195 | * case for all packets coming into netif_receive_skb or similar | ||
196 | * entry points. | ||
197 | */ | ||
198 | |||
199 | static inline int compare_ether_header(const void *a, const void *b) | ||
200 | { | ||
201 | u32 *a32 = (u32 *)((u8 *)a + 2); | ||
202 | u32 *b32 = (u32 *)((u8 *)b + 2); | ||
203 | |||
204 | return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) | | ||
205 | (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]); | ||
206 | } | ||
207 | |||
187 | #endif /* _LINUX_ETHERDEVICE_H */ | 208 | #endif /* _LINUX_ETHERDEVICE_H */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9ee344bc6c13..355662aac940 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1117,6 +1117,13 @@ static inline void skb_gro_reset_offset(struct sk_buff *skb) | |||
1117 | NAPI_GRO_CB(skb)->data_offset = 0; | 1117 | NAPI_GRO_CB(skb)->data_offset = 0; |
1118 | } | 1118 | } |
1119 | 1119 | ||
1120 | static inline void *skb_gro_mac_header(struct sk_buff *skb) | ||
1121 | { | ||
1122 | return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) : | ||
1123 | page_address(skb_shinfo(skb)->frags[0].page) + | ||
1124 | skb_shinfo(skb)->frags[0].page_offset; | ||
1125 | } | ||
1126 | |||
1120 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 1127 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
1121 | unsigned short type, | 1128 | unsigned short type, |
1122 | const void *daddr, const void *saddr, | 1129 | const void *daddr, const void *saddr, |