@@ -742,7 +742,7 @@ static int netvsc_set_channels(struct net_device *net,
742
742
struct hv_device * dev = net_device_ctx -> device_ctx ;
743
743
struct netvsc_device * nvdev = rtnl_dereference (net_device_ctx -> nvdev );
744
744
unsigned int count = channels -> combined_count ;
745
- bool was_running ;
745
+ bool was_opened ;
746
746
int ret ;
747
747
748
748
/* We do not support separate count for rx, tx, or other */
@@ -762,12 +762,9 @@ static int netvsc_set_channels(struct net_device *net,
762
762
if (count > nvdev -> max_chn )
763
763
return - EINVAL ;
764
764
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 );
771
768
772
769
rndis_filter_device_remove (dev , nvdev );
773
770
@@ -777,8 +774,9 @@ static int netvsc_set_channels(struct net_device *net,
777
774
else
778
775
netvsc_set_queues (net , dev , nvdev -> num_chn );
779
776
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 );
782
780
783
781
/* We may have missed link change notifications */
784
782
net_device_ctx -> last_reconfig = 0 ;
@@ -848,18 +846,15 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
848
846
struct netvsc_device * nvdev = rtnl_dereference (ndevctx -> nvdev );
849
847
struct hv_device * hdev = ndevctx -> device_ctx ;
850
848
struct netvsc_device_info device_info ;
851
- bool was_running ;
852
- int ret = 0 ;
849
+ bool was_opened ;
853
850
854
851
if (!nvdev || nvdev -> destroy )
855
852
return - ENODEV ;
856
853
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 );
863
858
864
859
memset (& device_info , 0 , sizeof (device_info ));
865
860
device_info .ring_size = ring_size ;
@@ -877,14 +872,17 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
877
872
ndev -> mtu = mtu ;
878
873
879
874
rndis_filter_device_add (hdev , & device_info );
875
+ nvdev = rtnl_dereference (ndevctx -> nvdev );
880
876
881
- if (was_running )
882
- ret = netvsc_open (ndev );
877
+ if (was_opened )
878
+ rndis_filter_open (nvdev );
879
+
880
+ netif_device_attach (ndev );
883
881
884
882
/* We may have missed link change notifications */
885
883
schedule_delayed_work (& ndevctx -> dwork , 0 );
886
884
887
- return ret ;
885
+ return 0 ;
888
886
}
889
887
890
888
static void netvsc_get_stats64 (struct net_device * net ,
0 commit comments