@@ -742,7 +742,7 @@ static int netvsc_set_channels(struct net_device *net,
742742 struct hv_device * dev = net_device_ctx -> device_ctx ;
743743 struct netvsc_device * nvdev = rtnl_dereference (net_device_ctx -> nvdev );
744744 unsigned int count = channels -> combined_count ;
745- bool was_running ;
745+ bool was_opened ;
746746 int ret ;
747747
748748 /* We do not support separate count for rx, tx, or other */
@@ -762,12 +762,9 @@ static int netvsc_set_channels(struct net_device *net,
762762 if (count > nvdev -> max_chn )
763763 return - EINVAL ;
764764
765- was_running = netif_running (net );
766- if (was_running ) {
767- ret = netvsc_close (net );
768- if (ret )
769- return ret ;
770- }
765+ was_opened = rndis_filter_opened (nvdev );
766+ if (was_opened )
767+ rndis_filter_close (nvdev );
771768
772769 rndis_filter_device_remove (dev , nvdev );
773770
@@ -777,8 +774,9 @@ static int netvsc_set_channels(struct net_device *net,
777774 else
778775 netvsc_set_queues (net , dev , nvdev -> num_chn );
779776
780- if (was_running )
781- ret = netvsc_open (net );
777+ nvdev = rtnl_dereference (net_device_ctx -> nvdev );
778+ if (was_opened )
779+ rndis_filter_open (nvdev );
782780
783781 /* We may have missed link change notifications */
784782 net_device_ctx -> last_reconfig = 0 ;
@@ -848,18 +846,15 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
848846 struct netvsc_device * nvdev = rtnl_dereference (ndevctx -> nvdev );
849847 struct hv_device * hdev = ndevctx -> device_ctx ;
850848 struct netvsc_device_info device_info ;
851- bool was_running ;
852- int ret = 0 ;
849+ bool was_opened ;
853850
854851 if (!nvdev || nvdev -> destroy )
855852 return - ENODEV ;
856853
857- was_running = netif_running (ndev );
858- if (was_running ) {
859- ret = netvsc_close (ndev );
860- if (ret )
861- return ret ;
862- }
854+ netif_device_detach (ndev );
855+ was_opened = rndis_filter_opened (nvdev );
856+ if (was_opened )
857+ rndis_filter_close (nvdev );
863858
864859 memset (& device_info , 0 , sizeof (device_info ));
865860 device_info .ring_size = ring_size ;
@@ -877,14 +872,17 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
877872 ndev -> mtu = mtu ;
878873
879874 rndis_filter_device_add (hdev , & device_info );
875+ nvdev = rtnl_dereference (ndevctx -> nvdev );
880876
881- if (was_running )
882- ret = netvsc_open (ndev );
877+ if (was_opened )
878+ rndis_filter_open (nvdev );
879+
880+ netif_device_attach (ndev );
883881
884882 /* We may have missed link change notifications */
885883 schedule_delayed_work (& ndevctx -> dwork , 0 );
886884
887- return ret ;
885+ return 0 ;
888886}
889887
890888static void netvsc_get_stats64 (struct net_device * net ,
0 commit comments