From patchwork Thu Nov 9 03:17:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10050045 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 2593C601EB for ; Thu, 9 Nov 2017 03:18:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B7272A971 for ; Thu, 9 Nov 2017 03:18:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FD202A977; Thu, 9 Nov 2017 03:18:12 +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,DKIM_SIGNED, DKIM_VALID,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 C06A72A967 for ; Thu, 9 Nov 2017 03:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751770AbdKIDSI (ORCPT ); Wed, 8 Nov 2017 22:18:08 -0500 Received: from mail-sn1nam02on0087.outbound.protection.outlook.com ([104.47.36.87]:9967 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751660AbdKIDSF (ORCPT ); Wed, 8 Nov 2017 22:18:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BDB+nt0tGThs97FLZxLtcGsNFtMMWrCE98soeKepGm4=; b=degJHPm3WNjiXSsYKKX1MU7iktvYWXEQvwpnxpBVm7ZTGMm7TzdN5kH+pNekz7Z0CDr9Z1eQMspOuEKhFWp7GNM6YoMk8QtI9L8fkqEE3apfSMTrxdDiRlfCs/XAy457vwvcpujN6Vur4Xjo9y0ZLqdKIkF/X5Gy9NdufbsZXs4= Received: from BY2PR07CA0031.namprd07.prod.outlook.com (10.166.107.26) by BN3PR07MB2515.namprd07.prod.outlook.com (10.167.4.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Thu, 9 Nov 2017 03:18:04 +0000 Received: from BY2FFO11FD043.protection.gbl (2a01:111:f400:7c0c::118) by BY2PR07CA0031.outlook.office365.com (2a01:111:e400:7bff::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.197.13 via Frontend Transport; Thu, 9 Nov 2017 03:18:03 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; HansenPartnership.com; dkim=none (message not signed) header.d=none;HansenPartnership.com; dmarc=none action=none header.from=cavium.com; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BY2FFO11FD043.mail.protection.outlook.com (10.1.14.228) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.178.5 via Frontend Transport; Thu, 9 Nov 2017 03:18:03 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Wed, 8 Nov 2017 19:17:56 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id vA93HtZc010320; Wed, 8 Nov 2017 19:17:55 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vA93HtBL010319; Wed, 8 Nov 2017 19:17:55 -0800 From: Himanshu Madhani To: , , , , , CC: , Subject: [PATCH v2 3/4] qla2xxx_nvmet: Add FC-NVMe Target LS request handling Date: Wed, 8 Nov 2017 19:17:53 -0800 Message-ID: <20171109031754.10270-4-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171109031754.10270-1-himanshu.madhani@cavium.com> References: <20171109031754.10270-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(2980300002)(428002)(189002)(199003)(110136005)(16586007)(54906003)(47776003)(316002)(42186006)(189998001)(2906002)(1076002)(36756003)(8676002)(33646002)(2201001)(8936002)(81166006)(48376002)(106466001)(81156014)(50466002)(5003940100001)(4326008)(101416001)(105586002)(87636003)(76176999)(86362001)(478600001)(72206003)(50986999)(69596002)(2950100002)(80596001)(305945005)(50226002)(356003)(5660300001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR07MB2515; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD043; 1:SJmZzmOhuxr1+4at9/COiQCivefMKPPtSAgLYzGJny3PLDPBvUbpVVIH5IDcO1nxhgutY6lE3Njt/xdhJXWywhm3pig5ATT/2iYptliM/0cHKwNnMtCUBy4Aogv5HzDs X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f6c86f3-bdbd-4532-2758-08d527207d4a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BN3PR07MB2515; X-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+0lVDqJ4IVkYctqEypOWDvbdB/wW4s//WEKGjB2ffjMPTlcc8r2QdpyY7XlYBux/bJx23Nz8VnWYIRTfzHM8jcgZPLI8USp1tqCSLAJzDHF3Fec8PzzmLgu4b0WWWDbg2zl8WcMPSlppO0BHEmd4Zl1k/5yedpHMKASxqIr6Iyk57bJ70tyXxkqiBhiX8hDOwFcnAHs+Jdzj+eF8UQwLpfd6IGwEj2JJswxlKg+7n+YqqjC5uf47wcEpoHlgcoUznnA9EDOus5ppWSXugrFhvMNFVRQqr4UTYU8rc4nbrcGH0WweqK25nbxQfZ8aGF0HA45cDb49IZ1I3lf4tFhm1BL8lzgHWfBzTNk8VYxdyubXZTgkzFiQd+wvgJEthtuPnkF3C1fJeanx9BNKcDPEQ6Gr4I/8OERzUmZrG0zrKYelcF86Qtfw/5I9QrO9TTt2DQbJYDHyomLWne46CLSjXgrTCo6fP73UFPZ1I5+4frkgrbiK/Mbrw72+xa X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(3231021)(3002001)(10201501046)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR07MB2515; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR07MB2515; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2515; 4:G5RlrAchVKjnMIe1rCrR0SsBrY9I9gN4X2RhnI80yf37Ad1glkZKCqr2gTGK7SuWCrg/LjXR5aFi9Vscl3Qaqx7MvaprlWURoxIEprKA+MpzPFFJBVdre7KwSlQglIDUbJJXzEXCnlr84iU6Eon+HujpEEFH+cfX6lppTGXpAk8780B6cptef0oY7hhpOuAqxlgowo6IRkiWEWsocSLtS/Xis1yJ4ml0OVjaFUGQ5P7KafNwur70yURM8JMOhn8MvQRQ4oYYqkV092LDO7REZA== X-Forefront-PRVS: 0486A0CB86 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR07MB2515; 23:nOlQMzrk2FI2JBBoW7qqbhdjK9Ki5gEmWqkZfPtKY?= =?us-ascii?Q?TBZzjnjGtduWxPyEIJ+9VDm+dABC8nEcm8GsJU/3TP5JuAV+g16d3Skyu3hQ?= =?us-ascii?Q?SptYijQU7bk2vZigyTTjeuKrJFhnIrhRvrN82Xzs9HWtL0o8++mEI3RrMbIN?= =?us-ascii?Q?O35qDtMUqs9ZNliaChISH+c7yRLsKh4hnVhq94S4flf6bjNMdevQrg3Q+0/V?= =?us-ascii?Q?v+vl7RypStpUZ6id/Mw2qdz1wAOhj2VgR3OScpaZdnZLRjooK9iiQPTNlUDL?= =?us-ascii?Q?jFEAooAtUfp0W0yxvAjpALjcJxZC+RZXiB6c0AwbF4g8sNtDxtTVgOAaBxyb?= =?us-ascii?Q?V9td/tUTElPXqWNklz0QvK2D7tcgXcXwVwTXJWYtAlga8ySp+aSZVlNylm1g?= =?us-ascii?Q?g81niyOSaHdRKwotH5t2IRVtVrTXJ+wJtfZvwAqGJLrTOzC2DfKt1nClMnHZ?= =?us-ascii?Q?LGonZRI09Rw5a2pB65v7KJ05KzcvYJmkfoQb9jEaiPO3ymcM1bDNfYkeKPfR?= =?us-ascii?Q?6DK13GxyvF+KRoVzWSJyzWtNwxc/8Q+2xetiIoq5AXq170yakx4aK6dc2uva?= =?us-ascii?Q?eQcGdByyrx5JKGbPpOpkWCmVdJvycJuGxB7kvFKU+b2naQ0aS8Fsg8fraE4v?= =?us-ascii?Q?I1VllPT3afRLRqFCRJE8bPipEOQallg4GGx+IjBcaQx6lremj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gc0qdMgnn/W7fyVHFK2houVKHfyFHfIsRmiNc9lr7YZuOvtXPdXX9pnPHbQMC+l4dBfUxVkDF+ZWip4qA=; 7:XktL9sUsLz7r6A+giN95w+nF5/ug1GFsUi9rbuVgBNAL97M4rWBwLGwmipRLag/CnbQ4gIARrrxr9/hS+3vErKcyofd0E4fbmGEkZQ8Dezq4ceeDKnWQcWMGo4QN2IJBQSGHW/av6nD9iYvsMmWfQcfmzi9TYy/cR9UZOMBqjDqx85hJ4hTZYT2q78Ra92Daz0MixAzQtttydg4m8Ml3zKTCWeO5PWhdfikHMvJND7gFjcDdl8Ojlk3KocMPcRXv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2017 03:18:03.4901 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f6c86f3-bdbd-4532-2758-08d527207d4a X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2515 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: Anil Gurumurthy Signed-off-by: Anil Gurumurthy Signed-off-by: Giridhar Malavali Signed-off-by: Darren Trapp Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_dbg.c | 1 + drivers/scsi/qla2xxx/qla_dbg.h | 2 ++ drivers/scsi/qla2xxx/qla_iocb.c | 42 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 3e9dc54b89a3..974cae74072f 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -67,6 +67,7 @@ * | Target Mode Management | 0xf09b | 0xf002 | * | | | 0xf046-0xf049 | * | Target Mode Task Management | 0x1000d | | + * | NVME | 0x11000 | | * ---------------------------------------------------------------------- */ diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index 8877aa97d829..4ad97923e40b 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h @@ -367,6 +367,8 @@ ql_log_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...); #define ql_dbg_tgt_tmr 0x00001000 /* Target mode task management */ #define ql_dbg_tgt_dif 0x00000800 /* Target mode dif */ +#define ql_dbg_nvme 0x00000400 /* NVME Target */ + extern int qla27xx_dump_mpi_ram(struct qla_hw_data *, uint32_t, uint32_t *, uint32_t, void **); extern int qla24xx_dump_ram(struct qla_hw_data *, uint32_t, uint32_t *, diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index d810a447cb4a..4ac2817e5f8d 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2152,7 +2152,7 @@ __qla2x00_alloc_iocbs(struct qla_qpair *qpair, srb_t *sp) sp->handle = handle; /* Adjust entry-counts as needed. */ - if (sp->type != SRB_SCSI_CMD) + if ((sp->type != SRB_SCSI_CMD) && (sp->type != SRB_NVMET_FCP)) req_cnt = sp->iocbs; skip_cmd_array: @@ -3381,6 +3381,40 @@ qla_nvme_ls(srb_t *sp, struct pt_ls4_request *cmd_pkt) return rval; } +/* + * Build NVMET LS response + */ +static int +qla_nvmet_ls(srb_t *sp, struct pt_ls4_request *rsp_pkt) +{ + struct srb_iocb *nvme; + int rval = QLA_SUCCESS; + + nvme = &sp->u.iocb_cmd; + + rsp_pkt->entry_type = PT_LS4_REQUEST; + rsp_pkt->entry_count = 1; + rsp_pkt->control_flags = cpu_to_le16(CF_LS4_RESPONDER << CF_LS4_SHIFT); + rsp_pkt->handle = sp->handle; + + rsp_pkt->nport_handle = sp->fcport->loop_id; + rsp_pkt->vp_index = nvme->u.nvme.vp_index; + rsp_pkt->exchange_address = cpu_to_le32(nvme->u.nvme.exchange_address); + + rsp_pkt->tx_dseg_count = 1; + rsp_pkt->tx_byte_count = cpu_to_le16(nvme->u.nvme.rsp_len); + rsp_pkt->dseg0_len = cpu_to_le16(nvme->u.nvme.rsp_len); + rsp_pkt->dseg0_address[0] = cpu_to_le32(LSD(nvme->u.nvme.rsp_dma)); + rsp_pkt->dseg0_address[1] = cpu_to_le32(MSD(nvme->u.nvme.rsp_dma)); + + ql_log(ql_log_info, sp->vha, 0xffff, + "Dumping the NVME-LS response IOCB\n"); + ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, sp->vha, 0x2075, + (uint8_t *)rsp_pkt, sizeof(*rsp_pkt)); + + return rval; +} + int qla2x00_start_sp(srb_t *sp) { @@ -3440,6 +3474,9 @@ qla2x00_start_sp(srb_t *sp) case SRB_NVME_LS: qla_nvme_ls(sp, pkt); break; + case SRB_NVMET_LS: + qla_nvmet_ls(sp, pkt); + break; case SRB_ABT_CMD: IS_QLAFX00(ha) ? qlafx00_abort_iocb(sp, pkt) : @@ -3459,6 +3496,9 @@ qla2x00_start_sp(srb_t *sp) case SRB_NACK_LOGO: qla2x00_send_notify_ack_iocb(sp, pkt); break; + case SRB_NVME_ELS_RSP: + qlt_send_els_resp(sp, pkt); + break; default: break; }