From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id D22C31B29E for ; Thu, 21 Dec 2017 14:00:19 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id r78so15869276wme.5 for ; Thu, 21 Dec 2017 05:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7s9bXlefmv74EFnl7zSj37S8dx2PIfNvY6+n4xyEDWM=; b=oMtsdC7nPQKGSO4gZDcA9bMUP2eXkVxKEaY63HGHmS6gi4MSi3vfWCVW/4Bgx5KFrA Tvi0nqw+mkjhEGh9Cl0QSMBHPCj1V9ZE/k/tQml0P2bjA903DC7lmKWS4sDpq4dyIKuQ EIjV091sjJJ1PCqcyyO+d1PcOyNxxZVr4qoA28IEEXtqIceZ9yQlR2Qs6wAKXrIhRp6O TH5dR1xJqHbz4IxLLJGygRB0T+q1oX0EP+G3BXt41y2tROBT9uEJI6/6WMbZeoXVikfD Txpi44E5nIqjA7OJjiRbtGrjPolji5Rr//+g5alGql8spSN/dU+pUzKptxUJ7tzXmc19 Mikw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7s9bXlefmv74EFnl7zSj37S8dx2PIfNvY6+n4xyEDWM=; b=ab5k5v3Btoj4wTQUsnS3QZ+ebHhszDBe3RYKnEujia8qqS7uEaXX428J1r4Pg1cxLR WknTbZV/Nu+/53zgnE/S9KV9aMpOPFAqStBBObFkBlQ1nmZb/NRdapgMrDG6nEX52Lc+ Q49rR9Q77+cdvCETgtOsgmcBSJ1sTQHT6e9UsryeiZNEkZIBlHudN/DWtg/CKT66/ocT klRsqE08K42H43/9E1PixU76i3EhFn+j4XE4aVkdNwhQ+FWdijO010DiQ8yLj5Ua2DFz QtjTWKpVhhqDE82dsONlnDSHfeEKMPbMq75EpfOsJhNBaRWf5qEGTtbKkJqFufQ5s9Ps AX1g== X-Gm-Message-State: AKGB3mJ5nIHYMtm9l5HOjIHcPWDDee2wuJHhhZly3kHJ4dyzW+dPrFTw d1urbPexjxaDm4pxOvpWDVSQTseM X-Google-Smtp-Source: ACJfBovpu32enu5uEOkLrRLA0oqtWBSHkibyltaySVqG4E9UIFNUw/zFvTWuk57Av1Pi/u7c42KBTw== X-Received: by 10.80.165.41 with SMTP id y38mr10133348edb.72.1513861219053; Thu, 21 Dec 2017 05:00:19 -0800 (PST) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id k18sm16940597eda.20.2017.12.21.05.00.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 05:00:18 -0800 (PST) Date: Thu, 21 Dec 2017 14:00:06 +0100 From: Adrien Mazarguil To: dev@dpdk.org Cc: Olivier Matz , Bruce Richardson Message-ID: <20171221122458.811-7-adrien.mazarguil@6wind.com> References: <20171221122458.811-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171221122458.811-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v1 6/6] net: fix rte_ether conflicts with libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2017 13:00:20 -0000 Applications can't combine either net/ethernet.h or netinet/ether.h together with rte_ether.h due to the redefinition of struct ether_addr and various macros by the latter. This patch adapts rte_ether.h to rely on system definitions while maintaining DPDK additions. An unforeseen consequence of involving more system header files compilation issues with some base drivers (i40e, ixgbe) defining their own conflicting types (e.g. __le64). This is addressed by explicitly including rte_ether.h where missing to ensure system definitions always come first. Signed-off-by: Adrien Mazarguil Cc: Olivier Matz Cc: Bruce Richardson --- This patch should work but wasn't validated on FreeBSD, any volunteers? --- drivers/net/i40e/base/i40e_osdep.h | 1 + drivers/net/ixgbe/base/ixgbe_osdep.h | 1 + drivers/net/qede/base/bcm_osal.h | 1 - lib/librte_net/rte_ether.h | 30 ++++++++++++++++++++---------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h index 8e5c593c9..0f53d8f66 100644 --- a/drivers/net/i40e/base/i40e_osdep.h +++ b/drivers/net/i40e/base/i40e_osdep.h @@ -40,6 +40,7 @@ #include #include +#include #include #include #include diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h index bb5dfd2af..a59d2a63f 100644 --- a/drivers/net/ixgbe/base/ixgbe_osdep.h +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 52c2f0ec9..c4c8e179e 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -334,7 +334,6 @@ u32 qede_find_first_zero_bit(unsigned long *, u32); qede_find_first_zero_bit(bitmap, length) #define OSAL_BUILD_BUG_ON(cond) nothing -#define ETH_ALEN ETHER_ADDR_LEN #define OSAL_BITMAP_WEIGHT(bitmap, count) 0 diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 06d7b486c..19e62ea89 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -44,6 +44,7 @@ extern "C" { #endif +#include #include #include @@ -52,15 +53,7 @@ extern "C" { #include #include -#define ETHER_ADDR_LEN 6 /**< Length of Ethernet address. */ -#define ETHER_TYPE_LEN 2 /**< Length of Ethernet type field. */ -#define ETHER_CRC_LEN 4 /**< Length of Ethernet CRC. */ -#define ETHER_HDR_LEN \ - (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN) /**< Length of Ethernet header. */ -#define ETHER_MIN_LEN 64 /**< Minimum frame len, including CRC. */ -#define ETHER_MAX_LEN 1518 /**< Maximum frame len, including CRC. */ -#define ETHER_MTU \ - (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) /**< Ethernet MTU. */ +#define ETHER_MTU ETHERMTU /**< Deprecated, defined for compatibility. */ #define ETHER_MAX_VLAN_FRAME_LEN \ (ETHER_MAX_LEN + 4) /**< Maximum VLAN frame length, including CRC. */ @@ -72,8 +65,11 @@ extern "C" { #define ETHER_MIN_MTU 68 /**< Minimum MTU for IPv4 packets, see RFC 791. */ +#ifdef __DOXYGEN__ + /** - * Ethernet address: + * Ethernet address. + * * A universally administered address is uniquely assigned to a device by its * manufacturer. The first three octets (in transmission order) contain the * Organizationally Unique Identifier (OUI). The following three (MAC-48 and @@ -82,11 +78,25 @@ extern "C" { * A locally administered address is assigned to a device by a network * administrator and does not contain OUIs. * See http://standards.ieee.org/regauth/groupmac/tutorial.html + * + * This structure is defined system-wide by "net/ethernet.h", however since + * the name of its data field is OS-dependent, a macro named "addr_bytes" is + * defined as an alias for the convenience of DPDK applications. + * + * The following definition is only for documentation purposes. */ struct ether_addr { uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ } __attribute__((__packed__)); +#endif /* __DOXYGEN__ */ + +#if defined(__FreeBSD__) +#define addr_bytes octet +#else +#define addr_bytes ether_addr_octet +#endif + #define ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ #define ETHER_GROUP_ADDR 0x01 /**< Multicast or broadcast Eth. address. */ -- 2.11.0