All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Charles (Chas) Williams" <3chas3@gmail.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: netdev@vger.kernel.org, xen-devel@lists.xenproject.org
Subject: [PATCH net-next v2] xen-netfront: always set num queues if possible
Date: Wed, 16 Sep 2015 16:28:25 -0400	[thread overview]
Message-ID: <1442435305.3494.21.camel@gmail.com> (raw)
In-Reply-To: <55F7FA2D.5040701@citrix.com>

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.

Signed-off-by: Chas Williams <3chas3@gmail.com>
---
 drivers/net/xen-netfront.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index f821a97..9bf63c2 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1819,19 +1819,22 @@ 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_NIL,
+			  info->xbdev->otherend, "multi-queue-max-queues")) {
 		/* Write the number of queues */
-		err = xenbus_printf(xbt, dev->nodename, "multi-queue-num-queues",
-				    "%u", num_queues);
+		err = xenbus_printf(xbt, dev->nodename,
+				    "multi-queue-num-queues", "%u", num_queues);
 		if (err) {
 			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];
-- 
2.1.0

  parent reply	other threads:[~2015-09-16 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14 21:28 [PATCH net-next] xen-netfront: always set num queues if possible Charles (Chas) Williams
2015-09-15 10:59 ` [Xen-devel] " David Vrabel
2015-09-15 14:37   ` Charles (Chas) Williams
2015-09-15 14:37   ` [Xen-devel] " Charles (Chas) Williams
2015-09-16 20:28   ` Charles (Chas) Williams [this message]
2015-09-21  4:39     ` [PATCH net-next v2] " David Miller
2015-09-21  4:39     ` David Miller
2015-09-16 20:28   ` Charles (Chas) Williams
2015-09-15 10:59 ` [PATCH net-next] " David Vrabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442435305.3494.21.camel@gmail.com \
    --to=3chas3@gmail.com \
    --cc=david.vrabel@citrix.com \
    --cc=netdev@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.