This source file includes following definitions.
- is_metadata_hdr_valid
- remove_metadata_hdr
1 #ifndef __MLX5E_ACCEL_H__
2 #define __MLX5E_ACCEL_H__
3
4 #ifdef CONFIG_MLX5_ACCEL
5
6 #include <linux/skbuff.h>
7 #include <linux/netdevice.h>
8 #include "en.h"
9
10 static inline bool is_metadata_hdr_valid(struct sk_buff *skb)
11 {
12 __be16 *ethtype;
13
14 if (unlikely(skb->len < ETH_HLEN + MLX5E_METADATA_ETHER_LEN))
15 return false;
16 ethtype = (__be16 *)(skb->data + ETH_ALEN * 2);
17 if (*ethtype != cpu_to_be16(MLX5E_METADATA_ETHER_TYPE))
18 return false;
19 return true;
20 }
21
22 static inline void remove_metadata_hdr(struct sk_buff *skb)
23 {
24 struct ethhdr *old_eth;
25 struct ethhdr *new_eth;
26
27
28 old_eth = (struct ethhdr *)skb->data;
29 new_eth = (struct ethhdr *)(skb->data + MLX5E_METADATA_ETHER_LEN);
30 memmove(new_eth, old_eth, 2 * ETH_ALEN);
31
32 skb_pull_inline(skb, MLX5E_METADATA_ETHER_LEN);
33 }
34
35 #endif
36
37 #endif