* [dpdk-dev] [PATCH v2] kni: fix compile errors on Oracle Linux6.4 and RHEL6.5
@ 2014-06-11 13:43 Helin Zhang
2014-06-19 15:32 ` Thomas Monjalon
2014-06-23 20:57 ` Thomas Monjalon
0 siblings, 2 replies; 4+ messages in thread
From: Helin Zhang @ 2014-06-11 13:43 UTC (permalink / raw)
To: dev
From: HELIN ZHANG <helin.zhang@intel.com>
The compile errors are copied as follows. The fixes came from
Linux drivers of ixgbe-3.21.2 and igb-5.1.2 with modifications.
The idea is to use self-defined functions no matter they have
already been defined somewhere or not.
* Oracle Linux6.4
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h:3111:
error: redefinition of 'ether_addr_equal'
include/linux/etherdevice.h:180: note: previous definition
of 'ether_addr_equal' was here
* RHEL6.5
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3597:
error: redefinition of 'mmd_eee_cap_to_ethtool_sup_t'
include/linux/mdio.h:387: note: previous definition of
'mmd_eee_cap_to_ethtool_sup_t' was here
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3625:
error: redefinition of 'mmd_eee_adv_to_ethtool_adv_t'
include/linux/mdio.h:415: note: previous definition of
'mmd_eee_adv_to_ethtool_adv_t' was here
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3653:
error: redefinition of 'ethtool_adv_to_mmd_eee_adv_t'
include/linux/mdio.h:443: note: previous definition of
'ethtool_adv_to_mmd_eee_adv_t' was here
Signed-off-by: HELIN ZHANG <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
---
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 19 +++++++++++--------
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h | 5 ++---
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index 4c27d5d..0aa15cd 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3534,12 +3534,11 @@ extern void _kc_skb_add_rx_frag(struct sk_buff *, int, struct page *,
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) )
#define skb_tx_timestamp(skb) do {} while (0)
-#if !(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,4))
-static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
+static inline bool __kc_ether_addr_equal(const u8 *addr1, const u8 *addr2)
{
return !compare_ether_addr(addr1, addr2);
}
-#endif
+#define ether_addr_equal(_addr1, _addr2) __kc_ether_addr_equal((_addr1),(_addr2))
#else
#define HAVE_FDB_OPS
#define HAVE_ETHTOOL_GET_TS_INFO
@@ -3586,7 +3585,6 @@ static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
#define ADVERTISED_40000baseLR4_Full (1 << 26)
#endif
-#if defined(ETHTOOL_GEEE) || (RHEL_RELEASE_CODE && RHEL_RELEASE_CODE <= RHEL_RELEASE_VERSION(6,4))
/**
* mmd_eee_cap_to_ethtool_sup_t
* @eee_cap: value of the MMD EEE Capability register
@@ -3594,7 +3592,7 @@ static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
* A small helper function that translates MMD EEE Capability (3.20) bits
* to ethtool supported settings.
*/
-static inline u32 mmd_eee_cap_to_ethtool_sup_t(u16 eee_cap)
+static inline u32 __kc_mmd_eee_cap_to_ethtool_sup_t(u16 eee_cap)
{
u32 supported = 0;
@@ -3613,6 +3611,8 @@ static inline u32 mmd_eee_cap_to_ethtool_sup_t(u16 eee_cap)
return supported;
}
+#define mmd_eee_cap_to_ethtool_sup_t(eee_cap) \
+ __kc_mmd_eee_cap_to_ethtool_sup_t(eee_cap)
/**
* mmd_eee_adv_to_ethtool_adv_t
@@ -3622,7 +3622,7 @@ static inline u32 mmd_eee_cap_to_ethtool_sup_t(u16 eee_cap)
* and MMD EEE Link Partner Ability (7.61) bits to ethtool advertisement
* settings.
*/
-static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
+static inline u32 __kc_mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
{
u32 adv = 0;
@@ -3641,6 +3641,8 @@ static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
return adv;
}
+#define mmd_eee_adv_to_ethtool_adv_t(eee_adv) \
+ __kc_mmd_eee_adv_to_ethtool_adv_t(eee_adv)
/**
* ethtool_adv_to_mmd_eee_adv_t
@@ -3650,7 +3652,7 @@ static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
* to EEE advertisements for the MMD EEE Advertisement (7.60) and
* MMD EEE Link Partner Ability (7.61) registers.
*/
-static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
+static inline u16 __kc_ethtool_adv_to_mmd_eee_adv_t(u32 adv)
{
u16 reg = 0;
@@ -3669,7 +3671,8 @@ static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
return reg;
}
-#endif
+#define ethtool_adv_to_mmd_eee_adv_t(adv) \
+__kc_ethtool_adv_to_mmd_eee_adv_t(adv)
#ifndef pci_pcie_type
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) )
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
index 4126d14..b539315 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
@@ -3107,12 +3107,11 @@ typedef netdev_features_t kni_netdev_features_t;
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) )
-#if !(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,4))
-static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
+static inline bool __kc_ether_addr_equal(const u8 *addr1, const u8 *addr2)
{
return !compare_ether_addr(addr1, addr2);
}
-#endif
+#define ether_addr_equal(_addr1, _addr2) __kc_ether_addr_equal((_addr1),(_addr2))
#else
#define HAVE_FDB_OPS
#endif /* < 3.5.0 */
--
1.8.1.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] kni: fix compile errors on Oracle Linux6.4 and RHEL6.5
2014-06-11 13:43 [dpdk-dev] [PATCH v2] kni: fix compile errors on Oracle Linux6.4 and RHEL6.5 Helin Zhang
@ 2014-06-19 15:32 ` Thomas Monjalon
2014-06-20 2:08 ` Zhang, Helin
2014-06-23 20:57 ` Thomas Monjalon
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2014-06-19 15:32 UTC (permalink / raw)
To: Helin Zhang; +Cc: dev
2014-06-11 21:43, Helin Zhang:
> -#if !(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,4))
> -static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
> +static inline bool __kc_ether_addr_equal(const u8 *addr1, const u8 *addr2)
> {
> return !compare_ether_addr(addr1, addr2);
> }
> -#endif
> +#define ether_addr_equal(_addr1, _addr2) __kc_ether_addr_equal((_addr1),(_addr2))
Why not defining it in one line (as Neil suggested)?
#define ether_addr_equal(_addr1, _addr2) (!compare_ether_addr(addr1, addr2))
--
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] kni: fix compile errors on Oracle Linux6.4 and RHEL6.5
2014-06-19 15:32 ` Thomas Monjalon
@ 2014-06-20 2:08 ` Zhang, Helin
0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Helin @ 2014-06-20 2:08 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas
No special reason to avoid using '#define'. I think both are OK.
But inline function can provide more type checks for the input/output parameters. Also inline functions with even only one line code can be seen a lot in that file.
So I assume that it is not mandatory to use '#define' instead.
Regards,
Helin
-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
Sent: Thursday, June 19, 2014 11:33 PM
To: Zhang, Helin
Cc: dev@dpdk.org; Neil Horman
Subject: Re: [dpdk-dev] [PATCH v2] kni: fix compile errors on Oracle Linux6.4 and RHEL6.5
2014-06-11 21:43, Helin Zhang:
> -#if !(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >=
> RHEL_RELEASE_VERSION(6,4)) -static inline bool ether_addr_equal(const
> u8 *addr1, const u8 *addr2)
> +static inline bool __kc_ether_addr_equal(const u8 *addr1, const u8
> +*addr2)
> {
> return !compare_ether_addr(addr1, addr2); } -#endif
> +#define ether_addr_equal(_addr1, _addr2)
> +__kc_ether_addr_equal((_addr1),(_addr2))
Why not defining it in one line (as Neil suggested)?
#define ether_addr_equal(_addr1, _addr2) (!compare_ether_addr(addr1, addr2))
--
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] kni: fix compile errors on Oracle Linux6.4 and RHEL6.5
2014-06-11 13:43 [dpdk-dev] [PATCH v2] kni: fix compile errors on Oracle Linux6.4 and RHEL6.5 Helin Zhang
2014-06-19 15:32 ` Thomas Monjalon
@ 2014-06-23 20:57 ` Thomas Monjalon
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2014-06-23 20:57 UTC (permalink / raw)
To: Helin Zhang; +Cc: dev
> The compile errors are copied as follows. The fixes came from
> Linux drivers of ixgbe-3.21.2 and igb-5.1.2 with modifications.
> The idea is to use self-defined functions no matter they have
> already been defined somewhere or not.
>
> * Oracle Linux6.4
> lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h:3111:
> error: redefinition of 'ether_addr_equal'
> include/linux/etherdevice.h:180: note: previous definition
> of 'ether_addr_equal' was here
> * RHEL6.5
> lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3597:
> error: redefinition of 'mmd_eee_cap_to_ethtool_sup_t'
> include/linux/mdio.h:387: note: previous definition of
> 'mmd_eee_cap_to_ethtool_sup_t' was here
> lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3625:
> error: redefinition of 'mmd_eee_adv_to_ethtool_adv_t'
> include/linux/mdio.h:415: note: previous definition of
> 'mmd_eee_adv_to_ethtool_adv_t' was here
> lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3653:
> error: redefinition of 'ethtool_adv_to_mmd_eee_adv_t'
> include/linux/mdio.h:443: note: previous definition of
> 'ethtool_adv_to_mmd_eee_adv_t' was here
>
> Signed-off-by: HELIN ZHANG <helin.zhang@intel.com>
> Acked-by: Cunming Liang <cunming.liang@intel.com>
> Tested-by: Waterman Cao <waterman.cao@intel.com>
Applied for version 1.7.0.
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-23 20:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11 13:43 [dpdk-dev] [PATCH v2] kni: fix compile errors on Oracle Linux6.4 and RHEL6.5 Helin Zhang
2014-06-19 15:32 ` Thomas Monjalon
2014-06-20 2:08 ` Zhang, Helin
2014-06-23 20:57 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).