linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: swise@opengridcomputing.com (Steve Wise)
Subject: [PATCH 6/6] nvme/rdma: Make nvme_rdma_conn_rejected() more informative
Date: Thu, 20 Oct 2016 15:41:44 -0500	[thread overview]
Message-ID: <015c01d22b12$5e9f4e70$1bddeb50$@opengridcomputing.com> (raw)
In-Reply-To: <015201d22b0b$4f526440$edf72cc0$@opengridcomputing.com>



> -----Original Message-----
> From: Steve Wise [mailto:swise at opengridcomputing.com]
> Sent: Thursday, October 20, 2016 2:51 PM
> To: 'Bart Van Assche'; 'Keith Busch'
> Cc: 'Jens Axboe'; 'Christoph Hellwig'; linux-nvme at lists.infradead.org; 'Sagi
> Grimberg'
> Subject: RE: [PATCH 6/6] nvme/rdma: Make nvme_rdma_conn_rejected() more
> informative
> 
> >
> > > On 10/20/2016 10:45 AM, Steve Wise wrote:
> > > > I agree.  What if we add a helper function in the core to map the
> > >  > event->status value to something human readable?  That would at
> > >  > least push this into the core.   The nvme host really doesn't do
> > >  > anything other than display a different message...
> > > >
> > > > Something like rdma_event_msg(), but using event->status.
> > >
> > > Hello Steve,
> > >
> > > It won't be possible to let rdma_event_msg() decode the NVME_RDMA_CM_*
> > > status unless a callback function that performs such decoding is passed
> > > to rdma_event_msg(). Since such an approach would work for translating a
> > > status into a message but not for any more advanced CM status handling
> > > my preference is to unify the calling conventions for IB/RoCE and iWARP
> > > CM reject callbacks.
> >
> > I think for this particular case, mapping event->status to a string is all
> > that nvme needs.  And having a status to string mapping would be easy to
> > do
> > in the core.  I agree though, that unifying the status codes is a "good
> > thing".
> 
> What about something along these lines? (untested and mangled by my emailer,
> but you get the point)

And here is a proposed change to nvme_rdma to use rdma_reject_msg().  If you like this idea, I'll send out these two patches, or send them to you to include in your series.



diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 601aecf..41a2d4c 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1237,18 +1237,19 @@ out_destroy_queue_ib:
 static int nvme_rdma_conn_rejected(struct nvme_rdma_queue *queue,
                struct rdma_cm_event *ev)
 {
+       short nvme_status = -1;
+
        if (ev->param.conn.private_data_len) {
                struct nvme_rdma_cm_rej *rej =
                        (struct nvme_rdma_cm_rej *)ev->param.conn.private_data;

-               dev_err(queue->ctrl->ctrl.device,
-                       "Connect rejected, status %d.", le16_to_cpu(rej->sts));
-               /* XXX: Think of something clever to do here... */
-       } else {
-               dev_err(queue->ctrl->ctrl.device,
-                       "Connect rejected, no private data.\n");
+               nvme_status = le16_to_cpu(rej->sts);
        }

+       dev_err(queue->ctrl->ctrl.device, "Connect rejected: status %d (%s) "
+               "nvme status %d.\n", ev->status,
+               rdma_reject_msg(queue->cm_id, ev->status), nvme_status);
+
        return -ECONNRESET;
 }

  parent reply	other threads:[~2016-10-20 20:41 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 20:09 [PATCH 0/6] Six NVMeOF-related patches Bart Van Assche
2016-10-18 20:10 ` [PATCH 1/6] nvme/scsi: Remove set-but-not-used variables Bart Van Assche
2016-10-19  7:26   ` Johannes Thumshirn
2016-10-19 10:31   ` Christoph Hellwig
2016-10-18 20:10 ` [PATCH 2/6] nvme-fabrics: Adjust source code indentation Bart Van Assche
2016-10-19  7:26   ` Johannes Thumshirn
2016-10-19 10:31   ` Christoph Hellwig
2016-10-18 20:10 ` [PATCH 3/6] nvme-fabrics: Fix memory leaks in nvmf_parse_options() Bart Van Assche
2016-10-19  7:27   ` Johannes Thumshirn
2016-10-19 10:37   ` Christoph Hellwig
2016-10-18 20:11 ` [PATCH 4/6] nvme-fabrics: Fix a memory leak in an nvmf_create_ctrl() error path Bart Van Assche
2016-10-19  7:27   ` Johannes Thumshirn
2016-10-19 10:37   ` Christoph Hellwig
2016-10-18 20:11 ` [PATCH 5/6] nvme-fabrics: Print network address if address resolution fails Bart Van Assche
2016-10-19  7:27   ` Johannes Thumshirn
2016-10-19 10:39   ` Christoph Hellwig
2016-10-19 17:02     ` Bart Van Assche
2016-10-20  7:54     ` Sagi Grimberg
2016-10-18 20:12 ` [PATCH 6/6] nvme/rdma: Make nvme_rdma_conn_rejected() more informative Bart Van Assche
2016-10-19  7:29   ` Johannes Thumshirn
2016-10-19 10:41   ` Christoph Hellwig
2016-10-19 17:08     ` Bart Van Assche
2016-10-20  7:57   ` Sagi Grimberg
2016-10-20 14:35   ` Steve Wise
2016-10-20 17:34     ` Bart Van Assche
2016-10-20 17:45       ` Steve Wise
2016-10-20 18:05         ` Bart Van Assche
2016-10-20 18:11           ` Steve Wise
     [not found]           ` <012601d22afd$5a310460$0e930d20$@opengridcomputing.com>
2016-10-20 19:51             ` Steve Wise
     [not found]             ` <015201d22b0b$4f526440$edf72cc0$@opengridcomputing.com>
2016-10-20 20:41               ` Steve Wise [this message]
2016-10-20 21:08                 ` Bart Van Assche
2016-10-20 21:12                   ` Steve Wise
     [not found]                   ` <018701d22b16$b4927e20$1db77a60$@opengridcomputing.com>
2016-10-20 21:35                     ` Steve Wise
2016-10-18 22:16 ` [PATCH 0/6] Six NVMeOF-related patches Keith Busch
2016-10-20  8:02 ` Sagi Grimberg
2016-10-20 17:38   ` Bart Van Assche
2016-10-21 13:32     ` Christoph Hellwig
2016-10-21 15:08       ` Keith Busch
2016-10-21 21:33         ` Sagi Grimberg
2016-10-25 16:48 ` Sagi Grimberg
2016-10-25 16:55   ` Steve Wise

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='015c01d22b12$5e9f4e70$1bddeb50$@opengridcomputing.com' \
    --to=swise@opengridcomputing.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).