aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/xen-netfront.c')
-rw-r--r--drivers/net/xen-netfront.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 47f791e60851..f821a97d7827 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1338,7 +1338,7 @@ static void xennet_disconnect_backend(struct netfront_info *info)
1338 1338
1339 netif_carrier_off(info->netdev); 1339 netif_carrier_off(info->netdev);
1340 1340
1341 for (i = 0; i < num_queues; ++i) { 1341 for (i = 0; i < num_queues && info->queues; ++i) {
1342 struct netfront_queue *queue = &info->queues[i]; 1342 struct netfront_queue *queue = &info->queues[i];
1343 1343
1344 if (queue->tx_irq && (queue->tx_irq == queue->rx_irq)) 1344 if (queue->tx_irq && (queue->tx_irq == queue->rx_irq))
@@ -1350,7 +1350,8 @@ static void xennet_disconnect_backend(struct netfront_info *info)
1350 queue->tx_evtchn = queue->rx_evtchn = 0; 1350 queue->tx_evtchn = queue->rx_evtchn = 0;
1351 queue->tx_irq = queue->rx_irq = 0; 1351 queue->tx_irq = queue->rx_irq = 0;
1352 1352
1353 napi_synchronize(&queue->napi); 1353 if (netif_running(info->netdev))
1354 napi_synchronize(&queue->napi);
1354 1355
1355 xennet_release_tx_bufs(queue); 1356 xennet_release_tx_bufs(queue);
1356 xennet_release_rx_bufs(queue); 1357 xennet_release_rx_bufs(queue);
@@ -2103,7 +2104,8 @@ static int xennet_remove(struct xenbus_device *dev)
2103 2104
2104 unregister_netdev(info->netdev); 2105 unregister_netdev(info->netdev);
2105 2106
2106 xennet_destroy_queues(info); 2107 if (info->queues)
2108 xennet_destroy_queues(info);
2107 xennet_free_netdev(info->netdev); 2109 xennet_free_netdev(info->netdev);
2108 2110
2109 return 0; 2111 return 0;
@@ -2132,8 +2134,11 @@ static int __init netif_init(void)
2132 2134
2133 pr_info("Initialising Xen virtual ethernet driver\n"); 2135 pr_info("Initialising Xen virtual ethernet driver\n");
2134 2136
2135 /* Allow as many queues as there are CPUs, by default */ 2137 /* Allow as many queues as there are CPUs if user has not
2136 xennet_max_queues = num_online_cpus(); 2138 * specified a value.
2139 */
2140 if (xennet_max_queues == 0)
2141 xennet_max_queues = num_online_cpus();
2137 2142
2138 return xenbus_register_frontend(&netfront_driver); 2143 return xenbus_register_frontend(&netfront_driver);
2139} 2144}