diff options
Diffstat (limited to 'drivers/net/xen-netback/xenbus.c')
-rw-r--r-- | drivers/net/xen-netback/xenbus.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 8079c31ac5e6..fab0d4b42f58 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -39,7 +39,7 @@ struct backend_info { | |||
39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); | 39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); |
40 | static void connect(struct backend_info *be); | 40 | static void connect(struct backend_info *be); |
41 | static int read_xenbus_vif_flags(struct backend_info *be); | 41 | static int read_xenbus_vif_flags(struct backend_info *be); |
42 | static void backend_create_xenvif(struct backend_info *be); | 42 | static int backend_create_xenvif(struct backend_info *be); |
43 | static void unregister_hotplug_status_watch(struct backend_info *be); | 43 | static void unregister_hotplug_status_watch(struct backend_info *be); |
44 | static void set_backend_state(struct backend_info *be, | 44 | static void set_backend_state(struct backend_info *be, |
45 | enum xenbus_state state); | 45 | enum xenbus_state state); |
@@ -52,6 +52,7 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v) | |||
52 | struct xenvif_queue *queue = m->private; | 52 | struct xenvif_queue *queue = m->private; |
53 | struct xen_netif_tx_back_ring *tx_ring = &queue->tx; | 53 | struct xen_netif_tx_back_ring *tx_ring = &queue->tx; |
54 | struct xen_netif_rx_back_ring *rx_ring = &queue->rx; | 54 | struct xen_netif_rx_back_ring *rx_ring = &queue->rx; |
55 | struct netdev_queue *dev_queue; | ||
55 | 56 | ||
56 | if (tx_ring->sring) { | 57 | if (tx_ring->sring) { |
57 | struct xen_netif_tx_sring *sring = tx_ring->sring; | 58 | struct xen_netif_tx_sring *sring = tx_ring->sring; |
@@ -112,6 +113,13 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v) | |||
112 | queue->credit_timeout.expires, | 113 | queue->credit_timeout.expires, |
113 | jiffies); | 114 | jiffies); |
114 | 115 | ||
116 | dev_queue = netdev_get_tx_queue(queue->vif->dev, queue->id); | ||
117 | |||
118 | seq_printf(m, "\nRx internal queue: len %u max %u pkts %u %s\n", | ||
119 | queue->rx_queue_len, queue->rx_queue_max, | ||
120 | skb_queue_len(&queue->rx_queue), | ||
121 | netif_tx_queue_stopped(dev_queue) ? "stopped" : "running"); | ||
122 | |||
115 | return 0; | 123 | return 0; |
116 | } | 124 | } |
117 | 125 | ||
@@ -344,7 +352,9 @@ static int netback_probe(struct xenbus_device *dev, | |||
344 | be->state = XenbusStateInitWait; | 352 | be->state = XenbusStateInitWait; |
345 | 353 | ||
346 | /* This kicks hotplug scripts, so do it immediately. */ | 354 | /* This kicks hotplug scripts, so do it immediately. */ |
347 | backend_create_xenvif(be); | 355 | err = backend_create_xenvif(be); |
356 | if (err) | ||
357 | goto fail; | ||
348 | 358 | ||
349 | return 0; | 359 | return 0; |
350 | 360 | ||
@@ -389,19 +399,19 @@ static int netback_uevent(struct xenbus_device *xdev, | |||
389 | } | 399 | } |
390 | 400 | ||
391 | 401 | ||
392 | static void backend_create_xenvif(struct backend_info *be) | 402 | static int backend_create_xenvif(struct backend_info *be) |
393 | { | 403 | { |
394 | int err; | 404 | int err; |
395 | long handle; | 405 | long handle; |
396 | struct xenbus_device *dev = be->dev; | 406 | struct xenbus_device *dev = be->dev; |
397 | 407 | ||
398 | if (be->vif != NULL) | 408 | if (be->vif != NULL) |
399 | return; | 409 | return 0; |
400 | 410 | ||
401 | err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); | 411 | err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); |
402 | if (err != 1) { | 412 | if (err != 1) { |
403 | xenbus_dev_fatal(dev, err, "reading handle"); | 413 | xenbus_dev_fatal(dev, err, "reading handle"); |
404 | return; | 414 | return (err < 0) ? err : -EINVAL; |
405 | } | 415 | } |
406 | 416 | ||
407 | be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); | 417 | be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); |
@@ -409,10 +419,11 @@ static void backend_create_xenvif(struct backend_info *be) | |||
409 | err = PTR_ERR(be->vif); | 419 | err = PTR_ERR(be->vif); |
410 | be->vif = NULL; | 420 | be->vif = NULL; |
411 | xenbus_dev_fatal(dev, err, "creating interface"); | 421 | xenbus_dev_fatal(dev, err, "creating interface"); |
412 | return; | 422 | return err; |
413 | } | 423 | } |
414 | 424 | ||
415 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); | 425 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); |
426 | return 0; | ||
416 | } | 427 | } |
417 | 428 | ||
418 | static void backend_disconnect(struct backend_info *be) | 429 | static void backend_disconnect(struct backend_info *be) |
@@ -703,6 +714,7 @@ static void connect(struct backend_info *be) | |||
703 | be->vif->queues = vzalloc(requested_num_queues * | 714 | be->vif->queues = vzalloc(requested_num_queues * |
704 | sizeof(struct xenvif_queue)); | 715 | sizeof(struct xenvif_queue)); |
705 | be->vif->num_queues = requested_num_queues; | 716 | be->vif->num_queues = requested_num_queues; |
717 | be->vif->stalled_queues = requested_num_queues; | ||
706 | 718 | ||
707 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { | 719 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { |
708 | queue = &be->vif->queues[queue_index]; | 720 | queue = &be->vif->queues[queue_index]; |
@@ -873,15 +885,10 @@ static int read_xenbus_vif_flags(struct backend_info *be) | |||
873 | if (!rx_copy) | 885 | if (!rx_copy) |
874 | return -EOPNOTSUPP; | 886 | return -EOPNOTSUPP; |
875 | 887 | ||
876 | if (vif->dev->tx_queue_len != 0) { | 888 | if (xenbus_scanf(XBT_NIL, dev->otherend, |
877 | if (xenbus_scanf(XBT_NIL, dev->otherend, | 889 | "feature-rx-notify", "%d", &val) < 0 || val == 0) { |
878 | "feature-rx-notify", "%d", &val) < 0) | 890 | xenbus_dev_fatal(dev, -EINVAL, "feature-rx-notify is mandatory"); |
879 | val = 0; | 891 | return -EINVAL; |
880 | if (val) | ||
881 | vif->can_queue = 1; | ||
882 | else | ||
883 | /* Must be non-zero for pfifo_fast to work. */ | ||
884 | vif->dev->tx_queue_len = 1; | ||
885 | } | 892 | } |
886 | 893 | ||
887 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", | 894 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", |