mirror of
https://github.com/qosmio/nss-packages.git
synced 2025-12-17 08:42:18 +00:00
105 lines
3.1 KiB
Diff
105 lines
3.1 KiB
Diff
--- a/pvxlanmgr/nss_pvxlanmgr.c
|
|
+++ b/pvxlanmgr/nss_pvxlanmgr.c
|
|
@@ -186,6 +186,26 @@ static struct rtnl_link_stats64 *nss_pvx
|
|
return stats;
|
|
}
|
|
|
|
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
|
|
+/*
|
|
+ * nss_pvxlanmgr_dev_tunnel_stats()
|
|
+ * Netdev ops function to retrieve stats for kernel version < 4.6
|
|
+ */
|
|
+static struct rtnl_link_stats64 *nss_pvxlanmgr_dev_tunnel_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
|
+{
|
|
+ return nss_pvxlanmgr_get_tunnel_stats(dev, stats);
|
|
+}
|
|
+#else
|
|
+/*
|
|
+ * nss_pvxlanmgr_dev_tunnel_stats()
|
|
+ * Netdev ops function to retrieve stats for kernel version > 4.6
|
|
+ */
|
|
+static void nss_pvxlanmgr_dev_tunnel_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
|
+{
|
|
+ nss_pvxlanmgr_get_tunnel_stats(dev, stats);
|
|
+}
|
|
+#endif
|
|
+
|
|
/*
|
|
* nss_pvxlanmgr_unregister_with_nss()
|
|
* Internal function to unregister with NSS FW
|
|
@@ -262,7 +282,7 @@ static const struct net_device_ops nss_p
|
|
.ndo_stop = nss_pvxlanmgr_close,
|
|
.ndo_start_xmit = nss_pvxlanmgr_start_xmit,
|
|
.ndo_set_mac_address = eth_mac_addr,
|
|
- .ndo_get_stats64 = nss_pvxlanmgr_get_tunnel_stats,
|
|
+ .ndo_get_stats64 = nss_pvxlanmgr_dev_tunnel_stats,
|
|
};
|
|
|
|
/*
|
|
@@ -278,7 +298,13 @@ static void nss_pvxlanmgr_dummy_netdev_s
|
|
dev->ethtool_ops = NULL;
|
|
dev->header_ops = NULL;
|
|
dev->netdev_ops = &nss_pvxlanmgr_netdev_ops;
|
|
+
|
|
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 11, 8))
|
|
dev->destructor = NULL;
|
|
+#else
|
|
+ dev->priv_destructor = NULL;
|
|
+#endif
|
|
+
|
|
memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
|
|
memset(dev->broadcast, 0xff, dev->addr_len);
|
|
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
|
|
@@ -600,13 +626,14 @@ EXPORT_SYMBOL(nss_pvxlanmgr_netdev_creat
|
|
void __exit nss_pvxlanmgr_exit_module(void)
|
|
{
|
|
int ret;
|
|
-
|
|
+#ifdef CONFIG_OF
|
|
/*
|
|
* If the node is not compatible, don't do anything.
|
|
*/
|
|
if (!of_find_node_by_name(NULL, "nss-common")) {
|
|
return;
|
|
}
|
|
+#endif
|
|
|
|
ret = unregister_netdevice_notifier(&nss_pvxlanmgr_netdev_notifier);
|
|
if (!ret) {
|
|
@@ -623,12 +650,14 @@ void __exit nss_pvxlanmgr_exit_module(vo
|
|
int __init nss_pvxlanmgr_init_module(void)
|
|
{
|
|
int ret;
|
|
+#ifdef CONFIG_OF
|
|
/*
|
|
* If the node is not compatible, don't do anything.
|
|
*/
|
|
if (!of_find_node_by_name(NULL, "nss-common")) {
|
|
return 0;
|
|
}
|
|
+#endif
|
|
|
|
nss_pvxlanmgr_info("module %s loaded\n",
|
|
NSS_CLIENT_BUILD_ID);
|
|
--- a/pvxlanmgr/nss_pvxlanmgr_priv.h
|
|
+++ b/pvxlanmgr/nss_pvxlanmgr_priv.h
|
|
@@ -1,6 +1,6 @@
|
|
/*
|
|
**************************************************************************
|
|
- * Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
|
+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
|
* Permission to use, copy, modify, and/or distribute this software for
|
|
* any purpose with or without fee is hereby granted, provided that the
|
|
* above copyright notice and this permission notice appear in all copies.
|
|
@@ -19,8 +19,10 @@
|
|
* Pvxlan manager private defines
|
|
*/
|
|
#include <linux/types.h>
|
|
+#include <linux/of.h>
|
|
#include <linux/module.h>
|
|
#include <linux/skbuff.h>
|
|
+#include <linux/version.h>
|
|
#include <nss_api_if.h>
|
|
#include <linux/in.h>
|
|
#include <linux/etherdevice.h>
|