From: gpiccoli@linux.vnet.ibm.com (Guilherme G. Piccoli)
Subject: [PATCH 2/2] [RFC] nvme: enable asynchronous events notification by default
Date: Fri, 17 Jun 2016 14:21:15 -0300 [thread overview]
Message-ID: <1466184075-10471-3-git-send-email-gpiccoli@linux.vnet.ibm.com> (raw)
In-Reply-To: <1466184075-10471-1-git-send-email-gpiccoli@linux.vnet.ibm.com>
Asynchronous events notification currently is disabled by default;
to enable it, one should issue a set-feature command through
nvme-cli userspace application. The tool also allows disabling
these events once they're enable, as per user desire.
This patch makes the asynchronous events notification enabled by
default; to do so, we submit the set-feature command from the
driver, in the end of nvme_reset_work() routine. This way, the
feature is enabled on the driver initialization and after resets,
in case they happen.
Enabling the asynchronous events notification feature by default
is interesting as an error report feature.
Signed-off-by: Guilherme G. Piccoli <gpiccoli at linux.vnet.ibm.com>
---
drivers/nvme/host/pci.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index befac5b..3a82390 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1779,6 +1779,18 @@ static void nvme_remove_dead_ctrl(struct nvme_dev *dev, int status)
nvme_put_ctrl(&dev->ctrl);
}
+static int nvme_enable_async_events(struct nvme_dev *dev)
+{
+ struct nvme_command c;
+
+ memset(&c, 0, sizeof(c));
+ c.common.opcode = nvme_admin_set_features;
+ c.common.cdw10[0] = 0xB; /* Feature: Async Event Configuration */
+ c.common.cdw10[1] = 0x3FF; /* Enable all available events */
+
+ return nvme_submit_sync_cmd(dev->ctrl.admin_q, &c, NULL, 0);
+}
+
static void nvme_reset_work(struct work_struct *work)
{
struct nvme_dev *dev = container_of(work, struct nvme_dev, reset_work);
@@ -1849,6 +1861,10 @@ static void nvme_reset_work(struct work_struct *work)
if (dev->online_queues > 1)
nvme_queue_scan(&dev->ctrl);
+
+ if (nvme_enable_async_events(dev))
+ dev_info(dev->ctrl.device,
+ "failed to enable async events notification\n");
return;
out:
--
2.1.0
next prev parent reply other threads:[~2016-06-17 17:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-17 17:21 [PATCH 0/2] 2 patches about asynchronous events notification Guilherme G. Piccoli
2016-06-17 17:21 ` [PATCH 1/2] nvme: introduce asynchronous events textual output Guilherme G. Piccoli
2016-06-17 17:21 ` Guilherme G. Piccoli [this message]
2016-06-20 6:55 ` [PATCH 2/2] [RFC] nvme: enable asynchronous events notification by default Sagi Grimberg
2016-06-20 17:03 ` Guilherme G. Piccoli
2016-06-20 20:21 ` Keith Busch
2016-06-24 8:17 ` Christoph Hellwig
2016-06-28 15:11 ` Keith Busch
2016-06-29 4:17 ` Gabriel Krisman Bertazi
2016-07-06 22:47 ` Guilherme G. Piccoli
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=1466184075-10471-3-git-send-email-gpiccoli@linux.vnet.ibm.com \
--to=gpiccoli@linux.vnet.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).