root/drivers/net/ethernet/mellanox/mlx5/core/accel/accel.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. is_metadata_hdr_valid
  2. 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         /* Remove the metadata from the buffer */
  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         /* Ethertype is already in its new place */
  32         skb_pull_inline(skb, MLX5E_METADATA_ETHER_LEN);
  33 }
  34 
  35 #endif /* CONFIG_MLX5_ACCEL */
  36 
  37 #endif /* __MLX5E_EN_ACCEL_H__ */

/* [<][>][^][v][top][bottom][index][help] */