From: Daniel Wagner <dwagner@suse.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Daniel Wagner <wagi@kernel.org>,
James Smart <james.smart@broadcom.com>,
Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
Paul Ely <paul.ely@broadcom.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/3] nvme: handle connectivity loss in nvme_set_queue_count
Date: Tue, 17 Dec 2024 15:01:55 +0100 [thread overview]
Message-ID: <bee71ac4-37bf-4182-ad7e-78efd9baff46@flourine.local> (raw)
In-Reply-To: <b8dad319-8e6e-40e7-ada3-f50863315614@suse.de>
On Tue, Dec 17, 2024 at 10:45:45AM +0100, Hannes Reinecke wrote:
> On 12/17/24 09:35, Daniel Wagner wrote:
> > On Fri, Nov 29, 2024 at 12:10:33PM +0100, Hannes Reinecke wrote:
> > > > + /*
> > > > + * It's either a kernel error or the host observed a connection
> > > > + * lost. In either case it's not possible communicate with the
> > > > + * controller and thus enter the error code path.
> > > > + */
> > > > + if (status < 0 || status == NVME_SC_HOST_PATH_ERROR)
> > > > return status;
> > > > /*
> > > >
> > > Hmm. Maybe checking for NVME_SC_DNR, too?
> >
> > if no one complains I'll update the check to:
> >
> > if (status < 0 || (status > 0 && (status & NVME_STATUS_DNR)) ||
> > status == NVME_SC_HOST_PATH_ERROR)
> > return status;
> >
> > okay?
>
> Which really cries out for a helper. But otherwise okay.
As far I remember, Christoph is not a big fan of single users of tiny
helper functions. Anyway, what about this:
+static bool nvme_num_queue_updated(status)
+{
+ /*
+ * It's either a kernel error or the host observed a connection
+ * lost. In either case it's not possible communicate with the
+ * controller and thus enter the error code path.
+ */
+
+ if (status < 0 || status & NVME_STATUS_DNR ||
+ status == NVME_SC_HOST_PATH_ERROR)
+ return false;
+
+ return true;
+}
+
int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
{
u32 q_count = (*count - 1) | ((*count - 1) << 16);
@@ -1701,13 +1716,8 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, NULL, 0,
&result);
- /*
- * It's either a kernel error or the host observed a connection
- * lost. In either case it's not possible communicate with the
- * controller and thus enter the error code path.
- */
- if (status < 0 || (status > 0 && (status & NVME_STATUS_DNR)) ||
- status == NVME_SC_HOST_PATH_ERROR)
+
+ if (!nvme_num_queue_updated(status))
return status;
/*
next prev parent reply other threads:[~2024-12-17 14:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-29 9:28 [PATCH v3 0/3] nvme-fc: fix race with connectivity loss and nvme_fc_create_association Daniel Wagner
2024-11-29 9:28 ` [PATCH v3 1/3] nvme-fc: go straight to connecting state when initializing Daniel Wagner
2024-11-29 9:28 ` [PATCH v3 2/3] nvme: trigger reset when keep alive fails Daniel Wagner
2024-11-29 11:09 ` Hannes Reinecke
2024-12-09 13:36 ` Christoph Hellwig
2024-12-24 10:31 ` Sagi Grimberg
2025-01-07 14:38 ` Daniel Wagner
2025-01-08 10:50 ` Sagi Grimberg
2024-11-29 9:28 ` [PATCH v3 3/3] nvme: handle connectivity loss in nvme_set_queue_count Daniel Wagner
2024-11-29 11:10 ` Hannes Reinecke
2024-12-17 8:35 ` Daniel Wagner
2024-12-17 9:45 ` Hannes Reinecke
2024-12-17 14:01 ` Daniel Wagner [this message]
2024-12-20 8:32 ` Hannes Reinecke
2024-12-24 10:35 ` Sagi Grimberg
2025-01-07 14:40 ` Daniel Wagner
2025-01-08 10:51 ` Sagi Grimberg
2024-12-24 10:39 ` Sagi Grimberg
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=bee71ac4-37bf-4182-ad7e-78efd9baff46@flourine.local \
--to=dwagner@suse.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=paul.ely@broadcom.com \
--cc=sagi@grimberg.me \
--cc=wagi@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox