X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Fnet%2Frte_ether.h;h=b83e0d3fce4b28376bf0abab601532e9025e0e9c;hb=28dde5da503ed09f10cdfb295e390b114df7330a;hp=a303c24a8cbcebda16e226568c29b0615943b41f;hpb=99a2dd955fba6e4cc23b77d590a033650ced9c45;p=dpdk.git diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h index a303c24a8c..b83e0d3fce 100644 --- a/lib/net/rte_ether.h +++ b/lib/net/rte_ether.h @@ -221,6 +221,20 @@ rte_ether_addr_copy(const struct rte_ether_addr *__restrict ea_from, *ea_to = *ea_from; } +/** + * Macro to print six-bytes of MAC address in hex format + */ +#define RTE_ETHER_ADDR_PRT_FMT "%02X:%02X:%02X:%02X:%02X:%02X" +/** + * Macro to extract the MAC address bytes from rte_ether_addr struct + */ +#define RTE_ETHER_ADDR_BYTES(mac_addrs) ((mac_addrs)->addr_bytes[0]), \ + ((mac_addrs)->addr_bytes[1]), \ + ((mac_addrs)->addr_bytes[2]), \ + ((mac_addrs)->addr_bytes[3]), \ + ((mac_addrs)->addr_bytes[4]), \ + ((mac_addrs)->addr_bytes[5]) + #define RTE_ETHER_ADDR_FMT_SIZE 18 /** * Format 48bits Ethernet address in pattern xx:xx:xx:xx:xx:xx. @@ -249,46 +263,27 @@ rte_ether_format_addr(char *buf, uint16_t size, * 0 if successful * -1 and sets rte_errno if invalid string */ -__rte_experimental int rte_ether_unformat_addr(const char *str, struct rte_ether_addr *eth_addr); -/* Windows Sockets headers contain `#define s_addr S_un.S_addr`. - * Temporarily disable this macro to avoid conflict at definition. - * Place source MAC address in both `s_addr` and `S_un.S_addr` fields, - * so that access works either directly or through the macro. - */ -#pragma push_macro("s_addr") -#ifdef s_addr -#undef s_addr -#endif - /** * Ethernet header: Contains the destination address, source address * and frame type. */ struct rte_ether_hdr { - struct rte_ether_addr d_addr; /**< Destination address. */ - RTE_STD_C11 - union { - struct rte_ether_addr s_addr; /**< Source address. */ - struct { - struct rte_ether_addr S_addr; - } S_un; /**< Do not use directly; use s_addr instead.*/ - }; - uint16_t ether_type; /**< Frame type. */ + struct rte_ether_addr dst_addr; /**< Destination address. */ + struct rte_ether_addr src_addr; /**< Source address. */ + rte_be16_t ether_type; /**< Frame type. */ } __rte_aligned(2); -#pragma pop_macro("s_addr") - /** * Ethernet VLAN Header. * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type * of the encapsulated frame. */ struct rte_vlan_hdr { - uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */ - uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */ + rte_be16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */ + rte_be16_t eth_proto; /**< Ethernet type of encapsulated frame. */ } __rte_packed;