DPDK  1.6.0r2
Data Structures | Macros | Functions
rte_ether.h File Reference
#include <stdint.h>
#include <rte_memcpy.h>
#include <rte_random.h>

Data Structures

struct  ether_addr
struct  ether_hdr
struct  vlan_hdr

Macros

#define ETHER_ADDR_LEN   6
#define ETHER_TYPE_LEN   2
#define ETHER_CRC_LEN   4
#define ETHER_HDR_LEN   (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN)
#define ETHER_MIN_LEN   64
#define ETHER_MAX_LEN   1518
#define ETHER_MTU   (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define ETHER_MAX_VLAN_FRAME_LEN   (ETHER_MAX_LEN + 4)
#define ETHER_MAX_JUMBO_FRAME_LEN   0x3F00
#define ETHER_MAX_VLAN_ID   4095
#define ETHER_LOCAL_ADMIN_ADDR   0x02
#define ETHER_GROUP_ADDR   0x01
#define ETHER_TYPE_IPv4   0x0800
#define ETHER_TYPE_IPv6   0x86DD
#define ETHER_TYPE_ARP   0x0806
#define ETHER_TYPE_RARP   0x8035
#define ETHER_TYPE_VLAN   0x8100
#define ETHER_TYPE_1588   0x88F7

Functions

static int is_zero_ether_addr (const struct ether_addr *ea)
static int is_unicast_ether_addr (const struct ether_addr *ea)
static int is_multicast_ether_addr (const struct ether_addr *ea)
static int is_broadcast_ether_addr (const struct ether_addr *ea)
static int is_universal_ether_addr (const struct ether_addr *ea)
static int is_local_admin_ether_addr (const struct ether_addr *ea)
static int is_valid_assigned_ether_addr (const struct ether_addr *ea)
static void eth_random_addr (uint8_t *addr)
static void ether_addr_copy (const struct ether_addr *ea_from, struct ether_addr *ea_to)

Detailed Description

Ethernet Helpers in RTE

Macro Definition Documentation

#define ETHER_ADDR_LEN   6

Length of Ethernet address.

#define ETHER_CRC_LEN   4

Length of Ethernet CRC.

#define ETHER_GROUP_ADDR   0x01

Multicast or broadcast Eth. address.

#define ETHER_HDR_LEN   (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN)

Length of Ethernet header.

#define ETHER_LOCAL_ADMIN_ADDR   0x02

Locally assigned Eth. address.

#define ETHER_MAX_JUMBO_FRAME_LEN   0x3F00

Maximum Jumbo frame length, including CRC.

#define ETHER_MAX_LEN   1518

Maximum frame len, including CRC.

#define ETHER_MAX_VLAN_FRAME_LEN   (ETHER_MAX_LEN + 4)

Maximum VLAN frame length, including CRC.

#define ETHER_MAX_VLAN_ID   4095

Maximum VLAN ID.

#define ETHER_MIN_LEN   64

Minimum frame len, including CRC.

#define ETHER_MTU   (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)

Ethernet MTU.

#define ETHER_TYPE_1588   0x88F7

IEEE 802.1AS 1588 Precise Time Protocol.

#define ETHER_TYPE_ARP   0x0806

Arp Protocol.

#define ETHER_TYPE_IPv4   0x0800

IPv4 Protocol.

#define ETHER_TYPE_IPv6   0x86DD

IPv6 Protocol.

#define ETHER_TYPE_LEN   2

Length of Ethernet type field.

#define ETHER_TYPE_RARP   0x8035

Reverse Arp Protocol.

#define ETHER_TYPE_VLAN   0x8100

IEEE 802.1Q VLAN tagging.

Function Documentation

static void eth_random_addr ( uint8_t *  addr)
inlinestatic

Generate a random Ethernet address that is locally administered and not multicast.

Parameters
addrA pointer to Ethernet address.
static void ether_addr_copy ( const struct ether_addr ea_from,
struct ether_addr ea_to 
)
inlinestatic

Fast copy an Ethernet address.

Parameters
ea_fromA pointer to a ether_addr structure holding the Ethernet address to copy.
ea_toA pointer to a ether_addr structure where to copy the Ethernet address.
static int is_broadcast_ether_addr ( const struct ether_addr ea)
inlinestatic

Check if an Ethernet address is a broadcast address.

Parameters
eaA pointer to a ether_addr structure containing the ethernet address to check.
Returns
True (1) if the given ethernet address is a broadcast address; false (0) otherwise.
static int is_local_admin_ether_addr ( const struct ether_addr ea)
inlinestatic

Check if an Ethernet address is a locally assigned address.

Parameters
eaA pointer to a ether_addr structure containing the ethernet address to check.
Returns
True (1) if the given ethernet address is a locally assigned address; false (0) otherwise.
static int is_multicast_ether_addr ( const struct ether_addr ea)
inlinestatic

Check if an Ethernet address is a multicast address.

Parameters
eaA pointer to a ether_addr structure containing the ethernet address to check.
Returns
True (1) if the given ethernet address is a multicast address; false (0) otherwise.
static int is_unicast_ether_addr ( const struct ether_addr ea)
inlinestatic

Check if an Ethernet address is a unicast address.

Parameters
eaA pointer to a ether_addr structure containing the ethernet address to check.
Returns
True (1) if the given ethernet address is a unicast address; false (0) otherwise.
static int is_universal_ether_addr ( const struct ether_addr ea)
inlinestatic

Check if an Ethernet address is a universally assigned address.

Parameters
eaA pointer to a ether_addr structure containing the ethernet address to check.
Returns
True (1) if the given ethernet address is a universally assigned address; false (0) otherwise.
static int is_valid_assigned_ether_addr ( const struct ether_addr ea)
inlinestatic

Check if an Ethernet address is a valid address. Checks that the address is a unicast address and is not filled with zeros.

Parameters
eaA pointer to a ether_addr structure containing the ethernet address to check.
Returns
True (1) if the given ethernet address is valid; false (0) otherwise.
static int is_zero_ether_addr ( const struct ether_addr ea)
inlinestatic

Check if an Ethernet address is filled with zeros.

Parameters
eaA pointer to a ether_addr structure containing the ethernet address to check.
Returns
True (1) if the given ethernet address is filled with zeros; false (0) otherwise.