diff options
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index defec2b3c5a4..9fbdfcd1e1a0 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -938,7 +938,9 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs) | |||
938 | return -EINVAL; | 938 | return -EINVAL; |
939 | } else { | 939 | } else { |
940 | vi->curr_queue_pairs = queue_pairs; | 940 | vi->curr_queue_pairs = queue_pairs; |
941 | schedule_delayed_work(&vi->refill, 0); | 941 | /* virtnet_open() will refill when device is going to up. */ |
942 | if (dev->flags & IFF_UP) | ||
943 | schedule_delayed_work(&vi->refill, 0); | ||
942 | } | 944 | } |
943 | 945 | ||
944 | return 0; | 946 | return 0; |
@@ -1116,6 +1118,11 @@ static int virtnet_cpu_callback(struct notifier_block *nfb, | |||
1116 | { | 1118 | { |
1117 | struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb); | 1119 | struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb); |
1118 | 1120 | ||
1121 | mutex_lock(&vi->config_lock); | ||
1122 | |||
1123 | if (!vi->config_enable) | ||
1124 | goto done; | ||
1125 | |||
1119 | switch(action & ~CPU_TASKS_FROZEN) { | 1126 | switch(action & ~CPU_TASKS_FROZEN) { |
1120 | case CPU_ONLINE: | 1127 | case CPU_ONLINE: |
1121 | case CPU_DOWN_FAILED: | 1128 | case CPU_DOWN_FAILED: |
@@ -1128,6 +1135,9 @@ static int virtnet_cpu_callback(struct notifier_block *nfb, | |||
1128 | default: | 1135 | default: |
1129 | break; | 1136 | break; |
1130 | } | 1137 | } |
1138 | |||
1139 | done: | ||
1140 | mutex_unlock(&vi->config_lock); | ||
1131 | return NOTIFY_OK; | 1141 | return NOTIFY_OK; |
1132 | } | 1142 | } |
1133 | 1143 | ||
@@ -1733,7 +1743,9 @@ static int virtnet_restore(struct virtio_device *vdev) | |||
1733 | vi->config_enable = true; | 1743 | vi->config_enable = true; |
1734 | mutex_unlock(&vi->config_lock); | 1744 | mutex_unlock(&vi->config_lock); |
1735 | 1745 | ||
1746 | rtnl_lock(); | ||
1736 | virtnet_set_queues(vi, vi->curr_queue_pairs); | 1747 | virtnet_set_queues(vi, vi->curr_queue_pairs); |
1748 | rtnl_unlock(); | ||
1737 | 1749 | ||
1738 | return 0; | 1750 | return 0; |
1739 | } | 1751 | } |