Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlaf Hering <ohering@suse.de>2017-10-20 12:20:33 +0200
committerOlaf Hering <ohering@suse.de>2017-10-20 12:23:29 +0200
commit04d48a22ba849bb4f522e08f4f47b29bb0c53898 (patch)
tree841872a0cbb6dc5cc2ef413780c19f6aabc6bdfb
parent68d6b87d1aac30c380d10a7e18158aef01557321 (diff)
netvsc: allow driver to be removed even if VF is present
-rw-r--r--patches.suse/msft-hv-1456-netvsc-allow-driver-to-be-removed-even-if-VF-is-pres.patch77
-rw-r--r--series.conf1
2 files changed, 78 insertions, 0 deletions
diff --git a/patches.suse/msft-hv-1456-netvsc-allow-driver-to-be-removed-even-if-VF-is-pres.patch b/patches.suse/msft-hv-1456-netvsc-allow-driver-to-be-removed-even-if-VF-is-pres.patch
new file mode 100644
index 0000000000..34193996ef
--- /dev/null
+++ b/patches.suse/msft-hv-1456-netvsc-allow-driver-to-be-removed-even-if-VF-is-pres.patch
@@ -0,0 +1,77 @@
+From: Stephen Hemminger <stephen@networkplumber.org>
+Date: Thu, 31 Aug 2017 16:16:13 -0700
+Patch-mainline: v4.14-rc1
+Subject: netvsc: allow driver to be removed even if VF is present
+Git-commit: ec158f77def2df084d9f62565357e3037b04bd3f
+References: fate#323887
+
+If VF is attached then can still allow netvsc driver module to
+be removed. Just have to make sure and do the cleanup.
+
+Also, avoid extra rtnl round trip when calling unregister.
+
+Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Olaf Hering <ohering@suse.de>
+---
+ drivers/net/hyperv/netvsc_drv.c | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
+--- a/drivers/net/hyperv/netvsc_drv.c
++++ b/drivers/net/hyperv/netvsc_drv.c
+@@ -1839,9 +1839,6 @@ static int netvsc_register_vf(struct net_device *vf_netdev)
+
+ netdev_info(ndev, "VF registering: %s\n", vf_netdev->name);
+
+- /* Prevent this module from being unloaded while VF is registered */
+- try_module_get(THIS_MODULE);
+-
+ dev_hold(vf_netdev);
+ rcu_assign_pointer(net_device_ctx->vf_netdev, vf_netdev);
+ return NOTIFY_OK;
+@@ -1885,10 +1882,11 @@ static int netvsc_unregister_vf(struct net_device *vf_netdev)
+
+ netdev_info(ndev, "VF unregistering: %s\n", vf_netdev->name);
+
++ netdev_rx_handler_unregister(vf_netdev);
+ netdev_upper_dev_unlink(vf_netdev, ndev);
+ RCU_INIT_POINTER(net_device_ctx->vf_netdev, NULL);
+ dev_put(vf_netdev);
+- module_put(THIS_MODULE);
++
+ return NOTIFY_OK;
+ }
+
+@@ -1992,11 +1990,11 @@ no_net:
+
+ static int netvsc_remove(struct hv_device *dev)
+ {
+- struct net_device *net;
+ struct net_device_context *ndev_ctx;
++ struct net_device *vf_netdev;
++ struct net_device *net;
+
+ net = hv_get_drvdata(dev);
+-
+ if (net == NULL) {
+ dev_err(&dev->device, "No net device to remove\n");
+ return 0;
+@@ -2013,12 +2011,15 @@ static int netvsc_remove(struct hv_device *dev)
+ * removed. Also blocks mtu and channel changes.
+ */
+ rtnl_lock();
++ vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
++ if (vf_netdev)
++ netvsc_unregister_vf(vf_netdev);
++
+ rndis_filter_device_remove(dev,
+ rtnl_dereference(ndev_ctx->nvdev));
++ unregister_netdevice(net);
+ rtnl_unlock();
+
+- unregister_netdev(net);
+-
+ hv_set_drvdata(dev, NULL);
+
+ free_percpu(ndev_ctx->vf_stats);
diff --git a/series.conf b/series.conf
index a5b998767d..9c790980de 100644
--- a/series.conf
+++ b/series.conf
@@ -1704,6 +1704,7 @@
patches.suse/msft-hv-1453-x86-hyper-v-Support-extended-CPU-ranges-for-TLB-flus.patch
patches.suse/msft-hv-1454-tracing-hyper-v-Trace-hyperv_mmu_flush_tlb_others.patch
patches.suse/msft-hv-1455-netvsc-cleanup-datapath-switch.patch
+ patches.suse/msft-hv-1456-netvsc-allow-driver-to-be-removed-even-if-VF-is-pres.patch
patches.suse/suse-hv-guest-os-id.patch
patches.suse/suse-hv-kvp_on_msg.dbg.patch