[ovs-dev] [PATCH] datapath: RHEL 7.5 ndo_change_mtu backward compatibility

lucasagomes at gmail.com lucasagomes at gmail.com
Thu May 17 11:27:50 UTC 2018


From: Lucas Alvares Gomes <lucasagomes at gmail.com>

The commit [0] partially fixed the problem but in RHEL 7.5 neither
.{min, max}_mtu or 'ndo_change_mtu' were being set/implemented for
vport-internal_dev.c.

As pointed out by commit [0], the ndo_change_mtu function pointer has been
moved from 'struct net_device_ops' to 'struct net_device_ops_extended'
on RHEL 7.5.

So this patch fixes the backport issue by setting the
.extended.ndo_change_mtu when necessary.

[0] 39ca338374abe367e28a2247bac9159695f19710
---
 datapath/vport-internal_dev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index 3cb8d06b2..16f4aaeee 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -88,7 +88,7 @@ static const struct ethtool_ops internal_dev_ethtool_ops = {
 	.get_link	= ethtool_op_get_link,
 };
 
-#if	!defined(HAVE_NET_DEVICE_WITH_MAX_MTU) && !defined(HAVE_RHEL7_MAX_MTU)
+#ifndef HAVE_NET_DEVICE_WITH_MAX_MTU
 static int internal_dev_change_mtu(struct net_device *dev, int new_mtu)
 {
 	if (new_mtu < ETH_MIN_MTU) {
@@ -155,6 +155,8 @@ static const struct net_device_ops internal_dev_netdev_ops = {
 	.ndo_set_mac_address = eth_mac_addr,
 #if	!defined(HAVE_NET_DEVICE_WITH_MAX_MTU) && !defined(HAVE_RHEL7_MAX_MTU)
 	.ndo_change_mtu = internal_dev_change_mtu,
+#elif	!defined(HAVE_NET_DEVICE_WITH_MAX_MTU) && defined(HAVE_RHEL7_MAX_MTU)
+	.extended.ndo_change_mtu = internal_dev_change_mtu,
 #endif
 	.ndo_get_stats64 = (void *)internal_get_stats,
 };
-- 
2.17.0



More information about the dev mailing list