Skip to contentSkip to conversation

xen-netfront: always set num queues if possible

PATCH New Charles (Chas) Williams 1 participant 1 message Sep 15, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-netfront: always set num queues if possible

If netfront connects with two (or more) queues and then reconnects with only one queue it fails to delete or rewrite the multi-queue-num-queues key and netback will try to use the wrong number of queues.

Always write the num-queues field if the backend has multi-queue support.

---
 drivers/net/xen-netfront.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/xen-netfront.c +7 -5
index f821a97..7f8b7bd 100644
@@ -1819,11 +1819,7 @@ again:
 		goto destroy_ring;
 	}
 
-	if (num_queues == 1) {
-		err = write_queue_xenstore_keys(&info->queues[0], &xbt, 0); /* flat */
-		if (err)
-			goto abort_transaction_no_dev_fatal;
-	} else {
+	if (xenbus_exists(xbt, dev->nodename, "multi-queue-max-queues")) {
 		/* Write the number of queues */
 		err = xenbus_printf(xbt, dev->nodename, "multi-queue-num-queues",
 				    "%u", num_queues);
@@ -1831,7 +1827,13 @@ again:
 			message = "writing multi-queue-num-queues";
 			goto abort_transaction_no_dev_fatal;
 		}
+	}
 
+	if (num_queues == 1) {
+		err = write_queue_xenstore_keys(&info->queues[0], &xbt, 0); /* flat */
+		if (err)
+			goto abort_transaction_no_dev_fatal;
+	} else {
 		/* Write the keys for each queue */
 		for (i = 0; i < num_queues; ++i) {
 			queue = &info->queues[i];
Signature · 1 line
2.1.0