kni: fix build for Linux kernel 4.19

Message ID 20181024105443.57063-1-ferruh.yigit@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series kni: fix build for Linux kernel 4.19 |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Ferruh Yigit Oct. 24, 2018, 10:54 a.m. UTC
  The build error observed with Linux kernel 4.19 when KNI ethtool
support enabled (CONFIG_RTE_KNI_KMOD_ETHTOOL=y)

.../build/build/kernel/linux/kni/kni_ethtool.c:193:3:
   error: ‘struct ethtool_ops’ has no member named ‘get_settings’;
  .get_settings  = kni_get_settings,
   ^~~~~~~~~~~~

.../build/build/kernel/linux/kni/kni_ethtool.c:194:3:
   error: ‘struct ethtool_ops’ has no member named ‘set_settings’;
  .set_settings  = kni_set_settings,
   ^~~~~~~~~~~~

With kernel 4.19 ethtool_ops `get_settings` & `set_settings` are
replaced with `get_link_ksettings` & `set_link_ksettings`
Commit 9b3004953503 ("ethtool: drop get_settings and set_settings callbacks")

This fix practically removes `get_settings` & `set_settings` support
for the kernel versions that have the new ethtool_ops without
implementing the new ones.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 kernel/linux/kni/kni_ethtool.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Patch

diff --git a/kernel/linux/kni/kni_ethtool.c b/kernel/linux/kni/kni_ethtool.c
index a44e7d949..b6b6be23f 100644
--- a/kernel/linux/kni/kni_ethtool.c
+++ b/kernel/linux/kni/kni_ethtool.c
@@ -27,6 +27,8 @@  kni_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 	priv->lad_dev->ethtool_ops->get_drvinfo(priv->lad_dev, info);
 }
 
+/* ETHTOOL_GLINKSETTINGS replaces ETHTOOL_GSET */
+#ifndef ETHTOOL_GLINKSETTINGS
 static int
 kni_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 {
@@ -34,7 +36,10 @@  kni_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 
 	return priv->lad_dev->ethtool_ops->get_settings(priv->lad_dev, ecmd);
 }
+#endif
 
+/* ETHTOOL_SLINKSETTINGS replaces ETHTOOL_SSET */
+#ifdef ETHTOOL_SLINKSETTINGS
 static int
 kni_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 {
@@ -42,6 +47,7 @@  kni_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 
 	return priv->lad_dev->ethtool_ops->set_settings(priv->lad_dev, ecmd);
 }
+#endif
 
 static void
 kni_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
@@ -190,8 +196,12 @@  kni_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats,
 struct ethtool_ops kni_ethtool_ops = {
 	.begin			= kni_check_if_running,
 	.get_drvinfo		= kni_get_drvinfo,
+#ifndef ETHTOOL_GLINKSETTINGS
 	.get_settings		= kni_get_settings,
+#endif
+#ifdef ETHTOOL_SLINKSETTINGS
 	.set_settings		= kni_set_settings,
+#endif
 	.get_regs_len		= kni_get_regs_len,
 	.get_regs		= kni_get_regs,
 	.get_wol		= kni_get_wol,