From patchwork Tue Mar 5 10:58:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839259 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 9916017E4 for ; Tue, 5 Mar 2019 10:59:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B8A5297DE for ; Tue, 5 Mar 2019 10:59:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CFF42AE4C; Tue, 5 Mar 2019 10:59:13 +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,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 B2EF7297DE for ; Tue, 5 Mar 2019 10:59:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727322AbfCEK7M (ORCPT ); Tue, 5 Mar 2019 05:59:12 -0500 Received: from mail-eopbgr800054.outbound.protection.outlook.com ([40.107.80.54]:51484 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726250AbfCEK7L (ORCPT ); Tue, 5 Mar 2019 05:59:11 -0500 Received: from BYAPR07CA0005.namprd07.prod.outlook.com (2603:10b6:a02:bc::18) by BYAPR07MB4760.namprd07.prod.outlook.com (2603:10b6:a02:f0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.18; Tue, 5 Mar 2019 10:59:07 +0000 Received: from BY2NAM05FT059.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by BYAPR07CA0005.outlook.office365.com (2603:10b6:a02:bc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:07 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT059.mail.protection.outlook.com (10.152.100.196) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:07 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:04 -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 x25Ax4CO013224; Tue, 5 Mar 2019 02:59:04 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25Ax43k013223; Tue, 5 Mar 2019 02:59:04 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 01/26] qedf: Do not retry ELS request if qedf_alloc_cmd fails. Date: Tue, 5 Mar 2019 02:58:36 -0800 Message-ID: <20190305105901.13185-2-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571477609426;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(346002)(376002)(39860400002)(396003)(2980300002)(1109001)(1110001)(339900001)(51234002)(199004)(189003)(53936002)(5660300002)(36756003)(316002)(36906005)(2906002)(50226002)(54906003)(42186006)(1076003)(16586007)(51416003)(48376002)(68736007)(26005)(76176011)(8936002)(50466002)(26826003)(97736004)(498600001)(14444005)(305945005)(6862004)(356004)(6666004)(106466001)(86362001)(105606002)(2351001)(87636003)(45080400002)(4326008)(85426001)(336012)(11346002)(80596001)(69596002)(486006)(2616005)(476003)(8676002)(81166006)(47776003)(126002)(81156014)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR07MB4760;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b877c2cf-f5b7-4a4d-9e75-08d6a1599708 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BYAPR07MB4760; X-MS-TrafficTypeDiagnostic: BYAPR07MB4760: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4760;23:QAGro9pLqlTf6tGZ1/RGZ3B5ghrLS2e3l/OYLNriq78J3Sh00lth6t6tzioMrtIXgbl0J7d/H0YdNkYQ0F50Y/Dzknp79w5R7VYKIobp7GdP+yptfCrzIxXYFQCpW3qfvcRo2SuASwKjQMJnPi+YWlFlTJKIjawnf40t+uc9qimmCmf+qYNtVoSSmkOx7qtQXUckf3D+wQQHKOovlv9mp3MqfvKbd8Mr7qdQyW+xmPk6lgW89riexijXth7gR1ZYCLdWxJhPoqsL3CKw2Zj5XFNUzHBq52/ZoYtVCoqOlZ2cbCaO+HRpnmnr3nFOQ/9TmEPTCMFo72olYk7WCDLto7Vm1n4V1CfAwVmRrD3f4oFiuWqaLgsrO7FwzrC+D03NcGsf/IXYQBqmC44gLFeU6KunH/GBdTu8+8IFhAUZCaK+5GrjuxL7x8kVQMYeIXxteD1VwVV+RerW4APi0/biLSGjE8erLQtOpnCsB9gfZE3YNUflrk/oHG8LpSUfCxXhRrGZC7EW4CkG8bkOTYJA0DYwKknD0hjiONqrMUV2qpPwd0BcmfbzHQVsHOb6zxw1fMR/OBEvf1q+Omv16oZx8ro7CFEdTkDOnCdG1vKW03lqLkfmmuqxf+AAHuEka7CqgHTAm2F3LLgqgBsUcJfD9GO+NmoQ1wFyraxmZ14QQ8wotw1uVgNdkiWR4P+EAa8cGOJM0/ozO/q/0T1RxYUMqT6RQk192iLvkyugbCnoJVNyp0iUDfE2L+/n664LZyB9gt+bqutJcONaV/wi75OoB8g0Dytjgvc0eFPS6AfQjak3BMgOr38CQTKot3gYJIiCkIK1yAUgQD6q0VuYtsYpXepvdI8BdNtPXmDoqV/7RCeYZvOeBinzmDmCP5X3IT0PvF3qE2chLJW8gqsGZY4DDotu07b8rLYsNGKpMqKfvBvGJxe40ukHsLgTTYPFvQ7XpSO0ZkHVmbPRBdh14t1iGXAxQa6QNK8z1FX+Yy909djFhVMvr9eqsT0L33H1y4TdYKeQ5RKL5nhmW2RJInvVS58KJC1cg4z+iANjGfZ54jXOAZ1Qf5jOlUAtzuSZTeU7w489+8lNccc7wD5chhO2K5kwhdq0YcBa8ZZOCp8RO2EuZ0bRFdziwLZwYqUdO/LuPuDTQrp4Kc9aysi5n+FbNiwnNXOlYwJgfZdv4KZ6mkV1+Wl3khWac7NlLjoCaUuXJlpYrLzXBerh6xNRAoXvAC4PK1bl5u0Xe5eoWH0EI74pKjsD95WsWcG24qhkqc3FO7im61jYiOtDZcWB7Ch+hAfL64PWWUUqtkarOJpP2NE= X-Microsoft-Antispam-Message-Info: egxduFI8dvButhlz7kmsLXGs9386/6Ur9Wqh7KhrTJoPgjX6nZtmYY2tUUtv7lriXmg8pYIstWT4Shjf/hIHQeUF7vdpYJo0qaf95ukM8lk341e7BGpovsE1gWt5C0ynbN9WcBTHTrC5e4oTI/IB08fhW1SoJKWjI0Ys+Bv8HREtzMe0YFLcvsFR8MeTCa8e64xijpHpYoxPTxBCKNahKLUCXckEw1mW660rWnQ65t4A5GuS2975cU7JGQROqKVM6QuIX26f5ltSObZALAn5n4z8uL+DAASvfRRkTeM4/7n+5f73KdKF3zO+UTO1r6WNcsbGLBY/nFNClGEv499jKtp6H8aOs7+8oDfDoje83tYSEgc66V+Y63eNB2dqg68hgsehPvPo7OQ2Q1xksJzkaKnUjqOoF/xw3/aTFvme2Ds= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:07.5147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b877c2cf-f5b7-4a4d-9e75-08d6a1599708 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4760 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: Chad Dupuis If we cannot allocate an ELS middlepath request, simply fail instead of trying to delay and then reallocate. This delay logic is causing soft lockup messages: NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:1:7639] Modules linked in: xt_CHECKSUM ipt_MASQUERADE nf_nat_masquerade_ipv4 tun devlink ip6t_rpfilter ipt_REJECT nf_reject_ipv4 ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter dm_service_time vfat fat rpcrdma sunrpc ib_isert iscsi_target_mod ib_iser libiscsi scsi_transport_iscsi ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm sb_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd iTCO_wdt iTCO_vendor_support qedr(OE) ib_core joydev ipmi_ssif pcspkr hpilo hpwdt sg ipmi_si ipmi_devintf ipmi_msghandler ioatdma shpchp lpc_ich wmi dca acpi_power_meter dm_multipath ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic qedf(OE) libfcoe mgag200 libfc i2c_algo_bit drm_kms_helper scsi_transport_fc qede(OE) syscopyarea sysfillrect sysimgblt fb_sys_fops ttm qed(OE) drm crct10dif_pclmul e1000e crct10dif_common crc32c_intel scsi_tgt hpsa i2c_core ptp scsi_transport_sas pps_core dm_mirror dm_region_hash dm_log dm_mod CPU: 2 PID: 7639 Comm: kworker/2:1 Kdump: loaded Tainted: G OEL ------------ 3.10.0-861.el7.x86_64 #1 Hardware name: HP ProLiant DL580 Gen9/ProLiant DL580 Gen9, BIOS U17 07/21/2016 Workqueue: qedf_2_dpc qedf_handle_rrq [qedf] task: ffff959edd628fd0 ti: ffff959ed6f08000 task.ti: ffff959ed6f08000 RIP: 0010:[] [] delay_tsc+0x3a/0x60 RSP: 0018:ffff959ed6f0bd30 EFLAGS: 00000246 RAX: 000000008ef5f791 RBX: 5f646d635f666465 RCX: 0000025b8ededa2f RDX: 000000000000025b RSI: 0000000000000002 RDI: 0000000000217d1e RBP: ffff959ed6f0bd30 R08: ffffffffc079aae8 R09: 0000000000000200 R10: ffffffffc07952c6 R11: 0000000000000000 R12: 6c6c615f66646571 R13: ffff959ed6f0bcc8 R14: ffff959ed6f0bd08 R15: ffff959e00000028 FS: 0000000000000000(0000) GS:ffff959eff480000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4117fa1eb0 CR3: 0000002039e66000 CR4: 00000000003607e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: [] __const_udelay+0x2d/0x30 [] qedf_initiate_els+0x13a/0x450 [qedf] [] ? qedf_srr_compl+0x2a0/0x2a0 [qedf] [] qedf_send_rrq+0x127/0x230 [qedf] [] qedf_handle_rrq+0x15/0x20 [qedf] [] process_one_work+0x17f/0x440 [] worker_thread+0x126/0x3c0 [] ? manage_workers.isra.24+0x2a0/0x2a0 [] kthread+0xd1/0xe0 [] ? insert_kthread_work+0x40/0x40 [] ret_from_fork_nospec_begin+0x21/0x21 [] ? insert_kthread_work+0x40/0x40 Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_els.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index 04f0c4d..5178cd0 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -23,8 +23,6 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, int rc = 0; uint32_t did, sid; uint16_t xid; - uint32_t start_time = jiffies / HZ; - uint32_t current_time; struct fcoe_wqe *sqe; unsigned long flags; u16 sqe_idx; @@ -59,18 +57,12 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, goto els_err; } -retry_els: els_req = qedf_alloc_cmd(fcport, QEDF_ELS); if (!els_req) { - current_time = jiffies / HZ; - if ((current_time - start_time) > 10) { - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, - "els: Failed els 0x%x\n", op); - rc = -ENOMEM; - goto els_err; - } - mdelay(20 * USEC_PER_MSEC); - goto retry_els; + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS, + "Failed to alloc ELS request 0x%x\n", op); + rc = -ENOMEM; + goto els_err; } QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "initiate_els els_req = " From patchwork Tue Mar 5 10:58:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839261 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 79B311803 for ; Tue, 5 Mar 2019 10:59:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65552297DE for ; Tue, 5 Mar 2019 10:59:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58F092AE4C; Tue, 5 Mar 2019 10:59:15 +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,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 D0792297DE for ; Tue, 5 Mar 2019 10:59:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727332AbfCEK7O (ORCPT ); Tue, 5 Mar 2019 05:59:14 -0500 Received: from mail-eopbgr770059.outbound.protection.outlook.com ([40.107.77.59]:43175 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726765AbfCEK7O (ORCPT ); Tue, 5 Mar 2019 05:59:14 -0500 Received: from BYAPR07CA0005.namprd07.prod.outlook.com (2603:10b6:a02:bc::18) by BN7PR07MB4756.namprd07.prod.outlook.com (2603:10b6:406:f0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:10 +0000 Received: from BY2NAM05FT059.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by BYAPR07CA0005.outlook.office365.com (2603:10b6:a02:bc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:10 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT059.mail.protection.outlook.com (10.152.100.196) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:10 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:07 -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 x25Ax7Yl013228; Tue, 5 Mar 2019 02:59:07 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25Ax7Cc013227; Tue, 5 Mar 2019 02:59:07 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 02/26] qedf: Correct xid range overlap between offloaded requests and libfc requests. Date: Tue, 5 Mar 2019 02:58:37 -0800 Message-ID: <20190305105901.13185-3-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571504280695;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(396003)(376002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(69596002)(126002)(26005)(6862004)(305945005)(97736004)(2351001)(26826003)(80596001)(4326008)(53936002)(50466002)(16586007)(68736007)(316002)(54906003)(47776003)(76176011)(42186006)(85426001)(36906005)(48376002)(356004)(81166006)(6666004)(476003)(2616005)(14444005)(1076003)(8676002)(8936002)(81156014)(86362001)(5660300002)(106466001)(105606002)(11346002)(50226002)(336012)(36756003)(87636003)(51416003)(486006)(498600001)(2906002)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4756;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d5df28cf-234a-4f01-6f4b-08d6a159989f X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4756; X-MS-TrafficTypeDiagnostic: BN7PR07MB4756: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4756;23:p++k2ceVpQej2+By5lOy0FeV11ilKz+EVqRkoKjYFDkAcdB229BvomeqhzY6cIWjOFRXGXC5mRqVaZa4f/c81e2HhTaOeh12eVw27u+qu36yQJ0OdUdCV8286V9+1HiefES9UTAvcEaJsNX0+LwrAYXJK2LDBVn9HKnYBKkH1p7fT8k6vTqvNZu4fbCyIpw/M9p44YCi1INq5PvhyQ7+UwIVh3NwGd5wQVgGqSKOUOwIGekMNvx2WaL7wBVdBf/6k8x4693Sb6TMiHZzFoJYM3YsY3FQTZ525tw+dEKVG/CjGvV4Z7dwtdFucANr5jbJ56ncNR4qJLi40mLbqorcH8QRLQWjM+C7Vd717sCe5YYdMTs9l0qwsna3lprM8cEFUjZHUarP05XfF6Tq9SSA3kFC8x+T0EUld/ZmNu1Net7ptJ/acH9OnSsLW5dAxYIgcpkKmk0F7l84IkPgwGVhmLqxRliqUDOTKYb22yzPDdYrTudeTm6TBDWnGLwCG6WzMsXYYfb4H3NV+bxdnOZT1LGlRXPZPjPtqzdcSsi2EFAQMwfJNwCbR+V4k3kSHoQ+mv5jXjzX6lyGZxnevFMdTyNo5pbhFm4D8LyfKynD94+aPSRkVQ/R30tor0EJOUunLvSed9sGVsp1qRzYkeAfVhpEjoDnXXqTsRcjOBpYgsTFyGffC01BNJ2Nl5WAM0+wU2cquuhrOeILxpewfl2woGX7QMZWZxDZ6wxZuE9AjlFWSHqzO923H0/a0Vq+Fd5cbt53MH7Aw/3lWWrijd1qnUpJ+XvB3su9bT7z0naSpw2ivQK3W+Z9/iFMJmKuHB8b1xk0FOm+QHzlBb60fI8JXaw/xCjLMOzLxzSV9SvLAqoiESadyzmgsEt/vRpAMveTQP2oQNEYltJKitPzUQP2CFCetjqzl+Sx6SAp2cktQmPAq3upJ26mVu50Co5ELOmA9F1joAdvlwVQy3FazyBCQp2D2G35llKdw7ZxLlaR6sVmw18eknLv06amPwS1SptvVAE2J9TowQf9CJQxlBnpR/kiI5cSQizq1C+4UQg2F+08r9ym9YNZ/a0SG2Cg5Ix7MU98XsJrwNVIqc3aetjiw+apHhyr+B165bwG9hRCQGiYo41EiTg8YDfgTCkQqcGE2uaLNi/EZcpVEaX0lZyJK8o85J4LYKVPCkOKV/rEhtGBasyXN29rEqFKtZLDVR7SCEYeI2qJgGH5Icq7GyGYUqCppFVrw197zdPV0KogGgmbUH1ATyteatYapzs7RNVa X-Microsoft-Antispam-Message-Info: QgAH6OSX6qOyTv+VDTHwqdqCO4w5BSNYRCL6YPVclFG7zPL4io9D1RCiX0gCb92i8laqBmRdGsXeMUXWeeaV/eIjdiiP6aiPiwi3au6FOSupXqGf/bfzRCyb1EukwwtLwqsp/5H7IUeVX3qXpRI8+b8REALtMs6viVVTInm2rN0bTv3P+HBFja9kX11u6AYYcxhwj/+OwXcynGZjT5LZMlHpliqalI/mRPaXD+UgAydda1NNWpijq8tXz75kO6tbVJjzp/FpVUvTcUhCRsnn3Y4nejZR4SPzt5p66HjOspx/1oVF9g7atd8mhsyJp00Dwr8XpueLYOh9cX5vS88dtMva219CVoDvqO4aYL9rQQLtXJmiAFwb5yiTHtUGBpJk4bbz1hA4EplojI4i9BRptXwg2o4a2725KeL2ryp+OC0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:10.1828 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d5df28cf-234a-4f01-6f4b-08d6a159989f X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4756 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: Chad Dupuis There is currently an overlap where exchange IDs between what is used for offloaded commands and by libfc for ELS commands. Correct this so that exchange ID range is: Offloaded requests: 0 to 0xfff libfc requests: 0x1000 to 0xfffe Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf.h | 5 ----- drivers/scsi/qedf/qedf_io.c | 6 +++--- drivers/scsi/qedf/qedf_main.c | 13 ++++--------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 2c78d8f..8e75c21 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -35,9 +35,6 @@ #define QEDF_DESCR "QLogic FCoE Offload Driver" #define QEDF_MODULE_NAME "qedf" -#define QEDF_MIN_XID 0 -#define QEDF_MAX_SCSI_XID (NUM_TASKS_PER_CONNECTION - 1) -#define QEDF_MAX_ELS_XID 4095 #define QEDF_FLOGI_RETRY_CNT 3 #define QEDF_RPORT_RETRY_CNT 255 #define QEDF_MAX_SESSIONS 1024 @@ -295,8 +292,6 @@ struct qedf_ctx { #define QEDF_DCBX_PENDING 0 #define QEDF_DCBX_DONE 1 atomic_t dcbx; - uint16_t max_scsi_xid; - uint16_t max_els_xid; #define QEDF_NULL_VLAN_ID -1 #define QEDF_FALLBACK_VLAN 1002 #define QEDF_DEFAULT_PRIO 3 diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 6ca583b..7c2ecf3 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -103,7 +103,7 @@ void qedf_cmd_mgr_free(struct qedf_cmd_mgr *cmgr) struct io_bdt *bdt_info; struct qedf_ctx *qedf = cmgr->qedf; size_t bd_tbl_sz; - u16 min_xid = QEDF_MIN_XID; + u16 min_xid = 0; u16 max_xid = (FCOE_PARAMS_NUM_TASKS - 1); int num_ios; int i; @@ -169,7 +169,7 @@ struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf) u16 xid; int i; int num_ios; - u16 min_xid = QEDF_MIN_XID; + u16 min_xid = 0; u16 max_xid = (FCOE_PARAMS_NUM_TASKS - 1); /* Make sure num_queues is already set before calling this function */ @@ -201,7 +201,7 @@ struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf) /* * Initialize I/O request fields. */ - xid = QEDF_MIN_XID; + xid = 0; for (i = 0; i < num_ios; i++) { io_req = &cmgr->cmds[i]; diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index edcaf4b..432026b 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1500,8 +1500,8 @@ static int qedf_lport_setup(struct qedf_ctx *qedf) fcoe_libfc_config(lport, &qedf->ctlr, &qedf_lport_template, 0); /* Allocate the exchange manager */ - fc_exch_mgr_alloc(lport, FC_CLASS_3, qedf->max_scsi_xid + 1, - qedf->max_els_xid, NULL); + fc_exch_mgr_alloc(lport, FC_CLASS_3, FCOE_PARAMS_NUM_TASKS, + 0xfffe, NULL); if (fc_lport_init_stats(lport)) return -ENOMEM; @@ -1624,7 +1624,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) vport_qedf->wwpn = vn_port->wwpn; vn_port->host->transportt = qedf_fc_vport_transport_template; - vn_port->host->can_queue = QEDF_MAX_ELS_XID; + vn_port->host->can_queue = FCOE_PARAMS_NUM_TASKS; vn_port->host->max_lun = qedf_max_lun; vn_port->host->sg_tablesize = QEDF_MAX_BDS_PER_CMD; vn_port->host->max_cmd_len = QEDF_MAX_CDB_LEN; @@ -3176,11 +3176,6 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) sprintf(host_buf, "host_%d", host->host_no); qed_ops->common->set_name(qedf->cdev, host_buf); - - /* Set xid max values */ - qedf->max_scsi_xid = QEDF_MAX_SCSI_XID; - qedf->max_els_xid = QEDF_MAX_ELS_XID; - /* Allocate cmd mgr */ qedf->cmd_mgr = qedf_cmd_mgr_alloc(qedf); if (!qedf->cmd_mgr) { @@ -3191,9 +3186,9 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) if (mode != QEDF_MODE_RECOVERY) { host->transportt = qedf_fc_transport_template; - host->can_queue = QEDF_MAX_ELS_XID; host->max_lun = qedf_max_lun; host->max_cmd_len = QEDF_MAX_CDB_LEN; + host->can_queue = FCOE_PARAMS_NUM_TASKS; rc = scsi_add_host(host, &pdev->dev); if (rc) goto err6; From patchwork Tue Mar 5 10:58:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839263 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 D78101803 for ; Tue, 5 Mar 2019 10:59:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3545297DE for ; Tue, 5 Mar 2019 10:59:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7AA92AE4C; Tue, 5 Mar 2019 10:59:16 +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,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 22B46297DE for ; Tue, 5 Mar 2019 10:59:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbfCEK7P (ORCPT ); Tue, 5 Mar 2019 05:59:15 -0500 Received: from mail-eopbgr780088.outbound.protection.outlook.com ([40.107.78.88]:39723 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726765AbfCEK7P (ORCPT ); Tue, 5 Mar 2019 05:59:15 -0500 Received: from BYAPR07CA0029.namprd07.prod.outlook.com (2603:10b6:a02:bc::42) by BN6PR07MB2995.namprd07.prod.outlook.com (2603:10b6:404:a6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:13 +0000 Received: from BY2NAM05FT059.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0029.outlook.office365.com (2603:10b6:a02:bc::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:13 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT059.mail.protection.outlook.com (10.152.100.196) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:13 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:11 -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 x25AxA2D013232; Tue, 5 Mar 2019 02:59:10 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxAdF013231; Tue, 5 Mar 2019 02:59:10 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 03/26] qedf: Add missing return in qedf_post_io_req() in the fcport offload check. Date: Tue, 5 Mar 2019 02:58:38 -0800 Message-ID: <20190305105901.13185-4-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571534604961;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(346002)(39860400002)(136003)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(5660300002)(85426001)(54906003)(2906002)(81156014)(81166006)(6862004)(4326008)(47776003)(68736007)(76176011)(51416003)(86362001)(2616005)(36906005)(16586007)(316002)(11346002)(446003)(42186006)(1076003)(8936002)(476003)(69596002)(6666004)(36756003)(126002)(45080400002)(2351001)(498600001)(356004)(14444005)(80596001)(26826003)(26005)(87636003)(50466002)(305945005)(106466001)(50226002)(336012)(8676002)(486006)(53936002)(105606002)(48376002)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR07MB2995;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 311f71f4-e232-43e3-4c71-08d6a1599a6e X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN6PR07MB2995; X-MS-TrafficTypeDiagnostic: BN6PR07MB2995: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN6PR07MB2995;23:hOGmzEmyENz1vKkqoiCjQGNaYiQt3nvms72avqIP+zpkLflrTTWL/79RplnIM3GTi8vxy+fxpAbcQ3nm8iOsaooN23Lf7Yvx7nA2HFky79YJHA4ZmNbeGpZhcy+7I0diVn8vG5bqzhsXtyYzwrO4nGQbBcYj1wP29wi9S2ap7Wvh5NeQJE/HyHBe6mkTFIWytQU04hHpMSjgS8mqjQjXSJ72RnD60TMS2XRljapX85fRJHdPpzsGwsvbaHvG7F285o5vQ/4Bj74bODlwbZdvqoO760jt7DeqQSVQGeK4zPQFLOPLyThFsckkdB/PQzZo4Ehn0GaOfJbMQNfJqt5mUhNQNVbCIwVkBERKJ/e0sYLfysQoTyJsJcXp8RLNVHRd/ysVgCd70KexnZpualZAXuT4C9oMxbnb2VgGxD+WX3IwcEEB5NRCxzEm6qsD1g6l4ZSfesU+V+oeKqWgP7axB2UNvc2lVBbsEcXcYAGsUsTSlDPpz8X9KZ7XjyuyXyKI6zJoX+jpo5lhC2r2vdN4BqFcysLRdPZximMLc4tdz+SeX0BJ2POjihyRBEBf5yLxD7un7bbJ1FHac/jAvWAe9AdXZpv/KgkIwaQakOEgx2JjX0oVjgpo2qeodSNI6u1lJRs6rAG0KXryOdkI0v650ZVNq33CMste0RTLFlQq22P2kkS9kWIBjnlbf4ksTScBqDi6vnuuPw/hUm4pu5l6J9524Vd1acxnB6VFgUSuuSoSQ7YBRgfcKcnwRs+6cUK7q11joc6m/KcwxObYikCklJV4IjVOeIrL+PMJQNgrzKHWTnFTnTV5Ed0mURc+b3GdxkgxKcq1obUQeUQEcA7YO8kkwCEAwa42k1TbIuDXnry0GNbo7d51fz7No0bOitSYd6K6IZYS8ALPiySe4o71xMVue7BY8YIU9nWnSUzOzyHsRjihuZJI8q4xdlMGZJAilRmNRtLyaGgvvtiODiRGwzCRoyA9ymYOxX7N87DaZjngyjhYvWF4E5ZJuVPFDZpJuvDbIg7Ac7fCbaTJqUD0bSXQ/iRuPPDlq93wNgkFz4ZTmJws6r8BSE7y+O2DipgblFgilzVlb50dbVwZBv2ftGBPu0haGk0aUEWdfg+Wpae7RPvzjDgPoLa2gqtwhhcUxkVNiPYhZEZ88DsO7SjZYxv1dbTOptubdNzGgUxWaXtB9QqxaC/tAyr3Y3l7Csug8IVzaqyzrEhrvuXQ8Z8s4xKDCTr6mG+UGD7Bhn1arCzeuqWOW4KdWpOMVVjRwf9yT/2hxOl4D311sfXNa0UJFA== X-Microsoft-Antispam-Message-Info: HJX1uDr1wCur1KzvEoLR6nO5hNcR2gRxgRUfpCO/DDatqlkQM6LXov07XQk27+B1qj3KWlPTSz5JhSHmYx3Xu8lxrLHgEh6I/QzAt8nXwmSWC2wegGgvS6r6RSZDXNi2VzT/4tsa0xrI5HrsKoODIieJxZakrWO5a0MtfhuC7xj0yrqORobOsPwxhUI8Lm1BLwVshAO3Qgflrh5FC6sJOFyZhFJm94yTxUO9szxWWu8vE8cM68T3F6qpXL1d0rH9FRsQfS0D4vrewDvvGEKp59yxJMwu/ctqRcQ2cimBLqCeLgiRsT/qdxIn5GrtTqaTWAi5GSThr7Jmy1L6xj8Vhd7qG7uWM3B9G98kpiWIRBDK2xZjp5BfWWlsLUoTR999eW5L9nmfzMyKHHSpbrH7wmHgO4MPO/bO+goHFHqFFJg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:13.2052 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 311f71f4-e232-43e3-4c71-08d6a1599a6e X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB2995 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: Chad Dupuis Fixes the following crash as the return was missing from the check if an fcport is offloaded. If we hit this code we continue to try to post an invalid task which can lead to the crash: [30259.616411] [0000:61:00.3]:[qedf_post_io_req:989]:3: Session not offloaded yet. [30259.616413] [0000:61:00.3]:[qedf_upload_connection:1340]:3: Uploading connection port_id=490020. [30259.623769] BUG: unable to handle kernel NULL pointer dereference at 0000000000000198 [30259.631645] IP: [] qedf_init_task.isra.16+0x3d/0x450 [qedf] [30259.638816] PGD 0 [30259.640841] Oops: 0000 [#1] SMP [30259.644098] Modules linked in: fuse xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables devlink ip6table_filter ip6_tables iptable_filter vfat fat ib_isert iscsi_target_mod ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib ib_ucm ib_umad dm_service_time skx_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel rpcrdma sunrpc rdma_ucm ib_uverbs lrw gf128mul ib_iser rdma_cm iw_cm ib_cm libiscsi scsi_transport_iscsi qedr(OE) glue_helper ablk_helper cryptd ib_core dm_round_robin joydev pcspkr ipmi_ssif ses enclosure ipmi_si ipmi_devintf ipmi_msghandler mei_me [30259.715529] mei sg hpilo hpwdt shpchp wmi lpc_ich acpi_power_meter dm_multipath ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic uas usb_storage mgag200 qedf(OE) i2c_algo_bit libfcoe drm_kms_helper libfc syscopyarea sysfillrect scsi_transport_fc qede(OE) sysimgblt fb_sys_fops ptp ttm pps_core drm qed(OE) smartpqi crct10dif_pclmul crct10dif_common crc32c_intel i2c_core scsi_transport_sas scsi_tgt dm_mirror dm_region_hash dm_log dm_mod [30259.754237] CPU: 9 PID: 977 Comm: kdmwork-253:7 Kdump: loaded Tainted: G W OE ------------ 3.10.0-862.el7.x86_64 #1 [30259.765664] Hardware name: HPE Synergy 480 Gen10/Synergy 480 Gen10 Compute Module, BIOS I42 04/04/2018 [30259.775000] task: ffff8c801efd0000 ti: ffff8c801efd8000 task.ti: ffff8c801efd8000 [30259.782505] RIP: 0010:[] [] qedf_init_task.isra.16+0x3d/0x450 [qedf] [30259.792116] RSP: 0018:ffff8c801efdbbb0 EFLAGS: 00010046 [30259.797444] RAX: 0000000000000000 RBX: ffffa7f1450948d8 RCX: ffff8c7fe5bc40c8 [30259.804600] RDX: ffff8c800715b300 RSI: ffffa7f1450948d8 RDI: ffff8c80169c2480 [30259.811755] RBP: ffff8c801efdbc30 R08: 00000000000000ae R09: ffff8c800a314540 [30259.818911] R10: ffff8c7fe5bc40c8 R11: ffff8c801efdb8ae R12: 0000000000000000 [30259.826068] R13: ffff8c800715b300 R14: ffff8c80169c2480 R15: ffff8c8005da28e0 [30259.833223] FS: 0000000000000000(0000) GS:ffff8c803f840000(0000) knlGS:0000000000000000 [30259.841338] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [30259.847100] CR2: 0000000000000198 CR3: 000000081242e000 CR4: 00000000007607e0 [30259.854256] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [30259.861412] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [30259.868568] PKRU: 00000000 [30259.871278] Call Trace: [30259.873737] [] qedf_post_io_req+0x148/0x680 [qedf] [30259.880201] [] qedf_queuecommand+0x1f0/0x240 [qedf] [30259.886749] [] scsi_dispatch_cmd+0xb0/0x240 [30259.892600] [] scsi_request_fn+0x4cc/0x680 [30259.898364] [] __blk_run_queue+0x39/0x50 [30259.903954] [] __elv_add_request+0xd3/0x260 [30259.909805] [] blk_insert_cloned_request+0xf0/0x1b0 [30259.916358] [] map_request+0x142/0x220 [dm_mod] [30259.922560] [] map_tio_request+0x16/0x40 [dm_mod] [30259.928932] [] kthread_worker_fn+0x85/0x180 [30259.934782] [] ? kthread_stop+0xf0/0xf0 [30259.940284] [] kthread+0xd1/0xe0 [30259.945176] [] ? insert_kthread_work+0x40/0x40 [30259.951290] [] ret_from_fork_nospec_begin+0x7/0x21 [30259.957750] [] ? insert_kthread_work+0x40/0x40 [30259.963860] Code: fe 41 55 49 89 d5 41 54 53 48 89 f3 48 83 ec 58 4c 8b 67 28 4c 8b 4e 18 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31 c0 4c 8b 7e 58 <49> 8b 84 24 98 01 00 00 48 8b 00 f6 80 31 01 00 00 10 0f 85 0b [30259.983372] RIP [] qedf_init_task.isra.16+0x3d/0x450 [qedf] [30259.990630] RSP [30259.994127] CR2: 0000000000000198 Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 7c2ecf3..da728d2 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -902,6 +902,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { QEDF_ERR(&(qedf->dbg_ctx), "Session not offloaded yet.\n"); kref_put(&io_req->refcount, qedf_release_cmd); + return -EINVAL; } /* Obtain free SQE */ From patchwork Tue Mar 5 10:58:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839265 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 BB65617E4 for ; Tue, 5 Mar 2019 10:59:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A57CA29A66 for ; Tue, 5 Mar 2019 10:59:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C38F2AEA5; Tue, 5 Mar 2019 10:59:24 +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,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 C101429A66 for ; Tue, 5 Mar 2019 10:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727432AbfCEK7X (ORCPT ); Tue, 5 Mar 2019 05:59:23 -0500 Received: from mail-eopbgr760054.outbound.protection.outlook.com ([40.107.76.54]:56736 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726765AbfCEK7X (ORCPT ); Tue, 5 Mar 2019 05:59:23 -0500 Received: from BYAPR07CA0029.namprd07.prod.outlook.com (2603:10b6:a02:bc::42) by CY4PR07MB2998.namprd07.prod.outlook.com (2603:10b6:903:cf::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.16; Tue, 5 Mar 2019 10:59:16 +0000 Received: from BY2NAM05FT059.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0029.outlook.office365.com (2603:10b6:a02:bc::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:16 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT059.mail.protection.outlook.com (10.152.100.196) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:16 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:14 -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 x25AxEai013236; Tue, 5 Mar 2019 02:59:14 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxEN3013235; Tue, 5 Mar 2019 02:59:14 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 04/26] qedf: Simplify s/g list mapping. Date: Tue, 5 Mar 2019 02:58:39 -0800 Message-ID: <20190305105901.13185-5-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571564982445;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(136003)(39860400002)(346002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(76176011)(498600001)(26826003)(85426001)(36906005)(50226002)(36756003)(126002)(14444005)(80596001)(42186006)(51416003)(476003)(16586007)(26005)(486006)(87636003)(69596002)(1076003)(316002)(6862004)(2906002)(4326008)(6666004)(356004)(97736004)(305945005)(8936002)(47776003)(48376002)(50466002)(86362001)(68736007)(81156014)(81166006)(8676002)(5660300002)(336012)(106466001)(446003)(2616005)(2351001)(53936002)(105606002)(54906003)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB2998;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86c49d60-c1bb-4209-d24d-08d6a1599c3d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY4PR07MB2998; X-MS-TrafficTypeDiagnostic: CY4PR07MB2998: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2998;23:PrOLqU/iheiJ8hdmlwSKzqZNL34lzHgSq2i0WCkqe1mIxNTQw04sSrEcbXDyEb9AEKfSyPInJXVUFbM0ivcUVkUV7Wy9Z5e0y3w+yksSIk+laAhlgQxTHfTVZ5SK909TtphYaNdTxU1jCAePVnEXrmwLUfbmOWqnkBQ1eTeiIYcF/wtgeM7YHdVSKMdD29l56S/Xad/tG6AFNR9ymRRY+e3SOPth36+lKUX+Ua44h0eRGH72FKbjYnyploueiwxpODLPtaBQT3YR8MtZOnXq2Ktd9/R5rAat7CNaxo2LZ2YGowQuwk/uDejjT799x0PFQaTMwk37GygalAuv+eP91Rg/+0qD3tCqiC1KuH6SJH+vvzR4dRaUO9hdmvrMS2PbLpVXjih7jEnsSRBMzMTaJ2e6WuAL6kTM9QB0XyGm43sd8y4VkuQ39OeuwZbaHt6jSHeDo/wVc4FWk9gSDJStZn/updvHF4ptkPa9HqrvDImsN+lP9+ecPOT3wFxIjAtsV6GxEk5l6Q6Ngk8qbpFCg59VrZvHIP1DKPrABUN1Gr3I466+d14ZVbSQ+tqjeohX9du2NwXAQDvXR5kEMOw1EYFtGMAQx3UOF+otTB5C1ttkL82j5VhMnLzJVwrjkO8VdRranXd4gqpPuBJLfM8PjVSzS4RpX5EQrkW5feOnbdlgAg/8qffc/Vd2RPy3xB6djXRAjEfVJgjBhaD792dNYgcIdrGjdv5KyNR8291LMkTxovYHfRfhdeLG1qhD9f5GRAvqomSUepH9Xk54Ywe+2eeUvWxOpHuysJAO1iX+MEOlAuZDWROVp4eMWEw15zayoEBm27s3c1LNEeMoY1QPaumx5ElQ6uF/0R7qOKPfpIf1awNd9cWuiiUIIxVyJ4XVoXo3lJN3wu/FPovS1NGXvOkFVBXeX5iov3zkVKQbRm7zsdpg1Gy4xbvmsICWrQ46SGXTOyrHepgrHJSPtymrgAFKgNj8GJ83x1kVYiSJOx5kYG5qXzrCjQdcC4P5LgZvNPLOCSuJBaEp7FVGF+23QbRru9WbwzMgg9O6rMIBnIf4bT2NGPnf+u8/dkB7fcWBqAIN3VwdOb766UPF9/e3Js7PezaxSGTlv5mz8Sf500fkkhGjBW7VUgzdF+qAMSwCpDLcDKZaRr2L0fAh9e0kUELl07yAPqncrBGIa/ZxHQ4jVWwhlevyTR7DxOX30DOWr4nO0nKDUI1WBeA0Dmk0Rw2iCUmd/k89BsDiQ/+T09Fd1s6Rvy8pOcJw0c6AhOZK X-Microsoft-Antispam-Message-Info: eC2OVW3JcE4Gh3wG6NTLKvJmlOAJUJ2NZHeoKWQHY1DBR1JoFzlIWN9pHuIv0HBtBlxD3La8xIT9S8g3UarZ0hwhwNHSuOp8ZtYGy4yv9cRa5SmQ8UWp9Io/P0LqRkMkfyhNrEGrFxc0Z2v67KuYGAVsYNB+dEv99xDZRUoGVnZq6TYB8LRASJ1ChKaNvZe2XdCHZEB+gNXfgtUcNWL6NtWUu0dO7cQnjSTt0hoSP8zQQqxdlfXAj80eGB+xRRC9CC5qSurVN3oL2a8OVTRLYSu1mTehzl4Tb5M8LA3PAQGsbMuBf4sysbutlzuLWCWdI1LW/BLlKIBkmAhfgwrDxiZWZz/G1gms/iTAEzUQD5hKuax3Gov7qun8ijc7vGdwwk2pTSG529nCWI4P27QtcjA575bcR5Tq/XMnmO3dVWY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:16.2540 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86c49d60-c1bb-4209-d24d-08d6a1599c3d X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB2998 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: Chad Dupuis When mapping the pages from a scatter/gather list from the SCSI layer we only need to follow these rules: o Max SGEs for each I/O request is 256 o No size limit on each SGE o No need to split OS provided SGEs to 4K before sending to firmware. o Slow SGE is applicable only when: - There are > 8 SGEs and any middle SGE is less than a page size (4K) Make necessary changes so that driver follows these rules. applicable only for Write requests (not for Read requests) No need to check SGE address alignment requirements (first, middle or last) before declaring slow SGE Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf.h | 8 +-- drivers/scsi/qedf/qedf_debugfs.c | 2 - drivers/scsi/qedf/qedf_io.c | 124 ++++++++++++--------------------------- 3 files changed, 40 insertions(+), 94 deletions(-) diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 8e75c21..4080af8 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -102,7 +102,6 @@ struct qedf_ioreq { struct list_head link; uint16_t xid; struct scsi_cmnd *sc_cmd; - bool use_slowpath; /* Use slow SGL for this I/O */ #define QEDF_SCSI_CMD 1 #define QEDF_TASK_MGMT_CMD 2 #define QEDF_ABTS 3 @@ -152,9 +151,9 @@ struct qedf_ioreq { int fp_idx; unsigned int cpu; unsigned int int_cpu; -#define QEDF_IOREQ_SLOW_SGE 0 -#define QEDF_IOREQ_SINGLE_SGE 1 -#define QEDF_IOREQ_FAST_SGE 2 +#define QEDF_IOREQ_UNKNOWN_SGE 1 +#define QEDF_IOREQ_SLOW_SGE 2 +#define QEDF_IOREQ_FAST_SGE 3 u8 sge_type; struct delayed_work rrq_work; @@ -366,7 +365,6 @@ struct qedf_ctx { u32 slow_sge_ios; u32 fast_sge_ios; - u32 single_sge_ios; uint8_t *grcdump; uint32_t grcdump_size; diff --git a/drivers/scsi/qedf/qedf_debugfs.c b/drivers/scsi/qedf/qedf_debugfs.c index a32d8ee..6ae78dd 100644 --- a/drivers/scsi/qedf/qedf_debugfs.c +++ b/drivers/scsi/qedf/qedf_debugfs.c @@ -303,7 +303,6 @@ seq_printf(s, "cmg_mgr free io_reqs: %d\n", atomic_read(&qedf->cmd_mgr->free_list_cnt)); seq_printf(s, "slow SGEs: %d\n", qedf->slow_sge_ios); - seq_printf(s, "single SGEs: %d\n", qedf->single_sge_ios); seq_printf(s, "fast SGEs: %d\n\n", qedf->fast_sge_ios); seq_puts(s, "Offloaded ports:\n\n"); @@ -361,7 +360,6 @@ /* Clear stat counters exposed by 'stats' node */ qedf->slow_sge_ios = 0; - qedf->single_sge_ios = 0; qedf->fast_sge_ios = 0; return count; diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index da728d2..d7480f1 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -428,29 +428,6 @@ void qedf_release_cmd(struct kref *ref) clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); } -static int qedf_split_bd(struct qedf_ioreq *io_req, u64 addr, int sg_len, - int bd_index) -{ - struct scsi_sge *bd = io_req->bd_tbl->bd_tbl; - int frag_size, sg_frags; - - sg_frags = 0; - while (sg_len) { - if (sg_len > QEDF_BD_SPLIT_SZ) - frag_size = QEDF_BD_SPLIT_SZ; - else - frag_size = sg_len; - bd[bd_index + sg_frags].sge_addr.lo = U64_LO(addr); - bd[bd_index + sg_frags].sge_addr.hi = U64_HI(addr); - bd[bd_index + sg_frags].sge_len = (uint16_t)frag_size; - - addr += (u64)frag_size; - sg_frags++; - sg_len -= frag_size; - } - return sg_frags; -} - static int qedf_map_sg(struct qedf_ioreq *io_req) { struct scsi_cmnd *sc = io_req->sc_cmd; @@ -462,75 +439,45 @@ static int qedf_map_sg(struct qedf_ioreq *io_req) int byte_count = 0; int sg_count = 0; int bd_count = 0; - int sg_frags; - unsigned int sg_len; + u32 sg_len; u64 addr, end_addr; - int i; + int i = 0; sg_count = dma_map_sg(&qedf->pdev->dev, scsi_sglist(sc), scsi_sg_count(sc), sc->sc_data_direction); - sg = scsi_sglist(sc); - /* - * New condition to send single SGE as cached-SGL with length less - * than 64k. - */ - if ((sg_count == 1) && (sg_dma_len(sg) <= - QEDF_MAX_SGLEN_FOR_CACHESGL)) { - sg_len = sg_dma_len(sg); - addr = (u64)sg_dma_address(sg); - - bd[bd_count].sge_addr.lo = (addr & 0xffffffff); - bd[bd_count].sge_addr.hi = (addr >> 32); - bd[bd_count].sge_len = (u16)sg_len; + io_req->sge_type = QEDF_IOREQ_UNKNOWN_SGE; - return ++bd_count; - } + if (sg_count <= 8 || io_req->io_req_flags == QEDF_READ) + io_req->sge_type = QEDF_IOREQ_FAST_SGE; scsi_for_each_sg(sc, sg, sg_count, i) { - sg_len = sg_dma_len(sg); + sg_len = (u32)sg_dma_len(sg); addr = (u64)sg_dma_address(sg); end_addr = (u64)(addr + sg_len); /* - * First s/g element in the list so check if the end_addr - * is paged aligned. Also check to make sure the length is - * at least page size. - */ - if ((i == 0) && (sg_count > 1) && - ((end_addr % QEDF_PAGE_SIZE) || - sg_len < QEDF_PAGE_SIZE)) - io_req->use_slowpath = true; - /* - * Last s/g element so check if the start address is paged - * aligned. - */ - else if ((i == (sg_count - 1)) && (sg_count > 1) && - (addr % QEDF_PAGE_SIZE)) - io_req->use_slowpath = true; - /* * Intermediate s/g element so check if start and end address - * is page aligned. + * is page aligned. Only required for writes and only if the + * number of scatter/gather elements is 8 or more. */ - else if ((i != 0) && (i != (sg_count - 1)) && - ((addr % QEDF_PAGE_SIZE) || (end_addr % QEDF_PAGE_SIZE))) - io_req->use_slowpath = true; + if (io_req->sge_type == QEDF_IOREQ_UNKNOWN_SGE && (i) && + (i != (sg_count - 1)) && sg_len < QEDF_PAGE_SIZE) + io_req->sge_type = QEDF_IOREQ_SLOW_SGE; - if (sg_len > QEDF_MAX_BD_LEN) { - sg_frags = qedf_split_bd(io_req, addr, sg_len, - bd_count); - } else { - sg_frags = 1; - bd[bd_count].sge_addr.lo = U64_LO(addr); - bd[bd_count].sge_addr.hi = U64_HI(addr); - bd[bd_count].sge_len = (uint16_t)sg_len; - } + bd[bd_count].sge_addr.lo = U64_LO(addr); + bd[bd_count].sge_addr.hi = U64_HI(addr); + bd[bd_count].sge_len = sg_len; - bd_count += sg_frags; + bd_count++; byte_count += sg_len; } + /* To catch a case where FAST and SLOW nothing is set, set FAST */ + if (io_req->sge_type == QEDF_IOREQ_UNKNOWN_SGE) + io_req->sge_type = QEDF_IOREQ_FAST_SGE; + if (byte_count != scsi_bufflen(sc)) QEDF_ERR(&(qedf->dbg_ctx), "byte_count = %d != " "scsi_bufflen = %d, task_id = 0x%x.\n", byte_count, @@ -655,8 +602,10 @@ static void qedf_init_task(struct qedf_rport *fcport, struct fc_lport *lport, io_req->sgl_task_params->num_sges = bd_count; io_req->sgl_task_params->total_buffer_size = scsi_bufflen(io_req->sc_cmd); - io_req->sgl_task_params->small_mid_sge = - io_req->use_slowpath; + if (io_req->sge_type == QEDF_IOREQ_SLOW_SGE) + io_req->sgl_task_params->small_mid_sge = 1; + else + io_req->sgl_task_params->small_mid_sge = 0; } /* Fill in physical address of sense buffer */ @@ -679,16 +628,10 @@ static void qedf_init_task(struct qedf_rport *fcport, struct fc_lport *lport, io_req->task_retry_identifier, fcp_cmnd); /* Increment SGL type counters */ - if (bd_count == 1) { - qedf->single_sge_ios++; - io_req->sge_type = QEDF_IOREQ_SINGLE_SGE; - } else if (io_req->use_slowpath) { + if (io_req->sge_type == QEDF_IOREQ_SLOW_SGE) qedf->slow_sge_ios++; - io_req->sge_type = QEDF_IOREQ_SLOW_SGE; - } else { + else qedf->fast_sge_ios++; - io_req->sge_type = QEDF_IOREQ_FAST_SGE; - } } void qedf_init_mp_task(struct qedf_ioreq *io_req, @@ -770,9 +713,6 @@ void qedf_init_mp_task(struct qedf_ioreq *io_req, &task_fc_hdr, &tx_sgl_task_params, &rx_sgl_task_params, 0); - - /* Midpath requests always consume 1 SGE */ - qedf->single_sge_ios++; } /* Presumed that fcport->rport_lock is held */ @@ -872,7 +812,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) /* Initialize rest of io_req fileds */ io_req->data_xfer_len = scsi_bufflen(sc_cmd); sc_cmd->SCp.ptr = (char *)io_req; - io_req->use_slowpath = false; /* Assume fast SGL by default */ + io_req->sge_type = QEDF_IOREQ_FAST_SGE; /* Assume fast SGL by default */ /* Record which cpu this request is associated with */ io_req->cpu = smp_processor_id(); @@ -942,7 +882,17 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) int rc = 0; int rval; unsigned long flags = 0; - + int num_sgs = 0; + + num_sgs = scsi_sg_count(sc_cmd); + if (scsi_sg_count(sc_cmd) > QEDF_MAX_BDS_PER_CMD) { + QEDF_ERR(&qedf->dbg_ctx, + "Number of SG elements %d exceeds what hardware limitation of %d.\n", + num_sgs, QEDF_MAX_BDS_PER_CMD); + sc_cmd->result = DID_ERROR; + sc_cmd->scsi_done(sc_cmd); + return 0; + } if (test_bit(QEDF_UNLOADING, &qedf->flags) || test_bit(QEDF_DBG_STOP_IO, &qedf->flags)) { From patchwork Tue Mar 5 10:58:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839269 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 9F1AE1803 for ; Tue, 5 Mar 2019 10:59:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 887BE2B352 for ; Tue, 5 Mar 2019 10:59:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A51A2B2A9; Tue, 5 Mar 2019 10:59:32 +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,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 2BC412B2A9 for ; Tue, 5 Mar 2019 10:59:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727443AbfCEK7a (ORCPT ); Tue, 5 Mar 2019 05:59:30 -0500 Received: from mail-eopbgr730083.outbound.protection.outlook.com ([40.107.73.83]:39360 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727409AbfCEK7a (ORCPT ); Tue, 5 Mar 2019 05:59:30 -0500 Received: from BYAPR07CA0024.namprd07.prod.outlook.com (2603:10b6:a02:bc::37) by DM6PR07MB4377.namprd07.prod.outlook.com (2603:10b6:5:bf::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:20 +0000 Received: from BY2NAM05FT059.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::206) by BYAPR07CA0024.outlook.office365.com (2603:10b6:a02:bc::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:19 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT059.mail.protection.outlook.com (10.152.100.196) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:19 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:17 -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 x25AxHTC013240; Tue, 5 Mar 2019 02:59:17 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxHJS013239; Tue, 5 Mar 2019 02:59:17 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 05/26] qedf: Modify flush routine to handle all I/Os and TMF. Date: Tue, 5 Mar 2019 02:58:40 -0800 Message-ID: <20190305105901.13185-6-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571597677299;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(376002)(346002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(2906002)(81166006)(356004)(8936002)(80596001)(8676002)(6666004)(81156014)(68736007)(26005)(97736004)(48376002)(4326008)(6862004)(50466002)(50226002)(53936002)(486006)(1076003)(2616005)(69596002)(85426001)(126002)(476003)(105606002)(498600001)(106466001)(26826003)(36906005)(446003)(54906003)(47776003)(87636003)(16586007)(2351001)(76176011)(42186006)(86362001)(336012)(30864003)(11346002)(5660300002)(51416003)(36756003)(14444005)(316002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4377;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb24e519-aeba-41ac-b524-08d6a1599e30 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB4377; X-MS-TrafficTypeDiagnostic: DM6PR07MB4377: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4377;23:/LSkUmVTG2TwxBHUH8ULLZXFwsWIYbeNuQcZpwxT18tI0ZU9O1MQi9bJKeHfIhqY++D7EC129KCCKZk2mFU9y25m3Dgbt8RGrdgxJNwGKosla981MAV/O4MUcRBjuedjahG1GxsBifMbB3aRSyO+8Huv5E63XVjwVMBBujIAIanrJwCRbiRzfLR2cg9hVqzOXWjAE0NwfmQqCkckXYtrumA9BsA82QOczHFCczS4GCVZBsi5oSISPmz1S74yRD4uhwYzsnbMlj8P8wGdOTpDC1XAqJnLOin1yxu8xavkd7K85zZ1o7byzUuOZHStNvFYu3NnLwoLIyluUxikWltj1kuC57l45F6XiCBKjIUaqccxPJDmKvkrQ173eDUv+XbaSFxEUElq4cQutduk/muME5iP/MmR+X2+3TO5sDUpO1heIP8H5lH6asq37vSIEAHfmQBqgRCZRYk4nf28R1qspk49FCC54YcXbZDnocuDjW14f7b/dnUWszWP1B8TJrOOGVFZJZO5/nAWrBE/mIrjl7JSGTnmYkFedKhHnKywRg8nKNZzKKK/u+Dvj6A0aLHcai/kS2R2OiuqlN7FjeF8rzuv/POmEjFTIc4CtaSBst2rcCYaj7mUAuZXyfhXs3YMAPnoYQebdx02PUHzTf0w2EDR9mF0KSZWkP5ZvlxLYLtkItMfyBBdMR+Gh3yHdWdrvJzAeP6cyJKCxR31roI9aVY+N0JdIRcsvqERJhb5+yiJjjKT90gLsh8Ap/lPB6SlzhzB9un+RVrGeoWdsGDzgksshQUS5OnXlJ5FvKukZZXv5QC0nDaVABOrizIVlEHp4QwgGf+VFtGlZ9loTs7iIL1um1JlKTXWzPVQc4C8NfgQw5lyVMygbmdacWallYUTf+MKceT7epjFKqAha4H/YqOAJM4+htQbw3TIydMhIC0vqI8wmetWqRxb4y79PKjklkwDJw0zQI85xlJcqLjdvYbBNi4rQa9qShvkHWJ+wNWhuBvY/OXybGKyQShZCnZPPa7spI8eM5jG6h+LrT6oOadSZI4AiDEzV2mZGbWgbxH3R4Umm7BYDF0f6ADEV1xvTzLRc85mDePsId1rwJR+RJgVPiw3nV+Ildam0WFVovATahmksUBeEF+vPfQiq7lVOQ+lbU4ZSuQaGOCPXbdWI5SAC6rs0TlHeaZqcuH2pbp7VPCxcaFook4oBqsEYmEeq5slhGPArYFhBKV+NHYlepvv++/ZJw8fXaa+SBt8pjtZ/U5HmGWJ5+qaeUvfTXjl7RKqqgzwo20t6RD2gFc7DQ== X-Microsoft-Antispam-Message-Info: sKq7U/1sjcb5ZtrZOi8f/ONqiF51WH6X/04uCFMaUB4a8WWpoEkYXCFRJmw3GMUE6jtgJRQvRSv/ylwYAvAE2h6nvLKSKvKb+irfmkkEn9qcl+2njsekDIih4v7pgbk3Amf2H3FZ1tMFwtXrY26/dxOa6Lp2Ykw2qEB+GR1tGDFxc7fp08T+xpT585BqFpHWPfWu/QCl5WbEtV3JX7DX4t4eztaTR/tumKx+SBX1NFPZmE/teAZpIxoTh1KTMDG75LhOVKP1mTho748mTrpefWbAurDlfov+OFPwK9Dk4KsuCdmC9uohjKLQHwZTxdVBB5lmrIg4itDsXxOLP9hqYl/khqneYHe4S9WfOHymOwv6zO+QzqsscO7EQRA8WYselABDYxZsJK2jKXso3QJ6H2TCDiLJ300SemTtS2Fm9q0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:19.5125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb24e519-aeba-41ac-b524-08d6a1599e30 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4377 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: Shyam Sundar The purpose of flush routine is to cleanup I/Os to the firmware and complete them to scsi middle layer. This routine is invoked before connection is uploaded because of rport going away. - Don't process any I/Os, aborts, TMFs coming when flush in progress. - Add flags to handle cleanup and release of I/Os because flush can prematurely complete I/Os. - Original command can get completed to driver when cleanup for same is posted to firmware, handle this condition. - Modify flush to handle I/Os in all the states like abort, TMF, RRQ and timeouts. Signed-off-by: Shyam Sundar Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf.h | 6 + drivers/scsi/qedf/qedf_els.c | 4 + drivers/scsi/qedf/qedf_io.c | 285 ++++++++++++++++++++++++++++++++++++++---- drivers/scsi/qedf/qedf_main.c | 8 +- 4 files changed, 277 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 4080af8..787cc12 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -113,6 +113,8 @@ struct qedf_ioreq { #define QEDF_CMD_IN_ABORT 0x1 #define QEDF_CMD_IN_CLEANUP 0x2 #define QEDF_CMD_SRR_SENT 0x3 +#define QEDF_CMD_DIRTY 0x4 +#define QEDF_CMD_ERR_SCSI_DONE 0x5 u8 io_req_flags; uint8_t tm_flags; struct qedf_rport *fcport; @@ -129,6 +131,7 @@ struct qedf_ioreq { struct fcoe_task_params *task_params; struct scsi_sgl_task_params *sgl_task_params; int idx; + int lun; /* * Need to allocate enough room for both sense data and FCP response data * which has a max length of 8 bytes according to spec. @@ -168,6 +171,8 @@ struct qedf_ioreq { * during some form of error processing. */ bool return_scsi_cmd_on_abts; + + unsigned int alloc; }; extern struct workqueue_struct *qedf_io_wq; @@ -187,6 +192,7 @@ struct qedf_rport { void __iomem *p_doorbell; /* Send queue management */ atomic_t free_sqes; + atomic_t ios_to_queue; atomic_t num_active_ios; struct fcoe_wqe *sq; dma_addr_t sq_dma; diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index 5178cd0..a60819b 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -135,6 +135,8 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Ringing doorbell for ELS " "req\n"); qedf_ring_doorbell(fcport); + set_bit(QEDF_CMD_OUTSTANDING, &els_req->flags); + spin_unlock_irqrestore(&fcport->rport_lock, flags); els_err: return rc; @@ -151,6 +153,8 @@ void qedf_process_els_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered with xid = 0x%x" " cmd_type = %d.\n", els_req->xid, els_req->cmd_type); + clear_bit(QEDF_CMD_OUTSTANDING, &els_req->flags); + /* Kill the ELS timer */ cancel_delayed_work(&els_req->timeout_work); diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index d7480f1..3a8c7f7 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -329,7 +329,7 @@ struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport, u8 cmd_type) cmd_mgr->idx = 0; /* Check to make sure command was previously freed */ - if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags)) + if (!io_req->alloc) break; } @@ -338,7 +338,9 @@ struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport, u8 cmd_type) goto out_failed; } - set_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + /* Clear any flags now that we've reallocated the xid */ + io_req->flags = 0; + io_req->alloc = 1; spin_unlock_irqrestore(&cmd_mgr->lock, flags); atomic_inc(&fcport->num_active_ios); @@ -349,6 +351,10 @@ struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport, u8 cmd_type) io_req->cmd_mgr = cmd_mgr; io_req->fcport = fcport; + /* Clear any stale sc_cmd back pointer */ + io_req->sc_cmd = NULL; + io_req->lun = -1; + /* Hold the io_req against deletion */ kref_init(&io_req->refcount); @@ -412,6 +418,10 @@ void qedf_release_cmd(struct kref *ref) container_of(ref, struct qedf_ioreq, refcount); struct qedf_cmd_mgr *cmd_mgr = io_req->cmd_mgr; struct qedf_rport *fcport = io_req->fcport; + unsigned long flags; + + if (io_req->cmd_type == QEDF_SCSI_CMD) + WARN_ON(io_req->sc_cmd); if (io_req->cmd_type == QEDF_ELS || io_req->cmd_type == QEDF_TASK_MGMT_CMD) @@ -424,8 +434,14 @@ void qedf_release_cmd(struct kref *ref) /* Increment task retry identifier now that the request is released */ io_req->task_retry_identifier++; + io_req->fcport = NULL; - clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + clear_bit(QEDF_CMD_DIRTY, &io_req->flags); + io_req->cpu = 0; + spin_lock_irqsave(&cmd_mgr->lock, flags); + io_req->fcport = NULL; + io_req->alloc = 0; + spin_unlock_irqrestore(&cmd_mgr->lock, flags); } static int qedf_map_sg(struct qedf_ioreq *io_req) @@ -835,16 +851,24 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) /* Build buffer descriptor list for firmware from sg list */ if (qedf_build_bd_list_from_sg(io_req)) { QEDF_ERR(&(qedf->dbg_ctx), "BD list creation failed.\n"); + /* Release cmd will release io_req, but sc_cmd is assigned */ + io_req->sc_cmd = NULL; kref_put(&io_req->refcount, qedf_release_cmd); return -EAGAIN; } - if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { + if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags) || + test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { QEDF_ERR(&(qedf->dbg_ctx), "Session not offloaded yet.\n"); + /* Release cmd will release io_req, but sc_cmd is assigned */ + io_req->sc_cmd = NULL; kref_put(&io_req->refcount, qedf_release_cmd); return -EINVAL; } + /* Record LUN number for later use if we neeed them */ + io_req->lun = (int)sc_cmd->device->lun; + /* Obtain free SQE */ sqe_idx = qedf_get_sqe_idx(fcport); sqe = &fcport->sq[sqe_idx]; @@ -855,6 +879,8 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) if (!task_ctx) { QEDF_WARN(&(qedf->dbg_ctx), "task_ctx is NULL, xid=%d.\n", xid); + /* Release cmd will release io_req, but sc_cmd is assigned */ + io_req->sc_cmd = NULL; kref_put(&io_req->refcount, qedf_release_cmd); return -EINVAL; } @@ -864,6 +890,9 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) /* Ring doorbell */ qedf_ring_doorbell(fcport); + /* Set that command is with the firmware now */ + set_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + if (qedf_io_tracing && io_req->sc_cmd) qedf_trace_io(fcport, io_req, QEDF_IO_TRACE_REQ); @@ -940,12 +969,16 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) rc = SCSI_MLQUEUE_TARGET_BUSY; goto exit_qcmd; } + + atomic_inc(&fcport->ios_to_queue); + if (fcport->retry_delay_timestamp) { if (time_after(jiffies, fcport->retry_delay_timestamp)) { fcport->retry_delay_timestamp = 0; } else { /* If retry_delay timer is active, flow off the ML */ rc = SCSI_MLQUEUE_TARGET_BUSY; + atomic_dec(&fcport->ios_to_queue); goto exit_qcmd; } } @@ -953,6 +986,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) io_req = qedf_alloc_cmd(fcport, QEDF_SCSI_CMD); if (!io_req) { rc = SCSI_MLQUEUE_HOST_BUSY; + atomic_dec(&fcport->ios_to_queue); goto exit_qcmd; } @@ -967,6 +1001,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) rc = SCSI_MLQUEUE_HOST_BUSY; } spin_unlock_irqrestore(&fcport->rport_lock, flags); + atomic_dec(&fcport->ios_to_queue); exit_qcmd: return rc; @@ -1057,6 +1092,15 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, if (!cqe) return; + if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags) || + test_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags) || + test_bit(QEDF_CMD_IN_ABORT, &io_req->flags)) { + QEDF_ERR(&qedf->dbg_ctx, + "io_req xid=0x%x already in cleanup or abort processing or already completed.\n", + io_req->xid); + return; + } + xid = io_req->xid; task_ctx = qedf_get_task_mem(&qedf->tasks, xid); sc_cmd = io_req->sc_cmd; @@ -1073,6 +1117,12 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, return; } + if (!sc_cmd->device) { + QEDF_ERR(&qedf->dbg_ctx, + "Device for sc_cmd %p is NULL.\n", sc_cmd); + return; + } + if (!sc_cmd->request) { QEDF_WARN(&(qedf->dbg_ctx), "sc_cmd->request is NULL, " "sc_cmd=%p.\n", sc_cmd); @@ -1194,6 +1244,12 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, if (qedf_io_tracing) qedf_trace_io(fcport, io_req, QEDF_IO_TRACE_RSP); + /* + * We wait till the end of the function to clear the + * outstanding bit in case we need to send an abort + */ + clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + io_req->sc_cmd = NULL; sc_cmd->SCp.ptr = NULL; sc_cmd->scsi_done(sc_cmd); @@ -1211,6 +1267,19 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, if (!io_req) return; + if (test_and_set_bit(QEDF_CMD_ERR_SCSI_DONE, &io_req->flags)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "io_req:%p scsi_done handling already done\n", + io_req); + return; + } + + /* + * We will be done with this command after this call so clear the + * outstanding bit. + */ + clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + xid = io_req->xid; sc_cmd = io_req->sc_cmd; @@ -1219,12 +1288,23 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, return; } + if (!virt_addr_valid(sc_cmd)) { + QEDF_ERR(&qedf->dbg_ctx, "sc_cmd=%p is not valid.", sc_cmd); + return; + } + if (!sc_cmd->SCp.ptr) { QEDF_WARN(&(qedf->dbg_ctx), "SCp.ptr is NULL, returned in " "another context.\n"); return; } + if (!sc_cmd->device) { + QEDF_ERR(&qedf->dbg_ctx, "Device for sc_cmd %p is NULL.\n", + sc_cmd); + return; + } + qedf_unmap_sg_list(qedf, io_req); sc_cmd->result = result << 16; @@ -1389,6 +1469,10 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) struct qedf_ctx *qedf; struct qedf_cmd_mgr *cmd_mgr; int i, rc; + unsigned long flags; + int flush_cnt = 0; + int wait_cnt = 100; + int refcount = 0; if (!fcport) return; @@ -1400,18 +1484,87 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) } qedf = fcport->qedf; + + if (!qedf) { + QEDF_ERR(NULL, "qedf is NULL.\n"); + return; + } + + /* Only wait for all commands to be queued in the Upload context */ + if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags) && + (lun == -1)) { + while (atomic_read(&fcport->ios_to_queue)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Waiting for %d I/Os to be queued\n", + atomic_read(&fcport->ios_to_queue)); + if (wait_cnt == 0) { + QEDF_ERR(NULL, + "%d IOs request could not be queued\n", + atomic_read(&fcport->ios_to_queue)); + } + msleep(20); + wait_cnt--; + } + } + cmd_mgr = qedf->cmd_mgr; - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "Flush active i/o's.\n"); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Flush active i/o's num=0x%x fcport=0x%p port_id=0x%06x scsi_id=%d.\n", + atomic_read(&fcport->num_active_ios), fcport, + fcport->rdata->ids.port_id, fcport->rport->scsi_target_id); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Locking flush mutex.\n"); + + mutex_lock(&qedf->flush_mutex); + if (lun == -1) { + set_bit(QEDF_RPORT_IN_TARGET_RESET, &fcport->flags); + } else { + set_bit(QEDF_RPORT_IN_LUN_RESET, &fcport->flags); + fcport->lun_reset_lun = lun; + } for (i = 0; i < FCOE_PARAMS_NUM_TASKS; i++) { io_req = &cmd_mgr->cmds[i]; if (!io_req) continue; + if (!io_req->fcport) + continue; + + spin_lock_irqsave(&cmd_mgr->lock, flags); + + if (io_req->alloc) { + if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags)) { + if (io_req->cmd_type == QEDF_SCSI_CMD) + QEDF_ERR(&qedf->dbg_ctx, + "Allocated but not queued, xid=0x%x\n", + io_req->xid); + } + spin_unlock_irqrestore(&cmd_mgr->lock, flags); + } else { + spin_unlock_irqrestore(&cmd_mgr->lock, flags); + continue; + } + if (io_req->fcport != fcport) continue; - if (io_req->cmd_type == QEDF_ELS) { + + /* In case of ABTS, CMD_OUTSTANDING is cleared on ABTS response, + * but RRQ is still pending. + * Workaround: Within qedf_send_rrq, we check if the fcport is + * NULL, and we drop the ref on the io_req to clean it up. + */ + if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags)) { + refcount = kref_read(&io_req->refcount); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Not outstanding, xid=0x%x, cmd_type=%d refcount=%d.\n", + io_req->xid, io_req->cmd_type, refcount); + continue; + } + + /* Only consider flushing ELS during target reset */ + if (io_req->cmd_type == QEDF_ELS && + lun == -1) { rc = kref_get_unless_zero(&io_req->refcount); if (!rc) { QEDF_ERR(&(qedf->dbg_ctx), @@ -1419,6 +1572,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) io_req, io_req->xid); continue; } + flush_cnt++; qedf_flush_els_req(qedf, io_req); /* * Release the kref and go back to the top of the @@ -1435,28 +1589,49 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) io_req, io_req->xid); continue; } + if (lun != -1 && io_req->lun != lun) + goto free_cmd; + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Flushing abort xid=0x%x.\n", io_req->xid); - clear_bit(QEDF_CMD_IN_ABORT, &io_req->flags); - - if (io_req->sc_cmd) { - if (io_req->return_scsi_cmd_on_abts) - qedf_scsi_done(qedf, io_req, DID_ERROR); + if (cancel_delayed_work_sync(&io_req->rrq_work)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Putting reference for pending RRQ work xid=0x%x.\n", + io_req->xid); + kref_put(&io_req->refcount, qedf_release_cmd); } + /* Cancel any timeout work */ + cancel_delayed_work_sync(&io_req->timeout_work); + + if (!test_bit(QEDF_CMD_IN_ABORT, &io_req->flags)) + goto free_cmd; + + qedf_initiate_cleanup(io_req, true); + flush_cnt++; + /* Notify eh_abort handler that ABTS is complete */ - complete(&io_req->abts_done); kref_put(&io_req->refcount, qedf_release_cmd); + complete(&io_req->abts_done); goto free_cmd; } if (!io_req->sc_cmd) continue; - if (lun > 0) { - if (io_req->sc_cmd->device->lun != - (u64)lun) + if (!io_req->sc_cmd->device) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Device backpointer NULL for sc_cmd=%p.\n", + io_req->sc_cmd); + /* Put reference for non-existent scsi_cmnd */ + io_req->sc_cmd = NULL; + qedf_initiate_cleanup(io_req, false); + kref_put(&io_req->refcount, qedf_release_cmd); + continue; + } + if (lun > -1) { + if (io_req->lun != lun) continue; } @@ -1470,8 +1645,10 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) "io_req=0x%p xid=0x%x\n", io_req, io_req->xid); continue; } + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "Cleanup xid=0x%x.\n", io_req->xid); + flush_cnt++; /* Cleanup task and return I/O mid-layer */ qedf_initiate_cleanup(io_req, true); @@ -1479,6 +1656,52 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) free_cmd: kref_put(&io_req->refcount, qedf_release_cmd); } + + wait_cnt = 60; + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Flushed 0x%x I/Os, active=0x%x.\n", + flush_cnt, atomic_read(&fcport->num_active_ios)); + /* Only wait for all commands to complete in the Upload context */ + if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags) && + (lun == -1)) { + while (atomic_read(&fcport->num_active_ios)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Flushed 0x%x I/Os, active=0x%x cnt=%d.\n", + flush_cnt, + atomic_read(&fcport->num_active_ios), + wait_cnt); + if (wait_cnt == 0) { + QEDF_ERR(&qedf->dbg_ctx, + "Flushed %d I/Os, active=%d.\n", + flush_cnt, + atomic_read(&fcport->num_active_ios)); + for (i = 0; i < FCOE_PARAMS_NUM_TASKS; i++) { + io_req = &cmd_mgr->cmds[i]; + if (io_req->fcport && + io_req->fcport == fcport) { + refcount = + kref_read(&io_req->refcount); + QEDF_ERR(&qedf->dbg_ctx, + "Outstanding io_req =%p xid=0x%x flags=0x%lx, sc_cmd=%p refcount=%d cmd_type=%d.\n", + io_req, io_req->xid, + io_req->flags, + io_req->sc_cmd, + refcount, + io_req->cmd_type); + } + } + WARN_ON(1); + break; + } + msleep(500); + wait_cnt--; + } + } + + clear_bit(QEDF_RPORT_IN_LUN_RESET, &fcport->flags); + clear_bit(QEDF_RPORT_IN_TARGET_RESET, &fcport->flags); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Unlocking flush mutex.\n"); + mutex_unlock(&qedf->flush_mutex); } /* @@ -1754,6 +1977,7 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, unsigned long flags; struct fcoe_wqe *sqe; u16 sqe_idx; + int refcount = 0; fcport = io_req->fcport; if (!fcport) { @@ -1775,7 +1999,7 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, } if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags) || - test_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags)) { + test_and_set_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags)) { QEDF_ERR(&(qedf->dbg_ctx), "io_req xid=0x%x already in " "cleanup processing or already completed.\n", io_req->xid); @@ -1788,20 +2012,26 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, return FAILED; } + if (io_req->cmd_type == QEDF_CLEANUP) { + QEDF_ERR(&qedf->dbg_ctx, + "io_req=0x%x is already a cleanup command cmd_type=%d.\n", + io_req->xid, io_req->cmd_type); + clear_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags); + return SUCCESS; + } + + refcount = kref_read(&io_req->refcount); - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "Entered xid=0x%x\n", - io_req->xid); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Entered xid=0x%x sc_cmd=%p cmd_type=%d flags=0x%lx refcount=%d\n", + io_req->xid, io_req->sc_cmd, io_req->cmd_type, io_req->flags, + refcount); /* Cleanup cmds re-use the same TID as the original I/O */ xid = io_req->xid; io_req->cmd_type = QEDF_CLEANUP; io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts; - /* Set the return CPU to be the same as the request one */ - io_req->cpu = smp_processor_id(); - - set_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags); - task = qedf_get_task_mem(&qedf->tasks, xid); init_completion(&io_req->tm_done); @@ -1832,6 +2062,15 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, qedf_drain_request(qedf); } + /* If it TASK MGMT handle it, reference will be decreased + * in qedf_execute_tmf + */ + if (io_req->cmd_type == QEDF_TASK_MGMT_CMD) { + clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + io_req->sc_cmd = NULL; + complete(&io_req->tm_done); + } + if (io_req->sc_cmd) { if (io_req->return_scsi_cmd_on_abts) qedf_scsi_done(qedf, io_req, DID_ERROR); diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 432026b..8affe0e 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1369,10 +1369,12 @@ static void qedf_rport_event_handler(struct fc_lport *lport, fcport = (struct qedf_rport *)&rp[1]; /* Only free this fcport if it is offloaded already */ - if (test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { - set_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags); + if (test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags) && + !test_bit(QEDF_RPORT_UPLOADING_CONNECTION, + &fcport->flags)) { + set_bit(QEDF_RPORT_UPLOADING_CONNECTION, + &fcport->flags); qedf_cleanup_fcport(qedf, fcport); - /* * Remove fcport to list of qedf_ctx list of offloaded * ports From patchwork Tue Mar 5 10:58:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839273 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 F181F1823 for ; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC75D2B2A9 for ; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0D732B352; Tue, 5 Mar 2019 10:59:33 +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,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 713C72B2C2 for ; Tue, 5 Mar 2019 10:59:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727450AbfCEK7b (ORCPT ); Tue, 5 Mar 2019 05:59:31 -0500 Received: from mail-eopbgr750050.outbound.protection.outlook.com ([40.107.75.50]:37447 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726765AbfCEK7b (ORCPT ); Tue, 5 Mar 2019 05:59:31 -0500 Received: from BYAPR07CA0024.namprd07.prod.outlook.com (2603:10b6:a02:bc::37) by BN7PR07MB4753.namprd07.prod.outlook.com (2603:10b6:406:f0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:23 +0000 Received: from BY2NAM05FT059.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::206) by BYAPR07CA0024.outlook.office365.com (2603:10b6:a02:bc::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:22 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT059.mail.protection.outlook.com (10.152.100.196) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:22 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:20 -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 x25AxK7P013244; Tue, 5 Mar 2019 02:59:20 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxKkR013243; Tue, 5 Mar 2019 02:59:20 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 06/26] qedf: Modify abort and tmf handler to handle edge condition and flush. Date: Tue, 5 Mar 2019 02:58:41 -0800 Message-ID: <20190305105901.13185-7-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571624258578;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(136003)(346002)(376002)(396003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(486006)(54906003)(86362001)(1076003)(305945005)(316002)(80596001)(42186006)(4326008)(16586007)(36906005)(69596002)(81166006)(26005)(14444005)(2351001)(97736004)(30864003)(51416003)(81156014)(8676002)(76176011)(446003)(47776003)(11346002)(336012)(105606002)(50226002)(106466001)(26826003)(2616005)(8936002)(6862004)(53936002)(5660300002)(48376002)(68736007)(85426001)(126002)(498600001)(6666004)(87636003)(356004)(50466002)(476003)(36756003)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4753;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41339bce-cdca-475c-4de2-08d6a1599fc6 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4753; X-MS-TrafficTypeDiagnostic: BN7PR07MB4753: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4753;23:ehR6UCfHP3DfVtZ4ZwbRf8ooQv7GmQLXCrT/Yx5O2XdbkAWpIhhu2z/JgRvXNJow9zkZDSV6SIhUHSMWWMCCm6PgVrDsjEEHEe4Gb5x6Ge8t+G/iemD9Eu0sRv0OpZl0poyfS9WXp4+55lx8/LKAX+XALKxxSQSDXMvxSMLOphIYk/slw4sQBSwDv4hh/kzu6igyKNH7AzyYMDk9rRNNCnUMbQ7suoDknu3D1v6LLZhuJXrtg+OUIdZRXOayZZFVLk4xbu5q2q+LxNhkXJJB8Ia/gkWV9Sz+31TN15syEwnPPH8aglf9r+UCGEBEVGQobG6r5LPRcX260G2ewpyDdqQCHZoSKKYlIcE/u4AofRRo5uwHpZQOswC+3zpkRer+46YpKSq0XhaRDanAzvWouJvZA4AXJeSjZ7QCFewkDSgrk9CajDir8g9qQJpNBKmeePle01tHCiUPyYlgN90FUiXDZ+dcBkhHOC7SDcgJNiUxMtqkT6Q4G7pfELerm5vySywS2kvpnDxSlQgmgll+8dNiofULFSSqpdJ2E+nh9FWe4lpOcdajOMKi1fZ/ftUkvtFWqAQ/zChGIbl7Ao3B1eetVhcb7m6goicJb8cGtgt781EB9m4ZATiqlIlFtC0yt7lAl0sMgc7GibBPypqN7bUJ1FGfY62S2iB/oLPSPMW/0tJNMcEXQMcPpbR/3Mo81vBrpOeHWHSe4EvGGSdfy9YAN+/5bYBIF/9/cxtzmNh2hP1y7EdhIGJdhxmQWuoL8oKitzCXXl1dKgpRUIL0DEff05rik2qvH8UUmvbk/dPkjh/wFo3tXhbGQ87V/bTnN4E2URlDOrOLh+eGMx8XBZuHwyB5j6jBfB1i9x3NxcnAixbESrxL6iK51V6R2ujE7sETJ5sC+T6+7uQMS6Ar63PATU3gK5mTvTDDQyr0nx8tUxdZICQ7MzkwvX4nxeXkNwTFV3wGNcJ2LbjbjxPJPbmAnhHrZpkfagxu20WTjaAbNNh1e2wFFg0pFM2zAAMMbdMunm3Ue3A+clfPtPqRCcu3Zb9FHOyG8NIrCYky8mnpa/h/8cvYPfNzXhCwInKVyVo3wHlKnFzAAvW/JwmnB2xGrs4l4u1XM2yxlEqObijPT8CExkH5Q+un5P4wT4qLO50BISC0TBHlRHKgz7a8FsAK8Ne8BA1JdX8cowlffte6CflqpUwX6hQv3x6s9rVSuQPf7VtmeuXxxQc3GFLrYsKGZum4R/XIFC5l82OIlI0F25iQ/SVEZ2ivumfhh2SRM5w9wKEbMuI+/Fdx4J6msg== X-Microsoft-Antispam-Message-Info: 49w0mIVSyjxxkz6Hb3ziWVrQDgI3T1ZumCyJ900RESBkFIFp0tBo4nmmrvIzH20J5Prhxl/v2UBijksXaNNWyD2S/WhdtZnD7ozvA/avqmCrkDEb9JIQWrXjaE2lPvwWqk6lPhzDKGpbash+YcrGt71ZL6EwicmYPAGakRZk47tBd9kSA9atI/8TX0Dqdnl1LX4nzRspnBp5Gej/KoYI31g2bwmwEd0mfw7saIrvLhEjnwjY1k8JvwAe9sHZDUgb3LzOrpqcTwlgfDQmPCSLD4fQoyqYvnV/dtF+sglVIR1PBGKbMDFqT+1FmpiYbQDQ3x2OGhBopU1gO5r/svCNnMgaQ+1hhUOUSf9MW1qJtuHZXYVcucK82UET8K3IpQXUvjf8nFD/0/ltmQTjRo2T6pH3D3Cja4T5ZaV9F9TEXFs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:22.1706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41339bce-cdca-475c-4de2-08d6a1599fc6 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4753 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 An I/Os can be any state when flush is called, it can be in abort, Waiting for abort, RRQ send and waiting or TMF send. - HZ can be different on different architecture, correctly set abort timeout value. - Flush can complete the I/Os prematurely, handle refcount for aborted I/Os and for which RRQ is pending. - Differentiate LUN/TARGET reset, as cleanup needs to be send to firmware accordingly. - Add flush mutex to sync cleanup call from abort and flush routine. - Clear abort/outstanding bit on timeout. Signed-off-by: Shyam Sundar Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf.h | 10 ++- drivers/scsi/qedf/qedf_els.c | 31 +++++++- drivers/scsi/qedf/qedf_io.c | 178 +++++++++++++++++++++++++++++++++++------- drivers/scsi/qedf/qedf_main.c | 124 +++++++++++++++++++++-------- 4 files changed, 276 insertions(+), 67 deletions(-) diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 787cc12..9e5e183 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -49,8 +49,8 @@ sizeof(struct fc_frame_header)) #define QEDF_MAX_NPIV 64 #define QEDF_TM_TIMEOUT 10 -#define QEDF_ABORT_TIMEOUT 10 -#define QEDF_CLEANUP_TIMEOUT 10 +#define QEDF_ABORT_TIMEOUT (10 * 1000) +#define QEDF_CLEANUP_TIMEOUT 1 #define QEDF_MAX_CDB_LEN 16 #define UPSTREAM_REMOVE 1 @@ -82,6 +82,7 @@ struct qedf_els_cb_arg { }; enum qedf_ioreq_event { + QEDF_IOREQ_EV_NONE, QEDF_IOREQ_EV_ABORT_SUCCESS, QEDF_IOREQ_EV_ABORT_FAILED, QEDF_IOREQ_EV_SEND_RRQ, @@ -182,7 +183,10 @@ struct qedf_rport { #define QEDF_RPORT_SESSION_READY 1 #define QEDF_RPORT_UPLOADING_CONNECTION 2 #define QEDF_RPORT_IN_RESET 3 +#define QEDF_RPORT_IN_LUN_RESET 4 +#define QEDF_RPORT_IN_TARGET_RESET 5 unsigned long flags; + int lun_reset_lun; unsigned long retry_delay_timestamp; struct fc_rport *rport; struct fc_rport_priv *rdata; @@ -395,6 +399,8 @@ struct qedf_ctx { u8 target_resets; u8 task_set_fulls; u8 busy; + /* Used for flush routine */ + struct mutex flush_mutex; }; struct io_bdt { diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index a60819b..ac2bfc2 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -201,8 +201,12 @@ static void qedf_rrq_compl(struct qedf_els_cb_arg *cb_arg) " orig xid = 0x%x, rrq_xid = 0x%x, refcount=%d\n", orig_io_req, orig_io_req->xid, rrq_req->xid, refcount); - /* This should return the aborted io_req to the command pool */ - if (orig_io_req) + /* + * This should return the aborted io_req to the command pool. Note that + * we need to check the refcound in case the original request was + * flushed but we get a completion on this xid. + */ + if (orig_io_req && refcount > 0) kref_put(&orig_io_req->refcount, qedf_release_cmd); out_free: @@ -229,6 +233,7 @@ int qedf_send_rrq(struct qedf_ioreq *aborted_io_req) uint32_t sid; uint32_t r_a_tov; int rc; + int refcount; if (!aborted_io_req) { QEDF_ERR(NULL, "abort_io_req is NULL.\n"); @@ -237,6 +242,15 @@ int qedf_send_rrq(struct qedf_ioreq *aborted_io_req) fcport = aborted_io_req->fcport; + if (!fcport) { + refcount = kref_read(&aborted_io_req->refcount); + QEDF_ERR(NULL, + "RRQ work was queued prior to a flush xid=0x%x, refcount=%d.\n", + aborted_io_req->xid, refcount); + kref_put(&aborted_io_req->refcount, qedf_release_cmd); + return -EINVAL; + } + /* Check that fcport is still offloaded */ if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { QEDF_ERR(NULL, "fcport is no longer offloaded.\n"); @@ -249,6 +263,19 @@ int qedf_send_rrq(struct qedf_ioreq *aborted_io_req) } qedf = fcport->qedf; + + /* + * Sanity check that we can send a RRQ to make sure that refcount isn't + * 0 + */ + refcount = kref_read(&aborted_io_req->refcount); + if (refcount != 1) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS, + "refcount for xid=%x io_req=%p refcount=%d is not 1.\n", + aborted_io_req->xid, aborted_io_req, refcount); + return -EINVAL; + } + lport = qedf->lport; sid = fcport->sid; r_a_tov = lport->r_a_tov; diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 3a8c7f7..044ef63 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -43,8 +43,9 @@ static void qedf_cmd_timeout(struct work_struct *work) switch (io_req->cmd_type) { case QEDF_ABTS: if (qedf == NULL) { - QEDF_INFO(NULL, QEDF_LOG_IO, "qedf is NULL for xid=0x%x.\n", - io_req->xid); + QEDF_INFO(NULL, QEDF_LOG_IO, + "qedf is NULL for ABTS xid=0x%x.\n", + io_req->xid); return; } @@ -61,6 +62,9 @@ static void qedf_cmd_timeout(struct work_struct *work) */ kref_put(&io_req->refcount, qedf_release_cmd); + /* Clear in abort bit now that we're done with the command */ + clear_bit(QEDF_CMD_IN_ABORT, &io_req->flags); + /* * Now that the original I/O and the ABTS are complete see * if we need to reconnect to the target. @@ -68,6 +72,15 @@ static void qedf_cmd_timeout(struct work_struct *work) qedf_restart_rport(fcport); break; case QEDF_ELS: + if (!qedf) { + QEDF_INFO(NULL, QEDF_LOG_IO, + "qedf is NULL for ELS xid=0x%x.\n", + io_req->xid); + return; + } + /* ELS request no longer outstanding since it timed out */ + clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + kref_get(&io_req->refcount); /* * Don't attempt to clean an ELS timeout as any subseqeunt @@ -1137,6 +1150,19 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, fcport = io_req->fcport; + /* + * When flush is active, let the cmds be completed from the cleanup + * context + */ + if (test_bit(QEDF_RPORT_IN_TARGET_RESET, &fcport->flags) || + (test_bit(QEDF_RPORT_IN_LUN_RESET, &fcport->flags) && + sc_cmd->device->lun == (u64)fcport->lun_reset_lun)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Dropping good completion xid=0x%x as fcport is flushing", + io_req->xid); + return; + } + qedf_parse_fcp_rsp(io_req, fcp_rsp); qedf_unmap_sg_list(qedf, io_req); @@ -1720,15 +1746,23 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) unsigned long flags; struct fcoe_wqe *sqe; u16 sqe_idx; + int refcount = 0; /* Sanity check qedf_rport before dereferencing any pointers */ if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { QEDF_ERR(NULL, "tgt not offloaded\n"); rc = 1; - goto abts_err; + goto out; } rdata = fcport->rdata; + + if (!rdata || !kref_get_unless_zero(&rdata->kref)) { + QEDF_ERR(&qedf->dbg_ctx, "stale rport\n"); + rc = 1; + goto out; + } + r_a_tov = rdata->r_a_tov; qedf = fcport->qedf; lport = qedf->lport; @@ -1736,20 +1770,20 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) if (lport->state != LPORT_ST_READY || !(lport->link_up)) { QEDF_ERR(&(qedf->dbg_ctx), "link is not ready\n"); rc = 1; - goto abts_err; + goto out; } if (atomic_read(&qedf->link_down_tmo_valid) > 0) { QEDF_ERR(&(qedf->dbg_ctx), "link_down_tmo active.\n"); rc = 1; - goto abts_err; + goto out; } /* Ensure room on SQ */ if (!atomic_read(&fcport->free_sqes)) { QEDF_ERR(&(qedf->dbg_ctx), "No SQ entries available\n"); rc = 1; - goto abts_err; + goto out; } if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { @@ -1774,18 +1808,17 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) qedf->control_requests++; qedf->packet_aborts++; - /* Set the return CPU to be the same as the request one */ - io_req->cpu = smp_processor_id(); - /* Set the command type to abort */ io_req->cmd_type = QEDF_ABTS; io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts; set_bit(QEDF_CMD_IN_ABORT, &io_req->flags); - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "ABTS io_req xid = " - "0x%x\n", xid); + refcount = kref_read(&io_req->refcount); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM, + "ABTS io_req xid = 0x%x refcount=%d\n", + xid, refcount); - qedf_cmd_timer_set(qedf, io_req, QEDF_ABORT_TIMEOUT * HZ); + qedf_cmd_timer_set(qedf, io_req, QEDF_ABORT_TIMEOUT); spin_lock_irqsave(&fcport->rport_lock, flags); @@ -1799,13 +1832,6 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) spin_unlock_irqrestore(&fcport->rport_lock, flags); - return rc; -abts_err: - /* - * If the ABTS task fails to queue then we need to cleanup the - * task at the firmware. - */ - qedf_initiate_cleanup(io_req, return_scsi_cmd_on_abts); out: return rc; } @@ -1815,25 +1841,59 @@ void qedf_process_abts_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, { uint32_t r_ctl; uint16_t xid; + int rc; + struct qedf_rport *fcport = io_req->fcport; QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "Entered with xid = " "0x%x cmd_type = %d\n", io_req->xid, io_req->cmd_type); - cancel_delayed_work(&io_req->timeout_work); - xid = io_req->xid; r_ctl = cqe->cqe_info.abts_info.r_ctl; + /* This was added at a point when we were scheduling abts_compl & + * cleanup_compl on different CPUs and there was a possibility of + * the io_req to be freed from the other context before we got here. + */ + if (!fcport) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Dropping ABTS completion xid=0x%x as fcport is NULL", + io_req->xid); + return; + } + + /* + * When flush is active, let the cmds be completed from the cleanup + * context + */ + if (test_bit(QEDF_RPORT_IN_TARGET_RESET, &fcport->flags) || + test_bit(QEDF_RPORT_IN_LUN_RESET, &fcport->flags)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Dropping ABTS completion xid=0x%x as fcport is flushing", + io_req->xid); + return; + } + + if (!cancel_delayed_work(&io_req->timeout_work)) { + QEDF_ERR(&qedf->dbg_ctx, + "Wasn't able to cancel abts timeout work.\n"); + } + switch (r_ctl) { case FC_RCTL_BA_ACC: QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "ABTS response - ACC Send RRQ after R_A_TOV\n"); io_req->event = QEDF_IOREQ_EV_ABORT_SUCCESS; + rc = kref_get_unless_zero(&io_req->refcount); + if (!rc) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM, + "kref is already zero so ABTS was already completed or flushed xid=0x%x.\n", + io_req->xid); + return; + } /* * Dont release this cmd yet. It will be relesed * after we get RRQ response */ - kref_get(&io_req->refcount); queue_delayed_work(qedf->dpc_wq, &io_req->rrq_work, msecs_to_jiffies(qedf->lport->r_a_tov)); break; @@ -2106,6 +2166,7 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, int rc = 0; uint16_t xid; int tmo = 0; + int lun = 0; unsigned long flags; struct fcoe_wqe *sqe; u16 sqe_idx; @@ -2115,6 +2176,7 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, return FAILED; } + lun = (int)sc_cmd->device->lun; if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { QEDF_ERR(&(qedf->dbg_ctx), "fcport not offloaded\n"); rc = FAILED; @@ -2141,7 +2203,7 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, io_req->fcport = fcport; io_req->cmd_type = QEDF_TASK_MGMT_CMD; - /* Set the return CPU to be the same as the request one */ + /* Record which cpu this request is associated with */ io_req->cpu = smp_processor_id(); /* Set TM flags */ @@ -2150,7 +2212,7 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, io_req->tm_flags = tm_flags; /* Default is to return a SCSI command when an error occurs */ - io_req->return_scsi_cmd_on_abts = true; + io_req->return_scsi_cmd_on_abts = false; /* Obtain exchange id */ xid = io_req->xid; @@ -2174,12 +2236,16 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, spin_unlock_irqrestore(&fcport->rport_lock, flags); + set_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); tmo = wait_for_completion_timeout(&io_req->tm_done, QEDF_TM_TIMEOUT * HZ); if (!tmo) { rc = FAILED; QEDF_ERR(&(qedf->dbg_ctx), "wait for tm_cmpl timeout!\n"); + /* Clear outstanding bit since command timed out */ + clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + io_req->sc_cmd = NULL; } else { /* Check TMF response code */ if (io_req->fcp_rsp_code == 0) @@ -2187,14 +2253,25 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, else rc = FAILED; } + /* + * Double check that fcport has not gone into an uploading state before + * executing the command flush for the LUN/target. + */ + if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { + QEDF_ERR(&qedf->dbg_ctx, + "fcport is uploading, not executing flush.\n"); + goto no_flush; + } + /* We do not need this io_req any more */ + kref_put(&io_req->refcount, qedf_release_cmd); + if (tm_flags == FCP_TMF_LUN_RESET) - qedf_flush_active_ios(fcport, (int)sc_cmd->device->lun); + qedf_flush_active_ios(fcport, lun); else qedf_flush_active_ios(fcport, -1); - kref_put(&io_req->refcount, qedf_release_cmd); - +no_flush: if (rc != SUCCESS) { QEDF_ERR(&(qedf->dbg_ctx), "task mgmt command failed...\n"); rc = FAILED; @@ -2215,22 +2292,57 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) struct fc_lport *lport; int rc = SUCCESS; int rval; + struct qedf_ioreq *io_req = NULL; + int ref_cnt = 0; + struct fc_rport_priv *rdata = fcport->rdata; - rval = fc_remote_port_chkready(rport); + QEDF_ERR(NULL, + "tm_flags 0x%x sc_cmd %p op = 0x%02x target_id = 0x%x lun=%d\n", + tm_flags, sc_cmd, sc_cmd->cmnd[0], rport->scsi_target_id, + (int)sc_cmd->device->lun); + if (!rdata || !kref_get_unless_zero(&rdata->kref)) { + QEDF_ERR(NULL, "stale rport\n"); + return FAILED; + } + + QEDF_ERR(NULL, "portid=%06x tm_flags =%s\n", rdata->ids.port_id, + (tm_flags == FCP_TMF_TGT_RESET) ? "TARGET RESET" : + "LUN RESET"); + + if (sc_cmd->SCp.ptr) { + io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr; + ref_cnt = kref_read(&io_req->refcount); + QEDF_ERR(NULL, + "orig io_req = %p xid = 0x%x ref_cnt = %d.\n", + io_req, io_req->xid, ref_cnt); + } + + rval = fc_remote_port_chkready(rport); if (rval) { QEDF_ERR(NULL, "device_reset rport not ready\n"); rc = FAILED; goto tmf_err; } - if (fcport == NULL) { + rc = fc_block_scsi_eh(sc_cmd); + if (rc) + return rc; + + if (!fcport) { QEDF_ERR(NULL, "device_reset: rport is NULL\n"); rc = FAILED; goto tmf_err; } qedf = fcport->qedf; + + if (!qedf) { + QEDF_ERR(NULL, "qedf is NULL.\n"); + rc = FAILED; + goto tmf_err; + } + lport = qedf->lport; if (test_bit(QEDF_UNLOADING, &qedf->flags) || @@ -2245,6 +2357,12 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) goto tmf_err; } + if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { + QEDF_ERR(&qedf->dbg_ctx, "fcport is uploading.\n"); + rc = FAILED; + goto tmf_err; + } + rc = qedf_execute_tmf(fcport, sc_cmd, tm_flags); tmf_err: @@ -2256,6 +2374,8 @@ void qedf_process_tmf_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, { struct fcoe_cqe_rsp_info *fcp_rsp; + clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); + fcp_rsp = &cqe->cqe_info.rsp_info; qedf_parse_fcp_rsp(io_req, fcp_rsp); diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 8affe0e..3fd8107 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -615,50 +615,113 @@ static u32 qedf_get_login_failures(void *cookie) static int qedf_eh_abort(struct scsi_cmnd *sc_cmd) { struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); - struct fc_rport_libfc_priv *rp = rport->dd_data; - struct qedf_rport *fcport; struct fc_lport *lport; struct qedf_ctx *qedf; struct qedf_ioreq *io_req; + struct fc_rport_libfc_priv *rp = rport->dd_data; + struct fc_rport_priv *rdata; + struct qedf_rport *fcport = NULL; int rc = FAILED; + int wait_count = 100; + int refcount = 0; int rval; - - if (fc_remote_port_chkready(rport)) { - QEDF_ERR(NULL, "rport not ready\n"); - goto out; - } + int got_ref = 0; lport = shost_priv(sc_cmd->device->host); qedf = (struct qedf_ctx *)lport_priv(lport); - if ((lport->state != LPORT_ST_READY) || !(lport->link_up)) { - QEDF_ERR(&(qedf->dbg_ctx), "link not ready.\n"); + /* rport and tgt are allocated together, so tgt should be non-NULL */ + fcport = (struct qedf_rport *)&rp[1]; + rdata = fcport->rdata; + if (!rdata || !kref_get_unless_zero(&rdata->kref)) { + QEDF_ERR(&qedf->dbg_ctx, "stale rport, sc_cmd=%p\n", sc_cmd); + rc = 1; goto out; } - fcport = (struct qedf_rport *)&rp[1]; io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr; if (!io_req) { - QEDF_ERR(&(qedf->dbg_ctx), "io_req is NULL.\n"); + QEDF_ERR(&qedf->dbg_ctx, + "sc_cmd not queued with lld, sc_cmd=%p op=0x%02x, port_id=%06x\n", + sc_cmd, sc_cmd->cmnd[0], + rdata->ids.port_id); rc = SUCCESS; - goto out; + goto drop_rdata_kref; } - QEDF_ERR(&(qedf->dbg_ctx), "Aborting io_req sc_cmd=%p xid=0x%x " - "fp_idx=%d.\n", sc_cmd, io_req->xid, io_req->fp_idx); + rval = kref_get_unless_zero(&io_req->refcount); /* ID: 005 */ + if (rval) + got_ref = 1; + + /* If we got a valid io_req, confirm it belongs to this sc_cmd. */ + if (!rval || io_req->sc_cmd != sc_cmd) { + QEDF_ERR(&qedf->dbg_ctx, + "Freed/Incorrect io_req, io_req->sc_cmd=%p, sc_cmd=%p, port_id=%06x, bailing out.\n", + io_req->sc_cmd, sc_cmd, rdata->ids.port_id); + + goto drop_rdata_kref; + } + + if (fc_remote_port_chkready(rport)) { + refcount = kref_read(&io_req->refcount); + QEDF_ERR(&qedf->dbg_ctx, + "rport not ready, io_req=%p, xid=0x%x sc_cmd=%p op=0x%02x, refcount=%d, port_id=%06x\n", + io_req, io_req->xid, sc_cmd, sc_cmd->cmnd[0], + refcount, rdata->ids.port_id); + + goto drop_rdata_kref; + } + + rc = fc_block_scsi_eh(sc_cmd); + if (rc) + goto drop_rdata_kref; + + if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { + QEDF_ERR(&qedf->dbg_ctx, + "Connection uploading, xid=0x%x., port_id=%06x\n", + io_req->xid, rdata->ids.port_id); + while (io_req->sc_cmd && (wait_count != 0)) { + msleep(100); + wait_count--; + } + if (wait_count) { + QEDF_ERR(&qedf->dbg_ctx, "ABTS succeeded\n"); + rc = SUCCESS; + } else { + QEDF_ERR(&qedf->dbg_ctx, "ABTS failed\n"); + rc = FAILED; + } + goto drop_rdata_kref; + } + + if (lport->state != LPORT_ST_READY || !(lport->link_up)) { + QEDF_ERR(&qedf->dbg_ctx, "link not ready.\n"); + goto drop_rdata_kref; + } + + QEDF_ERR(&qedf->dbg_ctx, + "Aborting io_req=%p sc_cmd=%p xid=0x%x fp_idx=%d, port_id=%06x.\n", + io_req, sc_cmd, io_req->xid, io_req->fp_idx, + rdata->ids.port_id); if (qedf->stop_io_on_error) { qedf_stop_all_io(qedf); rc = SUCCESS; - goto out; + goto drop_rdata_kref; } init_completion(&io_req->abts_done); rval = qedf_initiate_abts(io_req, true); if (rval) { QEDF_ERR(&(qedf->dbg_ctx), "Failed to queue ABTS.\n"); - goto out; + /* + * If we fail to queue the ABTS then return this command to + * the SCSI layer as it will own and free the xid + */ + rc = SUCCESS; + qedf_scsi_done(qedf, io_req, DID_ERROR); + goto drop_rdata_kref; } wait_for_completion(&io_req->abts_done); @@ -684,19 +747,27 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd) QEDF_ERR(&(qedf->dbg_ctx), "ABTS failed, xid=0x%x.\n", io_req->xid); +drop_rdata_kref: + kref_put(&rdata->kref, fc_rport_destroy); out: + if (got_ref) + kref_put(&io_req->refcount, qedf_release_cmd); return rc; } static int qedf_eh_target_reset(struct scsi_cmnd *sc_cmd) { - QEDF_ERR(NULL, "TARGET RESET Issued..."); + QEDF_ERR(NULL, "%d:0:%d:%lld: TARGET RESET Issued...", + sc_cmd->device->host->host_no, sc_cmd->device->id, + sc_cmd->device->lun); return qedf_initiate_tmf(sc_cmd, FCP_TMF_TGT_RESET); } static int qedf_eh_device_reset(struct scsi_cmnd *sc_cmd) { - QEDF_ERR(NULL, "LUN RESET Issued...\n"); + QEDF_ERR(NULL, "%d:0:%d:%lld: LUN RESET Issued... ", + sc_cmd->device->host->host_no, sc_cmd->device->id, + sc_cmd->device->lun); return qedf_initiate_tmf(sc_cmd, FCP_TMF_LUN_RESET); } @@ -740,22 +811,6 @@ static int qedf_eh_host_reset(struct scsi_cmnd *sc_cmd) { struct fc_lport *lport; struct qedf_ctx *qedf; - struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); - struct fc_rport_libfc_priv *rp = rport->dd_data; - struct qedf_rport *fcport = (struct qedf_rport *)&rp[1]; - int rval; - - rval = fc_remote_port_chkready(rport); - - if (rval) { - QEDF_ERR(NULL, "device_reset rport not ready\n"); - return FAILED; - } - - if (fcport == NULL) { - QEDF_ERR(NULL, "device_reset: rport is NULL\n"); - return FAILED; - } lport = shost_priv(sc_cmd->device->host); qedf = lport_priv(lport); @@ -3002,6 +3057,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) pci_set_drvdata(pdev, qedf); init_completion(&qedf->fipvlan_compl); mutex_init(&qedf->stats_mutex); + mutex_init(&qedf->flush_mutex); QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "QLogic FastLinQ FCoE Module qedf %s, " From patchwork Tue Mar 5 10:58:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839267 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 A8A951803 for ; Tue, 5 Mar 2019 10:59:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94F1E2B2A9 for ; Tue, 5 Mar 2019 10:59:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87D512B352; Tue, 5 Mar 2019 10:59:30 +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,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 187522B2A9 for ; Tue, 5 Mar 2019 10:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbfCEK73 (ORCPT ); Tue, 5 Mar 2019 05:59:29 -0500 Received: from mail-eopbgr680058.outbound.protection.outlook.com ([40.107.68.58]:50563 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727322AbfCEK73 (ORCPT ); Tue, 5 Mar 2019 05:59:29 -0500 Received: from BYAPR07CA0007.namprd07.prod.outlook.com (2603:10b6:a02:bc::20) by DM5PR07MB3002.namprd07.prod.outlook.com (2603:10b6:3:e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:26 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0007.outlook.office365.com (2603:10b6:a02:bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:26 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:26 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:23 -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 x25AxNYR013248; Tue, 5 Mar 2019 02:59:23 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxNCB013247; Tue, 5 Mar 2019 02:59:23 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 07/26] qedf: Use a separate completion for cleanup commands. Date: Tue, 5 Mar 2019 02:58:42 -0800 Message-ID: <20190305105901.13185-8-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571666211920;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(396003)(39860400002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(26826003)(53936002)(1076003)(498600001)(48376002)(50226002)(2906002)(8936002)(97736004)(8676002)(81156014)(81166006)(68736007)(6862004)(105606002)(356004)(106466001)(86362001)(50466002)(87636003)(4326008)(126002)(305945005)(486006)(6666004)(11346002)(336012)(446003)(476003)(2616005)(51416003)(54906003)(36756003)(2351001)(316002)(42186006)(16586007)(76176011)(47776003)(80596001)(69596002)(26005)(5660300002)(85426001)(14444005)(36906005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB3002;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78610929-de7e-40b5-deb4-08d6a159a238 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM5PR07MB3002; X-MS-TrafficTypeDiagnostic: DM5PR07MB3002: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB3002;23:njY6O/lPSNwXGKLz5U/hiUjP/pRNKT6tNf532CtsryZdjVfwAuRFtUvCGfRqmUQPSEy6c3iivZbMzacOOV9EWYzWPQDhAkf5rBBQFlBp4vkLADOIvn9mao0XtKYVLKv6hVXj7/Is2evhpdWRCH3kYVRNzksNDHBLGNWf1mLN1OGtu8DqGm/7GDhMiZ8yARocY/Iy9i1EOQDEOr3KlO2Uwntoc0Gv727RbrAeJcTsAjrawwyL4vDV0EyzHFEzgbVBCIWkpqkgO0IXtnbgtaiWK+nHcwDe+x6XZBSHQcbaTL6jqKh2X1xE8Vt4fPtITR+yp7GzESt5+/joqaYBIjKND7ggBwrv7Afqzrt/+QxtygTrvXMa7SJXHfzTTOQSyzWfwHDeRvyAGa3MCchcGIPOyyfKkGjgsMx9GHQNl9sBRF0Qsu6xmLQbb3pXyffz6u7WJHPBVAR2tuCzs4jDEXHoHPXoRDSm7uUxGOqAtzh9J/IWEuSfIyAtVjNbNJZB13MlJj+wYSufZzWQT0wAcLl3SDaaBV7iRj55KNbzxFsGaU6kq2eIOQtlFpimyw14vSODX0ScEwL8DZbL8SdIPvEsxz/E1ooZdE183TPOZZkdAMNs6IFTnE/N0DzjZMOtGg3AGbaO8tVdeucySBuPGgEBxAEbbMKq79dB2RCyDVk7qFZQ/HCxSXbDnVdAUHJvNXfeRK/xON6Giey/p+C3ltFYam/fzU2zMF3Xxh1+Fl+KWB2H8J/8XxJTmUCAelT3JvhZMnnuYNpj5sHgXXOivIiA6stt90HJeBuBNaJvJ93bc1K7V1Z+3n5KEy1IMdJ6j9EekMvWfNPPTRHDgRBEwvMQKCdhh7lblaSIk5jc0nyvZP9iG2y+6bq3fNlQE/NXCf/4GEJ6igtDmmbPt8H12Z2Lfbyp5wSzZqjN4k+3/UzuHzIn1a+IXEANfwZqt3YTXnS7gbF9xuhmP15RijeevVk7Ip9YdHq5EeU3EIMhkwEznalwvAw7nK8AHZZcBRVQczEJCsfWoMBlQhLXcbTjOKPbU50P+bKrJzC+orBXoJ51asfvRd/rI5PqSS4f/b56vIrj6jkrCPQ0cDcXzJ4vkAIf3FLr0Q/yS36UhDFe1iSH//PuJmKPixkt77RrV0yD5zadoQLy3I5GsBjm5fw9QE4TAL9Qtx9oo0Z+P9C9bRfb3R8UO4LVaCi0XPBKQ1M5Cv4iB9udHLL7ntpSZQXcVBeXKDU7Htbv7A0sqKnGfWhQP1dXneXwwOlHaNij6Fc6UWVU X-Microsoft-Antispam-Message-Info: 0HpS3E0fjgqIWkIlwfhphAuTXgYDt/4sIo/oDjS2bZFxg/vTMkzDU2faAkgDJ5fIZDLdSeILNs/e1TmpERShpOEa/SxiOxVg/8ESKGKyFrj8KxbVOxx5WnKSP2tBYkbk3rJi9yQ4D4VPGxVny3k+i9gFkqz+x3XdH8weM0XQKFyhOlezVEUkdfrzJiWdcbRZG976fvSIn4+C7Itsps8OEKs9p+PYT8oPwWO82ezZD8tZNGkYj5jc0Jy4dPkUHVUeFw8f/WRUSLAODKxmIKB5tg05CON0ZRSFdw7CM7DhZRBSgV1F6+0ePT0SO5ykkjVmRgvn1/RRtHX7EXQg6uTocAYdqYJmV4+EoZnsOsyjbLojfmAd3JbkmqcKtzn9yVCC1CIvtREZrnuqXHncynWDyWGdrisQgLLLZtdA+6PTu40= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:26.2780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78610929-de7e-40b5-deb4-08d6a159a238 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3002 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: Chad Dupuis - If a TMF and cleanup are issued at the same time they could cause a call trace if issued against the same xid as the io_req->tm_done completion is used for both. - Set and clear cleanup bit in cleanup routine. Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf.h | 1 + drivers/scsi/qedf/qedf_io.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 9e5e183..fb7d0d5 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -128,6 +128,7 @@ struct qedf_ioreq { struct delayed_work timeout_work; struct completion tm_done; struct completion abts_done; + struct completion cleanup_done; struct e4_fcoe_task_context *task; struct fcoe_task_params *task_params; struct scsi_sgl_task_params *sgl_task_params; diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 044ef63..1a36ab5 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -2065,10 +2065,13 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, io_req->xid); return SUCCESS; } + set_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags); /* Ensure room on SQ */ if (!atomic_read(&fcport->free_sqes)) { QEDF_ERR(&(qedf->dbg_ctx), "No SQ entries available\n"); + /* Need to make sure we clear the flag since it was set */ + clear_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags); return FAILED; } @@ -2094,7 +2097,7 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, task = qedf_get_task_mem(&qedf->tasks, xid); - init_completion(&io_req->tm_done); + init_completion(&io_req->cleanup_done); spin_lock_irqsave(&fcport->rport_lock, flags); @@ -2108,8 +2111,8 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, spin_unlock_irqrestore(&fcport->rport_lock, flags); - tmo = wait_for_completion_timeout(&io_req->tm_done, - QEDF_CLEANUP_TIMEOUT * HZ); + tmo = wait_for_completion_timeout(&io_req->cleanup_done, + QEDF_CLEANUP_TIMEOUT * HZ); if (!tmo) { rc = FAILED; @@ -2153,7 +2156,7 @@ void qedf_process_cleanup_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, clear_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags); /* Complete so we can finish cleaning up the I/O */ - complete(&io_req->tm_done); + complete(&io_req->cleanup_done); } static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, From patchwork Tue Mar 5 10:58:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839271 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 C33D217E4 for ; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B16602B352 for ; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5D7C2B360; Tue, 5 Mar 2019 10:59:33 +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,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 472E52B2A9 for ; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727451AbfCEK7c (ORCPT ); Tue, 5 Mar 2019 05:59:32 -0500 Received: from mail-eopbgr730071.outbound.protection.outlook.com ([40.107.73.71]:37511 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727439AbfCEK7c (ORCPT ); Tue, 5 Mar 2019 05:59:32 -0500 Received: from BYAPR07CA0018.namprd07.prod.outlook.com (2603:10b6:a02:bc::31) by DM6PR07MB4377.namprd07.prod.outlook.com (2603:10b6:5:bf::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:30 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by BYAPR07CA0018.outlook.office365.com (2603:10b6:a02:bc::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:29 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:29 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:27 -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 x25AxQwx013252; Tue, 5 Mar 2019 02:59:26 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxQHd013251; Tue, 5 Mar 2019 02:59:26 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 08/26] qedf: Correct the memory barriers in qedf_ring_doorbell. Date: Tue, 5 Mar 2019 02:58:43 -0800 Message-ID: <20190305105901.13185-9-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571699184746;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(376002)(346002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(2906002)(81166006)(356004)(8936002)(80596001)(8676002)(6666004)(81156014)(68736007)(26005)(97736004)(48376002)(4326008)(6862004)(50466002)(50226002)(53936002)(486006)(1076003)(2616005)(69596002)(85426001)(126002)(476003)(105606002)(498600001)(106466001)(26826003)(36906005)(446003)(54906003)(47776003)(87636003)(16586007)(2351001)(76176011)(42186006)(86362001)(336012)(11346002)(5660300002)(51416003)(36756003)(14444005)(316002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4377;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a57c4e1-8012-4b46-6f24-08d6a159a43d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB4377; X-MS-TrafficTypeDiagnostic: DM6PR07MB4377: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4377;23:8fiALP9Q8I1FCXRqtbTRil9SjCc787ZTCKPAEXXFypRsMvIFioVUb5HLaOf5ZSAtKrOXmtOBWW1Nl5Z/Zxn2RiYRsRGNCpEXBzENSvGTTFu7BH3XYEh7mDE+a4jbOs5mHx0rLav0zX4+1WN/3VZzkHwFZvr4+u0LFxnhMGAW1OEb9W9BTExzT3nUIP0AcbS921KT8NT+7wKBvAz5AqxV4q9HTggujStkfmeaceMk/nnZ2yvAXKGMWxhOlCDHLCroJw2UVwjKCGIUZ9CVyNO7a+JK9cds+Jy+vedaeE+2t+SLDb7QJCp1uTDXrw+A08JuSW56yUBLppoHuGMxwOdMRlIwF7F4mf+4a3xPcA0um9NliLtLP7BPqKJse2f0xc3gljL+aJyFvDq8dj3RagYMGjsxsOlfY3Xz8Agx+XNpy36MOBswfxcPiEpljQS6CzoQcyqRsoxwq+iKd13NOqOuXC6K6SpHQFAlzOqrok/6CWHFdq8tbpYs6o87rj2EI4X98C0HnVPdCIpXKNXrHWr3iS+6TbZ//Jnv4XXUZKUqT0Tqdn8iMnHLdBnMpLfmb4Uuvg1SaYIeKO2QlS3xzaXVlTzCOV1kBqRp8Xd1T76VIbQGXrAhSJjiUbJcAPoqAbX2b11un4zETFCoKy09JGca+ksjtXqw7CfcEEYVSjtvQG0an1ckEwubyhiQ0t3oUQRxscpuj/TiMMwCifP1sfTAMjIfLpPLR6dl3x1hTnZHwALaRFrHi9QotI+8/XG5mswYn8YGF5h8pav0NyO38nwe1uK/5SKm8T3S9OhY1MMqvGbDKdRbrm9W72kS66e591OOj/nJ3l1BYwgmCdwRxV8CIG6Rg94ymRkJXsNYEvzl+pzPIES/tjvQWW79UJFeNl33cRBbKTYCZiap0h44kHYjdR0Z+e2vDDWIUwapF0E5rR47yCXLm7+ZaOniccIJ4qJOdIZUe096TyzrLadMK3DtK8NbCttYv+UGZyQqIO0DmrKCo/WVvQsmLDFPsC90qs93HV1NvuaprgnvhVglcVPGfGbfdyVtZ2aAJUNvYL5/rl5JmbcSyt7wc77cb/fpSqC6mpL4fnjzRd8H3rShA1paVGDOax6Zt7JEUsObFe6LUSgJ4uOn/fEfeZaVD49m4rOIQ7vqrSkRMqAznQxlKEwkTualyqP3zh/DwuX38DIjOgbGP+zQYG+iLbsnsD/EhWxshnZMVhFmMn7/lUJHv5ctV1EqT8ng17iLhvRVyIH8P+YHCUUbJFeV9Eb4V7I9m0x9 X-Microsoft-Antispam-Message-Info: 7GN6WCWJn2eSuQPjsDHfs9yJjoeL3jCU4LLmdcyU4PNKnbQ/txjD1Epf1wRL4ROPP2OjsThGTvWIYRXsMaqSb3YROLWXyGNr26qkWRWb9qOSQgjyfS99HcLWOrcPsOgQHhDeDk8rnk78ZEHgqLbaHvV69bXTwFFQghj/6EysceJpsogDt+HiTHXpm8kKdEnJTsNP9/FfK6V5Ao+aZBEQ6USoauHA5R8nMnczqjuKfD0i7KWsRdorH8Sb+oGzbPnB7cIk324t79RTk6OZL/2QvVRX1oKc6AQpteAT8nAQtelUSgnFVxdnLEQ3aiyzV97knFeTkxV3e9iktgR55hG/QjIb495ip290nNSvbrEZzzSZhxsK+oWwq0gV4QzAvjTPgkhPX6/ttyGDNmqJWix1Dt7dLwlv9Z7Qbjr9fxLs5kg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:29.6706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a57c4e1-8012-4b46-6f24-08d6a159a43d X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4377 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: Andrew Vasquez - Correct memory barriers to make sure all cmnds are flushed. Signed-off-by: Andrew Vasquez Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 1a36ab5..f04191f 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -773,10 +773,18 @@ void qedf_ring_doorbell(struct qedf_rport *fcport) FCOE_DB_DATA_AGG_VAL_SEL_SHIFT; dbell.sq_prod = fcport->fw_sq_prod_idx; + /* wmb makes sure that the BDs data is updated before updating the + * producer, otherwise FW may read old data from the BDs. + */ + wmb(); + barrier(); writel(*(u32 *)&dbell, fcport->p_doorbell); - /* Make sure SQ index is updated so f/w prcesses requests in order */ + /* + * Fence required to flush the write combined buffer, since another + * CPU may write to the same doorbell address and data may be lost + * due to relaxed order nature of write combined bar. + */ wmb(); - mmiowb(); } static void qedf_trace_io(struct qedf_rport *fcport, struct qedf_ioreq *io_req, From patchwork Tue Mar 5 10:58:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839275 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 3EF6E1869 for ; Tue, 5 Mar 2019 10:59:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BF3A2B2A9 for ; Tue, 5 Mar 2019 10:59:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 208E32B352; Tue, 5 Mar 2019 10:59:36 +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,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 AD5FF2B2A9 for ; Tue, 5 Mar 2019 10:59:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727473AbfCEK7f (ORCPT ); Tue, 5 Mar 2019 05:59:35 -0500 Received: from mail-eopbgr730062.outbound.protection.outlook.com ([40.107.73.62]:39205 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727439AbfCEK7f (ORCPT ); Tue, 5 Mar 2019 05:59:35 -0500 Received: from BYAPR07CA0018.namprd07.prod.outlook.com (2603:10b6:a02:bc::31) by DM6PR07MB4377.namprd07.prod.outlook.com (2603:10b6:5:bf::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:32 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by BYAPR07CA0018.outlook.office365.com (2603:10b6:a02:bc::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:32 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:32 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:30 -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 x25AxUOw013256; Tue, 5 Mar 2019 02:59:30 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxUdp013255; Tue, 5 Mar 2019 02:59:30 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 09/26] qedf: Add missing fc_disc_init call after allocating lport. Date: Tue, 5 Mar 2019 02:58:44 -0800 Message-ID: <20190305105901.13185-10-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571724121953;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(376002)(346002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(2906002)(81166006)(356004)(8936002)(80596001)(8676002)(6666004)(81156014)(68736007)(26005)(97736004)(48376002)(4326008)(6862004)(50466002)(50226002)(53936002)(486006)(1076003)(2616005)(69596002)(85426001)(126002)(476003)(105606002)(498600001)(106466001)(26826003)(36906005)(446003)(54906003)(47776003)(87636003)(16586007)(2351001)(76176011)(42186006)(86362001)(336012)(11346002)(4744005)(5660300002)(51416003)(36756003)(316002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4377;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a1c5fc40-e7dd-487e-f216-08d6a159a5b9 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB4377; X-MS-TrafficTypeDiagnostic: DM6PR07MB4377: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4377;23:oYrNDUYaaOUT7whz0qw73m8oNb+L1j2LyRfZXmJ0+srQy2nPf3ZGjyZIYgC9x7/yVBn2IlKyGDvCm+7Rq6PqY5dHPJUWMzrcpgHU93kjrlFgnwX2eAs39tEdQRDIieEuCWFC1TsOU5VbwPXenDfM4fhJQ4yYK/ei1YkkdI+BTD/LazBII8sQYaVMbLi72siHUUx6dgqKIcb6De02jY/rL+w0sgyKJ4NCYiGuaROMi4wLk5pbMEWwjp18fIdLBcj6e2igQklMTOO4w1hox6vbmCvK0iZn+KyiyURet9xq9Z36e2XWDTWIQstnzVg/gqH90RS/GPEu0d0YB+jAC4jpQDe283kyJymsYMAC1/V+TiHE6A1AZK+w4uX7dcS/vfG9uMoZebMCveCQeiazL5+H1bCzpq3j94yIANr2zoiUrXGzwDnTIE0HrU5MjA0JyLcVwT1MRYQ4JaWgs/hXBeQRaEg076FGhaVPsaXDyPI/YkXEMufw0PZMgJcC3h4sPJ5tiY4JUi3muTBE8O9K4VQB5y/wJ7FDPmHnFCwSKHGWSXISzH8kFHC4LxPIsiuPKUfEIWjlg3UkjEG0m5iJLN10Hh2iyJCBoc9Us99v2x+Z3MHPbEsWenPInCprGeeYQm5q+0Pvo45CEzRNyieAoIu1H/F2iVM7XV3xBuB5r6ZOw3iwIKZKzf+QrhVVDOC4Whfi+G4KljL30cxM8aa1YQ3CLz8pP/0QMFb7XM1Tjtm/F05uKnJxj/PhV8lEu6z5cQWJzMQyU+Xg8XpdBbGc+ZamZbF29cTX/mUQgi3ZABWTVe5fmcwlYqFDEDuAoo/5OwUJpkfItZBBKW4FsbQDfwcp0gZ0johKT3vtaEfsEO6C2pNeMO7WXUqJzYZyeGCtusDlcCUOHy0YX4e2AZpUKxmN7tY7fS1tXDUCkWRRGJt7As8My2b3YbGxlKe/2NR1SUVuD/hZ8JOXTcE7Xywi4Tk3l/SIk98lunxOWNsK3+zb9LOS7AzoHOnUJocFF206gIunS92HgXsiWYVRytE22UoYUpHj3wmA9wQgTHWUPrStNfznG/I7A7XbVD31fUrO9p4WzrvLoFTlYFO74d8Wc8oct3ZM6doMdmUU6sQzZHuXQhAIwV3tJpiXNlenMJwFv+CdS8l3x4H2KULGECLPltRDBP0OA73qZRUgjuWE21+H2ofUKOZDsruXJvDYaDI+DjHgN8/ej1z34oeXgF2XbfE/mhjsBt64l1f+Kr0g7OpPAO+rFtdxRWJ+0+v3nwEBR/nJ X-Microsoft-Antispam-Message-Info: LcR3U8cVACmyMSX2xTs7dUqbOQoLxAtY7YMEO1NotdBTDpcGk+fBUszHHQCN5y8jE5XVjvuvjYwWmBlS8YfD2vIcKm/ktmEtp0FFGiTDzs9lGrEwThoeVqLr4Xb48N8xrbYN+aE5NOw5Y3QltxVqlL/G38Hhb1R8IeYX6uKXTrx89PYhmrpFi7LdX+sQN+NF51nBOqjnoGCIupNKvl1pqr55JjrkGS18glafOiKHKAZigPuNT1F/sFLUfSdWpCaadds4AkzpntTkN0L01D9BvFo2aYZuSiU+u5UMyvyPoFvA1/YzaPtyIiNqRAYmWe5yKCYB7mXS9tdIuayygoqDx+oSRod3qoyHKVGZ0v2ZlooW+rBAaonNvnPBAhZJstf62W0LPAS5XjqDGhNIKjk4AUWYMauZa8UIABzWXkZ4xWg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:32.1569 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1c5fc40-e7dd-487e-f216-08d6a159a5b9 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4377 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: Chad Dupuis When receiving an unsolicited frame we could crash on a list traversal in fc_rport_lookup while searching the rport which is associated with our lport. Initialize the lport's discovery node after allocating the lport in __qedf_probe(). Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 3fd8107..dee6fef 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -3042,6 +3042,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) goto err0; } + fc_disc_init(lport); + /* Initialize qedf_ctx */ qedf = lport_priv(lport); qedf->lport = lport; From patchwork Tue Mar 5 10:58:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839277 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 530AE1803 for ; Tue, 5 Mar 2019 10:59:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FB372B2A9 for ; Tue, 5 Mar 2019 10:59:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33E352B352; Tue, 5 Mar 2019 10:59:37 +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,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 B7EC72B2A9 for ; Tue, 5 Mar 2019 10:59:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727474AbfCEK7g (ORCPT ); Tue, 5 Mar 2019 05:59:36 -0500 Received: from mail-eopbgr700083.outbound.protection.outlook.com ([40.107.70.83]:56622 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727432AbfCEK7g (ORCPT ); Tue, 5 Mar 2019 05:59:36 -0500 Received: from BYAPR07CA0018.namprd07.prod.outlook.com (2603:10b6:a02:bc::31) by SN6PR07MB4766.namprd07.prod.outlook.com (2603:10b6:805:3c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:34 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by BYAPR07CA0018.outlook.office365.com (2603:10b6:a02:bc::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:34 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:34 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:30 -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 x25AxUOf013260; Tue, 5 Mar 2019 02:59:30 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxUXw013259; Tue, 5 Mar 2019 02:59:30 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 10/26] qedf: Check for link state before processing LL2 packets and send fipvlan retries. Date: Tue, 5 Mar 2019 02:58:45 -0800 Message-ID: <20190305105901.13185-11-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571743296825;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(136003)(396003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(81156014)(81166006)(51416003)(16586007)(69596002)(26826003)(53936002)(356004)(498600001)(86362001)(8676002)(87636003)(6862004)(36906005)(47776003)(305945005)(6666004)(80596001)(316002)(26005)(5660300002)(54906003)(76176011)(2906002)(42186006)(126002)(50226002)(336012)(446003)(48376002)(97736004)(486006)(105606002)(2616005)(476003)(11346002)(50466002)(36756003)(85426001)(106466001)(2351001)(4326008)(68736007)(8936002)(1076003)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB4766;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d56900fb-a8f1-4f66-af08-08d6a159a6de X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB4766; X-MS-TrafficTypeDiagnostic: SN6PR07MB4766: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB4766;23:MVLPNu2bX9wK542fVFMd2cRQjtG7CKafSzCuiObpp8OPEWgkXw2osbmxGLK5yVkd53+ebOOlaJrZ9pmygCsD8tkoZwlt2b/isgqk5Ky/taFLEScl+gHQI9HB5PA6KGtfD4o7gRoR/RMAi2msGEuNU2gKhcbj/WpTQFavb1kD0upRGqUX1HOoDGhLUn4pr4B4u+OFGR7Q0qBYyVz0IVEthY1zGT7p+BWFnBeKTNU4Hnz/h5aFkEzzf5Nrir0nAqV/JVMdGfqdk69bBchVBgNn0Tk459UIhc+uAq6ug30/6yy00eG4Rl1o6VRGl9BBWIafWvqs6AK0Ocvyi1+siJX2+bqcYZGYezNOUjvU3+WCsnV+uyLoIZYRiP6xaoh6xtruLLRKmir47bcWW1qcIYUyDVKpm8VD0zS/pA/SxgLytsFj8QQVVlPjfyfqTRiXNOmGT/BtTmuq6we2dDKYRY5L/YAx8SeAlPlJNyrR7Iz394EdoTIhXYS3UX7RNyMvHAYwpjv5bftFDy1ISe2knvrUq+xevzFfbVsQWO2ZlDnnTIhS26tYU7qDi4mDysU7KNJ178xZ0uGXnXmdMKRmWG5M4FKINWRaQZ9MTETpu0fxymZLHtbM0QtB3kE9BDwRklXvzmpDNeKBjFOUvEid63A2pJtPG9LdqgaQF6YbucS4G6Ys800RKGIFP+0wr2DuKQvmGvHfL66SApA6JQGqdnuBwdrPqTgYoGLCYYMOa9zqCsS9i8ib5cy/UU6IX1Zr3hEy5rt5aaMnt0rovM1mLQ6maSZPo7EeLm+urtd4pCSt30Ub0a1DZAddqHx3O1+fkTU11eJaxsEMkoujvltW87H96CRJZE2722A4fFYBLkteVJfpeccdGpQNSpmdcwyKsLgAsR+/Zo2uud3Ex9tlB4SMjfP9ZKX2grTDqWmxirbiaYVONbGMp9P9eYRkGSeqIGRVOWVECH87l0POZbPYElHLCtMrly+OKCcu9LyzQnzgwIGvNFzf/7MOMVgnLS4CmoQk5ty70xOgoYQ7XnuA2Jwg9eq65d30L2VzjJYlMF7bhZPxq7r8GGt95LeRxm12I2qGswWNSDhUq8pxoB9ZiBIoVbGXDzQ/MwW0eo20ozc+Xrsd1vTIgCRbIuswgQeT1cwOLq6aphe/+lc3MxQ5HMrDc0p1VHcHFHTpu89x1DnUsPYfsUsvbipXhVVpB6xXo4U4qt6u1WGcVycan7MPlqWsg627nVEoeyWhtFuP9dMOjCOO1kRPLVPx9voB92SsvaLX X-Microsoft-Antispam-Message-Info: /2gPBXwoGXB4HVoJTZsPYMoEvU5nM6PdU+ZGFpDg9BiA4eBXAtFffVsFCHc2Cg2GKkGsXOmhDrkQ4TaICSq9xfEZ1JGJ7kn3JhEpTF3r2DagqoWFeKy1KficfZRIvNjh28VFAxZIsw0/DBONOOU9Y/K2tWzOxO4xHQyCMVC7k/MnWBK0POW+LJrjHemjRDTG9XS5QcQPwUa5qnYBB60Szp69TUPTLTZuKufBkC9sPkj4tFQhCOCUebloY9mAr/S+e4LtrCMRcSkxA7NEuRricKFz+y1fHoWLeqiq5ChOf6IRZxf8+4E/JaTfCHgNLJWiIdWJUSzlayaWENF9yelV4w9TW650RbqTun45hubCvpOQhlxnsYGCmOWK6JlzmzNR6WHOY/kEXjXjfP0+mM5AYgk8HRXNAEi4B5TBP+WiQ0A= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:34.0777 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d56900fb-a8f1-4f66-af08-08d6a159a6de X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4766 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 - Check if link is UP before sending and processing any packets on wire. Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_fip.c | 6 ++++++ drivers/scsi/qedf/qedf_main.c | 28 ++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c index 3fd3af7..e669679 100644 --- a/drivers/scsi/qedf/qedf_fip.c +++ b/drivers/scsi/qedf/qedf_fip.c @@ -95,6 +95,12 @@ static void qedf_fcoe_process_vlan_resp(struct qedf_ctx *qedf, rlen -= dlen; } + if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "Dropping VLAN response as link is down.\n"); + return; + } + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "VLAN response, " "vid=0x%x.\n", vid); diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index dee6fef..f84552e 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -124,21 +124,24 @@ static bool qedf_initiate_fipvlan_req(struct qedf_ctx *qedf) { int rc; - if (atomic_read(&qedf->link_state) != QEDF_LINK_UP) { - QEDF_ERR(&(qedf->dbg_ctx), "Link not up.\n"); - return false; - } - while (qedf->fipvlan_retries--) { + /* This is to catch if link goes down during fipvlan retries */ + if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) { + QEDF_ERR(&qedf->dbg_ctx, "Link not up.\n"); + return false; + } + if (qedf->vlan_id > 0) return true; + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Retry %d.\n", qedf->fipvlan_retries); init_completion(&qedf->fipvlan_compl); qedf_fcoe_send_vlan_req(qedf); rc = wait_for_completion_timeout(&qedf->fipvlan_compl, 1 * HZ); - if (rc > 0) { + if (rc > 0 && + (atomic_read(&qedf->link_state) == QEDF_LINK_UP)) { fcoe_ctlr_link_up(&qedf->ctlr); return true; } @@ -159,6 +162,12 @@ static void qedf_handle_link_update(struct work_struct *work) rc = qedf_initiate_fipvlan_req(qedf); if (rc) return; + + if (atomic_read(&qedf->link_state) != QEDF_LINK_UP) { + qedf->vlan_id = 0; + return; + } + /* * If we get here then we never received a repsonse to our * fip vlan request so set the vlan_id to the default and @@ -2412,6 +2421,13 @@ static int qedf_ll2_rx(void *cookie, struct sk_buff *skb, struct qedf_ctx *qedf = (struct qedf_ctx *)cookie; struct qedf_skb_work *skb_work; + if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_LL2, + "Dropping frame as link state is down.\n"); + kfree_skb(skb); + return 0; + } + skb_work = kzalloc(sizeof(struct qedf_skb_work), GFP_ATOMIC); if (!skb_work) { QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate skb_work so " From patchwork Tue Mar 5 10:58:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839279 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 C08E91803 for ; Tue, 5 Mar 2019 10:59:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD5562B2C2 for ; Tue, 5 Mar 2019 10:59:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1FAE2B360; Tue, 5 Mar 2019 10:59:40 +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,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 959DA2B2C2 for ; Tue, 5 Mar 2019 10:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727483AbfCEK7j (ORCPT ); Tue, 5 Mar 2019 05:59:39 -0500 Received: from mail-eopbgr770075.outbound.protection.outlook.com ([40.107.77.75]:9148 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727477AbfCEK7j (ORCPT ); Tue, 5 Mar 2019 05:59:39 -0500 Received: from BYAPR07CA0007.namprd07.prod.outlook.com (2603:10b6:a02:bc::20) by BN7PR07MB4756.namprd07.prod.outlook.com (2603:10b6:406:f0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:37 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0007.outlook.office365.com (2603:10b6:a02:bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:37 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:36 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:33 -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 x25AxXqJ013264; Tue, 5 Mar 2019 02:59:33 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxXmN013263; Tue, 5 Mar 2019 02:59:33 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 11/26] qedf: missing kref_put in qedf_xmit() Date: Tue, 5 Mar 2019 02:58:46 -0800 Message-ID: <20190305105901.13185-12-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571770262459;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(396003)(376002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(69596002)(126002)(26005)(6862004)(305945005)(97736004)(2351001)(26826003)(80596001)(4326008)(53936002)(50466002)(16586007)(68736007)(316002)(54906003)(47776003)(76176011)(42186006)(85426001)(36906005)(48376002)(356004)(81166006)(6666004)(476003)(2616005)(14444005)(1076003)(8676002)(4744005)(8936002)(81156014)(86362001)(5660300002)(106466001)(105606002)(11346002)(50226002)(336012)(36756003)(87636003)(51416003)(486006)(498600001)(2906002)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4756;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 666bc34b-8e3e-4c47-2578-08d6a159a87a X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4756; X-MS-TrafficTypeDiagnostic: BN7PR07MB4756: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4756;23:yq+qNBOmZ0niVflSfCFjdefERBVc6K3TfaGMykXqXcumXzinhB0lB6uidZSYevIpUGJSA6kIz8Wm5nDEFLxPGFzmBaqh4MXZ3gDXVp7ecD+xSlC+RbUuj1pk8k0VrATpeGEHoO2U1JMqDFmVQSjQwBKTKx6Zty+/HPWADYrSgud2gFSjTjNXEmxfgl2O5+8kxZagXe/ziBN2OVEgcwGU5YB+GUZv42kpXLLuD8kPGWW+1KyHLWbgxA02lVbS0xE0tbD6ZzX9nMVl5Sdoib4258/mtk/d2kANETum3iALv9d/EyYaJzvD+/rsFLgfA7OZKjsQgdXrrUgKuQfBht89J4sS18O6sH/JOqUyGn6L/BKF/Y4bkLtWPOw32tiwWx8BmQzTkHrH1HafYGgw4Wp3RPfGqDlWxUUDUqWKZpwIZ+Hz9A3S2GS30qVlVoOoxtuBxBadcFbHuxzdMnibueNdJbYBneKeya7nnv2kI7bN9mc2+o6I9RUZUsCdeAOcR/eQs0J8y4XEQFBXabDo18BHeeZty5Ju9tKxAvRsLdE+w6p42fxkb9BAxaWggZXBEhACpwmq1WEtNg7AH4egMoFuWt1bgUVeWqhrk6ZHAVVGIgPLssKXGqI0fB4ms6nVJtETYEPstnM7sz/u1HDmuXkIU958AlyAGXTPc0eNI1CTaZsMsPFQKv0k5H67k++kEsgXj3IyDOrWMbLZqhOiwUZ8c6YqzyqsNp12xkIas65LKaYF9HMgqMb2WqUW5vIz9kNJnmjA4hBXc2kt0AYwucsO6UdcO6q3YJTXoLMf7mbm/hMQrVa2GlY0KjaP1k68xmB50oLrC3ueqTWcaB0zZAz6mX5Otq1YXsTi4umdAYNqoWrhqV0yyO4GzH/dGrx2RG+6QLOthqJz7dhpA8ZxNmCKpM6vKwNqjjJsfhOTDjd08HgBQbHtIKdTfEk/MfdlGWsYuC5UyyRw/HbtYkiio7jbt1MFsGcpy7zifeWej5OGbxhxHwxjUqcaPtD/ZBqK3SZbMVUJq12hrRlAh56l/7M6Ydl4fsKIfBF3N2McZpW+zBHuIc2JIAKNbfMpC+NCoPgdG+v6ObMDfsWgdRZsqyM0Ow9rXkI5HdTYFtIpFJjx10BF/UXRwk7ZWS8j35raqaBnF2JxXN93BEQ7aOSSE7n79VRIemCinSwtcMekUySEDZKvTAY3CTXXHMOgazJ7DTe/FL6o3ApgsBZ/8d5rtZzBHsQmCLqcKiuSh7iyXx6kFw5UbAmHq/N1Ru307BoIHaJbi+GSjjG4Pan6gljqLWYtLQ== X-Microsoft-Antispam-Message-Info: z3GN05vV8oERglX4Q11qMVML+k0qulsRCd3mgl9EOTEQ9979R5Od2eRLxpHzQ9EjxO+TI2xWlF0PrhTkY4N+86od6NFvwobgoavA0ngRg/ANQ5Qcv7qRYO4UW46NkEUrcxRu7GRYa1AXLEc29SSA57Fg3Z9ybbb77UIJ1EwZbrpdsfg+Dfxu20du6N2dipxVgCjma+ub2vRM4mm+3P7BSposbUYh7r81n5FpMIV1Skh+t7kOvoUPSCdMDaOpvxK1F0160XOxFwYUaejZj0B8dU+xtg/aDeozkFRndBOTwMARHW0ChbcL0ApdyDW1DQrx5ONl8B3ZJxTn6STmeeYmTFqU01Tg+ejDPwJl41ylsF6s4w+QPKmgT7a+BijcJqprYjmXIYffOPhHPtvqEXhlEcNXg83A/7/pk3y4us9Dn3c= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:36.7740 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 666bc34b-8e3e-4c47-2578-08d6a159a87a X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4756 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: Hannes Reinecke qedf_xmit() calls fc_rport_lookup(), but discards the returned rdata structure almost immediately without decreasing the refcount. This leads to a refcount leak and the rdata never to be freed. Signed-off-by: Hannes Reinecke Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index f84552e..fb9c288 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -971,8 +971,10 @@ static int qedf_xmit(struct fc_lport *lport, struct fc_frame *fp) "Dropping FCoE frame to %06x.\n", ntoh24(fh->fh_d_id)); kfree_skb(skb); rdata = fc_rport_lookup(lport, ntoh24(fh->fh_d_id)); - if (rdata) + if (rdata) { rdata->retries = lport->max_rport_retry_count; + kref_put(&rdata->kref, fc_rport_destroy); + } return -EINVAL; } /* End NPIV filtering */ From patchwork Tue Mar 5 10:58:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839281 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 0BDA017E4 for ; Tue, 5 Mar 2019 10:59:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC8F62B2A9 for ; Tue, 5 Mar 2019 10:59:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E13332B360; Tue, 5 Mar 2019 10:59:42 +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,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 905082B352 for ; Tue, 5 Mar 2019 10:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727484AbfCEK7m (ORCPT ); Tue, 5 Mar 2019 05:59:42 -0500 Received: from mail-eopbgr760087.outbound.protection.outlook.com ([40.107.76.87]:40672 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727477AbfCEK7m (ORCPT ); Tue, 5 Mar 2019 05:59:42 -0500 Received: from BYAPR07CA0007.namprd07.prod.outlook.com (2603:10b6:a02:bc::20) by CY4PR07MB2998.namprd07.prod.outlook.com (2603:10b6:903:cf::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.16; Tue, 5 Mar 2019 10:59:40 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0007.outlook.office365.com (2603:10b6:a02:bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:39 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:39 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:36 -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 x25AxaAa013268; Tue, 5 Mar 2019 02:59:36 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxaUU013267; Tue, 5 Mar 2019 02:59:36 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 12/26] qedf: fixup locking in qedf_restart_rport() Date: Tue, 5 Mar 2019 02:58:47 -0800 Message-ID: <20190305105901.13185-13-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571799135867;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(136003)(39860400002)(346002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(76176011)(498600001)(26826003)(85426001)(36906005)(50226002)(36756003)(126002)(14444005)(80596001)(42186006)(51416003)(476003)(16586007)(26005)(486006)(87636003)(69596002)(1076003)(316002)(6862004)(2906002)(4326008)(6666004)(356004)(97736004)(305945005)(8936002)(47776003)(48376002)(50466002)(86362001)(68736007)(81156014)(81166006)(8676002)(5660300002)(336012)(106466001)(446003)(2616005)(2351001)(53936002)(105606002)(54906003)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB2998;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84dbecfd-d0d4-47fd-90f4-08d6a159aa32 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY4PR07MB2998; X-MS-TrafficTypeDiagnostic: CY4PR07MB2998: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2998;23:fiRkZ5kU2sC03yQZ9YwhfkgsggUuZSgOeQuGB4mAp6mNORf17WJaUQGg5zlJobdI68XCYer/8VLuk22tmYk6hqzMHU825tmMul9kdlSbF8b9AYu+Rjqu3UY+QLLSIMS5S5600othgXUY3lrvKzD5rXJtEMek8oh4AAAgfneWVQNceSIkbuCFFny/XQ5duXfI26/ivtdlTBpttFNzCmXz7iPeyZOjNDXtt0KXXPcurX036awdQcHDYva6vkFwg1yAUtl46JuUnkEamRoT+esFwVu+YDGrp1AgX+E54qkx1KKQsJ+SB1lRT3xgyUrtCa5uPmqS6XEAhxEwtEWdxCEJct6qa92AMixPKI9lB01r4Zy7YUtqDu0otdO/2l/ifTcItFq1QfxOzalZdfi9UKo1hNuAq01IVZWnOnnV0KzNpkvL/Pq5rVD0FPUqLmx6G4VH18B2J/JrlcUh2Oi8G536Luo8DtEYoftpAB1IG2CVJRRnw3aDABXgWeeeeyBqdAOe2MltXfk2var1XAxPqFfqqN6pdiZJVUlROosY1W125Md03NJt2uUkDjKpYZ7vW/Jqav0biJ6qpbSYpniQtJzhnVV/Wgxo1Jdwea3ZOQ7aak/usXzq2X+s7z/8XEYy8YckiWCY6Qr+LWW9ZLnw6fagGQg5LjSEGWpEpXyNKjXrD/Cp9ZdSMuNmgLuYwM+nfEYV/gC/nTRa4aEbR8TblI1n5kzrMAwoCdxD3PIPRgKXHr69ewuuQ9GAjLUdwoT9gjQXS+GtlYTXOmltIG/M7Frp57Kw5zJM3wr8Qk/FEcr2pAJBnZJ+DA7uNCKS9keuJxHOG3Vl8kUm0YzZlFmbtO1iIHY9L1iLz43tVcgXxyoROrAQKNb6TebT9rUOSjm05em24jO/tKHu9/Bt832GSy+tvtvhmvGfbL8m18ZmCwXeQcwNrL4+RBitnDIvYrq1I+fajBokahuYmLI2Llq0VXZQ10hZTcitxugsIiIDVWne6sJLDEAwl54SDMgOmzDAvIlpJxLgdVGFoypummYNn4SloAfL1aGWhGOOZHumIBzpx7g5Bs3PO/BUmwu68+NpCnCgWXcqmlVIDbm4HpbixaM6eiCxB1mpbqjUD5p0o4hl/M8IqQyPmZSIEt/l2UG78YMGLeTUiVuX3u1YsFw4WX7Nj4Oh5+3FUiRSliym3J8lpA8X3TQ0NcLwlU/ledqBoMuy22IDXgXLifJO+DIcQ66xtHQAWZvZotA7PZPH+nIxBXAaE4iArL1fFgBCjj1w9hud X-Microsoft-Antispam-Message-Info: TewWQEtvdBMbpsJVkHhWtzurTtsCMme1pR8lowKGRP9B4s9ZJw5iC3X3ZeLVazY3gh81V3bbIdDyGx9Z90WUIj1LW1gTJh5z1fuEn+tznnJxI0TKQeQ8sAfTBo6Q3jO+dMQ8htfUiHmsprYrEq2OA8tVPH72yOfiL3m4PJI+7Iz1ve2mD8IV0p1AYZtBcfT3rRZcX8BcjGCtJhPR4ZDf2mk45LU19CnJLt1Zmk8TrMhJJCnvSx9h4jgvJPv5A7gE4SwonbRKQkDr6WR8bQuZ6oouRpBS7L0EymcYwStPHTIUJ/jTxeEesQwJysAYgtp1tRbEfMUz/zXuxvQqeporQittw4B3l9K0FBB3ZqUw2qIj6tSDcUH6W97Z1yxRUS6YutEmFpzCQwov/eTVQwGNI5fps8kPUyCYVDkwlhLVMag= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:39.6613 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84dbecfd-d0d4-47fd-90f4-08d6a159aa32 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB2998 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: Hannes Reinecke fc_rport_create() needs to be called with disc_mutex held. And we should re-assign the 'rdata' pointer in case it got changed. Signed-off-by: Hannes Reinecke Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_els.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index ac2bfc2..aad1f7c 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -380,10 +380,16 @@ void qedf_restart_rport(struct qedf_rport *fcport) QEDF_ERR(&(fcport->qedf->dbg_ctx), "LOGO port_id=%x.\n", port_id); fc_rport_logoff(rdata); + mutex_lock(&lport->disc.disc_mutex); /* Recreate the rport and log back in */ rdata = fc_rport_create(lport, port_id); - if (rdata) + if (rdata) { + mutex_unlock(&lport->disc.disc_mutex); fc_rport_login(rdata); + fcport->rdata = rdata; + } else { + mutex_unlock(&lport->disc.disc_mutex); + } } clear_bit(QEDF_RPORT_IN_RESET, &fcport->flags); } From patchwork Tue Mar 5 10:58:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839285 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 AA87E17E4 for ; Tue, 5 Mar 2019 10:59:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 978C02B2A9 for ; Tue, 5 Mar 2019 10:59:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BD382B352; Tue, 5 Mar 2019 10:59:49 +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,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 14F882B2A9 for ; Tue, 5 Mar 2019 10:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727492AbfCEK7s (ORCPT ); Tue, 5 Mar 2019 05:59:48 -0500 Received: from mail-eopbgr690079.outbound.protection.outlook.com ([40.107.69.79]:30002 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727477AbfCEK7s (ORCPT ); Tue, 5 Mar 2019 05:59:48 -0500 Received: from BYAPR07CA0018.namprd07.prod.outlook.com (2603:10b6:a02:bc::31) by SN6PR07MB4382.namprd07.prod.outlook.com (2603:10b6:805:58::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.18; Tue, 5 Mar 2019 10:59:42 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by BYAPR07CA0018.outlook.office365.com (2603:10b6:a02:bc::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:42 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:42 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:39 -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 x25AxdjH013280; Tue, 5 Mar 2019 02:59:39 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxdEK013271; Tue, 5 Mar 2019 02:59:39 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 13/26] qedf: fixup bit operations. Date: Tue, 5 Mar 2019 02:58:48 -0800 Message-ID: <20190305105901.13185-14-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571825748708;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(396003)(39860400002)(136003)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(1076003)(26826003)(498600001)(446003)(336012)(11346002)(51416003)(76176011)(8936002)(305945005)(48376002)(81156014)(81166006)(50226002)(36756003)(8676002)(87636003)(53936002)(86362001)(5660300002)(50466002)(316002)(486006)(356004)(6666004)(126002)(105606002)(2616005)(476003)(54906003)(42186006)(106466001)(36906005)(47776003)(68736007)(2906002)(26005)(6862004)(4326008)(80596001)(69596002)(85426001)(14444005)(16586007)(97736004)(2351001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB4382;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2dbfb94-a3ec-4c07-a587-08d6a159abc8 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB4382; X-MS-TrafficTypeDiagnostic: SN6PR07MB4382: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB4382;23:bQWX0Tmt1yUXV6njh490RBk7OsITOs/iEexYpHpkJUsLGhocUcBlKRGgrTNNp4XCm2gIYSSvJ+QmOMM79rrPu1ZTBdhtRfM/cfXO8NJ0MIeFkhMklV3lyAW3MyOnauQ369jNb3jEq758yXBG/7iGd9B7AaGzDzxxJOoLBNtcPKx9hJEKA8YDaoY+V6GvOxWHtKPAUzFdYeMPO41rYRARaBPD9y0ibRegPePzaOQQxIuUNYhX5V6Lxfy78om8ZrKaHs3Ay35gefWZ4lAKc0PcaCWvoVprnzjXAbZTvUt3oZKhheFjgLXx6snOAlAI1FnhLs3mxIdbO9j/FIoW4wNSsZ18oHRMgyOIbG/Gdd5X+mNU/PGbQ1DQx76JbIb6ceRVpgaYC+Yh8MoBs8aCNFiy0pqwabkc0RACQQWDCS7xjs1RFeB80Yw4t9kIsFCBzMQeCVv52NqN6KH6sJWyBvbHh3gu/YaH/wlwCri44eFcgytjP8hytGlfRUT+hkYKBkn7Glg5ziw/biWZ2XHwjlTZvRC7I9MVg1wxS7BAyXTrh8jhziItEnhewlfhTgRg/rPQJ6crjzv+cPTQZlVdt69WWiHK8b5abpREJKq1M0JPUwYMCvjxvgJa0c5o6lWjgDnHrkikYLYo7tYnwR+QY88YyiCmu7xhAwzZDs6Ivb1FfFaUGmvS6W4bscYtpP939CVr+xWrGBTVmTBqOfp3EejfH+EHDPCQBVr9eUHf3t7Iqdp8dL52Y1vfIxMSkgEX7pHT4H15vNJ0I0EstSX1dfG1J8he3BmZBD8V/QhqafRpa7GhHV6Q/UpOwbbjNS7k+MZmjtnuJkxuHsjFoon93S9oCQIycZc8NGOW9G7K7crsyvrc7apPgkrb1Gb54F/iwQhcgQHe/mPrhyVfugYLrVRCJ1GgFnx+EbS2eUBSPoEj9vwN57/BHYbpaHFuhUkrx+z/b3Nb1xbEPvK35F30Xb4dPjeV9aXhRn4FdMysCj2N8clUc1gx3Wc1i8uzkFBlCDchWqZc0n3fPpmoOYc2nXJE13XlBrPjvPe/XFLAYUN+bWYTKw6JGXmvnC2pDdonRH0BDEBf06sqGLh+wHsf2q+cVRdrKI9874frmZ3RAzKMeyameDTSLwfjj6QGS1+AlzdHjKkjOuDLKNC5rkAKTIfor5pxJMXjqyu+v8rOhYKNL2TRbWptVS0Kl+CgkeX4pHlm4gx8NXyoeDJ19pgsiGwA9nxfygNly3tLRmR3lSMHQ0R5XvTik5d0Zsx7yjpGQc0U X-Microsoft-Antispam-Message-Info: 1Stv8/NIq3deLJE/w1TqwcoImLi5crOHz4KLxgFuy/dUYdDdrHN/73iNbPCvSBtm0o+JFb1N3/HT6rnuiLLbsUEQMD9sPv9k6tqmhYLcpRf1ArfwZKldOKDIYwYxZpTiEwE2bF10Jwdra0Vu/yEnZBXr6z3emR6Qpe1aJFwpX0BQYKo9Q/29UUobYMDS6f6/1BVM+pQMS/lSeYyk9Oob0+7k35MgemDmAjY98ZlBiDf/7pylig4WtvEqYH7r0h+iG3OZWftr7Ag5daIe10vJSWsRybcMfo7aCYJg28akfhmIFXPbpuGBQRIAzsOuqKE99lijU9AFR2qQWuToAyOwKln79qAfJHx4s+zAlnOfM1ZtY8yltkyOgQC6txKHlQht/7gcsbSDcU7fzagJd7h2gviKpohATqwDYBjnw3aSbp8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:42.3209 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2dbfb94-a3ec-4c07-a587-08d6a159abc8 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4382 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: Hannes Reinecke test_bit() is atomic, test_bit() || test_bit() is not. So protect consecutive bit tests with a lock to avoid races. Signed-off-by: Hannes Reinecke Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_els.c | 4 ++++ drivers/scsi/qedf/qedf_main.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index aad1f7c..f1f57637 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -358,20 +358,24 @@ void qedf_restart_rport(struct qedf_rport *fcport) struct fc_lport *lport; struct fc_rport_priv *rdata; u32 port_id; + unsigned long flags; if (!fcport) return; + spin_lock_irqsave(&fcport->rport_lock, flags); if (test_bit(QEDF_RPORT_IN_RESET, &fcport->flags) || !test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags) || test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { QEDF_ERR(&(fcport->qedf->dbg_ctx), "fcport %p already in reset or not offloaded.\n", fcport); + spin_unlock_irqrestore(&fcport->rport_lock, flags); return; } /* Set that we are now in reset */ set_bit(QEDF_RPORT_IN_RESET, &fcport->flags); + spin_unlock_irqrestore(&fcport->rport_lock, flags); rdata = fcport->rdata; if (rdata) { diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index fb9c288..880dcf2 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1434,12 +1434,14 @@ static void qedf_rport_event_handler(struct fc_lport *lport, */ fcport = (struct qedf_rport *)&rp[1]; + spin_lock_irqsave(&fcport->rport_lock, flags); /* Only free this fcport if it is offloaded already */ if (test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags) && !test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { set_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags); + spin_unlock_irqrestore(&fcport->rport_lock, flags); qedf_cleanup_fcport(qedf, fcport); /* * Remove fcport to list of qedf_ctx list of offloaded @@ -1452,8 +1454,9 @@ static void qedf_rport_event_handler(struct fc_lport *lport, clear_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags); atomic_dec(&qedf->num_offloads); + } else { + spin_unlock_irqrestore(&fcport->rport_lock, flags); } - break; case RPORT_EV_NONE: From patchwork Tue Mar 5 10:58:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839287 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 644691823 for ; Tue, 5 Mar 2019 10:59:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 515B92B2A9 for ; Tue, 5 Mar 2019 10:59:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45EA62B352; Tue, 5 Mar 2019 10:59:50 +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,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 E13772B2A9 for ; Tue, 5 Mar 2019 10:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727477AbfCEK7t (ORCPT ); Tue, 5 Mar 2019 05:59:49 -0500 Received: from mail-eopbgr790048.outbound.protection.outlook.com ([40.107.79.48]:52770 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726150AbfCEK7t (ORCPT ); Tue, 5 Mar 2019 05:59:49 -0500 Received: from BYAPR07CA0009.namprd07.prod.outlook.com (2603:10b6:a02:bc::22) by DM5PR07MB3003.namprd07.prod.outlook.com (2603:10b6:3:e3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.18; Tue, 5 Mar 2019 10:59:46 +0000 Received: from BY2NAM05FT041.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::201) by BYAPR07CA0009.outlook.office365.com (2603:10b6:a02:bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:46 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT041.mail.protection.outlook.com (10.152.100.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:46 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:43 -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 x25AxgQv013284; Tue, 5 Mar 2019 02:59:42 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxgtV013283; Tue, 5 Mar 2019 02:59:42 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 14/26] qedf: Add additional checks for io_req->sc_cmd validity. Date: Tue, 5 Mar 2019 02:58:49 -0800 Message-ID: <20190305105901.13185-15-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571863333011;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(346002)(396003)(376002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(47776003)(305945005)(86362001)(26826003)(53936002)(4326008)(6862004)(2906002)(81156014)(50226002)(81166006)(8676002)(356004)(5660300002)(498600001)(8936002)(87636003)(54906003)(1076003)(48376002)(50466002)(68736007)(80596001)(69596002)(446003)(2616005)(51416003)(76176011)(336012)(2351001)(85426001)(36756003)(16586007)(36906005)(316002)(476003)(126002)(105606002)(11346002)(106466001)(486006)(97736004)(26005)(42186006);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB3003;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ffd7dd3d-acc2-45c0-210f-08d6a159adfd X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM5PR07MB3003; X-MS-TrafficTypeDiagnostic: DM5PR07MB3003: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB3003;23:jvoy+86EE0ngEGcmfnnr8TN9YqB8Q86hZI8ziSYQUQDo1yuJOmEniRbsOChjSJOny/lpdA81Tr/5vLn6KHcwEWUxmHw9tH2nDgalx17E8ySSVfRM62NVV/MobUeEjnWSQiZe7hvDgnjwzO98xLJwo4oIZCON+NkCA53jg/R3eJV6EVMtXlqiDYN7F8A0QNr3/zSIgErVECHlmN+Q6f7o2N9ADlLGYF5HWcikTh1HuUdc2t4xOWWVc/ch9iWbZaP/JTNEEmXcv+cTZ9lu4PKBU08u5O0VJyvhlkDw7mfA/rw3q4zzPlbeNXNogTgjbQP3RbOr3TH9V7z2NjrwWpLHtEvznmXZfBC8N1fs0gIccDX8pFCZyPlJBfBRKSIue5FnWWwen5qeeqeAiTGzjIvJGp2wR77gXilyKTGa/TkYfDcnYKZmwnSdcMfWwDKyMw7GxWwNGvmCyW1ZmMIrSK2vA1oH99cqUK+f1F18U8kpGpJ4NOayiEBracXIe+p1GtbWOIT6hhhN6Fi5xZ8+Hu98I20Y8hNl0aGFUXkwsddsLdNHUbt+ptfNXHnjN173H7G9bsKIjaPcYSQuBxLN5VAiysa71SCnYVsE0HtjQie0U24mwHrluu0GpUB9doZDXT+ySKezjFGo4qAaGc5mUb7QukA7M4/YPTtozEM6LPmsaweporDiJJfyvtA96PNlC27E5769wqyVnAmRLkPt8p5JVZsQVxPuv9Y5JVHKeISp2YIuLDvGC74UNadYBa+HvhYeYORimuo8dA3MRXdoEfaaJq6SrKQtSMcbZc4Z1JlaZF0rxPbJrh/hP8Zwmar3Zuokrq8BjgDtVnkCv1bG6CZkMYlmDaLrzAdsLyuZ07pT5LbyXhZe5WANjsrgBS5AIrfWd5zgskHsmv1ngj09GgWLoM5vD0f9cJdH7vkEortn/OBJUOPlMtIHlMsJQEsbJpeJrHMyTk+j/R+rhYJKlXscK3qgWPJjAzHR3HQ2YPbohtgSAUnS8hiiLyJhR9/frMFinOo7XbZJLJIHGFel+rUvrxMyLarsFgbl4GLSjek9P5wF/0xNqhYXdpGw4iLPuLX9h3SoV9x4XNHT1FPa7Tq/BUJAim72DBQtAQRd1jjtiag40iedG7QqJOzqff3eL2wmETtf1It9z1Lx5spxGToaZxOxUVvjK95mVFJRwE1UAssmTwxGNGVTmb5Vr3S0yEHueVe5kbdofp4hE0Qn6pdoTA== X-Microsoft-Antispam-Message-Info: 2/6n+d7bJUKBa739EU+LEvqXXh+J9s9cCjsmDhLY4bR6Ff5BmSy3lTG41MYDS3JrXGECrrRZIXDmGyKC/8cTOHj7lZjoHn2tfivg6zz+jkyqWuBCYv7cIXbTdrKFWVtlurXBeADvdqk474H/lxsQBqPDRQP6HT+3mLGZ+2FN3yBEviISVnTpSCZIW44rch8ec7Q4/qrhDJaO1P1XwvkDXT0v/41gpGq1/AEsDBkBYI0Z3F88nEn4DJEaAn/oIelrtW6MqSQgvzciwwK5rsAf7+lXLY372UrI5+s3G4q4XJOtjz/sLs/Uuj+41t8S0LCHGAt4/IlMHkV3niTU8UlA9CULgiYdyB+iIo3XQYE3NNOC5DkIRhQBsa+hhNzZ1p2HjNR690bNEYwO7Dpq1AnHCv2TyNV9hrJ8hISDnn4uk08= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:46.0180 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffd7dd3d-acc2-45c0-210f-08d6a159adfd X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3003 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: Chad Dupuis - Check the validity of various pointers before processing. Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index f04191f..f501a37 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -1324,7 +1324,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, if (!virt_addr_valid(sc_cmd)) { QEDF_ERR(&qedf->dbg_ctx, "sc_cmd=%p is not valid.", sc_cmd); - return; + goto bad_scsi_ptr; } if (!sc_cmd->SCp.ptr) { @@ -1336,7 +1336,34 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, if (!sc_cmd->device) { QEDF_ERR(&qedf->dbg_ctx, "Device for sc_cmd %p is NULL.\n", sc_cmd); - return; + goto bad_scsi_ptr; + } + + if (!virt_addr_valid(sc_cmd->device)) { + QEDF_ERR(&qedf->dbg_ctx, + "Device pointer for sc_cmd %p is bad.\n", sc_cmd); + goto bad_scsi_ptr; + } + + if (!sc_cmd->sense_buffer) { + QEDF_ERR(&qedf->dbg_ctx, + "sc_cmd->sense_buffer for sc_cmd %p is NULL.\n", + sc_cmd); + goto bad_scsi_ptr; + } + + if (!virt_addr_valid(sc_cmd->sense_buffer)) { + QEDF_ERR(&qedf->dbg_ctx, + "sc_cmd->sense_buffer for sc_cmd %p is bad.\n", + sc_cmd); + goto bad_scsi_ptr; + } + + if (!sc_cmd->scsi_done) { + QEDF_ERR(&qedf->dbg_ctx, + "sc_cmd->scsi_done for sc_cmd %p is NULL.\n", + sc_cmd); + goto bad_scsi_ptr; } qedf_unmap_sg_list(qedf, io_req); @@ -1365,6 +1392,14 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, sc_cmd->SCp.ptr = NULL; sc_cmd->scsi_done(sc_cmd); kref_put(&io_req->refcount, qedf_release_cmd); + +bad_scsi_ptr: + /* + * Clear the io_req->sc_cmd backpointer so we don't try to process + * this again + */ + io_req->sc_cmd = NULL; + kref_put(&io_req->refcount, qedf_release_cmd); /* ID: 001 */ } /* From patchwork Tue Mar 5 10:58:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839289 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 0F5B01803 for ; Tue, 5 Mar 2019 10:59:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F03DE2B2A9 for ; Tue, 5 Mar 2019 10:59:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E472E2B352; Tue, 5 Mar 2019 10:59: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=-7.9 required=2.0 tests=BAYES_00,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 517082B2A9 for ; Tue, 5 Mar 2019 10:59:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727497AbfCEK7w (ORCPT ); Tue, 5 Mar 2019 05:59:52 -0500 Received: from mail-eopbgr690061.outbound.protection.outlook.com ([40.107.69.61]:4864 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726150AbfCEK7w (ORCPT ); Tue, 5 Mar 2019 05:59:52 -0500 Received: from BYAPR07CA0009.namprd07.prod.outlook.com (2603:10b6:a02:bc::22) by SN6PR07MB4383.namprd07.prod.outlook.com (2603:10b6:805:58::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.16; Tue, 5 Mar 2019 10:59:49 +0000 Received: from BY2NAM05FT041.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::201) by BYAPR07CA0009.outlook.office365.com (2603:10b6:a02:bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:49 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT041.mail.protection.outlook.com (10.152.100.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:48 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:46 -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 x25AxkFF013289; Tue, 5 Mar 2019 02:59:46 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxkXq013287; Tue, 5 Mar 2019 02:59:46 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 15/26] qedf: Wait for upload and link down processing during soft ctx reset. Date: Tue, 5 Mar 2019 02:58:50 -0800 Message-ID: <20190305105901.13185-16-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571892304821;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(346002)(376002)(136003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(2906002)(53936002)(2616005)(47776003)(81166006)(81156014)(8676002)(305945005)(11346002)(446003)(6862004)(336012)(54906003)(36756003)(36906005)(316002)(16586007)(42186006)(68736007)(50226002)(8936002)(4326008)(87636003)(498600001)(86362001)(486006)(356004)(26826003)(6666004)(85426001)(126002)(48376002)(476003)(50466002)(14444005)(2351001)(69596002)(105606002)(106466001)(97736004)(80596001)(5660300002)(26005)(51416003)(1076003)(76176011);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB4383;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9fc45021-0cef-4b93-369b-08d6a159afc0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB4383; X-MS-TrafficTypeDiagnostic: SN6PR07MB4383: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB4383;23:eE9iOaWxLm72WbsTbPJXsOilBtoXQKEgfDW1FbUR1juwSA+pmi15qQa1+dMYdcGFMVNWtPHlsCud7RK+4CWzbve6+iDvdIXCu316a0UXkEHUqQ4BYEXu5IF6uLn+50MlV6iDtdanAYXHZJqhAs6S28C2wknE4StGBqVxL/gkrPvhc+UxKQ1r8n535BQ+MOrmBGaLyd9pBFLXuual9I/3hrQICNte5XbxP3k4K1mNvsLpXET/nwdBFZdnm+detDrevd1A1OxAlUYMdGev/QWqhhtGoQ4uTrIFcAHcJ/y0kReyn9zrdFC/MbIqgyqIrJPuwV/p9JY14+lMmJY2e+JewtmObXmSMjlDjThfXlHVWdKQHDCcG8/hR1IRW+W9FMGaM9DyQJkaXAh7mtWK+C6emIB4+QQSlvZIaTquHBD7PGx6Al2wgQTLkiU0bKw00J8Pydo+bQRrSjPXOu5y0HWQFnsA/HcivrwaKWw6WM5odcJmSG0teuMbckkmdn91Sw2rS2DqReGwnECctEsMfpMVo5yX7bK8jBL+MeSdMvoWNO5hGelQSc7LKnbucCyh1j0f3Ms5+KEqTWZFbrI+Usbub18P/mWy6kSIPfi6q90LCMHxoWbVNwwRCGdSVnroYn1uVQG32Tjx0n0L3h+Bv0pUfhpBkbaQHbXQaa43Z3ACgN+3Bi/eAYWuIuQV8QFV1HoTpXbRpCyfjxzn2hg4qLISHxzlj1KmctV01IBIiQM7yNRwugyMpvXYjMqvo9iurPFAsUiwfJ/nP6ERzunb+awrs8+E8iq+gbuvJqw1v4ap8WQU9JKTR5/dbCVD19aCXcCFkb5T1uIKjsEYPW7oxQ12W6wkWUAClaGdADR5LCB6B6A1NU8VaGgHRrvabnedI8rVfYkBJVvTtDTzJXAXNng1l6nXUUEvT6htSvE3dhv7P4FNbHJXAQErbj0q7xW70oPnmk5Y4F7pG3TnGX8nT3+4NytSbVNuE3pAJtH4T269kPNnqQy0z5SZDuTfdt0iPg6TwxVZJztC3g/xoExR2eeNEjTEcTBTcjNc6lurO2geD+8gNcN3zHPin1+RhXoiq6TOkrYZ3H6YRxsxjZpSr+xSX/LZEE6tcL0ZGEefgYnZssvbymKbjLAAzEVZjMJe5cQSCmUFcXIajTwO31O+hv15fxY1Hk4RMuK0BR9lXSbD3aIFFtdmukeya6bOKLfCBN88xyzoFvbgngetGdK92c3Cd4B54RAKXzGf4nk42sbciYdVykc4vaWLtf+pryeaWNyU X-Microsoft-Antispam-Message-Info: pEEosA3OiDGqagp8XJTgmYrDngwO1tb5yrJXrM0zD9VZ8O9mSO0jGE3VO6xpJkhFG53f5ANByatb6vMtoa1cXsj/osQbmBne+C24tyTfUNF/9CwMl7o53vUAaso79FI/Ye7Ky2XzAaxQDwS3kt8C6vDQolUAym8gIL2YK6U6eiVWepp3hpPQSS2N/WbQBApmZT/+uMckl950OveiTseZ3DY4fskxkOoOn67PF99xvDh7Oi+Us/b62Uj0etnbMmgcXSnASMEzXroZ6fUc6M1Kn44lnxvaqvass3ncHPutSfjgQM24/MP85qL6DSa5hEBS0bNS4is5wplNEaz/K62AaIBv5SzUHuqHlFDlExvE46OS1266pwhMb1sarju190kKrA8DIigfUd+ie58ohzxQBlX+Y4TqYIaoaz5EFTBjdkQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:48.9853 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fc45021-0cef-4b93-369b-08d6a159afc0 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4383 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: Chad Dupuis - Wait for all the connections to get uploaded. Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf.h | 4 ++- drivers/scsi/qedf/qedf_fip.c | 4 +-- drivers/scsi/qedf/qedf_main.c | 60 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index fb7d0d5..1e0d142 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -500,7 +500,7 @@ extern void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, extern void qedf_create_sysfs_ctx_attr(struct qedf_ctx *qedf); extern void qedf_remove_sysfs_ctx_attr(struct qedf_ctx *qedf); extern void qedf_capture_grc_dump(struct qedf_ctx *qedf); -extern void qedf_wait_for_upload(struct qedf_ctx *qedf); +bool qedf_wait_for_upload(struct qedf_ctx *qedf); extern void qedf_process_unsol_compl(struct qedf_ctx *qedf, uint16_t que_idx, struct fcoe_cqe *cqe); extern void qedf_restart_rport(struct qedf_rport *fcport); @@ -514,6 +514,8 @@ extern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf, extern void qedf_fp_io_handler(struct work_struct *work); extern void qedf_get_generic_tlv_data(void *dev, struct qed_generic_tlvs *data); extern void qedf_wq_grcdump(struct work_struct *work); +void qedf_stag_change_work(struct work_struct *work); +void qedf_ctx_soft_reset(struct fc_lport *lport); #define FCOE_WORD_TO_BYTE 4 #define QEDF_MAX_TASK_NUM 0xFFFF diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c index e669679..53c5eca5 100644 --- a/drivers/scsi/qedf/qedf_fip.c +++ b/drivers/scsi/qedf/qedf_fip.c @@ -236,9 +236,7 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb) QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, "do_reset=%d.\n", do_reset); if (do_reset) { - fcoe_ctlr_link_down(&qedf->ctlr); - qedf_wait_for_upload(qedf); - fcoe_ctlr_link_up(&qedf->ctlr); + qedf_ctx_soft_reset(qedf->lport); } kfree_skb(skb); } else { diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 880dcf2..f82b0b5 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -156,7 +156,8 @@ static void qedf_handle_link_update(struct work_struct *work) container_of(work, struct qedf_ctx, link_update.work); int rc; - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Entered.\n"); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Entered. link_state=%d.\n", + atomic_read(&qedf->link_state)); if (atomic_read(&qedf->link_state) == QEDF_LINK_UP) { rc = qedf_initiate_fipvlan_req(qedf); @@ -194,7 +195,9 @@ static void qedf_handle_link_update(struct work_struct *work) QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Calling fcoe_ctlr_link_down().\n"); fcoe_ctlr_link_down(&qedf->ctlr); - qedf_wait_for_upload(qedf); + if (qedf_wait_for_upload(qedf) == false) + QEDF_ERR(&qedf->dbg_ctx, + "Could not upload all sessions.\n"); /* Reset the number of FIP VLAN retries */ qedf->fipvlan_retries = qedf_fipvlan_retries; } @@ -780,22 +783,42 @@ static int qedf_eh_device_reset(struct scsi_cmnd *sc_cmd) return qedf_initiate_tmf(sc_cmd, FCP_TMF_LUN_RESET); } -void qedf_wait_for_upload(struct qedf_ctx *qedf) +bool qedf_wait_for_upload(struct qedf_ctx *qedf) { + struct qedf_rport *fcport = NULL; + while (1) { if (atomic_read(&qedf->num_offloads)) QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Waiting for all uploads to complete.\n"); else - break; + return true; msleep(500); } + + rcu_read_lock(); + list_for_each_entry_rcu(fcport, &qedf->fcports, peers) { + if (fcport && test_bit(QEDF_RPORT_SESSION_READY, + &fcport->flags)) { + if (fcport->rdata) + QEDF_ERR(&qedf->dbg_ctx, + "Waiting for fcport %p portid=%06x.\n", + fcport, fcport->rdata->ids.port_id); + } else { + QEDF_ERR(&qedf->dbg_ctx, + "Waiting for fcport %p.\n", fcport); + } + } + rcu_read_unlock(); + return false; + } /* Performs soft reset of qedf_ctx by simulating a link down/up */ -static void qedf_ctx_soft_reset(struct fc_lport *lport) +void qedf_ctx_soft_reset(struct fc_lport *lport) { struct qedf_ctx *qedf; + struct qed_link_output if_link; if (lport->vport) { QEDF_ERR(NULL, "Cannot issue host reset on NPIV port.\n"); @@ -806,11 +829,32 @@ static void qedf_ctx_soft_reset(struct fc_lport *lport) /* For host reset, essentially do a soft link up/down */ atomic_set(&qedf->link_state, QEDF_LINK_DOWN); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "Queuing link down work.\n"); queue_delayed_work(qedf->link_update_wq, &qedf->link_update, 0); - qedf_wait_for_upload(qedf); + + if (qedf_wait_for_upload(qedf) == false) { + QEDF_ERR(&qedf->dbg_ctx, "Could not upload all sessions.\n"); + WARN_ON(atomic_read(&qedf->num_offloads)); + } + + /* Before setting link up query physical link state */ + qed_ops->common->get_link(qedf->cdev, &if_link); + /* Bail if the physical link is not up */ + if (!if_link.link_up) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "Physical link is not up.\n"); + return; + } + /* Flush and wait to make sure link down is processed */ + flush_delayed_work(&qedf->link_update); + msleep(500); + atomic_set(&qedf->link_state, QEDF_LINK_UP); qedf->vlan_id = 0; + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "Queue link up work.\n"); queue_delayed_work(qedf->link_update_wq, &qedf->link_update, 0); } @@ -3448,7 +3492,9 @@ static void __qedf_remove(struct pci_dev *pdev, int mode) fcoe_ctlr_link_down(&qedf->ctlr); else fc_fabric_logoff(qedf->lport); - qedf_wait_for_upload(qedf); + + if (qedf_wait_for_upload(qedf) == false) + QEDF_ERR(&qedf->dbg_ctx, "Could not upload all sessions.\n"); #ifdef CONFIG_DEBUG_FS qedf_dbg_host_exit(&(qedf->dbg_ctx)); From patchwork Tue Mar 5 10:58:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839291 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 2599C1803 for ; Tue, 5 Mar 2019 10:59:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11D292B2A9 for ; Tue, 5 Mar 2019 10:59:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05F282B352; Tue, 5 Mar 2019 10:59:56 +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,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 A74B62B2A9 for ; Tue, 5 Mar 2019 10:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727498AbfCEK7z (ORCPT ); Tue, 5 Mar 2019 05:59:55 -0500 Received: from mail-eopbgr750072.outbound.protection.outlook.com ([40.107.75.72]:9003 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726150AbfCEK7z (ORCPT ); Tue, 5 Mar 2019 05:59:55 -0500 Received: from BYAPR07CA0009.namprd07.prod.outlook.com (2603:10b6:a02:bc::22) by DM6PR07MB4378.namprd07.prod.outlook.com (2603:10b6:5:bf::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:52 +0000 Received: from BY2NAM05FT041.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::201) by BYAPR07CA0009.outlook.office365.com (2603:10b6:a02:bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:52 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT041.mail.protection.outlook.com (10.152.100.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:51 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:49 -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 x25AxnOo013294; Tue, 5 Mar 2019 02:59:49 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxnSG013292; Tue, 5 Mar 2019 02:59:49 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 16/26] qedf: Add missing return in qedf_scsi_done(). Date: Tue, 5 Mar 2019 02:58:51 -0800 Message-ID: <20190305105901.13185-17-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571919775528;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(39860400002)(376002)(346002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(86362001)(26826003)(51416003)(486006)(126002)(476003)(50466002)(36756003)(48376002)(356004)(6666004)(498600001)(47776003)(316002)(54906003)(97736004)(42186006)(53936002)(85426001)(4744005)(2906002)(6862004)(26005)(16586007)(305945005)(8936002)(69596002)(80596001)(36906005)(76176011)(81166006)(81156014)(4326008)(87636003)(106466001)(336012)(5660300002)(8676002)(50226002)(11346002)(2616005)(105606002)(2351001)(1076003)(68736007)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4378;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8f12d090-bd52-4953-3ac4-08d6a159b163 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB4378; X-MS-TrafficTypeDiagnostic: DM6PR07MB4378: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4378;23:d6pOJVAGYzqGc4QmqQOLYAQS909xTnbP0bDagF3Oyub5s14/KtXqTrKRb4BNE4iqKslZQG/GJ3hGwDlHwuaNv2A3ShzPPYWAk5lnSadpnLcr7qwvDfrNj7t9uvlWOnu+QZ0YnDZ5pcc529EgduSlT/3IYtGy1G7c5rAwtRmR86SWMxNh/DGt+2pqhZGE7BEHRP11OV9v8EFhpT8hDJ3BYLDn3i0XBLBTeCVEcwn3UH7Y0VTWv4NOlY9QoGWtcuz4nafM7NfIjwUTd2oxKcrhNVVVTOIVDudso/nUFqQofNn/dVO8NC3Yvb3B5v35w4+uftYclF/u8aSuwVD0Iie6zHvbHUiLfMlkCDVJJ1oArYJXjtD9R0Zfv1VqXGuxF3kch8qgJH0yFitxknnWWfGfcI9A8/+DPEYxpk1mohlDFghWbIL65MCgrOvDR0PDFa8D5n9CaJm2gv9NA7hqUCD13azYr1AwXT725WjMv9bTR5WSBAPK/GP32tzMpo9A6XZ6tffA5aMdtOFjF8ENe39BrVrUaMxfFUbKinVDNe0NlUIOa/VO/W+5JFNqYpQTT2VY8rMax/gtwAXzv2K1HDcvz0zE7l7JER7X/26FPPMM5wcvWfHA6BxIJppl+Myd735h1ZzDnzQFfp0PywiNrVjSnKP8XS2x1PnMF/5+YHSKve6SMYhOu3vDeGfcjhIJISkLbWzrJTnGjEzZjaZE36i44fnzIy5qqE7ljwpL7CllFBQMD2zA7J9gITqxS6LVGeqOviqIoAE6nnPanysgdpkqyM93PpjY/qIebAc7+ab7dmBQIftXTkrlRHX89iIlhe8Bpj/rKslPFIGFM5BKNSucjJEwngK8+W8a53te5UAmby8HUPQvPiU3Vq2/TR4NMZy4tMx/KAhSuHvWhoVtV8WoeDE7ylb7yIglCuVXOVGDAhEvYZSUpH0sPOVkBJaGKxmAPleSAZHJtFcV8ztb+W3gzYnYUOj2O8gM8EUd6blbHAbuaebY16EPF94J332iRLTyWMIgP0jZ8wrInPLxjoze7C4tKO10j4TmVOzYppvaA7rP9k08mbNzh4xAvDWw3ED0QXQfkEO72ABq2PddSX5YKQ+7Wn3Rvh8qhWdWYnQRCGSJwpPnRdaWRxkqkrg4NcR17bm+FR623R9v124nGKtGDQsa1CW9fmc7D8EqXtZyCIvr8g6nI4uUWdhc9Jc3/hY42+8Dyxd9bngotL0UZ9JAiG+rLBtf86Grov2ue5I7C+4guZcaDTUJcI/5qC+ms1Rh X-Microsoft-Antispam-Message-Info: q1RgIGQcQLmhfn8OEL91ZRVjgvRWUKARRMZXgy9jQjVf8vMZ8c4dbADZPiiAqu06Xj36ZO/LTc5laUuTl3XX+MdhQA35iKOHrmYIZlo3W9K2vAq2H6aY0A70b/JpsOt1JIPIeFztkX0b+d55yNNLtX6MbAb300KpvVO9vanOWZiUAr85CQaGNE/pxjHSB3zhQN+caxwPCJkdEnWJ5amlPCG0i2dNbyQ2u2riYXSIWFSZi+19inRg6sIOsZUxxIrdi+2/HupXEYbE/vzUFg9R9fJwal3+EVkTqFg/N3n834a0/eBrW4/aD/qPyXOaOWpm2HHf4WKOCDusy26iB0WT/gNvFyftpyYhNOpNLsTeLfWUduXSDC2NVpyuZyuUNBzQbNE+NMJ1FCyt5LAIRh107If7EQsR9qBQcoH+NTaWY8A= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:51.7213 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f12d090-bd52-4953-3ac4-08d6a159b163 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4378 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: Chad Dupuis On completions where we do not have a bad scsi_cmnd pointer we should return before the the label lest we do a double kref_put. Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index f501a37..6f92b1b 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -1392,6 +1392,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, sc_cmd->SCp.ptr = NULL; sc_cmd->scsi_done(sc_cmd); kref_put(&io_req->refcount, qedf_release_cmd); + return; bad_scsi_ptr: /* From patchwork Tue Mar 5 10:58:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839293 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 A881D17E4 for ; Tue, 5 Mar 2019 10:59:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9477B2B2C2 for ; Tue, 5 Mar 2019 10:59:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88C592B360; Tue, 5 Mar 2019 10:59:58 +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,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 F33A02B2C2 for ; Tue, 5 Mar 2019 10:59:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727507AbfCEK75 (ORCPT ); Tue, 5 Mar 2019 05:59:57 -0500 Received: from mail-eopbgr750051.outbound.protection.outlook.com ([40.107.75.51]:5603 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726150AbfCEK75 (ORCPT ); Tue, 5 Mar 2019 05:59:57 -0500 Received: from BYAPR07CA0009.namprd07.prod.outlook.com (2603:10b6:a02:bc::22) by BN7PR07MB4753.namprd07.prod.outlook.com (2603:10b6:406:f0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:55 +0000 Received: from BY2NAM05FT041.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::201) by BYAPR07CA0009.outlook.office365.com (2603:10b6:a02:bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:54 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT041.mail.protection.outlook.com (10.152.100.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:54 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:52 -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 x25AxqRv013302; Tue, 5 Mar 2019 02:59:52 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25Axq0U013297; Tue, 5 Mar 2019 02:59:52 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 17/26] qedf: fc_rport_priv reference counting fixes Date: Tue, 5 Mar 2019 02:58:52 -0800 Message-ID: <20190305105901.13185-18-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571946021059;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(136003)(346002)(376002)(396003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(486006)(54906003)(86362001)(1076003)(305945005)(316002)(80596001)(42186006)(4326008)(16586007)(36906005)(69596002)(81166006)(26005)(14444005)(2351001)(97736004)(51416003)(81156014)(8676002)(76176011)(446003)(47776003)(11346002)(336012)(105606002)(50226002)(106466001)(26826003)(2616005)(8936002)(6862004)(53936002)(5660300002)(48376002)(68736007)(85426001)(126002)(498600001)(87636003)(356004)(50466002)(476003)(36756003)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4753;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f872deb-318e-41b8-db73-08d6a159b2f3 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4753; X-MS-TrafficTypeDiagnostic: BN7PR07MB4753: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4753;23:3kn8d23kOazpJRcUSZXdk/mAR9RVLhabN1AUjq7raVZCp71T1OsSdAC5Lfbs/NunDDK+2d74K8eQsxbF2JB32ELgMKJ1Vma8hnqVbL8AusXqoGSaEMKWeeCGnNfoLDFTXWJ0PoWU65MIC+c1X6TGPgnwaMRTUrjZ779GQGIU/J5UJPDN2PXNG2HJEsnDNcil0ADXZEk6LdiSeB81icr8rPBd8jxdFrHIcTN9yCcpfoqRRJlEPM9MzidSa7jo/8/riwEb8XeAnAr3VU+btUynnpUolDQ9Bcc9tnZFxJwwyVKeZKtypjL8Kqu3owor+BklLkAE8GG+YO82r15PMQzyZMcPrc5u5vawXG2s5j0/0X5GRN8WhtlK6dqzm+UsHNMcX+uGcgNsKzkF2Goeu+0C1OTtWsgCUCXvAdTY2aR/aVBfqfgVj+Wy/0xulIDgYJedRslrsJoIb9ES3oWdN8p1Kjwb3icUPc1osZAZdks1leISJB/Uqh1fqCERJJnBCbnB6cGZqbt6OKAwu8HjiI6V1U2NpekHrdrvhuQGtpyUbishNQlRVqnDRHMP1c2Rv7rJTnEVGi6yZNlQ0LM/77m25F/ywoArVST6D9jPqXIIKn6agrLmP6NsppulPAPeeIR38tAVrL6EG3KNfkojsM0Ejd3Ndw4YRtOyPMu0jUHI2lO++BPoMzf9vsBWYf5g2csr2NP0ns5FDsdv/1v9MjNueF2UCUWy2QaCYsZmQntL0cTF1RxgA/J5iTzIjK8Z5u33yIm+oI7sofm0rWmNc6Wy8x08BLPjSWCZBulixI4I5ILClvh4LXKeeZzNYeDR7xxF4hgekGaaATxyiJtkEK4oeMpi1EXZHKPcQMNf0HYFQYACVxJaOuwSVUyJoHZb/Q6lLKw9fpGsPf5jceLwSQjmSH/Fga6FWdtPCm8nk6Cfgd/E+fKv0arMTVgGUAxvlIK6iWNAusMM2OThzVm0N5Y8RvZM0ff/tlcvMegsHdGklwqDi42uWKxt3AsNoObU1QLTM67KBsHednEyD0jApMQzG1AxoBQHgIKQfuAs2ywxyEnT0gvLaokxBSlZo462yZ4DWyigejnhctJ0i4cOWdbW0ncxWLOtpSCHNriY+mvuow/BKWVaMX7b0VCbFNxe11v1ll9a0w+UjvVlj97WCeb/rIW6mmwbDBqS832bz8yrP4LjwkqxqCYMe6Nxj4MOUKqUOf32b1rx1a44n0SV8VGQ+O/xadDsKEGOBqXAxIsyAK8= X-Microsoft-Antispam-Message-Info: cbENvbkSVKQiz8fZJmg1tJl6ImkO2LmVvKVCqebER6U2iCoSIK4gL9V7oaoqDQftpYJNKCSk9a6RhcPmxKBdwqUzupt3OsRiPjlPrPJS3rLp07p/wMqqx2T8zWjsZcOK2Si5gkKX14cCnoG9QRTQUiYK9/uHd+vW5IEHpIoEpqaFOFlMtk3b1MT4DOEry8UFTfyhqcwnQcqHXD2WLyknt0S0LbCxxet1HWp1436kawCm6ugbzfVkQtMKk8Yo5GbXst6DPc32bjC593zIZzANc+VDtl7//KGB3ur7O6HIetsFN4aBt8mewEOKzjwY94DjhKvgM6uePTSYPbO3jf3rmEoaTIfj3Zmnu+7quCUes0UgWoGna/nVrDKORSeEV4/bfQthKbqxzqxyEUjTSy0jo/A8y0pBKTw4kKPgQrva+/k= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:54.3469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f872deb-318e-41b8-db73-08d6a159b2f3 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4753 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: Hannes Reinecke The fc_rport_priv structure is reference counted, so we need to ensure that the reference is increased before accessing the structure. Signed-off-by: Hannes Reinecke Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_els.c | 9 ++++++++- drivers/scsi/qedf/qedf_io.c | 25 +++++++++++++++++-------- drivers/scsi/qedf/qedf_main.c | 5 +++++ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index f1f57637..1781e73 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -378,12 +378,18 @@ void qedf_restart_rport(struct qedf_rport *fcport) spin_unlock_irqrestore(&fcport->rport_lock, flags); rdata = fcport->rdata; - if (rdata) { + if (rdata && !kref_get_unless_zero(&rdata->kref)) { + fcport->rdata = NULL; + rdata = NULL; + } + + if (rdata && rdata->rp_state == RPORT_ST_READY) { lport = fcport->qedf->lport; port_id = rdata->ids.port_id; QEDF_ERR(&(fcport->qedf->dbg_ctx), "LOGO port_id=%x.\n", port_id); fc_rport_logoff(rdata); + kref_put(&rdata->kref, fc_rport_destroy); mutex_lock(&lport->disc.disc_mutex); /* Recreate the rport and log back in */ rdata = fc_rport_create(lport, port_id); @@ -393,6 +399,7 @@ void qedf_restart_rport(struct qedf_rport *fcport) fcport->rdata = rdata; } else { mutex_unlock(&lport->disc.disc_mutex); + fcport->rdata = NULL; } } clear_bit(QEDF_RPORT_IN_RESET, &fcport->flags); diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 6f92b1b..504ae02 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -1799,6 +1799,7 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) goto out; } + qedf = fcport->qedf; rdata = fcport->rdata; if (!rdata || !kref_get_unless_zero(&rdata->kref)) { @@ -1808,32 +1809,31 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) } r_a_tov = rdata->r_a_tov; - qedf = fcport->qedf; lport = qedf->lport; if (lport->state != LPORT_ST_READY || !(lport->link_up)) { QEDF_ERR(&(qedf->dbg_ctx), "link is not ready\n"); rc = 1; - goto out; + goto drop_rdata_kref; } if (atomic_read(&qedf->link_down_tmo_valid) > 0) { QEDF_ERR(&(qedf->dbg_ctx), "link_down_tmo active.\n"); rc = 1; - goto out; + goto drop_rdata_kref; } /* Ensure room on SQ */ if (!atomic_read(&fcport->free_sqes)) { QEDF_ERR(&(qedf->dbg_ctx), "No SQ entries available\n"); rc = 1; - goto out; + goto drop_rdata_kref; } if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { QEDF_ERR(&qedf->dbg_ctx, "fcport is uploading.\n"); rc = 1; - goto out; + goto drop_rdata_kref; } if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags) || @@ -1843,7 +1843,7 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) "cleanup or abort processing or already " "completed.\n", io_req->xid); rc = 1; - goto out; + goto drop_rdata_kref; } kref_get(&io_req->refcount); @@ -1876,6 +1876,8 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) spin_unlock_irqrestore(&fcport->rport_lock, flags); +drop_rdata_kref: + kref_put(&rdata->kref, fc_rport_destroy); out: return rc; } @@ -2217,6 +2219,7 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, unsigned long flags; struct fcoe_wqe *sqe; u16 sqe_idx; + struct fc_rport_priv *rdata = fcport->rdata; if (!sc_cmd) { QEDF_ERR(&(qedf->dbg_ctx), "invalid arg\n"); @@ -2230,8 +2233,13 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, return FAILED; } - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "portid = 0x%x " - "tm_flags = %d\n", fcport->rdata->ids.port_id, tm_flags); + if (!rdata || !kref_get_unless_zero(&rdata->kref)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM, "stale rport\n"); + return FAILED; + } + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM, + "portid = 0x%x tm_flags = %d\n", + rdata->ids.port_id, tm_flags); io_req = qedf_alloc_cmd(fcport, QEDF_TASK_MGMT_CMD); if (!io_req) { @@ -2327,6 +2335,7 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, rc = SUCCESS; } reset_tmf_err: + kref_put(&rdata->kref, fc_rport_destroy); return rc; } diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index f82b0b5..3f42684 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1333,6 +1333,8 @@ static void qedf_upload_connection(struct qedf_ctx *qedf, static void qedf_cleanup_fcport(struct qedf_ctx *qedf, struct qedf_rport *fcport) { + struct fc_rport_priv *rdata = fcport->rdata; + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_CONN, "Cleaning up portid=%06x.\n", fcport->rdata->ids.port_id); @@ -1344,6 +1346,7 @@ static void qedf_cleanup_fcport(struct qedf_ctx *qedf, qedf_free_sq(qedf, fcport); fcport->rdata = NULL; fcport->qedf = NULL; + kref_put(&rdata->kref, fc_rport_destroy); } /** @@ -1419,6 +1422,8 @@ static void qedf_rport_event_handler(struct fc_lport *lport, break; } + /* Initial reference held on entry, so this can't fail */ + kref_get(&rdata->kref); fcport->rdata = rdata; fcport->rport = rport; From patchwork Tue Mar 5 10:58:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839295 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 8547517E4 for ; Tue, 5 Mar 2019 11:00:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A43B2B2C2 for ; Tue, 5 Mar 2019 11:00:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B3BA2B360; Tue, 5 Mar 2019 11:00:04 +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,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 C8E5E2B2C2 for ; Tue, 5 Mar 2019 11:00:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727519AbfCELAD (ORCPT ); Tue, 5 Mar 2019 06:00:03 -0500 Received: from mail-eopbgr800047.outbound.protection.outlook.com ([40.107.80.47]:3232 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726150AbfCELAD (ORCPT ); Tue, 5 Mar 2019 06:00:03 -0500 Received: from BYAPR07CA0021.namprd07.prod.outlook.com (2603:10b6:a02:bc::34) by BN7PR07MB4371.namprd07.prod.outlook.com (2603:10b6:406:b5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Tue, 5 Mar 2019 10:59:59 +0000 Received: from BY2NAM05FT041.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by BYAPR07CA0021.outlook.office365.com (2603:10b6:a02:bc::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:59 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT041.mail.protection.outlook.com (10.152.100.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:58 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:55 -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 x25AxtC4013306; Tue, 5 Mar 2019 02:59:55 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxtUx013305; Tue, 5 Mar 2019 02:59:55 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 18/26] qedf: Check both the FCF and fabric ID before servicing clear virtual link. Date: Tue, 5 Mar 2019 02:58:53 -0800 Message-ID: <20190305105901.13185-19-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571990119329;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(346002)(376002)(39860400002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(42186006)(305945005)(97736004)(86362001)(14444005)(6862004)(76176011)(36756003)(2906002)(26005)(87636003)(8936002)(498600001)(51416003)(356004)(4326008)(26826003)(446003)(486006)(8676002)(2616005)(81156014)(126002)(2351001)(50226002)(336012)(68736007)(105606002)(54906003)(80596001)(5660300002)(85426001)(81166006)(106466001)(11346002)(1076003)(476003)(69596002)(36906005)(47776003)(316002)(48376002)(50466002)(16586007)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4371;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 101225bc-15ad-44ad-be64-08d6a159b594 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4371; X-MS-TrafficTypeDiagnostic: BN7PR07MB4371: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4371;23:GslPcGFE9EwlpZ7FN0SQm1R6j7qrCKisaZ7rzQbQA2Cqrvzkk3cUOe3wJr3o/nk2D+EhIRtb1anto2iWOXdjIOmlyEuleb1o5TAq5YttWoywd+Eqjcr38INUNdAJDlyS3aNPXjShK4TX0R334Bxn+N/P1uZ4Ba4bytplGMEKmohhPFDq+66FSAZxdP56YYUNUuQproSpXfWkAbqfTfRf9b8s3qEBfjwPVh8mQHPI9yLQe9iMtn4Z0NQYGE8NbWZSXSgKnocgzvhS2fbE6fKc7Xw4Qq8aU7au49v+wCcvLIlWQxXntdXrRvTkc+AKiwf9vh9wDaaAaVXX7cEBMWjLhuYTq6dcNA/LveL+9FSkMMo2PKW0KG07a/YCTT0bPIvURYV2LcwEspNkRfYNb+AOJBjnJxCRd7DMURMd/zEaix6r2SaK/8h08gjthhLqkYVL1Wan2gk8/fLqJVqZfDK1qXS3kuMjf4UI62srBagQpsEKPLdvbyO06w1XF6NovMow8l3UiURUb9/j+kmHeYclIvJ9kkUfzPgKX72nWKAICfTr5votCn78C76jQQgJizZDTtZo0l+ECxy58OOa/K0uhk9l7S3NB1g9IHnDJsHgVudi6SnH84XJoM+pFIpW3wsvcysid/Qk/tkerWCIrSyUP4sThwOlPIabjuGREuAwXqfPBqZvGqyV5RfaIUxjrGArp8yMHrn+0wQNvMFkoOLpMpV+ibS6NTqoLzqQhd8LkRA32Lw+tKbuefJ8C2qCxcdBd10V7BhF/ay41nNN359Zux9o5AzTXIkVSV8tcR0Lwtq3Yq/zRIZ7zFpYBCiIRrJIQLe/hD4TMMV52S03GEU0T9H6ihHi3vSf2Tp3Rv2E2mid9BXo6yfvvFsgClZwyU4zBpxuRRGrLVW0bGLbqN193M0e7pTBaER0y51TYAlt76MocAcNRM8+RZwYckPqR1KUJb1FDfWqb8WVTbPVW3hUsCZtcmU0Fkv4aOHeDgznyNhFRR5SNzYW2m7F3nVbjT5VISHIjikZgvxMA+JcvjOrEfrCUnwmchajRZJL2gMRKiYelL/PL2I2chbHD2noEmue1Srsp+8dr2PQnspeBI14By63tsKmVDgTDgW2fVvBKI+9EUoIIFGQPwFMbrpbHUlusaIEBo04RaXxUHrZT7+iDtsASIRvZZwJo5TqTdPD5dxnQFU9ym9s/9lS0VqGlBFSGEVcDqx8Sd4p+vi/4W4WjUXl2skJr0GHZLZz0XDZu2I= X-Microsoft-Antispam-Message-Info: 9Pl5o1H5nosUa049heoP6/fyt1g1N8lVTf6fa4iWoTEbpT6RJsvb+q4GVK1awvCXcR3IGRt3uPSMVPGelRkS8eneLHOW268xW5GVSDL/IbNDkmrQoF87xf5k5Wf1qpgW27KpLywzfaOjZg5tRjjRJ443LRl+LdBSgUPfncJLYM+Jx2YOaE9Szp++Mq75CDaVlQ1kVMEWatWF8qT2wZXc/fYMxGg9/spG7WdiiFW9mkdNr4AFEjrSf+GQUN5sAFjjq5Fx+EPnqLknLHH4cIFM4RMNKqD0ewRYinzKBDAjwgBndhhsjtkceBn3JH6z4UXrhKMRC5lgMbMYfQo6CIq2CsxVPauWwNjAVX0ZT2Dt1LNjebUKINoA4A3ekm+nMUm1UXl6pvKwzfqZYU25wDFLwf6kdIAY1GDLgv4/vkrb07o= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:58.7567 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 101225bc-15ad-44ad-be64-08d6a159b594 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4371 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: Chad Dupuis - Check proper values before servicing CVL. Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_fip.c | 66 ++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c index 53c5eca5..766da74 100644 --- a/drivers/scsi/qedf/qedf_fip.c +++ b/drivers/scsi/qedf/qedf_fip.c @@ -151,6 +151,8 @@ void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb) qed_ops->ll2->start_xmit(qedf->cdev, skb, 0); } +static u8 fcoe_all_enode[ETH_ALEN] = FIP_ALL_ENODE_MACS; + /* Process incoming FIP frames. */ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb) { @@ -163,20 +165,37 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb) size_t rlen, dlen; u16 op; u8 sub; - bool do_reset = false; + bool fcf_valid = false; + /* Default is to handle CVL regardless of fabric id descriptor */ + bool fabric_id_valid = true; + bool fc_wwpn_valid = false; + u64 switch_name; + u16 vlan = 0; eth_hdr = (struct ethhdr *)skb_mac_header(skb); fiph = (struct fip_header *) ((void *)skb->data + 2 * ETH_ALEN + 2); op = ntohs(fiph->fip_op); sub = fiph->fip_subcode; - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, "FIP frame received: " - "skb=%p fiph=%p source=%pM op=%x sub=%x", skb, fiph, - eth_hdr->h_source, op, sub); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_LL2, + "FIP frame received: skb=%p fiph=%p source=%pM destn=%pM op=%x sub=%x vlan=%04x", + skb, fiph, eth_hdr->h_source, eth_hdr->h_dest, op, + sub, vlan); if (qedf_dump_frames) print_hex_dump(KERN_WARNING, "fip ", DUMP_PREFIX_OFFSET, 16, 1, skb->data, skb->len, false); + if (!ether_addr_equal(eth_hdr->h_dest, qedf->mac) && + !ether_addr_equal(eth_hdr->h_dest, fcoe_all_enode) && + !ether_addr_equal(eth_hdr->h_dest, qedf->data_src_addr)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_LL2, + "Dropping FIP type 0x%x pkt due to destination MAC mismatch dest_mac=%pM ctlr.dest_addr=%pM data_src_addr=%pM.\n", + op, eth_hdr->h_dest, qedf->mac, + qedf->data_src_addr); + kfree_skb(skb); + return; + } + /* Handle FIP VLAN resp in the driver */ if (op == FIP_OP_VLAN && sub == FIP_SC_VL_NOTE) { qedf_fcoe_process_vlan_resp(qedf, skb); @@ -205,25 +224,36 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb) switch (desc->fip_dtype) { case FIP_DT_MAC: mp = (struct fip_mac_desc *)desc; - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, - "fd_mac=%pM\n", mp->fd_mac); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "Switch fd_mac=%pM.\n", mp->fd_mac); if (ether_addr_equal(mp->fd_mac, qedf->ctlr.sel_fcf->fcf_mac)) - do_reset = true; + fcf_valid = true; break; case FIP_DT_NAME: wp = (struct fip_wwn_desc *)desc; - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, - "fc_wwpn=%016llx.\n", - get_unaligned_be64(&wp->fd_wwn)); + switch_name = get_unaligned_be64(&wp->fd_wwn); + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "Switch fd_wwn=%016llx fcf_switch_name=%016llx.\n", + switch_name, + qedf->ctlr.sel_fcf->switch_name); + if (switch_name == + qedf->ctlr.sel_fcf->switch_name) + fc_wwpn_valid = true; break; case FIP_DT_VN_ID: vp = (struct fip_vn_desc *)desc; - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, - "fd_fc_id=%x.\n", ntoh24(vp->fd_fc_id)); - if (ntoh24(vp->fd_fc_id) == + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "vx_port fd_fc_id=%x fd_mac=%pM.\n", + ntoh24(vp->fd_fc_id), vp->fd_mac); + /* Check vx_port fabric ID */ + if (ntoh24(vp->fd_fc_id) != qedf->lport->port_id) - do_reset = true; + fabric_id_valid = false; + /* Check vx_port MAC */ + if (!ether_addr_equal(vp->fd_mac, + qedf->data_src_addr)) + fabric_id_valid = false; break; default: /* Ignore anything else */ @@ -233,11 +263,11 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb) rlen -= dlen; } - QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, - "do_reset=%d.\n", do_reset); - if (do_reset) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "fcf_valid=%d fabric_id_valid=%d fc_wwpn_valid=%d.\n", + fcf_valid, fabric_id_valid, fc_wwpn_valid); + if (fcf_valid && fabric_id_valid && fc_wwpn_valid) qedf_ctx_soft_reset(qedf->lport); - } kfree_skb(skb); } else { /* Everything else is handled by libfcoe */ From patchwork Tue Mar 5 10:58:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839297 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 5D7E617E4 for ; Tue, 5 Mar 2019 11:00:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 498FD2B3F9 for ; Tue, 5 Mar 2019 11:00:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BFE72B5A5; Tue, 5 Mar 2019 11:00:07 +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,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 C77942B442 for ; Tue, 5 Mar 2019 11:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727451AbfCELAG (ORCPT ); Tue, 5 Mar 2019 06:00:06 -0500 Received: from mail-eopbgr740051.outbound.protection.outlook.com ([40.107.74.51]:27710 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727450AbfCELAG (ORCPT ); Tue, 5 Mar 2019 06:00:06 -0500 Received: from BYAPR07CA0021.namprd07.prod.outlook.com (2603:10b6:a02:bc::34) by BYAPR07MB4376.namprd07.prod.outlook.com (2603:10b6:a02:c0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 11:00:03 +0000 Received: from BY2NAM05FT041.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by BYAPR07CA0021.outlook.office365.com (2603:10b6:a02:bc::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 11:00:03 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT041.mail.protection.outlook.com (10.152.100.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 11:00:03 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:58 -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 x25AxwGL013319; Tue, 5 Mar 2019 02:59:58 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxwB7013309; Tue, 5 Mar 2019 02:59:58 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 19/26] qedf: Don't queue anything if upload is in progress. Date: Tue, 5 Mar 2019 02:58:54 -0800 Message-ID: <20190305105901.13185-20-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962572033282312;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(396003)(136003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(305945005)(11346002)(446003)(53936002)(126002)(48376002)(2616005)(47776003)(36756003)(81156014)(336012)(81166006)(8676002)(50466002)(2906002)(356004)(6666004)(1076003)(476003)(5660300002)(6862004)(26826003)(87636003)(498600001)(85426001)(69596002)(86362001)(16586007)(80596001)(486006)(2351001)(4326008)(26005)(14444005)(8936002)(51416003)(50226002)(68736007)(105606002)(36906005)(42186006)(76176011)(106466001)(316002)(97736004)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR07MB4376;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9484c0c1-039c-4401-82d9-08d6a159b827 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BYAPR07MB4376; X-MS-TrafficTypeDiagnostic: BYAPR07MB4376: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4376;23:r+XLKMfDe46fDl7gZ+O8GEoUgpOgVLAIAC+9sJzdzAesbvnS3rCqZq8wM96lRznr2kQeW5CVVQGpQiIcuIatgeVg+HimmR69KEa4npCXNSsrxRVxoNqmObePCbkTeHlZTeK+5Wq0h64e2amsNJ46oJ0AMQnW07zEivIv415wS+E5Uzo5eGa3F+riO6GyWAJDsJ0briKPry0NtIW6mtG2xNF9uz9MUYVBSuimMGkBOr1T/d4oGHZwvyuIJ1CIMUpJFQRozxDC5AC2kQagHJeS8vfyxRNzhM0ZBDHxGPJ/DL5V73/EPVvUH5vjYNjVuyEuw1tZhV7HCLhabk28uMWALNJdYIvfMXEbX93tvfSbUWTuFYI1gytbrb9qaYqu6PFyDc29eXYCeUjXhEyHcpMe+3Rv2xwAzkAEKEb9N+7N42+Y3UbU5qpGEsT0B+YJIdhMls+NhLe7xArxilXwH5K/GNx90NPwsyvjSNYUenSBCaXmooZYwN2d/c4gDxFyFSZBILnUMwciYPN+X8ofAfBauIHlg3sMu0xRq6tX6sNaq2DqkL2JmY+SGcR4BdGAmWWh+Lrv0Qy/Q4CL3SgROM2i928/k8WHY7RKy4SUs5PkIcPpdUDK9zedtfySzTalAJJBOYM3ZOQEJYpQZs8QV6o9gOYY1v5WeT6XhXLKvr4He1G9hNEAmMiCpvsGiu6eofoySNJGdg/bg/OS/cth0sd0Ogi9aptAL7SmVYMp7g9cxrnFtfOM94a2XhvL9dQmBJs35qDKKkGE7ZAw7KnwXk23eNe/jTi9hitl9BcZiz+XQDSokSrKKDZRXCIhtlcRZA/YdpRi1QGwkgsChKCEoAJGC9J9odXEA+9YoT0BJyWFUWHj2acBsk00kNKoCXnU0Ni7DDHuT1HbOOmLtsCIwuHCTL1GSofOJmckBeoy9P4Ms0kY2CJlgUCHIFJOfPNkXMuUXqZPK69307vQa5lGJzjutPvrEzomtT7hfLv/HCIIa8L1lIWG/f1Mfby6uPb4pui7CeSyml6kntDusAuw5DoNgrDZo4VJm/VvBguOy/1e4VWrNC/2Hnk/7a/uvEmHJnU7e3W9ltcFnOa7AlNm4ld0m8eDBtCoaAtrEeBGePnF+NKPv23TC18RSPq2fGQC+bqkM7iX9uiNT6YXuRC1wZjwB9OHa2dFqTHfd4vZpm4losSzWZ6NBydd73z+KY4pA6vyI2RK73qyGQJ/29pX2bvr7U7WBOKyMPz6jG6Fr9+gJng0e51ifYDdDvfz0hJ21tI4 X-Microsoft-Antispam-Message-Info: 3GphQa/FDXFjCHxzaxVTzQQiyF+je5XX09WrIWSKTdagYUnwSvc+v7aOBidO3EAujdyXO9jiTItZ/I60kFy9yyYTFc/dShb2c2iMTjktn93wD7N6+I4DV3BFkiunf1NOJcwxF8Oa1z2y1+zYZySj9hdOCyRAd445vdtwS8xsgv5B97y5b1td4aGU3nm0EyT6Jxb/zeOu8jmAi56gRk/YxaCYVX1pzjXH//4J8SPY9+oN1CJxOZd/IZ68smvyU5u6PqU+fnaHu4sZ6fHJsuLXUKvsylIVDQGd84p9fQ+TlaFLrQ1U2YIkc/4oBP2jRmSQIFlATnRcTS1fAG7yUOfW6ibLCPCM5H5MQlOAwG04dq31HKL5cDhwi6cXbulch7kc17Y4dUNCg1GPITTxOeGrnfHRsBMk1LlbduNLPm3j8Ug= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 11:00:03.0750 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9484c0c1-039c-4401-82d9-08d6a159b827 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4376 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: Shyam Sundar - I/Os, aborts and tmf should not be queued if flush is in progress. Signed-off-by: Shyam Sundar Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 504ae02..30932a8 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -982,7 +982,8 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) /* rport and tgt are allocated together, so tgt should be non-NULL */ fcport = (struct qedf_rport *)&rp[1]; - if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { + if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags) || + test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { /* * Session is not offloaded yet. Let SCSI-ml retry * the command. @@ -2401,6 +2402,12 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) lport = qedf->lport; + if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { + QEDF_ERR(&qedf->dbg_ctx, "Connection is getting uploaded.\n"); + rc = SUCCESS; + goto tmf_err; + } + if (test_bit(QEDF_UNLOADING, &qedf->flags) || test_bit(QEDF_DBG_STOP_IO, &qedf->flags)) { rc = SUCCESS; From patchwork Tue Mar 5 10:58:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839299 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 8CF591390 for ; Tue, 5 Mar 2019 11:00:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BE802B5E4 for ; Tue, 5 Mar 2019 11:00:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79A3D2B8AE; Tue, 5 Mar 2019 11:00: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=-7.9 required=2.0 tests=BAYES_00,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 4B4B72B5E4 for ; Tue, 5 Mar 2019 11:00:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727450AbfCELAL (ORCPT ); Tue, 5 Mar 2019 06:00:11 -0500 Received: from mail-eopbgr780043.outbound.protection.outlook.com ([40.107.78.43]:13540 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727401AbfCELAK (ORCPT ); Tue, 5 Mar 2019 06:00:10 -0500 Received: from DM6PR07CA0071.namprd07.prod.outlook.com (2603:10b6:5:74::48) by BN7PR07MB4372.namprd07.prod.outlook.com (2603:10b6:406:b5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Tue, 5 Mar 2019 11:00:08 +0000 Received: from BY2NAM05FT020.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::208) by DM6PR07CA0071.outlook.office365.com (2603:10b6:5:74::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.16 via Frontend Transport; Tue, 5 Mar 2019 11:00:07 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT020.mail.protection.outlook.com (10.152.100.157) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 11:00:06 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 03:00:02 -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 x25B02xx013406; Tue, 5 Mar 2019 03:00:02 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25B02vV013322; Tue, 5 Mar 2019 03:00:02 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 20/26] qedf: Don't send ABTS for under run scenario. Date: Tue, 5 Mar 2019 02:58:55 -0800 Message-ID: <20190305105901.13185-21-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962572072724854;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(39860400002)(136003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(16586007)(5660300002)(86362001)(80596001)(126002)(48376002)(47776003)(305945005)(76176011)(6666004)(51416003)(356004)(36756003)(4326008)(42186006)(54906003)(6862004)(36906005)(2906002)(53936002)(69596002)(336012)(97736004)(316002)(26005)(8676002)(81166006)(2616005)(2351001)(476003)(105606002)(446003)(50226002)(8936002)(11346002)(1076003)(50466002)(68736007)(486006)(85426001)(106466001)(87636003)(498600001)(26826003)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4372;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6864f7cd-754a-4c3f-c3ea-08d6a159ba73 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4372; X-MS-TrafficTypeDiagnostic: BN7PR07MB4372: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4372;23:WMalkXqTKbhB+nyeEv7D3Di58KNrLjVcGuwZmtGXoVbiLoI823MBOmXu7boFPHgR6CTpcBZpQlQnNdeTA1C/HB+MIeOuGaz15W01XkXwk2sYmcUzE1fu5r4ShxgTm1XdsJaIIXVKmkDIYERUiWlGdZZ86wcHV2nZti00r0J7ZBANVRNrUuIp5hW2+WVwDREF7kCgTSuTAkVvGcHJostoBtYB2kcef6JFWIpiMpxBNd1QqoG0JV4ASmqCNR8VVKK9XnnHZsmsn+DzGlov+U+ao9MWJIOFvTwxqE2BcZjNMN09OP3QnAWm5D7VlTk3TSc+voW6qFIZTrDdec2LZoja1BgkvXbgvDchlYSKie1Ahw6jPicQnzdVI6gAtluvGqxDQi6p+eFtg4O1AuGc4UvF+gqEfOO0h4tsyXd7QVVshF8cXFxAROn2936PiO5dYDngt9xoQs11/timyxoKfMMBBdjvNhWquzEFpBK15eSSj24LV3DvoseznRJybVbwSs2KKoyztkDqPRvKtD1sLbiaRFSxsqgkoqzZJAT6ORjLKvluXEMhnxV5IfYhzyVUO1vHq6rLQCNJBfyxu3Q8IDFQWaslxk9Mk37ufccDuhkVou5J9gjWqwqAy29NVf1XGic3aZ/frMXWh8ZZnJH1syUNNFghUcZxKza0+ERh6dWtOZcwAe0VsxuhB0vAxD0dBEXY5g4rOECIHIxhPnFRS+qElNSxh7P5rSBK0u0b8+mfWqDPQN2qKhUR5Q+VCpt794qC1UN4vDTRfZ5iC0g1hWbyRYhC2q19r7jUblOiXutc21EM7REZJEj98x25r/2gmzkmVVfAgs73X+OLLbzKv8xNyUWqeJnLrmCaUTqmA0XbL64JzRYbOgEhhS87odErpjWP4jeorQp5XBYXG79XvhmlomC80QF4LHd2Ilfz+PaBmHmsPw1S2xM67nIWkPPLLi1LWkGH64tDY1TRaGKosS77eql06tjZSykdHfIapC/pgm2e/7cHfRMCfD1ryPBoH6bGMm7/XZFzXJoBbMA82/TfODLOZgifjmXMQ3cmp0SdAsjMNsmGmfq3WDAuiM5y54ojl/zaX41iySg0ypsTF/CLl30Cz83QdDDeWrekLrRop8LdTUlxPDFsgCidfHni2tNLpolWD4Q6g2PNB2j8I3ynJ13VMcdIN/e67WtIx1AILwv9Usw1pRuvX90IewjteG1HEpZ891j31kVH0shj/cQaRl39fEfFSidmm5h4xwv6D2Y= X-Microsoft-Antispam-Message-Info: wXt3eGnMtSxzqlBuNEimCXaRIiBzA0RnmJEdiJ9iBpzofqFZpP0BD5IPw33RSkMC+gLjgbZQ/I0zgZsoNRnHTCwN7aC40tQ5Xjr6wh8BFlH1s9QaVc3zwD5kbOqtw92QjTJ2ytTtd22gZbAEKs7kCldIWJvFyuKH3WCOH1TYmAs7ocybprX/+FXGu+4+js1rTqe4IUnZZZXC4EKFb2PH3dcWH+0BkKUtOO+PliGgeBzCiJfsc05RjumAZ/Apo2JbpYMGv0VPNrqmZ3Ocdb3K5yPMOkyw+fJwNleVp1aT7bjDAFUdhvmecfHfqStVjw+m6Po+TKd3G7nWMo5W8B3ziMjB6GWDhnFfInG776TsY3Y+bfLTsAJN2pVeL6d9znEH32SixKzEeLkXhHL5d1HYGzfKwyH5qlw3hPZ+qpCTVQo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 11:00:06.8941 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6864f7cd-754a-4c3f-c3ea-08d6a159ba73 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4372 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 - Command is already completed with underrun so no need to send ABTS. Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 30932a8..5e7745e 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -1100,7 +1100,7 @@ static void qedf_unmap_sg_list(struct qedf_ctx *qedf, struct qedf_ioreq *io_req) void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, struct qedf_ioreq *io_req) { - u16 xid, rval; + u16 xid; struct e4_fcoe_task_context *task_ctx; struct scsi_cmnd *sc_cmd; struct fcoe_cqe_rsp_info *fcp_rsp; @@ -1200,14 +1200,6 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, else sc_cmd->result = (DID_OK << 16) | io_req->cdb_status; - /* Abort the command since we did not get all the data */ - init_completion(&io_req->abts_done); - rval = qedf_initiate_abts(io_req, true); - if (rval) { - QEDF_ERR(&(qedf->dbg_ctx), "Failed to queue ABTS.\n"); - sc_cmd->result = (DID_ERROR << 16) | io_req->cdb_status; - } - /* * Set resid to the whole buffer length so we won't try to resue * any previously data. From patchwork Tue Mar 5 10:58:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839301 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 C04B11390 for ; Tue, 5 Mar 2019 11:00:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACAD42B5A5 for ; Tue, 5 Mar 2019 11:00:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB3592B66F; Tue, 5 Mar 2019 11:00:19 +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,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 4213D2B665 for ; Tue, 5 Mar 2019 11:00:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727565AbfCELAR (ORCPT ); Tue, 5 Mar 2019 06:00:17 -0500 Received: from mail-eopbgr730063.outbound.protection.outlook.com ([40.107.73.63]:47520 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727444AbfCELAR (ORCPT ); Tue, 5 Mar 2019 06:00:17 -0500 Received: from DM6PR07CA0057.namprd07.prod.outlook.com (2603:10b6:5:74::34) by DM6PR07MB4761.namprd07.prod.outlook.com (2603:10b6:5:a1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.16; Tue, 5 Mar 2019 11:00:15 +0000 Received: from BY2NAM05FT020.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::207) by DM6PR07CA0057.outlook.office365.com (2603:10b6:5:74::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.16 via Frontend Transport; Tue, 5 Mar 2019 11:00:15 +0000 Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT020.mail.protection.outlook.com (10.152.100.157) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 11:00:15 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 03:00:05 -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 x25B05id013416; Tue, 5 Mar 2019 03:00:05 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25B05mE013409; Tue, 5 Mar 2019 03:00:05 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 21/26] qedf: Add a flag to help debugging io_req which could not be cleaned. Date: Tue, 5 Mar 2019 02:58:56 -0800 Message-ID: <20190305105901.13185-22-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962572153899851;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(39860400002)(396003)(136003)(346002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(36756003)(26005)(5660300002)(76176011)(11346002)(446003)(54906003)(51416003)(53936002)(2616005)(106466001)(47776003)(50226002)(486006)(476003)(126002)(68736007)(50466002)(105606002)(6346003)(336012)(6666004)(48376002)(356004)(2351001)(8676002)(305945005)(81166006)(81156014)(80596001)(69596002)(8936002)(1076003)(16586007)(87636003)(6862004)(498600001)(4326008)(2906002)(316002)(42186006)(36906005)(86362001)(97736004)(26826003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4761;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: da1dedc9-55de-4721-d606-08d6a159bf57 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB4761; X-MS-TrafficTypeDiagnostic: DM6PR07MB4761: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4761;23:4PoWLCEfj6QTTl+U1pr9WrKCiQLmQyqcTgmmSHFCFt+ycc2fvN7YtEnaNcCKZ6+nD2o7T40j6qYJZ8zcwBal+DYBRAh5mW6s5F5KgDT+ivLTAQh5jXPXBjGRS2Lz42mxnanmZwTj6wVW2c2duFpD+jk/iwiT8ah47hbNd6y2txhrsUmgc1WKEQnk8yJD9lOByYXbxN82Ui1tOKUgmEHfpTzVGQ6cpVgvdtY8ouOttbYh7e3S1eeiZ/I3Cg0gVdCuBWVv0YlN/rFPp+duD4WJZvka74M1WwKMO6MdBJXzZqvEPSHNYD3FXaOnwIMYRZ6kq4lwaUpRYEG4JG69dod1K8dSuqsmQywKuXkeH5WUy59cCXeZ5DgrKnVNHJ9oD+lTwcGCoZl8Aoyrn5T3Si1uWOO/gxY4EcZ8F7WZwvR0Jk3bVyf7AK8l1uPH29XMK5Ri78sYMMMhSoesNsoT9qkF8R2Y1ofAhWWZm/f0zW5djQ8rkJY3QVvYJvjQ3bVE9SkJ+uYxZUn9MSxn78+L9TEbcaH2V2hwzsMcFJ9ZDLdhfb8Sx4RrE7ckOD9DrYLBTSzl+wDtvl6bX7zwRMkRuk4JL3RnCSdlxeMxnXNE/C59F79bYjmOg8jPOX3MvQU8cb1gPQmhBHu6QGUqTNW787WZ2P+2n1Pge6mKaZzfrIrIhd3k95+FsBnex0bxLMVrH0EprlS5UqDZcOV9Q3FKBG2hMqj8BHJ4vsyFgr9sFnUlhQvJWh0WDH23qxU+2pIdEp8GgtwgujG1HpXGHCGmg3gEnDa2nOv3Erd8FciTSm8PBXVnSmQR1+V0uDFuh1veBBDUfCG/UlIGm0t8f/zs6Zs4PiQ3h7ve0D+cDMtZEfiHxYy0k9ZxTR8KhpSZBKv9TMIezYv42MFP/CeJ1LW7dw2YrUm3yI1+00m4l97CzPa74CmZ1+iDFVLiYoz7LBO4o5Q7SPz7LFFtGeZGXkTTLJFhqRhVLxL0bV8g+DIUN8pOoG5k6yvAhNR0lXYsyuGgPAfEpzGFtUsuE1q7uux04OaRuI7bbvWRhI4/Jt6w4FbihpIGrDKlla1D1kDDKVjNArkTcCjXYW/FO7WLIOXsccsfZiOXywTMlSuFjdgubgvdDk1nNaqMiUOaWD5+fr9Rjho6R5yZgfHAImhPJGmTKWheNR6WwxsfrhKxtYTktdttSL16pX+zM9NQVIx9dDvlELZ8s+cjBkRI/KUrSsnLnUnDibuNegOZBojrQ8uE1G0KQR0= X-Microsoft-Antispam-Message-Info: noUr695YGtLrQWl5W0Xfcl7C34lnSR3IAVJtaB88mBH1ms/kJkPl/BW293xngauObmaJkblN4f0YKN2Ow69gqrjpy7GMN8++7Vxwaw82EXChlJSHLARgkqrFN5NIjr8d1Sq3RCy2+V75KTbLZlaR5ynTCMITgeyROiuFuPWtqRj9DuMdAEQt2HYJDrGITbnSSLM05NKPG0AxwxeQSmz6udwj1q9MKiTvjyb/JvUwX/qhfnG484pAON3p8vBzQHV7F7XE8/aJIA7HkSovbRXRgulGqErpgSc6hzuP+NaTUHHhT+PcRi2IlZ+0nomHStoSJVUxtsZ7nKBUyeNa6rT7GX6Jt4R3DtMSNZZre3aBQmR7YnQpdGyhYeTTRk8jTbXhjrisBESfhnpEnAxWWoaSzdHSStL2AOGRALLT9HyZ2Hc= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 11:00:15.1327 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da1dedc9-55de-4721-d606-08d6a159bf57 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4761 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: Shyam Sundar - The flag will help in to figure out if io_req is cleaned or not. Signed-off-by: Shyam Sundar Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 5e7745e..90d1645 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -351,6 +351,11 @@ struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport, u8 cmd_type) goto out_failed; } + if (test_bit(QEDF_CMD_DIRTY, &io_req->flags)) + QEDF_ERR(&qedf->dbg_ctx, + "io_req found to be dirty ox_id = 0x%x.\n", + io_req->xid); + /* Clear any flags now that we've reallocated the xid */ io_req->flags = 0; io_req->alloc = 1; @@ -1744,6 +1749,8 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) io_req->fcport == fcport) { refcount = kref_read(&io_req->refcount); + set_bit(QEDF_CMD_DIRTY, + &io_req->flags); QEDF_ERR(&qedf->dbg_ctx, "Outstanding io_req =%p xid=0x%x flags=0x%lx, sc_cmd=%p refcount=%d cmd_type=%d.\n", io_req, io_req->xid, From patchwork Tue Mar 5 10:58:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839303 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 5B72A1390 for ; Tue, 5 Mar 2019 11:00:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48E522B604 for ; Tue, 5 Mar 2019 11:00:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D2162B67F; Tue, 5 Mar 2019 11:00:26 +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,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 2EBA02B442 for ; Tue, 5 Mar 2019 11:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727484AbfCELAY (ORCPT ); Tue, 5 Mar 2019 06:00:24 -0500 Received: from mail-eopbgr760083.outbound.protection.outlook.com ([40.107.76.83]:27016 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727401AbfCELAY (ORCPT ); Tue, 5 Mar 2019 06:00:24 -0500 Received: from DM6PR07CA0041.namprd07.prod.outlook.com (2603:10b6:5:74::18) by BN7PR07MB4370.namprd07.prod.outlook.com (2603:10b6:406:b5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Tue, 5 Mar 2019 11:00:22 +0000 Received: from BY2NAM05FT020.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by DM6PR07CA0041.outlook.office365.com (2603:10b6:5:74::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.20 via Frontend Transport; Tue, 5 Mar 2019 11:00:22 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT020.mail.protection.outlook.com (10.152.100.157) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 11:00:22 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 03:00:08 -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 x25B08ai013420; Tue, 5 Mar 2019 03:00:08 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25B08jE013419; Tue, 5 Mar 2019 03:00:08 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 22/26] qedf: Check for tm_flags instead of cmd_type during cleanup. Date: Tue, 5 Mar 2019 02:58:57 -0800 Message-ID: <20190305105901.13185-23-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962572223045182;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(376002)(136003)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(106466001)(47776003)(53936002)(2351001)(48376002)(50466002)(36756003)(8936002)(8676002)(105606002)(50226002)(81166006)(81156014)(26826003)(80596001)(498600001)(87636003)(69596002)(316002)(16586007)(42186006)(85426001)(54906003)(36906005)(2906002)(5660300002)(305945005)(68736007)(4744005)(1076003)(14444005)(76176011)(6862004)(11346002)(2616005)(4326008)(446003)(486006)(336012)(26005)(476003)(51416003)(126002)(86362001)(97736004)(6666004)(356004);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4370;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be13a125-afde-490a-e8c9-08d6a159c376 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4370; X-MS-TrafficTypeDiagnostic: BN7PR07MB4370: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4370;23:BTohc3YBct8HryIZ/HJ7FJ4ut7j6MHK+kFnjxQlCgRlqZukOtyiPrLCQC02BuiBsnoZZCbCXbAWrvQIr08XQPRdcKpcshPyypDmenN+6KpquC+b1RBlRzKs8R3QlMesJoDJVJnF/Yt4p6MTZaK37t6QHRenyodf7gRgNGd+K7zsFadEPBFmfQE45jKOZK1S6bwC4/bo7zodUXs4NlfHRfs++08Fcdoeclw+C0VEqG5Jokk1HwR3xApw1vzjuESAH+zeUgiAnFEht9uWMbzAcMdodgxlWAqLaUVl17kDXwY7sZADrMJaDDrkL8VtnxiRlj16ox+bVL+V2rDRufDT6GqEFkLwZxA13N7yn3R2XStQqbEFRyOxX4WQD7D4RVevgxOCyCS9PPu1Go+XJ954GOkBOmVid1lIh0PUfzN+bGuNw7bm6YdMTPBJf4hcUwt3JTBwXx85LPX0M6Bgk8iC7tzjTuJYPRhWIh61Tubl6yqKlIrMFoYCeYDt4liGndwhJ7y4Wlco/ZIYu/wkLh+3lvu3sMkkGP+DzY9o97JA2AEZplvD6CktN6ptDCrCMTpZ6Gigzwp0rX7N7VAky8sI1UTnISjKFBGQWMCIAypEub6AOLoezSk/J4OGh6lc/7+dJOjF3aYf+BgHsYYVQO3yLNGTVko46a8a+zCWav2Gr488Loav5X0OVdwSSoiJ9f3/lY8guEogWCUyh6SwnH9L12Z4N2jA6MQYvNyvslzMuMGNGTDdX+Uzz441/7fCAI/MgqmOTIYMwpNlNB/1ozEV/FzYMclomkc6ZfzwNv4R6jHR83pD60O5AYtRwSHDTz2jXr3WrL7pRBT53ORhFowooPaTMhQTl3QXaMxWbOvS4HgsOHMms1tRUSmYZKu/Ta4kNJVVkcm6fmkExl2o1tOuyqc2Aasd+2ujE6EEo/AL/v/X6S8wzyc0ZFI3MKA7PIvsxENruynWhTUAgbv/RVi5ntcAGrbcTLeHquexg6YD7+rUEY37XNvfmqCV3NNmaN5gBpwAmDWNYPaZdWFCMIG3keB7MQzf7FmmDmD23ddetAaO1Jg/UskG2H7s74gHQvMmqrdB1ipyJvUw1s69JVWBAQnLW33hwFrLLSEawmmiEf9vQhTjy0XTmxGoxP0ILDnza+8zjrwN129//L5LQZcqWOZhuBOrFNSIGzu9HLUsn+I5PVNyei93RrB5eHtCqvbQH1T3dz1h2GJD9St2/wqxTLFBP/uEdo6jkKbswiHU5V39cKh728srhKgi0D3WvNxgvA0qRXilSveDuyoH4W49ZBg== X-Microsoft-Antispam-Message-Info: FSGRhE+qkId4/7DdP4/MnQ/SeAZAcurpymPLXLVue/VnNvX69Gu/5bv6Hz6y6TaLA5weMvPGRcmqc47HgpqxRd0IS9Ogd9MRNmCZdz2TmmRONsBhQHOqyNaoGzY9UheIEBQN74zZZ4SqRuUmGbPIClqmmAliLGBRXCQLOP1OIFiElYpOjXlukbJmFdNDfIR+dPJoSi+6tPCVD30jDW1gKiQ0wQ6UTuf/qEov2M80UIgSfJxOtUu137+JQ2JFQRJgZ1rhffZNhfvBB5r0TOtDrFrbT97wxOjzoGLUYw8zMJvKZ1nxCiAVuzgOyINJWGcYhucUaAcBdaSRQ+9n2cyFLaLU7pVFY9YbP6+W9w5qnqB5czFHb20YUbuNdi9XMg56TaTImxbrAv99eVQOmjuFqW1foKqz27ghkCJD0yNEiI4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 11:00:22.0493 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be13a125-afde-490a-e8c9-08d6a159c376 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4370 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 cmd_type is over written to QEDF_CLEANUP during cleanup, so check for tm_flags. Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 90d1645..d8d55bc 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -2174,7 +2174,8 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, /* If it TASK MGMT handle it, reference will be decreased * in qedf_execute_tmf */ - if (io_req->cmd_type == QEDF_TASK_MGMT_CMD) { + if (io_req->tm_flags == FCP_TMF_LUN_RESET || + io_req->tm_flags == FCP_TMF_TGT_RESET) { clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); io_req->sc_cmd = NULL; complete(&io_req->tm_done); From patchwork Tue Mar 5 10:58:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839305 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 922551390 for ; Tue, 5 Mar 2019 11:00:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E30E2B442 for ; Tue, 5 Mar 2019 11:00:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 725392BB30; Tue, 5 Mar 2019 11:00:32 +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,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 5D1482A9B5 for ; Tue, 5 Mar 2019 11:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727492AbfCELAa (ORCPT ); Tue, 5 Mar 2019 06:00:30 -0500 Received: from mail-eopbgr740052.outbound.protection.outlook.com ([40.107.74.52]:5185 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727401AbfCELA3 (ORCPT ); Tue, 5 Mar 2019 06:00:29 -0500 Received: from DM6PR07CA0071.namprd07.prod.outlook.com (20.177.221.48) by BYAPR07MB4376.namprd07.prod.outlook.com (52.135.224.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 11:00:25 +0000 Received: from BY2NAM05FT020.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::208) by DM6PR07CA0071.outlook.office365.com (2603:10b6:5:74::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.16 via Frontend Transport; Tue, 5 Mar 2019 11:00:25 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT020.mail.protection.outlook.com (10.152.100.157) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 11:00:25 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 03:00:11 -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 x25B0B0c013424; Tue, 5 Mar 2019 03:00:11 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25B0Bt2013423; Tue, 5 Mar 2019 03:00:11 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 23/26] qedf: Cleanup rrq_work after QEDF_CMD_OUTSTANDING is cleared. Date: Tue, 5 Mar 2019 02:58:58 -0800 Message-ID: <20190305105901.13185-24-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962572256742070;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(396003)(136003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(305945005)(11346002)(446003)(53936002)(126002)(48376002)(2616005)(47776003)(36756003)(81156014)(336012)(81166006)(8676002)(50466002)(2906002)(356004)(6666004)(1076003)(476003)(5660300002)(6862004)(26826003)(87636003)(498600001)(85426001)(69596002)(86362001)(16586007)(80596001)(486006)(2351001)(4326008)(26005)(14444005)(8936002)(51416003)(50226002)(68736007)(105606002)(36906005)(42186006)(76176011)(106466001)(316002)(97736004)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR07MB4376;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c3acca2-97be-4fff-3cc3-08d6a159c579 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BYAPR07MB4376; X-MS-TrafficTypeDiagnostic: BYAPR07MB4376: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4376;23:xk3alJJUhX44g4oNi6rE/NY9dlm9++KlwiLVf1aPW5/Jdn1X9Mi3OWSobMbEezIuOk9Jk2xZwNgjW3oykqscmFWXNvcA/aRKucu8aQL3bRN7/A4JOb9bHJG8YmAe7ILaCLJwT59ls+rk28SDepNgcJVU+1FVaCK7wXArghHJD1PanxEDsRJfiUyfsRbc19IJPzZTnV04nGmkSkPBGmOqZp/c/QLTtn1dRSxZc9EBqzZnruB4EGrmVrpIexvp0lor5dVeOVSpySdEzwxPD91fYAtqFpIgLxk4P4u+Qb3IqBW9xhMMAtcFLkXayqF3g+fjC7/P5UOCTDtITBWtrignJl2jACanOQ+xo5hiBcH41b0YUhIg24fXNUAMjjQTg/VxaJmtiVb6sqsJx1FW+BvyuhKvALosr1dp2rmq4K/sa1pcyRIsEp08gBUO4jXeMSqIlnC1KLDMuCn6nOtMluDRtBDISVR+XVeB4qOH9DC0C3ogiFro3r9YgXF2scQTAxW0XM5w8H5mUScQyDTb2dGjeDWTGSKKLq56qv4M+ngBAVrUq3AyZyA0ZEoXI02pTT/lUlIA1zDiulf9S7MpuEtPjb8YX097keoWStGLMu9mNdD+2qNBYNg5f13bD1lzobB4P16e29zIyCNNOVT9Qs38VESyT+WQcQ02c0oZkOjqSNw+zSFqIPBWtYw37vvPREPksHXugBDdOimggzvKu6OM32EGXCVkxNXSX82VNQw+bCUqHK9/81my5W16JKGT9z2IS2cwIzuCyvYx5qyd/Q1lDvqg7u03VfmdzioQxv4wWXxrcxHnD6MolJKkPkDp6W47jVlNrca23sQjotgLaGBb79Y69uF64ZGy2T/aQnKUpWmg6PDoqrePmMbeHE6HfeGSNOrXH2g/WnBaJGwFWBG52tswbJxAcxGZeAM2SCjPCI5JgvKZ4Wrq4c1nuDjjsLwiyF7eXyqrUFiEO8fEn2B0wAGWAGrOKQcxF3M3iVYOmB1d9zFuf597+mHIlNkI7e1RVXTLgF/51qwkilJDIvj6Ay6MjVX2z2vRZzVajGmZwSGpzP6AWJ5kbntffbgRtMANOaw0xjCZdhn3BPocVmmjmXD0ZyUyhNCEIpC0om2haO0U6gpSRcBKVPcq0dW1E6OtvLRcDVAaGx79Z1uCtgO8mpAzOy3YkalDWUZolOHJWp0KYe2Y2FGA1ru563euIV6TinAF5f2cRcpxpR0W77Nap4Z4KaTXpRG+ONvBVMrYRadjxNr+FcwIMP9DUy13FDvj X-Microsoft-Antispam-Message-Info: jueSy9WXw1Pd4APnlv1BmZudSfKl3mHLxBaM+Yf5tAd5tIzILQ9ne11/acMHROdixfKDz2/3JUzuwLUEWGqsTUfhOqpU8xADkaeape3UH+mkikneKzS2i2drsap04f2sfDdtHS95QgbpVrUFv3XRiNbHoIn8AJlchxpnpEukTtIGBr7g/2chD523SuI2KqNkFffMZBYqZDtsGlg3XZCJsolp2oV4N4lLmy+qMhohuRCh2OKMj9YhM+139LAIbGabk9ebBI/NPtPeS/zjDzzG018G80FaPK1ySsHlTiN80Lnv9OCfzBH9738udbhB+b2f/j1h5m2e9wUcvlVZPcCriBO2pY0qEQ0vKfYjop3Rf6FCR676qoK1lqJKBQ9BlCdq0CzpHi8D1XHEvKQjuKzixFP30aZdgL/pw6sTw5+P6So= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 11:00:25.4210 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c3acca2-97be-4fff-3cc3-08d6a159c579 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4376 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: Shyam Sundar Here is the relevant logs for the problem we are solving: qedf_flush_active_ios:1707]:3: Flush active i/o's num=0x17 fcport=0xffff948168fbcc80 port_id=0x550200 scsi_id=0. qedf_flush_active_ios:1708]:3: Locking flush mutex. qedf_flush_active_ios:1758]:3: Not outstanding, xid=0xaaf, cmd_type=3 refcount=1. qedf_flush_active_ios:1896]:3: Flushed 0x16 I/Os, active=0x1. qedf_flush_active_ios:1901]:3: Flushed 0x16 I/Os, active=0x1 cnt=60. qedf_send_rrq:295]:3: Sending RRQ orig io = ffffb48b8f7d7158, orig_xid = 0xaaf qedf_initiate_els:37]:3: Sending ELS qedf_initiate_els:68]:3: initiate_els els_req = 0xffffb48b8f6d3098 cb_arg = ffff948fd5e4de80 xid = 4c6 qedf_init_mp_req:2172]:3: Entered. qedf_init_mp_task:727]:3: Initializing MP task for cmd_type=4 qedf_initiate_els:134]:3: Ringing doorbell for ELS req qedf_flush_active_ios:1901]:3: Flushed 0x16 I/Os, active=0x2 cnt=20. qedf_cmd_timeout:96]:3: ELS timeout, xid=0x4c6. qedf_rrq_compl:186]:3: Entered. qedf_rrq_compl:204]:3: rrq_compl: orig io = ffffb48b8f7d7158, orig xid = 0xaaf, rrq_xid = 0x4c6, refcount=1 qedf_flush_active_ios:1935]:3: Unlocking flush mutex. qedf_upload_connection:1579]:3: Uploading connection port_id=550200. We found an ABTS command for which CMD_OUTSTANDING was cleared (line 3). For this command, delayed send_rrq was queued, but would take 10 secs to execute. Adding capability to detect that (based on io_req->state that is being introduced), and attempt to cancel rrq_work. If we succeed, we drop the reference and free the io_req. If we cannot, then the els will get sent out and we will wait for 10 secs for it to complete. Signed-off-by: Shyam Sundar Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf.h | 17 +++++++++++++++ drivers/scsi/qedf/qedf_io.c | 53 +++++++++++++++++++++++++++++++-------------- 2 files changed, 54 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 1e0d142..f647817 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -119,9 +119,26 @@ struct qedf_ioreq { u8 io_req_flags; uint8_t tm_flags; struct qedf_rport *fcport; +#define QEDF_CMD_ST_INACTIVE 0 +#define QEDFC_CMD_ST_IO_ACTIVE 1 +#define QEDFC_CMD_ST_ABORT_ACTIVE 2 +#define QEDFC_CMD_ST_ABORT_ACTIVE_EH 3 +#define QEDFC_CMD_ST_CLEANUP_ACTIVE 4 +#define QEDFC_CMD_ST_CLEANUP_ACTIVE_EH 5 +#define QEDFC_CMD_ST_RRQ_ACTIVE 6 +#define QEDFC_CMD_ST_RRQ_WAIT 7 +#define QEDFC_CMD_ST_OXID_RETIRE_WAIT 8 +#define QEDFC_CMD_ST_TMF_ACTIVE 9 +#define QEDFC_CMD_ST_DRAIN_ACTIVE 10 +#define QEDFC_CMD_ST_CLEANED 11 +#define QEDFC_CMD_ST_ELS_ACTIVE 12 + atomic_t state; unsigned long flags; enum qedf_ioreq_event event; size_t data_xfer_len; + /* ID: 001: Alloc cmd (qedf_alloc_cmd) */ + /* ID: 002: Initiate ABTS (qedf_initiate_abts) */ + /* ID: 003: For RRQ (qedf_process_abts_compl) */ struct kref refcount; struct qedf_cmd_mgr *cmd_mgr; struct io_bdt *bd_tbl; diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index d8d55bc..d98f5f4 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -170,6 +170,7 @@ static void qedf_handle_rrq(struct work_struct *work) struct qedf_ioreq *io_req = container_of(work, struct qedf_ioreq, rrq_work.work); + atomic_set(&io_req->state, QEDFC_CMD_ST_RRQ_ACTIVE); qedf_send_rrq(io_req); } @@ -374,7 +375,8 @@ struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport, u8 cmd_type) io_req->lun = -1; /* Hold the io_req against deletion */ - kref_init(&io_req->refcount); + kref_init(&io_req->refcount); /* ID: 001 */ + atomic_set(&io_req->state, QEDFC_CMD_ST_IO_ACTIVE); /* Bind io_bdt for this io_req */ /* Have a static link between io_req and io_bdt_pool */ @@ -447,6 +449,7 @@ void qedf_release_cmd(struct kref *ref) atomic_inc(&cmd_mgr->free_list_cnt); atomic_dec(&fcport->num_active_ios); + atomic_set(&io_req->state, QEDF_CMD_ST_INACTIVE); if (atomic_read(&fcport->num_active_ios) < 0) QEDF_WARN(&(fcport->qedf->dbg_ctx), "active_ios < 0.\n"); @@ -1627,6 +1630,21 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Not outstanding, xid=0x%x, cmd_type=%d refcount=%d.\n", io_req->xid, io_req->cmd_type, refcount); + /* If RRQ work has been queue, try to cancel it and + * free the io_req + */ + if (atomic_read(&io_req->state) == + QEDFC_CMD_ST_RRQ_WAIT) { + if (cancel_delayed_work_sync + (&io_req->rrq_work)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Putting reference for pending RRQ work xid=0x%x.\n", + io_req->xid); + /* ID: 003 */ + kref_put(&io_req->refcount, + qedf_release_cmd); + } + } continue; } @@ -1650,6 +1668,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) } if (io_req->cmd_type == QEDF_ABTS) { + /* ID: 004 */ rc = kref_get_unless_zero(&io_req->refcount); if (!rc) { QEDF_ERR(&(qedf->dbg_ctx), @@ -1665,24 +1684,25 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) if (cancel_delayed_work_sync(&io_req->rrq_work)) { QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, - "Putting reference for pending RRQ work xid=0x%x.\n", + "Putting ref for cancelled RRQ work xid=0x%x.\n", io_req->xid); kref_put(&io_req->refcount, qedf_release_cmd); } - /* Cancel any timeout work */ - cancel_delayed_work_sync(&io_req->timeout_work); - - if (!test_bit(QEDF_CMD_IN_ABORT, &io_req->flags)) - goto free_cmd; - - qedf_initiate_cleanup(io_req, true); + if (cancel_delayed_work_sync(&io_req->timeout_work)) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, + "Putting ref for cancelled tmo work xid=0x%x.\n", + io_req->xid); + qedf_initiate_cleanup(io_req, true); + /* Notify eh_abort handler that ABTS is + * complete + */ + complete(&io_req->abts_done); + clear_bit(QEDF_CMD_IN_ABORT, &io_req->flags); + /* ID: 002 */ + kref_put(&io_req->refcount, qedf_release_cmd); + } flush_cnt++; - - /* Notify eh_abort handler that ABTS is complete */ - kref_put(&io_req->refcount, qedf_release_cmd); - complete(&io_req->abts_done); - goto free_cmd; } @@ -1722,7 +1742,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun) qedf_initiate_cleanup(io_req, true); free_cmd: - kref_put(&io_req->refcount, qedf_release_cmd); + kref_put(&io_req->refcount, qedf_release_cmd); /* ID: 004 */ } wait_cnt = 60; @@ -1929,7 +1949,7 @@ void qedf_process_abts_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "ABTS response - ACC Send RRQ after R_A_TOV\n"); io_req->event = QEDF_IOREQ_EV_ABORT_SUCCESS; - rc = kref_get_unless_zero(&io_req->refcount); + rc = kref_get_unless_zero(&io_req->refcount); /* ID: 003 */ if (!rc) { QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM, "kref is already zero so ABTS was already completed or flushed xid=0x%x.\n", @@ -1942,6 +1962,7 @@ void qedf_process_abts_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, */ queue_delayed_work(qedf->dpc_wq, &io_req->rrq_work, msecs_to_jiffies(qedf->lport->r_a_tov)); + atomic_set(&io_req->state, QEDFC_CMD_ST_RRQ_WAIT); break; /* For error cases let the cleanup return the command */ case FC_RCTL_BA_RJT: From patchwork Tue Mar 5 10:58:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839311 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 1A9D717E4 for ; Tue, 5 Mar 2019 11:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 069A62BCAB for ; Tue, 5 Mar 2019 11:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 051762BDF0; Tue, 5 Mar 2019 11:01:14 +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,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 8B01D2BCAB for ; Tue, 5 Mar 2019 11:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727269AbfCELBN (ORCPT ); Tue, 5 Mar 2019 06:01:13 -0500 Received: from mail-eopbgr810089.outbound.protection.outlook.com ([40.107.81.89]:12428 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727477AbfCELBN (ORCPT ); Tue, 5 Mar 2019 06:01:13 -0500 Received: from DM6PR07CA0020.namprd07.prod.outlook.com (2603:10b6:5:94::33) by BN7PR07MB4371.namprd07.prod.outlook.com (2603:10b6:406:b5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Tue, 5 Mar 2019 11:00:31 +0000 Received: from BY2NAM05FT011.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::205) by DM6PR07CA0020.outlook.office365.com (2603:10b6:5:94::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.15 via Frontend Transport; Tue, 5 Mar 2019 11:00:31 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT011.mail.protection.outlook.com (10.152.100.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 11:00:30 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 03:00:14 -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 x25B0ETo013428; Tue, 5 Mar 2019 03:00:14 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25B0EHX013427; Tue, 5 Mar 2019 03:00:14 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 24/26] qedf: Correctly handle refcounting of rdata. Date: Tue, 5 Mar 2019 02:58:59 -0800 Message-ID: <20190305105901.13185-25-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962572311006634;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(346002)(376002)(39860400002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(42186006)(305945005)(97736004)(86362001)(6862004)(76176011)(36756003)(2906002)(26005)(87636003)(8936002)(498600001)(6666004)(51416003)(356004)(4326008)(26826003)(446003)(486006)(8676002)(2616005)(81156014)(126002)(2351001)(50226002)(336012)(68736007)(105606002)(54906003)(80596001)(5660300002)(85426001)(81166006)(106466001)(11346002)(1076003)(476003)(69596002)(36906005)(47776003)(316002)(48376002)(50466002)(16586007)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4371;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 01a3d18f-fe83-4f53-c51e-08d6a159c8a2 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4371; X-MS-TrafficTypeDiagnostic: BN7PR07MB4371: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4371;23:KtEVHk4DquRlkwa6XZusJfTSDenX11FRVOLNmJ0OJfj0eXCJcHLiUI5b0yrdnPTDlIP6uvbSZm0k0YzrMs8HsLtAo9E7lZmVokiOLo6bBBfZTRMYf0UBbg+VX5cHAh4WPNPdFF6bR41CG2zNnYfNaDOSRbasjziyYLmaQKsVyqD0d+z7ZBvggLQ/AIvc1meWJUwQGBarBcTJApqVfZc79WEEZara1PSqkh0vrAqPiQ7IXhC2SskePTa7SA7uhaEvF+YbUUqu7it85RDl6WoCL3gc/AMjTgbEE4GyUU1sq6wBVBgaCO3HPJ+GUdPinuFEJI0Tbs7TDdpMA+Gaa1zdXZu8EN8VhXs2sjE10rQUF6u0/4uD6YWfkvFGVovQ6v3c65uDSukgzM5hYYfUk0LHUuLVpjX/qRXkeA14RJG8oRLgftOLWH7dAvwZH/4TVgHW6diGdE+TFgZBuK0NSUh1rZJl5hAEPCCQViN7Hj6jVIFPVgyGRiHHDKfqQ+PAJuPUx/TvyDAiZLDchwwZrD0DiAp4zqtIGSf7XR0f6HaY3DXt85qV154UQ9LJlOaij+dI3cdzbkmn/q02bdQYjLQxK1lWbrHwzOMzH+On3zMvoM4aKB9U0MBn47tOb5K6L3asF0W9+KrlVvUC3sazvIZUZm7R0HzVVhXDSp+7Aj8ABnPAr046C/lHHNZQlW4s9Xdsdnov9lbyfAExi1gwfDEtX2DIwgr0e89zWvz39Pme+rGv35Dc6q6ebLPivuR12HoLBOYoAPDlc5UADk1kaXDKlVq/bRX+lYnLhjsnGYNf/9gHGWHy9+3Ut6tZ8MXJla+tQcv1cGx+vjo4OD24/O06l8d3O5QjzoMN0/YTz1m8DbQ+ofOnnZICGFNa8lnAmkeoWiXanEW3HLbII7E4/bMV+8mgIeG9B52LqehzBFp0Fy14PG/nl4NbtBjC/bcBWGUC7oB8VTFcEiOzQ/lt69W52o3w0drbj8n2Yaq8BhIxAcwerrBu3xgNCh7Sygk/Ml3aw72Ikt+G24cCXBt8GY3jUDjs5dBSj0KnvVVF0YXj9ox/igqiIN7sDS8WBiiqTWHb4orOxzlqpdCPY+sxDKYsbKcLN6Z8LnUJadgHtA5SDvs5ZNiNlABlh4JooQgHusCqrftz10vRJjzovwphCUnqPrZd5G3aPwMEwQOvEx/zIn9Qfj52vD41bo3qTUfurzSUV3c5ubJ2nVrTIvkXE8YKvOPjCghsCrB2IN2kSQnNb6U= X-Microsoft-Antispam-Message-Info: SNlKPEYrpVL9ooLxaldZjkGbMeJ5ZeUTsXB+7FTHVkmACZNWTZ0+jkCQpz8iNcicroXECXBPmSpHPOL6Qn2MpXql8VN5zthpWsY5fjmYENY480NlymdGXkz9Y7LKnc5qq7Ad+U2b31mK2RAKxBilWtsJFS02so0m5XTLBdsHzJ+tlmcZnM3VYuU4CpmvsOf9m3PJnjtxUf/qWfUkeptl6a6WPQWBCnGjXU3V54tRIS/bAD2vzoIM3kbRzsjp10j6x3W7OKTkzF5YkP0d5NR50p9QbLAzVDZbQE3csY/BVEAoIG1/UqsaFNi4enoIodTvaJXPNqBtxsNp1hna2jYbHuTq+GyTy87F3I3qW6bIU6iJY4PDQy63rLL7P/LYBgkXBzc0kndNdb2+tTPVys4thKO/4iRXkc8D9ubCUYNs9jE= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 11:00:30.7193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 01a3d18f-fe83-4f53-c51e-08d6a159c8a2 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4371 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 - handle refcount of rdata during error conditions. Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index d98f5f4..b9877f1 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -2241,7 +2241,6 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, unsigned long flags; struct fcoe_wqe *sqe; u16 sqe_idx; - struct fc_rport_priv *rdata = fcport->rdata; if (!sc_cmd) { QEDF_ERR(&(qedf->dbg_ctx), "invalid arg\n"); @@ -2252,22 +2251,14 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { QEDF_ERR(&(qedf->dbg_ctx), "fcport not offloaded\n"); rc = FAILED; - return FAILED; - } - - if (!rdata || !kref_get_unless_zero(&rdata->kref)) { - QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM, "stale rport\n"); - return FAILED; + goto no_flush; } - QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM, - "portid = 0x%x tm_flags = %d\n", - rdata->ids.port_id, tm_flags); io_req = qedf_alloc_cmd(fcport, QEDF_TASK_MGMT_CMD); if (!io_req) { QEDF_ERR(&(qedf->dbg_ctx), "Failed TMF"); rc = -EAGAIN; - goto reset_tmf_err; + goto no_flush; } if (tm_flags == FCP_TMF_LUN_RESET) @@ -2356,8 +2347,6 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd, QEDF_ERR(&(qedf->dbg_ctx), "task mgmt command success...\n"); rc = SUCCESS; } -reset_tmf_err: - kref_put(&rdata->kref, fc_rport_destroy); return rc; } @@ -2405,7 +2394,7 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) rc = fc_block_scsi_eh(sc_cmd); if (rc) - return rc; + goto tmf_err; if (!fcport) { QEDF_ERR(NULL, "device_reset: rport is NULL\n"); @@ -2442,7 +2431,13 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) } if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { - QEDF_ERR(&qedf->dbg_ctx, "fcport is uploading.\n"); + if (!fcport->rdata) + QEDF_ERR(&qedf->dbg_ctx, "fcport %p is uploading.\n", + fcport); + else + QEDF_ERR(&qedf->dbg_ctx, + "fcport %p port_id=%06x is uploading.\n", + fcport, fcport->rdata->ids.port_id); rc = FAILED; goto tmf_err; } @@ -2450,6 +2445,7 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) rc = qedf_execute_tmf(fcport, sc_cmd, tm_flags); tmf_err: + kref_put(&rdata->kref, fc_rport_destroy); return rc; } From patchwork Tue Mar 5 10:59:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839307 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 8909317E4 for ; Tue, 5 Mar 2019 11:00:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77E872BADB for ; Tue, 5 Mar 2019 11:00:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C1482BC1D; Tue, 5 Mar 2019 11:00:37 +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,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 146B52BC06 for ; Tue, 5 Mar 2019 11:00:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727574AbfCELAg (ORCPT ); Tue, 5 Mar 2019 06:00:36 -0500 Received: from mail-eopbgr730075.outbound.protection.outlook.com ([40.107.73.75]:33184 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727401AbfCELAg (ORCPT ); Tue, 5 Mar 2019 06:00:36 -0500 Received: from DM6PR07CA0021.namprd07.prod.outlook.com (20.176.74.34) by DM6PR07MB4377.namprd07.prod.outlook.com (20.176.95.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 11:00:34 +0000 Received: from BY2NAM05FT011.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by DM6PR07CA0021.outlook.office365.com (2603:10b6:5:94::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.15 via Frontend Transport; Tue, 5 Mar 2019 11:00:34 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT011.mail.protection.outlook.com (10.152.100.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 11:00:33 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 03:00:18 -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 x25B0Hc0013432; Tue, 5 Mar 2019 03:00:17 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25B0HL4013431; Tue, 5 Mar 2019 03:00:17 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 25/26] qedf: Fix lport may be used uninitialezed warning. Date: Tue, 5 Mar 2019 02:59:00 -0800 Message-ID: <20190305105901.13185-26-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962572342311714;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(376002)(346002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(2906002)(81166006)(356004)(8936002)(80596001)(8676002)(6666004)(81156014)(68736007)(26005)(97736004)(48376002)(4326008)(6862004)(50466002)(50226002)(53936002)(486006)(1076003)(2616005)(69596002)(85426001)(126002)(476003)(105606002)(498600001)(106466001)(26826003)(36906005)(446003)(54906003)(47776003)(87636003)(16586007)(2351001)(76176011)(42186006)(86362001)(336012)(11346002)(5660300002)(51416003)(36756003)(14444005)(316002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4377;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0bb1de5-341f-4559-ecf2-08d6a159ca92 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB4377; X-MS-TrafficTypeDiagnostic: DM6PR07MB4377: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4377;23:l8+pSSek4M9MCM85oeHQXAqgOFNqqOZgp1/ueOPowysWYJ1xJFvvmHkfnDUOIaE8JkmtsuDWpnRm/tw40lwFe8NBqKWjT+v0K1oc2c2VKnZm2hlDZfW3q+nAMBm+wCbtZ0xpG/PEp6PdBAv5F4YUztrg3BJWg4Kvx460Pe0piHdBI6nUfJAqNLPSgIcEH7qzl+o5Hf7f7XjAj5EabOVtqHrEnUgY0CpxYnoPbBE4kJSyKib1xvdaiYDqAz6OOAyf3MJoYUQponbaTpg3w6f9lkbbdtK7dQ5AnZ5NLTO489V5PdjvNffQHT/LhDLF8lfeAoA0epKJCMiH3KfruvF59vYt9Mrgo9/Bu72HauIkQb4ao8ZU3Jyb1aiqsSP0BWHffPZjBEhRt39cPHvzaLbJWQCIP8kpIKMhNIMVcOgK6FUVeArDMkXKKiNLpRfS2agA49h5yqMdVv5cxbkIwE1HucuCWfMdpzJbvytU06nzncFXvQBP9ZOJOpf8vdCfdweqHVt+PkyridfFCHSWc2wkmIiRp3UYqo7DI/jtzOWVYAhemf/Vwv9FPxzMsVGQOmq7eKaLcNBK4bDEx+jfNZboZDPDKmhiB24LX8y3ynQoaT0xte2e3A0ZGZFRQJADe3aG2a+nLQrfvkL/4I/zoTjAIvz1a1pK4OmjgjyclS7ELWlc3Ae4DfoChYhtbfpR/egkvAb6hHDy9oNHhVXjWSP+VLEu/fkIRz8tJJtrdu3w2DdE9G3Zc3+mPPfQPbBIzsC0RsFig10fMLcM4bX/jsDi1iCVazumbyOXMVSRCmJRhvoE7PT+nujvhzqN1zWQVYfjmJYiUt1MHbotzbhfip4Ae/IoVIv1EJZS3TrBmBosD5+MXo+qiVN9tMl2r5TIdI3M6ivasLTDI1ADvQMLz6okZFxcYgfDv47+aIFzrGezH9HFi+cv9UHGxNwkoXgxAp2dbTsQOTwo4huIP4e6zyIRB+WKCXHlZpuf5h9ggaRU58TGFa5NpnGUXHFP5wCXIDEvSPUIru/PQsHIuTnus6st4BXbfz48U16S8ooQ7p2HzCsxkKTbxRV6a7qwGGAYLI8nJMY++V2CpSU8hmHYnYdsmde9UsV9+Xt1LQdg5/SDnMYYps72WzRbVDe7WboHEkFYzBJJgPkXrlPLhFXK+wDqM4cdmjp+CMJiVABkcpD2tH9HHUeb7gh3U6czxv5yWrkj1sbGsqFuKXz2md0d1fqFxDqRKI3krfgail83EhHLJdar+91ZdSNZ69E8fvtS8xB6 X-Microsoft-Antispam-Message-Info: mUB6RP/CXPtzmaa18WwaLiHaHlbNt2fKLVQmLvDi9RfRc/pnAtFyUxr8l1jJWq26LYsg1thjnmFjQViadjGM/w/GkxCq9oiOPcBdITiq/XTPwzZkZ+5KyjPe2lvoe/i3MKdTy3a4qnG5D/Gl4PcwXEHgrKj8562IUXj1bMlhOrCLjWz6i2DDjnOZsMTzzDV1O6LTp/M40mOQClMsIjY2iRRfEDUEiF7Pni7oD9VWQh/Km8p6Dr7O6QUjNEDXtKSUgg3zpAwKsnHE9oGuiSx0KfZ2wVq1jcJg3rbfpnwJDVf5brzIPBVq75wTkpatxxZaNQMOvQB8Wan553r1xZwgKXLN33zfLHm+wxxAoiNE6uId7gn1yC8S/eRpxnidoe4U15IX8B8EFIYCId6yxJZ5kea8Aa2btb/hyerQe9f4ozQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 11:00:33.9759 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f0bb1de5-341f-4559-ecf2-08d6a159ca92 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4377 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 - lport was getting used without initialization, initialize it to fix a warning. Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index b9877f1..ed149d5 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -2356,7 +2356,7 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) struct fc_rport_libfc_priv *rp = rport->dd_data; struct qedf_rport *fcport = (struct qedf_rport *)&rp[1]; struct qedf_ctx *qedf; - struct fc_lport *lport; + struct fc_lport *lport = shost_priv(sc_cmd->device->host); int rc = SUCCESS; int rval; struct qedf_ioreq *io_req = NULL; @@ -2410,8 +2410,6 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) goto tmf_err; } - lport = qedf->lport; - if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { QEDF_ERR(&qedf->dbg_ctx, "Connection is getting uploaded.\n"); rc = SUCCESS; From patchwork Tue Mar 5 10:59:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839309 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 65B811390 for ; Tue, 5 Mar 2019 11:00:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 552982BB6D for ; Tue, 5 Mar 2019 11:00:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 499AB2BC43; Tue, 5 Mar 2019 11:00:42 +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,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 E5C212BBC8 for ; Tue, 5 Mar 2019 11:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727497AbfCELAl (ORCPT ); Tue, 5 Mar 2019 06:00:41 -0500 Received: from mail-eopbgr690054.outbound.protection.outlook.com ([40.107.69.54]:51936 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727401AbfCELAl (ORCPT ); Tue, 5 Mar 2019 06:00:41 -0500 Received: from DM6PR07CA0034.namprd07.prod.outlook.com (2603:10b6:5:94::47) by SN6PR07MB4383.namprd07.prod.outlook.com (2603:10b6:805:58::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.16; Tue, 5 Mar 2019 11:00:39 +0000 Received: from BY2NAM05FT011.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by DM6PR07CA0034.outlook.office365.com (2603:10b6:5:94::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.16 via Frontend Transport; Tue, 5 Mar 2019 11:00:39 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT011.mail.protection.outlook.com (10.152.100.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 11:00:39 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 03:00:21 -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 x25B0LKw013436; Tue, 5 Mar 2019 03:00:21 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25B0LSr013435; Tue, 5 Mar 2019 03:00:21 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 26/26] qedf: Update the driver version to 8.37.25.19. Date: Tue, 5 Mar 2019 02:59:01 -0800 Message-ID: <20190305105901.13185-27-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962572393152387;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(396003)(346002)(376002)(136003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(2906002)(53936002)(15650500001)(2616005)(47776003)(81166006)(81156014)(8676002)(305945005)(11346002)(446003)(6862004)(336012)(54906003)(36756003)(36906005)(316002)(16586007)(42186006)(68736007)(50226002)(8936002)(4326008)(87636003)(498600001)(86362001)(486006)(356004)(26826003)(6666004)(85426001)(126002)(48376002)(476003)(50466002)(14444005)(2351001)(69596002)(105606002)(106466001)(97736004)(80596001)(5660300002)(26005)(4744005)(51416003)(1076003)(76176011)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB4383;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec1d8d17-c65e-471c-8a0d-08d6a159cd9a X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB4383; X-MS-TrafficTypeDiagnostic: SN6PR07MB4383: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB4383;23:LaD9lZBWV5mK9fC4yPo9k+Piv3Ex0RG3d6n/LvUzJx3YhXyVx2q2WTeKrOdu2/EF2GRaWSf2P9xLaNYz1od914KgoN14yJbz0njUiQfLGlWZAsQkMrW97kt8WLvim7aCv7+HoC6eXbkrjfKxR5FCothwy6tjKKzvvhUHvJWlgyvEJXPKlkqv9Lz+3UqW3u/YX9p23bqzXumgik8hDNrnIXnKL8nxsJyo9G2QP1WgZH+3CmmJQnSusvq5wO6IsFXyi0vQzJXSAJLatPEhPHrUkszHHRYns0aAb7r0YsKj4stZsl1cREUfCzvPl2QZPLSLRr7HiqFOBsg+3WYyg3j7TnJ/TMNjeFpwkgNvv3uEtbbPkuDxhWPBDo+fuESKoEkbHVBeZigYJ5D+XxlxI/klEJ695k7UcwvpFOLDkmZmrnB4+qILerpSISVbpsmZ6cu/ZSQxesRE1usF2jFDlRTUQSxW7bKLlEM4PX90/iUqMrwkSwAoXYj4HU/p5o1/7TZpW/r1U4/BuNimvCWegJdbIBgZhIsU08IFaBZNVDUF6cMbvd38jgOrA6rYojQkGiBAN6KzjNBLRHaHEl9ERescVokQSfa3uO31bjYzBf7SfP4g6Xoa/B+6KvpoWiL8M2NNN91TCTwGb2zPFjWzwFkEf6qFAv2c72uIdFW6+WFq6kF29zUgB1MZNL6/50rMvUw7A5b8YXKv5kn94ssFE9160IQ7cjTNIBXA5+AXr1XrZGe8oQQFsnswySMW7ottZ42mqisNlJBzU3lYokmWzFjvWs7BGuv9w/q7gaQ3fl9161UJn/F+rdyq8mOGg37/pnNFnEOHU6DGnpCy2Dm57FITmq4XpBUtOzJ50lAsupx4BJ2SjgcPdhHT0MpqDgPKXnczN/B1H36iBiTMQYQeDv7qx1O9Pa60xoRSO3X1bqgJKMeRUBnNOSUENtVOFelZjAV8svxMaINkM6iBGR+RytiqIFMYU6i09qBMPXPeK9ugF3fDvDEOjMahGM4wWGKj4UcJ1jQ8IhIOnpvNS5uZbC3RLgOYO1V4iwSwQUdI9tp9XEpeMddbEMOjSfsLmFXmj/OeVM1PtN21g4STY3kuBEA4j6rcV5WcJvzhDwt8NJIRRpSx2ouHvRF7pjNLNSfeOdp9n2F0x4u04gBi/Gf0X1GlPsU5nIs99m+BPj/eidejNvLNTf+pvUEUjAtkj6mvY76wTgMo9+upFzx/ijMSzr5Nfieb5d/puZU1aulVHp5BCcH31CKT+sEklDvGuCm0jdA93wdBZQiSIqV+cfFT49xAZPnAhj+gGni51c0X9HqzRanR/DpYd6uGQBkd/jx88buQzsEajsxQdxjlJn61g/akYN2letvQatSO+A8DSS81zZL79p3LK/RovHGhPl18GI1uePx8yFzr3F16d7joLaoh/A== X-Microsoft-Antispam-Message-Info: MCD6JwZGr+WK7ltCAtn0OPvVusC4QVKa9PcTvLQgqBQtTEk06P6iSdykp6JYiNsJVZFdBicpRpMYJW7mJIjY8jURFyyTcSYLI+bEBUcpmnsCh4GC+2H/kJ8FrRrnCX7jP0gXrngb4J41Kgx3DPSlezHV6+KEQFWwK+8dh4M2+8TdZW/nJWLHCZNVGjdI7JDpZcyBJYZyowQDQ8TqDYubbTwSoBIHZTTH2l87sMdw6FCcLOdBfb3ED8rwG4RkJx2loZ549DaUW/dgSQMgWcAoq2otT35JbzC9EPCWHV2xdJrZXQM/F0Xgl6YWX/9VssGo33LP+lTyYqKTrXIEtiGH9smUumEIcz+jU2ZpilC5Q0F6STb50CwHNlhxJM8Xt6lFz4KcRNjxKzmYc/+bj2XwcMNeHTsN4i+t0o2KqtU8vvQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 11:00:39.0600 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec1d8d17-c65e-471c-8a0d-08d6a159cd9a X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4383 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 - Update the driver version. Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_version.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qedf/qedf_version.h b/drivers/scsi/qedf/qedf_version.h index 9455faa..9a06a58 100644 --- a/drivers/scsi/qedf/qedf_version.h +++ b/drivers/scsi/qedf/qedf_version.h @@ -7,9 +7,9 @@ * this source tree. */ -#define QEDF_VERSION "8.33.16.20" +#define QEDF_VERSION "8.37.25.19" #define QEDF_DRIVER_MAJOR_VER 8 -#define QEDF_DRIVER_MINOR_VER 33 -#define QEDF_DRIVER_REV_VER 16 -#define QEDF_DRIVER_ENG_VER 20 +#define QEDF_DRIVER_MINOR_VER 37 +#define QEDF_DRIVER_REV_VER 25 +#define QEDF_DRIVER_ENG_VER 19