From patchwork Tue Apr 18 15:52:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9685657 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 CCF4F602C9 for ; Tue, 18 Apr 2017 15:53:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE9C427D4D for ; Tue, 18 Apr 2017 15:53:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B38412835B; Tue, 18 Apr 2017 15:53:06 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 5844E27D4D for ; Tue, 18 Apr 2017 15:53:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932358AbdDRPxF (ORCPT ); Tue, 18 Apr 2017 11:53:05 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:36827 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757269AbdDRPwp (ORCPT ); Tue, 18 Apr 2017 11:52:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0kMD9hhhARQgg7hDbC1EyDQs15RQDii8mVdWMehRJ+U=; b=c8xPzi66foqYtkGxWkPCp+ZqP OLg6tYMfVvTxJ4DQqn9RBFncp0RvzJdUkssHEHrJmU2BRwm3xTzy4xv9NhBKqHxfVL49V5VcKH8Gp BJYzjhHHrI50DgLlbuCP6Jw/NYXMkkDkfMy61SjsRIqMLD3KtEkAW+Khm0eflam0pIS4CtX/vlXwv rTz2EMO0cPTFEGNSkBuUlBQ+VZSkTDgFGSoMYT9j0zmhX8LlOKOR5ZIgdQSeiEvQTnle0O2BWRkeg wPYlnehwpu6/yMkc9815X4CrnZ7aN+hpC1/aHlFxZI3caBawm10X1voUdBHJ3596LukSbf5WPIqHg IIrZAkZ2g==; Received: from hch by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1d0VQe-0001ZJ-Ky; Tue, 18 Apr 2017 15:52:32 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Josef Bacik , James Smart , Konrad Rzeszutek Wilk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, dm-devel@redhat.com, Christoph Hellwig Subject: nvme-fc: fix status code handling in nvme_fc_fcpio_done Date: Tue, 18 Apr 2017 08:52:08 -0700 Message-Id: <20170418155229.5977-3-hch@bombadil.infradead.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170418155229.5977-1-hch@bombadil.infradead.org> References: <20170418155229.5977-1-hch@bombadil.infradead.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christoph Hellwig nvme_complete_async_event expects the little endian status code including the phase bit, and a new completion handler I plan to introduce will do so as well. Change the status variable into the little endian format with the phase bit used in the NVMe CQE to fix / enable this. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: James Smart --- drivers/nvme/host/fc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index fc42172c796a..aad7f9c0be32 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -1147,7 +1147,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) struct nvme_fc_ctrl *ctrl = op->ctrl; struct nvme_fc_queue *queue = op->queue; struct nvme_completion *cqe = &op->rsp_iu.cqe; - u16 status = NVME_SC_SUCCESS; + __le16 status = cpu_to_le16(NVME_SC_SUCCESS << 1); /* * WARNING: @@ -1182,9 +1182,9 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) sizeof(op->rsp_iu), DMA_FROM_DEVICE); if (atomic_read(&op->state) == FCPOP_STATE_ABORTED) - status = NVME_SC_ABORT_REQ | NVME_SC_DNR; + status = cpu_to_le16((NVME_SC_ABORT_REQ | NVME_SC_DNR) << 1); else if (freq->status) - status = NVME_SC_FC_TRANSPORT_ERROR; + status = cpu_to_le16(NVME_SC_FC_TRANSPORT_ERROR << 1); /* * For the linux implementation, if we have an unsuccesful @@ -1212,7 +1212,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) */ if (freq->transferred_length != be32_to_cpu(op->cmd_iu.data_len)) { - status = NVME_SC_FC_TRANSPORT_ERROR; + status = cpu_to_le16(NVME_SC_FC_TRANSPORT_ERROR << 1); goto done; } op->nreq.result.u64 = 0; @@ -1229,15 +1229,15 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) freq->transferred_length || op->rsp_iu.status_code || op->rqno != le16_to_cpu(cqe->command_id))) { - status = NVME_SC_FC_TRANSPORT_ERROR; + status = cpu_to_le16(NVME_SC_FC_TRANSPORT_ERROR << 1); goto done; } op->nreq.result = cqe->result; - status = le16_to_cpu(cqe->status) >> 1; + status = cqe->status; break; default: - status = NVME_SC_FC_TRANSPORT_ERROR; + status = cpu_to_le16(NVME_SC_FC_TRANSPORT_ERROR << 1); goto done; } @@ -1249,7 +1249,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) return; } - blk_mq_complete_request(rq, status); + blk_mq_complete_request(rq, le16_to_cpu(status) >> 1); } static int