From patchwork Fri Sep 28 22:46:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10620511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B9C1B913 for ; Fri, 28 Sep 2018 22:46:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6BEB2BE78 for ; Fri, 28 Sep 2018 22:46:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AACF2BE81; Fri, 28 Sep 2018 22:46:48 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 14E882BE78 for ; Fri, 28 Sep 2018 22:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726981AbeI2FMm (ORCPT ); Sat, 29 Sep 2018 01:12:42 -0400 Received: from mail-sn1nam01on0067.outbound.protection.outlook.com ([104.47.32.67]:23170 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726691AbeI2FMm (ORCPT ); Sat, 29 Sep 2018 01:12:42 -0400 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:X-MS-Exchange-SenderADCheck; bh=sDRdgPz2Of482zzy56QGZptYKOfJl1CsIXrgdssahUg=; b=O1+A0KBXD4nikk/KGGyXEa6RBvwcglFN93P6wItp12o4KdR90QrdCAXlL+sOxbkanrpjqMbpe2vcU5E9ty2flI6Gu+I24DRmk2uU92R/jIcVZQMWPwp9KH/7DQ8AquOOXn/EHmstvdIE9JvQ5/37Vzp1Lxj4gUPAi2a38Ohi1kQ= Received: from SN4PR0701CA0016.namprd07.prod.outlook.com (2603:10b6:803:28::26) by DM2PR07MB1452.namprd07.prod.outlook.com (2a01:111:e400:50c3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.22; Fri, 28 Sep 2018 22:46:42 +0000 Received: from DM3NAM05FT042.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::209) by SN4PR0701CA0016.outlook.office365.com (2603:10b6:803:28::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1164.22 via Frontend Transport; Fri, 28 Sep 2018 22:46:42 +0000 Authentication-Results: spf=pass (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by DM3NAM05FT042.mail.protection.outlook.com (10.152.98.156) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256) id 15.20.1185.5 via Frontend Transport; Fri, 28 Sep 2018 22:46:41 +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; Fri, 28 Sep 2018 15:46:27 -0700 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 w8SMkRAa019828; Fri, 28 Sep 2018 15:46:27 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w8SMkR67019827; Fri, 28 Sep 2018 15:46:27 -0700 From: Himanshu Madhani To: , , , , , , CC: Subject: [PATCH v3 4/5] qla2xxx_nvmet: Add SysFS node for FC-NVMe Target Date: Fri, 28 Sep 2018 15:46:25 -0700 Message-ID: <20180928224626.19777-5-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180928224626.19777-1-himanshu.madhani@cavium.com> References: <20180928224626.19777-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)(376002)(346002)(39860400002)(396003)(136003)(2980300002)(438002)(189003)(199004)(486006)(81166006)(8936002)(47776003)(76176011)(106466001)(476003)(16586007)(26005)(2906002)(44832011)(126002)(186003)(72206003)(2616005)(36756003)(4326008)(8676002)(50226002)(86362001)(81156014)(107886003)(1076002)(69596002)(51416003)(5660300001)(2201001)(80596001)(316002)(42186006)(50466002)(305945005)(48376002)(34290500001)(110136005)(356003)(106002)(11346002)(336012)(87636003)(478600001)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR07MB1452;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;DM3NAM05FT042;1:LTQSB+mp6RNc4XHr3kVt3PLHE8P1ev23PVSdeFBQXR08JQhFdCil/VR7FqRwpttfCN42HFssOpcGXt5Av/lkRtsC+s0svwi67mGz5CuqKheQi3cyo4FlAAVHSBvNhamk X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef5921ff-f574-4c8b-7395-08d62594427a X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM2PR07MB1452; X-Microsoft-Exchange-Diagnostics: 1;DM2PR07MB1452;3:0/Vydi+CBlaRIwTuBTiqy0kcjWpAXKd62ZXYhIHhoHOv2FdWDTYo9xI/xAGuhkrKidx5GMYiTFidBXvJlUQ7B6JAfomFz/D+QTUCohMmr+uLtI51q9mQ2n+fmgOhNplMXsYJbbU5gUbdh8hsOsLrnRFgx/Wwk8CWsjowU0Cz/mIGloVVMdRj5pbxJJm3oYrj8RjlbOaHlno8ABSE+fAveCM4YBOOim7sZsF3BjesDXDJKIdV07RDp9VqmwQz/T58mGvEOVb1IoBeoef7cPQhe+V8fleUsRmzzsSjcc+EbzXIkVZccPHjhkWvVbgAOXYOrVG4zvCH5DM0trG3v5U9oReH5pFPB1Fs6lnXunvu8W8=;25:ryaQvXXTbZZvY1Y2xu+q3xTlyma56ZiWNiw1NFtWWI1ZeAYcf4+ZTwrjc3/nQ3KNdIxiHh9uwlDtUFvyO0GdFbHlAaaaeXdffD5T9ugxhuy98nnlYFxDb2OsKxWjDhC95xz8eCKnzW//SWb0dJt3ZhBMwJV9ap6bJnBb3F1OoACBG4aj4JYT0S2pKP15zHFpnzEcbIFzBWg3wiI8X6zR7k+m4zNIHfm8IeMGDSF7TQXFbMMpHlPFUqzkc0Km8MeHnR2rSJ9yM35tmqos227iX0mhw0b8Or2EBTc1NCE+0jc2w4CVbLnngUt+JCXZwdsPdaJdlq9bedXDs1/S1SmzZ9Q8lvibvBf+89cNfMgrCuI= X-MS-TrafficTypeDiagnostic: DM2PR07MB1452: X-Microsoft-Exchange-Diagnostics: 1;DM2PR07MB1452;31:wvNFcOX3W9L+hHMTmTrfAIAGe7px0zlz+Z0x3pIEeeeVDd5S59HAHnrv5edLaIRaxOuAbhL29lqXR9y/pxZxJh8VRV+nFe+HeujwqxOc00NSV66K9Q9sGVGamNhUlFkKa/uWDF2tbGGYCSpsPAKLScw4Z5H6tyotz5fN+TdD7v26OCcBUTVP1FtRtani0L0AntYz3KqYXNqVRuaG9tYOIlNd7Ese5EKXM8zeTVsvBJQ=;20:YlmbSo2zKoWJVKuAbWsW9QsGH4plV7bbjutshJ4CdSyTYsiOHbO6c1EQArZeSmzYDOdiL9vSapjc8c6vW1gq09UhkWMAV2sfRihyxk7JgmgULTLV565bUVzMz/q7fw/f8Uu+Dul1atUFqG2a8ufYfTsWjn6KIAzNUPbV4ElCATyRVu5lewBvP/bVjjWrDLKM7WeJil2sKakpRUc+borOil6ysMZBdS0vAQr4hpa5dILeP4EFH46GqWlEWUYJjBUMS5ufvbQ1NodPGHIAlK2N87QrO/LvnQYV0bnMgsOg4olbel9Y1x/xgMvJ+jeG+xeE2CWjCcxtgfUTIOJ1dzuOJMtCvDdKxDJqsBxJERXhCBYd3RAVaUbQOjMMYs17gcJuSE4VIRGvD7EcVdB9f5oMG4XkkGU8aRU+u6MyoV5xbuBK/seCLGSQxtNXp/lxTCO2x6pk4tawPdOYyiv++47gq3+5vXPCtgT1t0Avx9SfAV7NxtMmtG+5TQlX8r3agRzp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93004095)(3231355)(944501410)(52105095)(3002001)(10201501046)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051);SRVR:DM2PR07MB1452;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB1452; X-Microsoft-Exchange-Diagnostics: 1;DM2PR07MB1452;4:F0LzZGh16ZETtBMCGeo7Y7pdR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Hlif4dIt0th91v91E6llWxNA69k2kL52DJYpQ9B6usLUf/LUhov97T5Z65uqc0exVQgf1+IBltJ+m1cVAvhWLohny2zrPQr9lfbH7Kb2B0GM34yAnKxn0HCLm57/lvfkg0SsWFhyrd5/lMbSvRlyn/Y+NWQZNfhm/6QIxM291JnVkKnyBlK8Z1DZ1qbBuIWisTszZAT6cLQjTUHg==;5:5OXalMB1KR1ek/tFFsH3mveL7H5ayVUU0nT6SkouxCXYeYx7Jb5M47ocmtlaRaZDjI2DP6zdiVW7REaKfyg71WMzm/NEbWFCuGaUD+YXfV8LxmMriOpoYmc94ODC+2oWo1TWbJkw1hP3tAWi6a8awr6WVyutG0+ZO15qkiVG+IE=;7:3x+77EIXNm1+DBkz87K9f3paIIx7tbjXuqTZJKkf/6esn/eWpSRB3iM2lgUWLRRI2/vq/HHvuinBWvR7cpe2I9oKI8GGF97njkbOwD1E/B1ZsQZi7EzB6Oh/0lrCCiBmd7sth8qNo8C90oseOmuEbk1oj7g3CpofBcFGoiBRIf9IpF1jYsNcpuu9eyEX/cP/e7HYyzkKrhKg3L4Ak8Lv1x+l6q+E1WJMLdOBReeVpvakxA7li1Otbh4w0xZ5OTNU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2018 22:46:41.4900 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef5921ff-f574-4c8b-7395-08d62594427a 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: DM2PR07MB1452 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 This patch adds SysFS node for NVMe Target configuration Signed-off-by: Anil Gurumurthy Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 33 +++++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_gs.c | 2 +- drivers/scsi/qla2xxx/qla_init.c | 3 ++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index a31d23905753..0d2d4f33701b 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -13,6 +13,7 @@ #include static int qla24xx_vport_disable(struct fc_vport *, bool); +extern void qlt_set_mode(struct scsi_qla_host *vha); /* SYSFS attributes --------------------------------------------------------- */ @@ -631,6 +632,37 @@ static struct bin_attribute sysfs_sfp_attr = { }; static ssize_t +qla2x00_sysfs_write_nvmet(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj, + struct device, kobj))); + struct qla_hw_data *ha = vha->hw; + scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); + + ql_log(ql_log_info, vha, 0x706e, + "Bringing up target mode!! vha:%p\n", vha); + qlt_op_target_mode = 1; + qlt_set_mode(base_vha); + set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + qla2x00_wait_for_hba_online(vha); + + return count; +} + +static struct bin_attribute sysfs_nvmet_attr = { + .attr = { + .name = "nvmet", + .mode = 0200, + }, + .size = 0, + .write = qla2x00_sysfs_write_nvmet, +}; + + +static ssize_t qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) @@ -943,6 +975,7 @@ static struct sysfs_entry { { "issue_logo", &sysfs_issue_logo_attr, }, { "xgmac_stats", &sysfs_xgmac_stats_attr, 3 }, { "dcbx_tlv", &sysfs_dcbx_tlv_attr, 3 }, + { "nvmet", &sysfs_nvmet_attr, }, { NULL }, }; diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index ea55ed972eed..cfc6818952a0 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -698,7 +698,7 @@ qla2x00_rff_id(scsi_qla_host_t *vha, u8 type) return (QLA_SUCCESS); return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha), - FC4_TYPE_FCP_SCSI); + type); } static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id, diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index cad8e0185a3b..fe1c1892386a 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5526,7 +5526,8 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) * will be newer than discovery_gen. */ qlt_do_generation_tick(vha, &discovery_gen); - if (USE_ASYNC_SCAN(ha)) { + if (USE_ASYNC_SCAN(ha) && !(vha->flags.nvmet_enabled)) { + /* If NVME target mode is enabled, go through regular scan */ rval = qla24xx_async_gpnft(vha, FC4_TYPE_FCP_SCSI, NULL); if (rval)