The compat layer ip_tunnel_get_stats64 function was checking for the Linux kernel version to determine if the return was void or a pointer. This is not very reliable and caused compile warnings on SLES 12 SP3. In acinclude.m4 create a more reliable method of determining when to use a void return vs. a pointer return.
Signed-off-by: Greg Rose <gvrose8...@gmail.com> --- acinclude.m4 | 3 +++ datapath/linux/compat/include/net/ip_tunnels.h | 2 +- datapath/linux/compat/ip_tunnels_core.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index ac81d0c..6e7ea4c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -880,6 +880,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_SKBUFF_CSUM_VALID])]) OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_checksum_simple_validate]) + OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], + [void.*ndo_get_stats64], + [OVS_DEFINE([HAVE_VOID_NDO_GET_STATS64])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h index d187a12..ce6fca4 100644 --- a/datapath/linux/compat/include/net/ip_tunnels.h +++ b/datapath/linux/compat/include/net/ip_tunnels.h @@ -364,7 +364,7 @@ static inline int ovs_ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, } #define ip_tunnel_get_stats64 rpl_ip_tunnel_get_stats64 -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) && !defined(HAVE_RHEL7_MAX_MTU) +#if !defined(HAVE_VOID_NDO_GET_STATS64) && !defined(HAVE_RHEL7_MAX_MTU) struct rtnl_link_stats64 *rpl_ip_tunnel_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *tot); #else diff --git a/datapath/linux/compat/ip_tunnels_core.c b/datapath/linux/compat/ip_tunnels_core.c index 38fb801..a3b1f7f 100644 --- a/datapath/linux/compat/ip_tunnels_core.c +++ b/datapath/linux/compat/ip_tunnels_core.c @@ -274,7 +274,7 @@ static void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) && !defined(HAVE_RHEL7_MAX_MTU) +#if !defined(HAVE_VOID_NDO_GET_STATS64) && !defined(HAVE_RHEL7_MAX_MTU) struct rtnl_link_stats64 *rpl_ip_tunnel_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *tot) #else @@ -306,7 +306,7 @@ void rpl_ip_tunnel_get_stats64(struct net_device *dev, tot->tx_bytes += tx_bytes; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) && !defined(HAVE_RHEL7_MAX_MTU) +#if !defined(HAVE_VOID_NDO_GET_STATS64) && !defined(HAVE_RHEL7_MAX_MTU) return tot; #endif } -- 1.8.3.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev