From 57668ed7bc086811ee2a8ca093cffcd0962c84e7 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Mon, 3 Oct 2016 10:38:43 +0200 Subject: [PATCH] net: move ethernet definitions to the net library The proper place for rte_ether.h is in librte_net because it defines network headers. Moving it will also prevent to have circular references in the following patches that will require the Ethernet header definition in rte_mbuf.c. By the way, fix minor checkpatch issues. Signed-off-by: Didier Pallard Signed-off-by: Olivier Matz --- lib/librte_ether/Makefile | 3 +-- lib/librte_net/Makefile | 2 +- lib/{librte_ether => librte_net}/rte_ether.h | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) rename lib/{librte_ether => librte_net}/rte_ether.h (98%) diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile index 0bb5dc900b..488b7c8471 100644 --- a/lib/librte_ether/Makefile +++ b/lib/librte_ether/Makefile @@ -48,12 +48,11 @@ SRCS-y += rte_ethdev.c # # Export include files # -SYMLINK-y-include += rte_ether.h SYMLINK-y-include += rte_ethdev.h SYMLINK-y-include += rte_eth_ctrl.h SYMLINK-y-include += rte_dev_info.h # this lib depends upon: -DEPDIRS-y += lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf +DEPDIRS-y += lib/librte_net lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf include $(RTE_SDK)/mk/rte.lib.mk diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile index ad2e482d96..fc332ff6c9 100644 --- a/lib/librte_net/Makefile +++ b/lib/librte_net/Makefile @@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_sctp.h rte_icmp.h rte_arp.h +SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_sctp.h rte_icmp.h rte_arp.h rte_ether.h include $(RTE_SDK)/mk/rte.install.mk diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_net/rte_ether.h similarity index 98% rename from lib/librte_ether/rte_ether.h rename to lib/librte_net/rte_ether.h index 1d62d8e5b7..647e6c9d5d 100644 --- a/lib/librte_ether/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -84,7 +84,7 @@ extern "C" { * See http://standards.ieee.org/regauth/groupmac/tutorial.html */ struct ether_addr { - uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Address bytes in transmission order */ + uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ } __attribute__((__packed__)); #define ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ @@ -224,7 +224,7 @@ static inline int is_local_admin_ether_addr(const struct ether_addr *ea) */ static inline int is_valid_assigned_ether_addr(const struct ether_addr *ea) { - return is_unicast_ether_addr(ea) && (! is_zero_ether_addr(ea)); + return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); } /** @@ -236,7 +236,7 @@ static inline int is_valid_assigned_ether_addr(const struct ether_addr *ea) static inline void eth_random_addr(uint8_t *addr) { uint64_t rand = rte_rand(); - uint8_t *p = (uint8_t*)&rand; + uint8_t *p = (uint8_t *)&rand; rte_memcpy(addr, p, ETHER_ADDR_LEN); addr[0] &= ~ETHER_GROUP_ADDR; /* clear multicast bit */ -- 2.20.1