From patchwork Thu Oct 20 22:40:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 9387703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F27C607D0 for ; Thu, 20 Oct 2016 22:44:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56CBA29CBF for ; Thu, 20 Oct 2016 22:44:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BD0E29CCD; Thu, 20 Oct 2016 22:44:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E25B729CBF for ; Thu, 20 Oct 2016 22:44:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754792AbcJTWoR (ORCPT ); Thu, 20 Oct 2016 18:44:17 -0400 Received: from smtp.opengridcomputing.com ([72.48.136.20]:36771 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754285AbcJTWoQ (ORCPT ); Thu, 20 Oct 2016 18:44:16 -0400 Received: from smtp.ogc.us (build2.ogc.int [10.10.0.32]) by smtp.opengridcomputing.com (Postfix) with ESMTP id 4E43B29ECE; Thu, 20 Oct 2016 17:44:16 -0500 (CDT) Received: by smtp.ogc.us (Postfix, from userid 503) id 4342DE0C53; Thu, 20 Oct 2016 17:44:16 -0500 (CDT) Message-Id: <60243a2ce17e08cdc93600b9998698dbd7f83306.1477003235.git.swise@opengridcomputing.com> In-Reply-To: References: From: Steve Wise Date: Thu, 20 Oct 2016 15:40:29 -0700 Subject: [PATCH RFC v2 3/3] nvme-rdma: use rdma_reject_msg() to log connection rejects To: dledford@redhat.com, sean.hefty@intel.com Cc: linux-rdma@vger.kernel.org, bart.vanassche@sandisk.com, linux-nvme@lists.infradead.org, sagig@grimberg.me, hch@lst.de, axboe@fb.com Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Steve Wise --- drivers/nvme/host/rdma.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 601aecf..6319c26 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1237,18 +1237,22 @@ out_destroy_queue_ib: static int nvme_rdma_conn_rejected(struct nvme_rdma_queue *queue, struct rdma_cm_event *ev) { - if (ev->param.conn.private_data_len) { + struct rdma_cm_id *cm_id = queue->cm_id; + int rdma_status = ev->status; + short nvme_status = -1; + + if (rdma_consumer_reject(cm_id, rdma_status) && + 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", rdma_status, + rdma_reject_msg(cm_id, rdma_status), nvme_status); + return -ECONNRESET; }