From patchwork Mon Nov 6 19:55:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10044373 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 7B8EF60247 for ; Mon, 6 Nov 2017 19:55:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C77329E3B for ; Mon, 6 Nov 2017 19:55:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 616C029F09; Mon, 6 Nov 2017 19:55:53 +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 DF78A29E3B for ; Mon, 6 Nov 2017 19:55:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754018AbdKFTzw (ORCPT ); Mon, 6 Nov 2017 14:55:52 -0500 Received: from mail-by2nam01on0064.outbound.protection.outlook.com ([104.47.34.64]:48458 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753973AbdKFTzu (ORCPT ); Mon, 6 Nov 2017 14:55:50 -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=TtWPUTjDoeroo4FX6lVz+iRcEK47nEfax7Kr1e/frO6wwP/wsbrm08MmQC4R0MWw3zmRN5RknKEjY4B+PghzLyaobQ6KW8fUS04MA936+Kkmx2BK11j8In9LNt7R9mYPffHq7m2iOI0N2qMnhA80xCQhYpkPURAszRNdvoc4Gxw= Received: from DM5PR07CA0047.namprd07.prod.outlook.com (10.168.109.33) by BY2PR0701MB1942.namprd07.prod.outlook.com (10.163.155.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Mon, 6 Nov 2017 19:55:48 +0000 Received: from BY2FFO11FD039.protection.gbl (2a01:111:f400:7c0c::195) by DM5PR07CA0047.outlook.office365.com (2603:10b6:3:16::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.197.13 via Frontend Transport; Mon, 6 Nov 2017 19:55:48 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; 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 BY2FFO11FD039.mail.protection.outlook.com (10.1.14.224) 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; Mon, 6 Nov 2017 19:55:47 +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; Mon, 6 Nov 2017 11:55:31 -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 vA6JtVv7017455; Mon, 6 Nov 2017 11:55:31 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vA6JtVUR017454; Mon, 6 Nov 2017 11:55:31 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 3/4] qla2xxx_nvmet: Add FC-NVMe Target LS request handling Date: Mon, 6 Nov 2017 11:55:29 -0800 Message-ID: <20171106195530.17408-4-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171106195530.17408-1-himanshu.madhani@cavium.com> References: <20171106195530.17408-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)(346002)(376002)(2980300002)(428002)(189002)(199003)(4326008)(316002)(42186006)(54906003)(110136005)(8936002)(81156014)(81166006)(2906002)(8676002)(69596002)(1076002)(80596001)(356003)(305945005)(189998001)(50226002)(16586007)(86362001)(5003940100001)(50466002)(48376002)(47776003)(33646002)(36756003)(5660300001)(76176999)(72206003)(87636003)(478600001)(106466001)(105586002)(101416001)(2950100002)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB1942; 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; BY2FFO11FD039; 1:0XtbYNCqcoYZXwEGDLvmWS8cl29Am3HfW8ieS16MXNK5mplMGwSl0BO1p7Zpd76BO5XPJd6jx/8dL/PgJGHSwvjZlKE2c7AR0kglgdEZtlCu2b3SVsR365JhnQuvm1Ur X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23929a69-e923-4bf6-41bf-08d525505fe7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BY2PR0701MB1942; X-Microsoft-Exchange-Diagnostics: 1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eYOZV7aRtY62iM194tk7Ums3HOTRr0uKH54NoVNmGkDxyjXz9bjErn5PuRWMPVzX8XqaJCtFUgxmMI6avtzAKnhyCqSnZoct1PxVgyWiR2d29mZD9DegEspRYLvg15hA5xkpZ80RJkUYkf2Mg/4R9y4JsLcrhGOmmQsFxUANnAy3c2DRUo6m53nQDZxcJJZ/q6Tjjfrp8HOuXv5YrsqMiKp1LRlX34I+NA5Qz8xKjkdrBtemFt4R9PagRIKhpAULm+Z5P6bPiRG1im+c+8ZQNIfBo+m7kHSO+Y+1o1vsehN4BTpY7LLCHvtrhx0h7mqVhD5JfLJWqHKbDzNDU16IBVGN54S+IzTOACZR/NyqFjY5BCr7BfZIZDsOZ1N0Qm8tWSNAZdAdkDe+oTWf8fhtu9VNvChqzzF07XfeLnqF5eIDHeylGqV8Sis4w0tlMNviVTrqyYVKvFDUd9z0X7oTIUF/Lk6C/bZAiSkO2ve 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)(5005006)(8121501046)(3231021)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR0701MB1942; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR0701MB1942; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1942; 4:/KKD8U0J9bl/oNkmsHAuj2b4aHnyUXBJGne3nZcP76SAQ+kI8b5hPWMcdFeQSVulCwktHtIEcAcjl8/LJSs+4Sbg+A9oq7Jhd0h4N4m8qdJOvuHOA7SFmu+lRR5DzTm4heHBxT4bfayHg+qiICpIXGTsbqfNJapgnCEouNkyMU8/plShn0e0Mf4HWn/JUCteb6D1SpRFXgaMr+aXubWb7SdjkkcBNuskhF02HbHd7UuGn0vFoIE6J6FQ4u61WgACtMV4bEffW1RJfJCNUIO5Gg== X-Forefront-PRVS: 048396AFA0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB1942; 23:KsmFE1IMUurOMmXjgDT2Kt2J4Y0mUVZjhxbuYKE?= =?us-ascii?Q?3Tm9631QPp9pxOUU4jOONIZUCKAWdV7JJ6Q6cFHQuUHL3bkJ8FNA642yXfNV?= =?us-ascii?Q?mv+mB+Bole6uzfA31NPxjZl5jU7Z1bpAL19hrqN0Kfq6c+4VYQt95eBoZbaC?= =?us-ascii?Q?sAgZUq6EBqMb8yeq6IHdqsYOXQSR2OhZELqSssyVQCAPyzNhxvVK8zWyT87S?= =?us-ascii?Q?2iLUX48Pz1GnHF8numCobPR2oqyCr8AGc/MUnhgJDPTxl/f15o6DwnmIxcyQ?= =?us-ascii?Q?ZQKTB0pka9rokF+1I6OgU2JhB7j4TDhuNuCv6pRnc4GkMZdIxHAN4J+I+24o?= =?us-ascii?Q?iLii5mVgzQtcCiOL/m6QhuyahcRUKcPyxZlTFEgxKaMlnnzVXUo1fMir+psr?= =?us-ascii?Q?zxUZL0S7sXx+mNnFMwAM0AIxEjYS1aPBdrR1Cee/qybX09y5RLbCj+7BWerE?= =?us-ascii?Q?IOfDtKLwtrg646qgqhNs98tzC1RJePQuKjNlszvHVg8zRsM3DkGteMIc+dQ3?= =?us-ascii?Q?QqM4EhRZbTbs4PRrrLsPyR9rqjsuav3coV3NnfIwvxxQgaGoyEgURo/FDn0E?= =?us-ascii?Q?RHKDwOSJFhDl/lfEkRfgNEjPoBCkKNTC2eybJNoQ3rgGQF7UVaOSRbwr55Mu?= =?us-ascii?Q?AUBhE46vj5b13z+wAS9ZH9sRoztXDbRVJriP3t0WUCRvnSy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wdWR2mg6E6NoKn8kLHgMEPzwMvtuAtBLoAbQR3/2kr+ECt0kVE=; 7:lOBqix7dN9bz6Uz/II3D9rVt1dHrnlOCanLZP58m0X+XHAA9lp8JFKoSJ+gpckctvYV265vppEUMHESb0vKymxGDoHCccnA+HHbUQmba1yKehRZHFR0Z5TUUYm4JZX+iBrRACW4DtKmsBC4Qn2pyN9i4oTIZ46xdUizEu0PH4iEOGpDwvKvjHqX+XVZAUq2pXqXdm8ELLt6noOg+rboxAPzC1AmM9ZZ4yeIXxnNkosu5R/z7YWm59cA/tWTxUS0H SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2017 19:55:47.7211 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23929a69-e923-4bf6-41bf-08d525505fe7 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: BY2PR0701MB1942 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; }