All of lore.kernel.org
 help / color / mirror / Atom feed
From: ChiaHao Hsu <andyhsu@amazon.com>
To: <netdev@vger.kernel.org>
Cc: <wei.liu@kernel.org>, <paul@xen.org>, <davem@davemloft.net>,
	<kuba@kernel.org>, <andyhsu@amazon.com>,
	<xen-devel@lists.xenproject.org>
Subject: [net-next 1/2] xen-netback: add module parameter to disable ctrl-ring
Date: Thu, 11 Mar 2021 22:59:44 +0000	[thread overview]
Message-ID: <20210311225944.24198-1-andyhsu@amazon.com> (raw)

In order to support live migration of guests between kernels
that do and do not support 'feature-ctrl-ring', we add a
module parameter that allows the feature to be disabled
at run time, instead of using hardcode value.
The default value is enable.

Signed-off-by: ChiaHao Hsu <andyhsu@amazon.com>
---
 drivers/net/xen-netback/common.h  |  2 ++
 drivers/net/xen-netback/netback.c |  6 ++++++
 drivers/net/xen-netback/xenbus.c  | 23 ++++++++++++++---------
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 4a16d6e33c09..bfb7a3054917 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -276,6 +276,7 @@ struct backend_info {
 	u8 have_hotplug_status_watch:1;
 
 	const char *hotplug_script;
+	bool ctrl_ring_enabled;
 };
 
 struct xenvif {
@@ -413,6 +414,7 @@ static inline pending_ring_idx_t nr_pending_reqs(struct xenvif_queue *queue)
 
 irqreturn_t xenvif_interrupt(int irq, void *dev_id);
 
+extern bool control_ring;
 extern bool separate_tx_rx_irq;
 extern bool provides_xdp_headroom;
 
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 39a01c2a3058..a119ae673862 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -48,6 +48,12 @@
 
 #include <asm/xen/hypercall.h>
 
+/* Provide an option to disable control ring which is used to pass
+ * large quantities of data from frontend to backend.
+ */
+bool control_ring = true;
+module_param(control_ring, bool, 0644);
+
 /* Provide an option to disable split event channels at load time as
  * event channels are limited resource. Split event channels are
  * enabled by default.
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index a5439c130130..9801b8d10239 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -755,10 +755,12 @@ static void connect(struct backend_info *be)
 	xen_register_watchers(dev, be->vif);
 	read_xenbus_vif_flags(be);
 
-	err = connect_ctrl_ring(be);
-	if (err) {
-		xenbus_dev_fatal(dev, err, "connecting control ring");
-		return;
+	if (be->ctrl_ring_enabled) {
+		err = connect_ctrl_ring(be);
+		if (err) {
+			xenbus_dev_fatal(dev, err, "connecting control ring");
+			return;
+		}
 	}
 
 	/* Use the number of queues requested by the frontend */
@@ -1123,11 +1125,14 @@ static int netback_probe(struct xenbus_device *dev,
 	if (err)
 		pr_debug("Error writing multi-queue-max-queues\n");
 
-	err = xenbus_printf(XBT_NIL, dev->nodename,
-			    "feature-ctrl-ring",
-			    "%u", true);
-	if (err)
-		pr_debug("Error writing feature-ctrl-ring\n");
+	be->ctrl_ring_enabled = READ_ONCE(control_ring);
+	if (be->ctrl_ring_enabled) {
+		err = xenbus_printf(XBT_NIL, dev->nodename,
+				    "feature-ctrl-ring",
+				    "%u", true);
+		if (err)
+			pr_debug("Error writing feature-ctrl-ring\n");
+	}
 
 	backend_switch_state(be, XenbusStateInitWait);
 
-- 
2.23.3


             reply	other threads:[~2021-03-11 23:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 22:59 ChiaHao Hsu [this message]
2021-03-12  7:32 ` [net-next 1/2] xen-netback: add module parameter to disable ctrl-ring Paul Durrant
2021-03-12 14:52 ` Andrew Lunn
2021-03-12 15:18   ` Hsu, Chiahao
2021-03-12 20:36     ` Andrew Lunn
2021-03-14 10:04       ` Leon Romanovsky
2021-03-16 15:22         ` Hsu, Chiahao
2021-03-17 17:22           ` Leon Romanovsky
2021-03-21 16:31             ` Hsu, Chiahao
2021-03-21 17:22               ` Leon Romanovsky
2021-03-21 17:54                 ` Hsu, Chiahao
2021-03-21 20:29                   ` Andrew Lunn
2021-03-21 21:00                     ` Hsu, Chiahao
2021-03-22  5:39                   ` Leon Romanovsky
2021-03-22  5:58                     ` Jürgen Groß
2021-03-22  6:48                       ` Leon Romanovsky
2021-03-22  7:01                         ` Jürgen Groß
2021-03-22  7:13                           ` Leon Romanovsky
2021-03-28 20:46                             ` Hsu, Chiahao
2021-03-29  5:03                               ` Juergen Gross

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=20210311225944.24198-1-andyhsu@amazon.com \
    --to=andyhsu@amazon.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul@xen.org \
    --cc=wei.liu@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.