26 #define ETHER_ADDR_LEN 6
27 #define ETHER_TYPE_LEN 2
28 #define ETHER_CRC_LEN 4
29 #define ETHER_HDR_LEN \
30 (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN)
31 #define ETHER_MIN_LEN 64
32 #define ETHER_MAX_LEN 1518
34 (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
36 #define ETHER_MAX_VLAN_FRAME_LEN \
39 #define ETHER_MAX_JUMBO_FRAME_LEN \
42 #define ETHER_MAX_VLAN_ID 4095
44 #define ETHER_MIN_MTU 68
59 } __attribute__((__packed__));
61 #define ETHER_LOCAL_ADMIN_ADDR 0x02
62 #define ETHER_GROUP_ADDR 0x01
78 static inline int is_same_ether_addr(const struct ether_addr *ea1,
83 if (ea1->addr_bytes[i] != ea2->addr_bytes[i])
149 const unaligned_uint16_t *ea_words = (
const unaligned_uint16_t *)ea;
151 return (ea_words[0] == 0xFFFF && ea_words[1] == 0xFFFF &&
152 ea_words[2] == 0xFFFF);
210 uint8_t *p = (uint8_t *)&rand;
228 #ifdef __INTEL_COMPILER
229 uint16_t *from_words = (uint16_t *)(ea_from->
addr_bytes);
230 uint16_t *to_words = (uint16_t *)(ea_to->
addr_bytes);
232 to_words[0] = from_words[0];
233 to_words[1] = from_words[1];
234 to_words[2] = from_words[2];
243 #define ETHER_ADDR_FMT_SIZE 18
258 snprintf(buf, size,
"%02X:%02X:%02X:%02X:%02X:%02X",
275 } __attribute__((__packed__));
285 } __attribute__((__packed__));
295 } __attribute__((__packed__));
298 #define ETHER_TYPE_IPv4 0x0800
299 #define ETHER_TYPE_IPv6 0x86DD
300 #define ETHER_TYPE_ARP 0x0806
301 #define ETHER_TYPE_RARP 0x8035
302 #define ETHER_TYPE_VLAN 0x8100
303 #define ETHER_TYPE_QINQ 0x88A8
304 #define ETHER_TYPE_ETAG 0x893F
305 #define ETHER_TYPE_1588 0x88F7
306 #define ETHER_TYPE_SLOW 0x8809
307 #define ETHER_TYPE_TEB 0x6558
308 #define ETHER_TYPE_LLDP 0x88CC
309 #define ETHER_TYPE_MPLS 0x8847
310 #define ETHER_TYPE_MPLSM 0x8848
312 #define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr))
325 } __attribute__((__packed__));
328 #define VXLAN_GPE_TYPE_IPV4 1
329 #define VXLAN_GPE_TYPE_IPV6 2
330 #define VXLAN_GPE_TYPE_ETH 3
331 #define VXLAN_GPE_TYPE_NSH 4
332 #define VXLAN_GPE_TYPE_MPLS 5
333 #define VXLAN_GPE_TYPE_GBP 6
334 #define VXLAN_GPE_TYPE_VBNG 7
336 #define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \
337 sizeof(struct vxlan_gpe_hdr))
413 if ((*m)->ol_flags & PKT_TX_TUNNEL_MASK)
414 (*m)->outer_l2_len +=
sizeof(
struct vlan_hdr);
416 (*m)->l2_len +=
sizeof(
struct vlan_hdr);
static void rte_pktmbuf_free(struct rte_mbuf *m)
static struct rte_mbuf * rte_pktmbuf_clone(struct rte_mbuf *md, struct rte_mempool *mp)
static uint64_t rte_rand(void)
static int is_local_admin_ether_addr(const struct ether_addr *ea)
static void ether_format_addr(char *buf, uint16_t size, const struct ether_addr *eth_addr)
static int is_universal_ether_addr(const struct ether_addr *ea)
static int is_multicast_ether_addr(const struct ether_addr *ea)
static int rte_vlan_strip(struct rte_mbuf *m)
static rte_be16_t rte_cpu_to_be_16(uint16_t x)
uint8_t addr_bytes[ETHER_ADDR_LEN]
static uint16_t rte_mbuf_refcnt_read(const struct rte_mbuf *m)
static char * rte_pktmbuf_adj(struct rte_mbuf *m, uint16_t len)
static int is_zero_ether_addr(const struct ether_addr *ea)
static int rte_vlan_insert(struct rte_mbuf **m)
#define rte_pktmbuf_mtod(m, t)
static int is_valid_assigned_ether_addr(const struct ether_addr *ea)
#define ETHER_LOCAL_ADMIN_ADDR
struct rte_mempool * pool
static char * rte_pktmbuf_prepend(struct rte_mbuf *m, uint16_t len)
static int is_broadcast_ether_addr(const struct ether_addr *ea)
static void * rte_memcpy(void *dst, const void *src, size_t n)
#define PKT_RX_VLAN_STRIPPED
static uint16_t rte_be_to_cpu_16(rte_be16_t x)
static void ether_addr_copy(const struct ether_addr *ea_from, struct ether_addr *ea_to)
static int is_unicast_ether_addr(const struct ether_addr *ea)
static void eth_random_addr(uint8_t *addr)