From patchwork Wed Oct 31 16:40:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10662945 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 79ED213A4 for ; Wed, 31 Oct 2018 16:49:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 697D72B312 for ; Wed, 31 Oct 2018 16:49:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D55F2B314; Wed, 31 Oct 2018 16:49:35 +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 D67FE2B317 for ; Wed, 31 Oct 2018 16:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729969AbeKABsV (ORCPT ); Wed, 31 Oct 2018 21:48:21 -0400 Received: from mail-eopbgr700066.outbound.protection.outlook.com ([40.107.70.66]:29332 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729965AbeKABsV (ORCPT ); Wed, 31 Oct 2018 21:48:21 -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=CIb403z+spQ5E9/v8FGDb2VHCn1SspFd7umMXkVz3hA=; b=CH5AUZYAhzBGjRk55mbXFeCKyULfkxyramyEbgR3TUQlAo1NFb+qrLbPhDGBoznzK17U0JKYvTTiUffaeq/ve08FRcFr2b8kLgRp9IUUjcyhaiin3IrVkp2aty+UuzPBiIkfXtzhrYgku+RB22YxVL7gLyElpkyJUjZaqU8XU5o= Received: from CY1PR07CA0001.namprd07.prod.outlook.com (2a01:111:e400:c60a::11) by SN6PR07MB5758.namprd07.prod.outlook.com (2603:10b6:805:f0::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.26; Wed, 31 Oct 2018 16:49:30 +0000 Received: from DM3NAM05FT042.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::204) by CY1PR07CA0001.outlook.office365.com (2a01:111:e400:c60a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.21 via Frontend Transport; Wed, 31 Oct 2018 16:49:30 +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) id 15.20.1318.5 via Frontend Transport; Wed, 31 Oct 2018 16:49:29 +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, 31 Oct 2018 09:41:00 -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 w9VGf1JB006337; Wed, 31 Oct 2018 09:41:01 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w9VGf1Z9006336; Wed, 31 Oct 2018 09:41:01 -0700 From: Himanshu Madhani To: , , , , , , CC: Subject: [PATCH v4 4/5] qla2xxx_nvmet: Add SysFS node for FC-NVMe Target Date: Wed, 31 Oct 2018 09:40:58 -0700 Message-ID: <20181031164059.6286-5-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20181031164059.6286-1-himanshu.madhani@cavium.com> References: <20181031164059.6286-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)(396003)(136003)(346002)(376002)(39860400002)(2980300002)(438002)(199004)(189003)(76176011)(2906002)(6666004)(575784001)(86362001)(356004)(107886003)(305945005)(1076002)(4326008)(336012)(51416003)(87636003)(478600001)(26005)(106002)(42186006)(106466001)(186003)(2201001)(47776003)(316002)(48376002)(16586007)(5660300001)(72206003)(80596001)(69596002)(50466002)(44832011)(11346002)(8676002)(81166006)(50226002)(8936002)(486006)(476003)(2616005)(81156014)(446003)(36756003)(110136005)(126002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5758;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;DM3NAM05FT042;1:wxmnId9YagQvMXwTv/7gRTQID3BD6ktZDRwtce5BzG/18IVoZF9FFqXoJxl/FmZ/AhTuts1m8ExhpBMhqh7UEAj4ac2a0tMEuVhrkWMEPTnaCpw4C525Qqa2D9KkZc3K X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0217f6c5-baf8-48a9-7c2b-08d63f50d3ed X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN6PR07MB5758; X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB5758;3:9Q5INNMkbxPhCNi/O+TKKJ2HwmsyzPFe9ugAroiVYhnQFYzAZwOWYtvBqPIvNwNbW0hFc/9PQWxA+1S4KDzQNDjXcxJBSnxqqcHvrJJFnDicRo/NxaVClupdSNFUnUsJQ5ksywgKDGvnIR+UcgYb88jofcTrmHgpNS+wrDGYua+rgXuJnzSIG3ctmZzzhT4thlw0RO96yyUFVeOyJp/lqqWN4CLEcPAxproZBO3LTmAb8JTS8waoN0/jqITywiXXyftlxGNCjn3Pj6p9XRsjf78LzPGMn5IPLXoTUlccQyk5J6yCW14DATz2Kow+0wLP8RpXCkMvWshbqber6SC1qkBOwJa+967U8h1tNWgc37g=;25:/Qb/U+Il6cBKReMa38q5n4tzsYBwoCgBmPw+V+1q60dWPuGhfwyAf7u7MABV4n8kEWQqoWo+0LiIsRvMFMsyjR6/3B8JKGEUbyOLaJpNWPQiMFyPQ5LqylHYNapTKUHnG6nafuOK8GgTFDeczP4oIbDf+Idd9vNNxntR5hfEjgugoUnCO0+aJXzW58YREJWD9mMOHKrKXqmGRwH3YhOnh4nlWMqwQCXv173I47iKE2kZ67prADdgvfRok12enxr9W0mnTAAYKyA2gT4QBmw3z2CozgvYD2ywHmy8jkQ+qDLzUS24Wxa10dRA9c9JpNyiB4jvYw2iWpR/UnRVhXBCPw== X-MS-TrafficTypeDiagnostic: SN6PR07MB5758: X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB5758;31:OJ4/WjX0insbpWhiZ5ZrYj/i9Z7s8UhzZnY0cgqtaAek5Bl0jcPy98OgCaNSDLk9TM3u9z600UKqHYXZJctX02q8RWoLqT9P62HRwIyeXdpobbq7to3wY32atppvQWCldcUWrQrgwj1LQqMN1/1wp0njI8y3qbpx4JVIRZfk1f3gVzHiWlrM1FcuXGsUmY2VNw3CFJyBVXOHXUtgbl6ZhOwUyFCYuRaC5pU6ov0Wk6w=;20:LKJBebmGzfkbeUMkKsH0fxYnf08aL6mCOOmrkQbrFh+y4TR2knwSc4nj6xDlUGLHPspwZ7hB2OI86ElTk9AyjxT7lNSKLVqIFna+hgcELYBHMXoq8gNF1vmOB/Mn8lPylhY8XDtOXwvaPoqAcPyeOc+OX/PmHQNYxP/IZQlphQndCRZYc2wp6VhrtLp5YEwBjEL2fu9iJIdDFK/XD50cgXBCxm6dWkamxVR5Dc+8k0J4960Pt5ndrQRnRxMAXcsyBbyk27w8UwTu7HJO+JTrG6dNFQQm6ubCFeAZbI3Q0k/IXdefLdjl004CV9mqfcBW5DfcjRiftgBLqpd/8z5GqNgoiViWS7FCPVcSuJzbERBZqgFOKa2Ray9upNkbG/FJzXEXp7nkEE9taV7vM1FK14nDeQuMhTjN5wCFcrnPiKW/jH/hTrPEz3eapXsAxh2TVRca5i9EatDDZPhdDz5woCZkNpFE37N0BinbdrPxDtS2Hm1VYuBzWCGlaw9HYZ3S 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)(10201501046)(3002001)(93006095)(93004095)(3231382)(944501410)(52105095)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:SN6PR07MB5758;BCL:0;PCL:0;RULEID:;SRVR:SN6PR07MB5758; X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB5758;4:h5PhfMg58lcnRnjTICWbzJ91cL/7lDs2KkzNN7iPvKVFV1mOZiVJd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FfiGuNMoGSjXNWyvBr2GmLzV4rUhT1o5v5t4t9AuTvie/fAqn1evBaBcvlBGafOTyYAd4P+IgQk4oW6H0tXFL8yRyunZT2QHf+zyYPBjZUG1D2uWaQSEkHc+fLOfi9yRvJVBhJYNQC0a0bpb7NMAbMfQY792XMgWmwekg2qRA+7y/DHRJK2IyJeBzHqEVrTw==;5:ZhDi/cgvfu7LZcZGsFcegKU0dFb5CPjIN2vwzCG9nUjV22wKSzsWbVmt6ThWI47WnKfhD0JklYjwCOFCVHgzbTd7QzCfWaOrBjvh6O7NVuqZ1c5PjzYmHtoJkcpRkFOPwN5Cq3B+za7pY9PiCz698RKp5PF0q/IFezjZoD+jDOY=;7:MNILvONC1Lfk8FbsyFBEjiMaeprqQzuRltd8vRZd2X1jiv6dpRPMjZaKy5+w0HF3t/xDbfQut9KT3zlot/UE21DYkP/RBfJe20Qp7ybaCKXDlBz8RZ5iAxfAJXNtvrgk+cH3qkGimDmDeSKo1dtZzg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2018 16:49:29.9368 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0217f6c5-baf8-48a9-7c2b-08d63f50d3ed 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: SN6PR07MB5758 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 Reviewed-by:   James Smart  --- 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 0bb9ac6ece92..678aff5ca947 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 665964d4f0c4..36d67230c3b1 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)