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 <didier.pallard@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Olivier Matz 2016-10-03 10:38:43 +02:00 committed by Thomas Monjalon
parent b84110e7ba
commit 57668ed7bc
3 changed files with 5 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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 */