]> git.proxmox.com Git - ovs.git/commitdiff
datapath: compat: Fix build on RHEL 7.5
authorYi-Hung Wei <yihung.wei@gmail.com>
Fri, 11 May 2018 17:32:12 +0000 (10:32 -0700)
committerPravin B Shelar <pshelar@ovn.org>
Tue, 15 May 2018 01:35:59 +0000 (18:35 -0700)
1) OVS datapath compat modules breaks on RHEL 7.5, because it moves
ndo_change_mtu function pointer from 'struct net_device_ops' to
'struct net_device_ops_extended'.

2) RHEL 7.5 introduces the MTU range checking as mentioned in
6c0bf091 ("datapath: use core MTU range checking in core net infra").
However, the max_mtu field is defined in 'struct net_device_extended'
but not in 'struct net_device' as upstream kernel.

This patch defines a new symbol HAVE_RHEL7_MAX_MTU that determines
the previous 2 conditions, and fixes the backport issue.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Acked-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
acinclude.m4
datapath/linux/compat/geneve.c
datapath/linux/compat/ip_gre.c
datapath/linux/compat/lisp.c
datapath/linux/compat/stt.c
datapath/linux/compat/vxlan.c
datapath/vport-internal_dev.c

index 76f64381f2ad2277c763e1a3e453dfe3d79fb57d..bf790fe72d87c862150805eac4f0310e674eab19 100644 (file)
@@ -576,6 +576,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
 
   OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device],
                         [max_mtu])
+  OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops_extended],
+                        [ndo_change_mtu], [OVS_DEFINE([HAVE_RHEL7_MAX_MTU])])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state])
   OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_register_net_hook])
index c08dced3feafd19d8778eac6d1597706d2f6e858..eacffb2c5b2a8af34cf5e7a3350918a3069e7116 100644 (file)
@@ -1271,7 +1271,11 @@ static const struct net_device_ops geneve_netdev_ops = {
        .ndo_stop               = geneve_stop,
        .ndo_start_xmit         = geneve_dev_xmit,
        .ndo_get_stats64        = ip_tunnel_get_stats64,
+#ifdef HAVE_RHEL7_MAX_MTU
+       .extended.ndo_change_mtu = geneve_change_mtu,
+#else
        .ndo_change_mtu         = geneve_change_mtu,
+#endif
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
 #ifdef HAVE_NDO_FILL_METADATA_DST
index 4e325914d8be37e820a5f8ea645dec190b690804..2f297a548e30198caa1d2ef1c317759b9e8c09c5 100644 (file)
@@ -491,7 +491,11 @@ static const struct net_device_ops gre_tap_netdev_ops = {
        .ndo_start_xmit         = gre_dev_xmit,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
+#ifdef HAVE_RHEL7_MAX_MTU
+       .extended.ndo_change_mtu = ip_tunnel_change_mtu,
+#else
        .ndo_change_mtu         = ip_tunnel_change_mtu,
+#endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
        .ndo_get_stats64        = ip_tunnel_get_stats64,
 #endif
index 34f82324a7ff5bbbc53933c7d194e62378caa44d..4882a636a33ee730b2f4dc629185f158b9b92049 100644 (file)
@@ -546,7 +546,11 @@ static const struct net_device_ops lisp_netdev_ops = {
        .ndo_open               = lisp_open,
        .ndo_stop               = lisp_stop,
        .ndo_start_xmit         = lisp_dev_xmit,
+#ifdef  HAVE_RHEL7_MAX_MTU
+       .extended.ndo_change_mtu = lisp_change_mtu,
+#else
        .ndo_change_mtu         = lisp_change_mtu,
+#endif
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
 #ifdef USE_UPSTREAM_TUNNEL
index 2189476e176eea27ad044e59ba4c5b428265bb41..ee1c7aa0a78d6ceae9d9e63e6e7ac8cf051879dc 100644 (file)
@@ -1857,7 +1857,11 @@ static const struct net_device_ops stt_netdev_ops = {
        .ndo_stop               = stt_stop,
        .ndo_start_xmit         = stt_dev_xmit,
        .ndo_get_stats64        = ip_tunnel_get_stats64,
+#ifdef  HAVE_RHEL7_MAX_MTU
+       .extended.ndo_change_mtu = stt_change_mtu,
+#else
        .ndo_change_mtu         = stt_change_mtu,
+#endif
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
 #ifdef USE_UPSTREAM_TUNNEL
index 54b953454bf4e3cc0440097d8357d39d836c5a30..40cb12b1329d47c78f7fd34eb5a85a5855731900 100644 (file)
@@ -1481,7 +1481,11 @@ static const struct net_device_ops vxlan_netdev_ether_ops = {
        .ndo_start_xmit         = vxlan_dev_xmit,
        .ndo_get_stats64        = ip_tunnel_get_stats64,
        .ndo_set_rx_mode        = vxlan_set_multicast_list,
+#ifdef HAVE_RHEL7_MAX_MTU
+       .extended.ndo_change_mtu = vxlan_change_mtu,
+#else
        .ndo_change_mtu         = vxlan_change_mtu,
+#endif
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
 #ifdef HAVE_NDO_FILL_METADATA_DST
@@ -1496,7 +1500,11 @@ static const struct net_device_ops vxlan_netdev_raw_ops = {
        .ndo_stop               = vxlan_stop,
        .ndo_start_xmit         = vxlan_dev_xmit,
        .ndo_get_stats64        = ip_tunnel_get_stats64,
+#ifdef HAVE_RHEL7_MAX_MTU
+       .extended.ndo_change_mtu = vxlan_change_mtu,
+#else
        .ndo_change_mtu         = vxlan_change_mtu,
+#endif
 #ifdef HAVE_NDO_FILL_METADATA_DST
        .ndo_fill_metadata_dst  = ovs_vxlan_fill_metadata_dst,
 #endif
index 9bb87516e464c115e3ebf32de827fac77a9b2317..a9c0a6ac08720091c10b60242e885a909e62079d 100644 (file)
@@ -89,7 +89,7 @@ static const struct ethtool_ops internal_dev_ethtool_ops = {
        .get_link       = ethtool_op_get_link,
 };
 
-#ifndef HAVE_NET_DEVICE_WITH_MAX_MTU
+#if    !defined(HAVE_NET_DEVICE_WITH_MAX_MTU) && !defined(HAVE_RHEL7_MAX_MTU)
 static int internal_dev_change_mtu(struct net_device *dev, int new_mtu)
 {
        if (new_mtu < ETH_MIN_MTU) {
@@ -154,7 +154,7 @@ static const struct net_device_ops internal_dev_netdev_ops = {
        .ndo_stop = internal_dev_stop,
        .ndo_start_xmit = internal_dev_xmit,
        .ndo_set_mac_address = eth_mac_addr,
-#ifndef HAVE_NET_DEVICE_WITH_MAX_MTU
+#if    !defined(HAVE_NET_DEVICE_WITH_MAX_MTU) && !defined(HAVE_RHEL7_MAX_MTU)
        .ndo_change_mtu = internal_dev_change_mtu,
 #endif
        .ndo_get_stats64 = (void *)internal_get_stats,