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:27 +0200
commit501d2f90fc64219461f5549ca4dcce42d6016745 (patch)
treebe950e17363041e13707eb8d6486a628c1fe5c25
parent7bf21420ad191c25e655c98dc574b5891dfca339 (diff)
netvsc: propagate MAC address change to VF slave (fate#323887).
-rw-r--r--patches.suse/msft-hv-1427-netvsc-propagate-MAC-address-change-to-VF-slave.patch72
-rw-r--r--series.conf1
2 files changed, 73 insertions, 0 deletions
diff --git a/patches.suse/msft-hv-1427-netvsc-propagate-MAC-address-change-to-VF-slave.patch b/patches.suse/msft-hv-1427-netvsc-propagate-MAC-address-change-to-VF-slave.patch
new file mode 100644
index 0000000000..9490b24730
--- /dev/null
+++ b/patches.suse/msft-hv-1427-netvsc-propagate-MAC-address-change-to-VF-slave.patch
@@ -0,0 +1,72 @@
+From: stephen hemminger <stephen@networkplumber.org>
+Date: Wed, 9 Aug 2017 17:46:05 -0700
+Patch-mainline: v4.14-rc1
+Subject: netvsc: propagate MAC address change to VF slave
+Git-commit: 16ba3266006be10dc7ec25dd1442f74cef89cb95
+References: fate#323887
+
+If VF is slaved to synthetic device, then any change to netvsc
+MAC address should be propagated to the slave device.
+
+If slave device doesn't support MAC address change then it
+should also be an error to attempt to change synthetic NIC MAC
+address.
+
+It also fixes the error unwind in the original code.
+If give a bad address, the old code would change the device
+MAC address anyway.
+
+Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
+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 | 26 +++++++++++++++-----------
+ 1 file changed, 15 insertions(+), 11 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
+@@ -1053,27 +1053,31 @@ static void netvsc_get_stats64(struct net_device *net,
+ static int netvsc_set_mac_addr(struct net_device *ndev, void *p)
+ {
+ struct net_device_context *ndc = netdev_priv(ndev);
++ struct net_device *vf_netdev = rtnl_dereference(ndc->vf_netdev);
+ struct netvsc_device *nvdev = rtnl_dereference(ndc->nvdev);
+ struct sockaddr *addr = p;
+- char save_adr[ETH_ALEN];
+- unsigned char save_aatype;
+ int err;
+
+- memcpy(save_adr, ndev->dev_addr, ETH_ALEN);
+- save_aatype = ndev->addr_assign_type;
+-
+- err = eth_mac_addr(ndev, p);
+- if (err != 0)
++ err = eth_prepare_mac_addr_change(ndev, p);
++ if (err)
+ return err;
+
+ if (!nvdev)
+ return -ENODEV;
+
++ if (vf_netdev) {
++ err = dev_set_mac_address(vf_netdev, addr);
++ if (err)
++ return err;
++ }
++
+ err = rndis_filter_set_device_mac(nvdev, addr->sa_data);
+- if (err != 0) {
+- /* roll back to saved MAC */
+- memcpy(ndev->dev_addr, save_adr, ETH_ALEN);
+- ndev->addr_assign_type = save_aatype;
++ if (!err) {
++ eth_commit_mac_addr_change(ndev, p);
++ } else if (vf_netdev) {
++ /* rollback change on VF */
++ memcpy(addr->sa_data, ndev->dev_addr, ETH_ALEN);
++ dev_set_mac_address(vf_netdev, addr);
+ }
+
+ return err;
diff --git a/series.conf b/series.conf
index 3bda60c986..69292ebc37 100644
--- a/series.conf
+++ b/series.conf
@@ -1677,6 +1677,7 @@
patches.suse/msft-hv-1424-x86-hyper-v-Use-hypercall-for-remote-TLB-flush.patch
patches.suse/msft-hv-1425-netvsc-delay-setup-of-VF-device.patch
patches.suse/msft-hv-1426-netvsc-don-t-signal-host-twice-if-empty.patch
+ patches.suse/msft-hv-1427-netvsc-propagate-MAC-address-change-to-VF-slave.patch
patches.suse/suse-hv-guest-os-id.patch
patches.suse/suse-hv-kvp_on_msg.dbg.patch