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>
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])
.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
.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
.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
.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
.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
.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
.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) {
.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,