diff mbox series

[ovs-dev] compat: Substitute more dependable define

Message ID 1534201216-27912-1-git-send-email-gvrose8192@gmail.com
State Accepted
Headers show
Series [ovs-dev] compat: Substitute more dependable define | expand

Commit Message

Gregory Rose Aug. 13, 2018, 11 p.m. UTC
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 <gvrose8192@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(-)

Comments

0-day Robot Aug. 13, 2018, 11:56 p.m. UTC | #1
Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Committer 0-day Robot <robot@bytheb.org> needs to sign off.
Lines checked: 70, Warnings: 0, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot
Ben Pfaff Aug. 14, 2018, 12:48 a.m. UTC | #2
On Mon, Aug 13, 2018 at 04:00:16PM -0700, Greg Rose wrote:
> 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 <gvrose8192@gmail.com>

Seems reasonable.  Applied to master and branch-2.10.
Aaron Conole Aug. 14, 2018, 10:44 a.m. UTC | #3
0-day Robot <robot@bytheb.org> writes:

> Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
> Thanks for your contribution.
>
> I encountered some error that I wasn't expecting.  See the details below.
>
>
> checkpatch:
> ERROR: Committer 0-day Robot <robot@bytheb.org> needs to sign off.
> Lines checked: 70, Warnings: 0, Errors: 1
>
>
> Please check this out.  If you feel there has been an error, please
> email aconole@bytheb.org
>
> Thanks,
> 0-day Robot

I believe I've updated the robot to do the right thing, now.
Gregory Rose Aug. 14, 2018, 3:13 p.m. UTC | #4
On 8/13/2018 5:48 PM, Ben Pfaff wrote:
> On Mon, Aug 13, 2018 at 04:00:16PM -0700, Greg Rose wrote:
>> 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 <gvrose8192@gmail.com>
> Seems reasonable.  Applied to master and branch-2.10.

Thanks Ben!
diff mbox series

Patch

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
 }