From patchwork Tue Mar 26 07:38:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10870501 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 73FBE14DE for ; Tue, 26 Mar 2019 07:39:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BF7A28C2B for ; Tue, 26 Mar 2019 07:39:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C74228DD5; Tue, 26 Mar 2019 07:39: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 B233228C2B for ; Tue, 26 Mar 2019 07:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730624AbfCZHjO (ORCPT ); Tue, 26 Mar 2019 03:39:14 -0400 Received: from mail-eopbgr800054.outbound.protection.outlook.com ([40.107.80.54]:3776 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726266AbfCZHjO (ORCPT ); Tue, 26 Mar 2019 03:39:14 -0400 Received: from DM6PR07CA0040.namprd07.prod.outlook.com (2603:10b6:5:74::17) by BYAPR07MB5366.namprd07.prod.outlook.com (2603:10b6:a03:64::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Tue, 26 Mar 2019 07:39:11 +0000 Received: from DM3NAM05FT049.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::207) by DM6PR07CA0040.outlook.office365.com (2603:10b6:5:74::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39:11 +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 DM3NAM05FT049.mail.protection.outlook.com (10.152.98.163) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:11 +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, 26 Mar 2019 00:39:02 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7d2uk026831; Tue, 26 Mar 2019 00:39:02 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7d2Jg026830; Tue, 26 Mar 2019 00:39:02 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 01/26] qedf: Do not retry ELS request if qedf_alloc_cmd fails. Date: Tue, 26 Mar 2019 00:38:33 -0700 Message-ID: <20190326073858.26792-2-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595516219799;(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)(346002)(396003)(376002)(136003)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(51234002)(446003)(47776003)(42186006)(8936002)(68736007)(76176011)(26005)(50226002)(51416003)(2351001)(105606002)(106466001)(2906002)(81166006)(305945005)(26826003)(498600001)(36756003)(81156014)(45080400002)(87636003)(97736004)(53936002)(316002)(1076003)(6862004)(36906005)(80596001)(69596002)(4326008)(85426001)(86362001)(48376002)(50466002)(14444005)(16586007)(336012)(54906003)(356004)(126002)(8676002)(476003)(6666004)(486006)(2616005)(5660300002)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR07MB5366;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: 585297b4-7038-4810-fa83-08d6b1be2373 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BYAPR07MB5366; X-MS-TrafficTypeDiagnostic: BYAPR07MB5366: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: I3fMVWZBRphHIO4uQE7Tmkp9E5PS1c0qkiGxYy4TzCF1Qvg11og5VSyJg2Epj9cyukjNstjuRFumwiZfP628yYYEvMCwNo7WBsQipJ1dGMLSoHPBZ2Du11CpIvT3hndVKW9b6W4bvhAD7RJ3WtOfh4jiYw4l+CKiXEfnROpyoxEERnochwwEQJv35RLPM6temdTzKcHJKlpzUA1RPlPc2NuKM/2BKPE9XihtQbeMY2LG5bd2kIQ2A6GL/HOHY5zYyjITKqzQ1etd9ZVJsT+tqlEcXEjaiOuHc1spiTScWiMcAQhwhcMeXhPTVkaJcnwAUb92izjJjwksUg858rS/mOaBLrLFZeVkwexri6rqfrGQn18qI9trj13kCudnbI/BNOMtfRTWWK6iu8/glOBy+wyg1lKmwGqoZhWqOwfNKaQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:11.2837 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 585297b4-7038-4810-fa83-08d6b1be2373 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: BYAPR07MB5366 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 26 07:38:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10870503 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 8274F14DE for ; Tue, 26 Mar 2019 07:39:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C38328C2B for ; Tue, 26 Mar 2019 07:39:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6082D28DD5; Tue, 26 Mar 2019 07:39:23 +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 D4B6D28C2B for ; Tue, 26 Mar 2019 07:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730790AbfCZHjW (ORCPT ); Tue, 26 Mar 2019 03:39:22 -0400 Received: from mail-eopbgr790058.outbound.protection.outlook.com ([40.107.79.58]:2157 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726266AbfCZHjW (ORCPT ); Tue, 26 Mar 2019 03:39:22 -0400 Received: from DM6PR07CA0040.namprd07.prod.outlook.com (2603:10b6:5:74::17) by SN6PR07MB5374.namprd07.prod.outlook.com (2603:10b6:805:74::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Tue, 26 Mar 2019 07:39:14 +0000 Received: from DM3NAM05FT049.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::207) by DM6PR07CA0040.outlook.office365.com (2603:10b6:5:74::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39:14 +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 DM3NAM05FT049.mail.protection.outlook.com (10.152.98.163) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:14 +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, 26 Mar 2019 00:39:05 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7d5KB026835; Tue, 26 Mar 2019 00:39:05 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7d5I0026834; Tue, 26 Mar 2019 00:39:05 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 02/26] qedf: Correct xid range overlap between offloaded requests and libfc requests. Date: Tue, 26 Mar 2019 00:38:34 -0700 Message-ID: <20190326073858.26792-3-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595546333469;(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)(39860400002)(346002)(376002)(136003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(446003)(476003)(486006)(2351001)(11346002)(2616005)(16586007)(42186006)(86362001)(6862004)(51416003)(53936002)(356004)(2906002)(26005)(126002)(316002)(6666004)(336012)(76176011)(36906005)(26826003)(48376002)(87636003)(50466002)(36756003)(498600001)(47776003)(85426001)(5660300002)(68736007)(69596002)(81166006)(54906003)(80596001)(97736004)(81156014)(8676002)(106466001)(8936002)(105606002)(4326008)(50226002)(1076003)(14444005)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5374;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: 8be0524b-6253-4857-52ee-08d6b1be253f X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5374; X-MS-TrafficTypeDiagnostic: SN6PR07MB5374: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: qb66pOMaqoAQNO6Vx1M9Udfgv1hR3liY6QRV1u02M3ZfXavxZ+WMDGFTgbeXErPgmYc36wkSxQfgUuJAVajqxlW/nda5a+ua1ESlZEuBJ1i6Lxim4x61JGonidgfCcnYduR8qQ6uu16rAOEY6c+qhZIm7YI8sVbJ7Aksi/AYxXVziWM11rMkVMt4SblLOTl7axh/aJLtTuka1n2hEfMKks0bLWO1T2hieMwvnlKGw/G11FQLgv6CSwFYZ8Xajb+Cf4YQ53M5ZE0kRoBvLr4aHithuh31yukc00mMGqhoQ3lAZw6X9DKTC8soOP0IneK7pT4c+J2P834JAkUhOC9lbBDGDwsdt1TvETT6H60P9T6qhogHQyUHGgjzkf5rP0UhudVsXfzDPjLiLbEYa5yNvhFuA3Kw96aI+enItNRYukM= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:14.2940 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8be0524b-6253-4857-52ee-08d6b1be253f 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: SN6PR07MB5374 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 26 07:38:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10870505 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 CFA6014DE for ; Tue, 26 Mar 2019 07:39:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6A5328C2B for ; Tue, 26 Mar 2019 07:39:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB32C28DD5; Tue, 26 Mar 2019 07:39:27 +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 0EDAC28C2B for ; Tue, 26 Mar 2019 07:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730714AbfCZHj0 (ORCPT ); Tue, 26 Mar 2019 03:39:26 -0400 Received: from mail-eopbgr790042.outbound.protection.outlook.com ([40.107.79.42]:26294 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726266AbfCZHj0 (ORCPT ); Tue, 26 Mar 2019 03:39:26 -0400 Received: from DM6PR07CA0063.namprd07.prod.outlook.com (2603:10b6:5:74::40) by BN3PR07MB2531.namprd07.prod.outlook.com (2a01:111:e400:7bba::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Tue, 26 Mar 2019 07:39:24 +0000 Received: from DM3NAM05FT049.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::204) by DM6PR07CA0063.outlook.office365.com (2603:10b6:5:74::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1730.16 via Frontend Transport; Tue, 26 Mar 2019 07:39:23 +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 DM3NAM05FT049.mail.protection.outlook.com (10.152.98.163) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:23 +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, 26 Mar 2019 00:39:08 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7d8SZ026839; Tue, 26 Mar 2019 00:39:08 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7d8r1026838; Tue, 26 Mar 2019 00:39:08 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 03/26] qedf: Add missing return in qedf_post_io_req() in the fcport offload check. Date: Tue, 26 Mar 2019 00:38:35 -0700 Message-ID: <20190326073858.26792-4-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595634412583;(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)(376002)(346002)(136003)(396003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(498600001)(26826003)(80596001)(2351001)(45080400002)(106466001)(87636003)(51416003)(69596002)(76176011)(26005)(11346002)(446003)(486006)(476003)(126002)(2906002)(4326008)(105606002)(6862004)(2616005)(1076003)(85426001)(47776003)(5660300002)(86362001)(8936002)(97736004)(16586007)(48376002)(53936002)(50466002)(36756003)(336012)(36906005)(8676002)(50226002)(68736007)(305945005)(316002)(356004)(81166006)(81156014)(6666004)(14444005)(42186006)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2531;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: 7ddf0ad5-f430-402e-26dc-08d6b1be2a7f X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2531; X-MS-TrafficTypeDiagnostic: BN3PR07MB2531: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: 6CQUe4pwXj0EivRmJpzyIilLD/NXJ+JSYxp6zOY882ujJslLKflIXl8pucXS49XZsuHrA6Fhyew9cT9vSzaSOSeRCCiAc9Q2v52r6fgYXQgNZpWH7zwmMsRdzB9Nw/ppf5EUz2ba7yzkVLDharSFW4Cbp86vn9orDKRZf0av8hlsG73H2tzIBoC3XORGWIwi+ZzI7VP890ZqD8PRdg99nMN6+qjvcdSek17UPW3zGAJlhKqm92UUt+HSIKYvOW0FYymmfxxt6fyvwNBe9a80Cd2hl49ekSBGTEoLDeS2h2aV3YQ2Z2sNa4ShyL5y+qfMR4WGAw8q79KbgUiMOFDk0VXFN8NcjTC1ZbYZpYcNPefIpkhRzERIcySFl6+/01DyXhG+lVjq8mHU/KkN1qRz/TZdCm4pU9t6a5o3LCl5CUg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:23.1069 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ddf0ad5-f430-402e-26dc-08d6b1be2a7f 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: BN3PR07MB2531 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 26 07:38: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: 10870507 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 DC8B115AC for ; Tue, 26 Mar 2019 07:39:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C585D28C2B for ; Tue, 26 Mar 2019 07:39:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B803228DD5; Tue, 26 Mar 2019 07:39:38 +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 8E3AE28C2B for ; Tue, 26 Mar 2019 07:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730935AbfCZHjh (ORCPT ); Tue, 26 Mar 2019 03:39:37 -0400 Received: from mail-eopbgr800048.outbound.protection.outlook.com ([40.107.80.48]:9088 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726266AbfCZHjh (ORCPT ); Tue, 26 Mar 2019 03:39:37 -0400 Received: from DM6PR07CA0040.namprd07.prod.outlook.com (2603:10b6:5:74::17) by SN2PR07MB2541.namprd07.prod.outlook.com (2603:10b6:804:7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:39:30 +0000 Received: from DM3NAM05FT049.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::207) by DM6PR07CA0040.outlook.office365.com (2603:10b6:5:74::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39:30 +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 DM3NAM05FT049.mail.protection.outlook.com (10.152.98.163) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39: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, 26 Mar 2019 00:39:12 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dBrx026843; Tue, 26 Mar 2019 00:39:11 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dB4L026842; Tue, 26 Mar 2019 00:39:11 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 04/26] qedf: Simplify s/g list mapping. Date: Tue, 26 Mar 2019 00:38:36 -0700 Message-ID: <20190326073858.26792-5-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595706188909;(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)(396003)(346002)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(2351001)(76176011)(36756003)(6862004)(53936002)(356004)(4326008)(6666004)(11346002)(476003)(2616005)(486006)(50466002)(51416003)(446003)(14444005)(126002)(48376002)(336012)(5660300002)(106466001)(86362001)(2906002)(105606002)(81166006)(47776003)(1076003)(26826003)(81156014)(97736004)(54906003)(305945005)(16586007)(80596001)(85426001)(87636003)(36906005)(26005)(42186006)(316002)(8936002)(50226002)(68736007)(498600001)(8676002)(69596002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2541;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: 80253259-98ad-4180-863e-08d6b1be2ec6 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN2PR07MB2541; X-MS-TrafficTypeDiagnostic: SN2PR07MB2541: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: M6clexeUaUPMj8hz2yfcSYwOcTmXD//ojrpoWripepEv4e16DQ5Ctuj5FlF8Rvoa1u218er2WVOV975nqP/LcScJAWQH6StOGxt2uYSIOS/yuytB5M1zG4TSMhtVEtmEcDPbsZfzzGMz+O0Qg3a2dtlhAO4hPEbN12xURO2bwwwjh1YZ89jpmlyG0fpihV71O10yjYUPxJT6S2sCHNntwWxcejo2LFZiWvSRviovULrkEFnQtXzd4d3IsALqlp+MUzNBazFzzslx29fhOE9hG34ZdaYwSQ0uXoSXk33UBKiBcsASqvfUU4Ht3wl5Lqbj8kuMZq+DSNK2TTtppEJtpOAJuEE9FVIyp8AJipMmxCkGBoUBx2j+kfoinLI0uRv+9xuOuxq1Sg9iWwM8DMtGRd3gNIfzPZtXtkofk29WbrU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:30.2716 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80253259-98ad-4180-863e-08d6b1be2ec6 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: SN2PR07MB2541 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..ed38df9 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 = cpu_to_le32(U64_LO(addr)); + bd[bd_count].sge_addr.hi = cpu_to_le32(U64_HI(addr)); + bd[bd_count].sge_len = cpu_to_le32(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 26 07:38: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: 10870511 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 B688B14DE for ; Tue, 26 Mar 2019 07:39:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EF8E2907B for ; Tue, 26 Mar 2019 07:39:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9310B29081; Tue, 26 Mar 2019 07:39:46 +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 E81C72907D for ; Tue, 26 Mar 2019 07:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731003AbfCZHjn (ORCPT ); Tue, 26 Mar 2019 03:39:43 -0400 Received: from mail-eopbgr750072.outbound.protection.outlook.com ([40.107.75.72]:62590 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730624AbfCZHjn (ORCPT ); Tue, 26 Mar 2019 03:39:43 -0400 Received: from DM6PR07CA0040.namprd07.prod.outlook.com (2603:10b6:5:74::17) by BN7PR07MB5361.namprd07.prod.outlook.com (2603:10b6:408:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:39:33 +0000 Received: from DM3NAM05FT049.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::207) by DM6PR07CA0040.outlook.office365.com (2603:10b6:5:74::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39:33 +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 DM3NAM05FT049.mail.protection.outlook.com (10.152.98.163) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39: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, 26 Mar 2019 00:39:15 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dFN4026847; Tue, 26 Mar 2019 00:39:15 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dFko026846; Tue, 26 Mar 2019 00:39:15 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 05/26] qedf: Modify flush routine to handle all I/Os and TMF. Date: Tue, 26 Mar 2019 00:38:37 -0700 Message-ID: <20190326073858.26792-6-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595737593559;(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)(39860400002)(396003)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(126002)(85426001)(476003)(68736007)(81156014)(486006)(8676002)(1076003)(6862004)(26005)(80596001)(47776003)(50226002)(4326008)(8936002)(81166006)(69596002)(6666004)(36756003)(356004)(51416003)(76176011)(11346002)(336012)(2616005)(446003)(16586007)(106466001)(5660300002)(105606002)(87636003)(305945005)(2351001)(53936002)(48376002)(36906005)(97736004)(54906003)(316002)(42186006)(2906002)(14444005)(30864003)(50466002)(498600001)(86362001)(26826003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB5361;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: d741b33d-d2fa-48a6-9199-08d6b1be30a5 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB5361; X-MS-TrafficTypeDiagnostic: BN7PR07MB5361: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: EJj6OacscBMmzZDX7VTS6/6/OIiFm6ZcQRKk0QUvK65QzAIusO/lnjBxB3NReBnuAQAtbOMuOYLVBsM8lMagL9WxVYlDZM8UTn1qHINk9qkkSwhPqGw68K0GU/pnrzpp9tqiPaRj0HKXoqGYINrhZp3B0twYeamIUPXdVcBgBTEV8n5diIP8++t873NeLUF2qpur25ZE0f6YoUdo4uqNX6ssdJzA0EY1q5XAJfavcb3bkroTak2MlZlDWipwnn1+Z7yw4N6sk4bJOVrNUpTjdgojT7AG9Izzh5EwxETYFis0WR6FLwJOC3VJb8RsiNFcKUVLdiMQv3YxpdlvrhnBnntPBINwgnEkJs6nkTKKy1cmkNhMQRabb4sjwLSzo0C4b/i30VleVLmp7R+j5jg8nJMpuqSHlMcSO9QoBZRBx5Q= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:33.4110 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d741b33d-d2fa-48a6-9199-08d6b1be30a5 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: BN7PR07MB5361 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 ed38df9..1d810d7 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 26 07:38: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: 10870513 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 C6C2415AC for ; Tue, 26 Mar 2019 07:39:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB8EE2907D for ; Tue, 26 Mar 2019 07:39:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FA9629089; Tue, 26 Mar 2019 07:39: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 269752907D for ; Tue, 26 Mar 2019 07:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731101AbfCZHjr (ORCPT ); Tue, 26 Mar 2019 03:39:47 -0400 Received: from mail-eopbgr730088.outbound.protection.outlook.com ([40.107.73.88]:64425 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726266AbfCZHjr (ORCPT ); Tue, 26 Mar 2019 03:39:47 -0400 Received: from BYAPR07CA0022.namprd07.prod.outlook.com (2603:10b6:a02:bc::35) by SN2PR07MB2544.namprd07.prod.outlook.com (2603:10b6:804:7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:39:37 +0000 Received: from DM3NAM05FT018.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::201) by BYAPR07CA0022.outlook.office365.com (2603:10b6:a02:bc::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18 via Frontend Transport; Tue, 26 Mar 2019 07:39: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 DM3NAM05FT018.mail.protection.outlook.com (10.152.98.127) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39: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, 26 Mar 2019 00:39:18 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dIs4026851; Tue, 26 Mar 2019 00:39:18 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dIg4026850; Tue, 26 Mar 2019 00:39:18 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 06/26] qedf: Modify abort and tmf handler to handle edge condition and flush. Date: Tue, 26 Mar 2019 00:38:38 -0700 Message-ID: <20190326073858.26792-7-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595774418794;(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)(1109001)(1110001)(339900001)(189003)(199004)(105606002)(2351001)(42186006)(68736007)(106466001)(336012)(86362001)(356004)(6666004)(1076003)(80596001)(498600001)(30864003)(87636003)(26826003)(85426001)(53936002)(69596002)(6862004)(36906005)(2906002)(36756003)(2616005)(446003)(11346002)(4326008)(5660300002)(97736004)(50226002)(48376002)(81156014)(50466002)(305945005)(8676002)(26005)(51416003)(8936002)(81166006)(476003)(54906003)(126002)(16586007)(486006)(316002)(76176011)(47776003)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2544;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: f2191358-2ef6-4211-04da-08d6b1be32d7 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN2PR07MB2544; X-MS-TrafficTypeDiagnostic: SN2PR07MB2544: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: m/YIWbw5gDLMwsr+qqD2KM5Sif68EqEaH3szWFolVqsd40PmWd2+TThzEYDF31XBwSKD6qIWkLTh1dyEGot5S5LBdgdvdU94E1gkx1rqnwKcpJvK1s/AQ/zpZ8avyuIOFWj7/8R2bPowwJYUi0Ezb4r6+R+u6ZQw8jG5/KjpmCxdig3LyBXRIJXRD60txUACM6XyhMYGHwRtd+nDrNmBrSUvScdY58Xugt4wv2PL1VNjZu3RbVGacy3NmHA5jx/z521UM0Y++b/c/wSwIM6S3IPJBuGyTAo5O4t1tXJt8nn61V7BO2renDZPLkQwFsXfzNCFMGDUZVT1JORtQf6PgrFDmqTjAXxxl54RhRIDrGk4ao8vRNUpYpdg1UhDNEF36XqlLuW2RjIxc1JgQupnoWwdRRkQPoSppo0rDLEDa2c= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:36.9604 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2191358-2ef6-4211-04da-08d6b1be32d7 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: SN2PR07MB2544 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 1d810d7..c22dbb3 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 26 07:38: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: 10870517 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 216C114DE for ; Tue, 26 Mar 2019 07:39:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A43028FEC for ; Tue, 26 Mar 2019 07:39:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F29882907B; Tue, 26 Mar 2019 07:39: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 457A129081 for ; Tue, 26 Mar 2019 07:39:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731106AbfCZHjs (ORCPT ); Tue, 26 Mar 2019 03:39:48 -0400 Received: from mail-eopbgr730088.outbound.protection.outlook.com ([40.107.73.88]:64425 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731059AbfCZHjs (ORCPT ); Tue, 26 Mar 2019 03:39:48 -0400 Received: from DM6PR07CA0062.namprd07.prod.outlook.com (2603:10b6:5:74::39) by SN2PR07MB2544.namprd07.prod.outlook.com (2603:10b6:804:7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:39:39 +0000 Received: from DM3NAM05FT049.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::207) by DM6PR07CA0062.outlook.office365.com (2603:10b6:5:74::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1730.16 via Frontend Transport; Tue, 26 Mar 2019 07:39:38 +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 DM3NAM05FT049.mail.protection.outlook.com (10.152.98.163) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:38 +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, 26 Mar 2019 00:39:21 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dLlf026855; Tue, 26 Mar 2019 00:39:21 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dLS8026854; Tue, 26 Mar 2019 00:39:21 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 07/26] qedf: Use a separate completion for cleanup commands. Date: Tue, 26 Mar 2019 00:38:39 -0700 Message-ID: <20190326073858.26792-8-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595786892255;(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)(1109001)(1110001)(339900001)(189003)(199004)(105606002)(2351001)(42186006)(68736007)(106466001)(336012)(86362001)(356004)(6666004)(1076003)(80596001)(498600001)(87636003)(26826003)(85426001)(53936002)(69596002)(6862004)(36906005)(2906002)(36756003)(2616005)(446003)(11346002)(4326008)(5660300002)(97736004)(50226002)(48376002)(81156014)(50466002)(305945005)(8676002)(26005)(51416003)(8936002)(81166006)(476003)(54906003)(126002)(16586007)(486006)(316002)(76176011)(47776003)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2544;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: a754ab87-3707-4888-f5b5-08d6b1be3395 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN2PR07MB2544; X-MS-TrafficTypeDiagnostic: SN2PR07MB2544: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: eLrclH2zyyB3vap0LDCTS0DE/GdTmJLGfSVrfKSVAy00NE4wtdWz7iR5y78ze7w/0Y9U5VUP2QwiscZop9O73qk/8lJTZQ+CTdVhJNR7Cvr+FnCqZJxHOsLTQYOVruqLmFatzPWFP1iAbJas3hkgSWdlerzZgAcoV3EtsP05/nwld9oRSEEHfvXjgzgHT8FV6xeLUw0uMKNeM+o/TgCkJxNmkNrU2U0Ec3VRSDSgxocZRDoKuwzgzhBFQBKs2cWjMMhzCOXQJLSDw81WauwR4UJH6sdJ9JiNR2a0S3WJVmM8ZlpARmje2TLbU/CnJAMUaO+xJisd0QnnS8ddkEEf27NCBslJwe7e2FZwrrIONNvbxVMQ8kA7UEmeY6yHgUw6Xo+xIqpaBpAAN0B5F7SzBpZq5XUrVT4V7H+XJSMOdSA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:38.3559 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a754ab87-3707-4888-f5b5-08d6b1be3395 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: SN2PR07MB2544 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 c22dbb3..58257ec 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 26 07:38: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: 10870509 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 59D2514DE for ; Tue, 26 Mar 2019 07:39:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41F1029081 for ; Tue, 26 Mar 2019 07:39:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3642F29089; Tue, 26 Mar 2019 07:39:45 +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 D817129081 for ; Tue, 26 Mar 2019 07:39:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731016AbfCZHjo (ORCPT ); Tue, 26 Mar 2019 03:39:44 -0400 Received: from mail-eopbgr800059.outbound.protection.outlook.com ([40.107.80.59]:46083 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730944AbfCZHjo (ORCPT ); Tue, 26 Mar 2019 03:39:44 -0400 Received: from DM5PR07CA0087.namprd07.prod.outlook.com (2603:10b6:4:ae::16) by SN2PR07MB2541.namprd07.prod.outlook.com (2603:10b6:804:7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:39:42 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::209) by DM5PR07CA0087.outlook.office365.com (2603:10b6:4:ae::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39: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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:41 +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, 26 Mar 2019 00:39:24 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dOZk026859; Tue, 26 Mar 2019 00:39:24 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dOEh026858; Tue, 26 Mar 2019 00:39:24 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 08/26] qedf: Correct the memory barriers in qedf_ring_doorbell. Date: Tue, 26 Mar 2019 00:38:40 -0700 Message-ID: <20190326073858.26792-9-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595823217458;(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)(396003)(346002)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(2351001)(76176011)(36756003)(6862004)(53936002)(356004)(4326008)(6666004)(11346002)(476003)(2616005)(486006)(50466002)(51416003)(446003)(14444005)(126002)(48376002)(336012)(5660300002)(106466001)(86362001)(2906002)(105606002)(81166006)(47776003)(1076003)(26826003)(81156014)(97736004)(54906003)(305945005)(16586007)(80596001)(85426001)(87636003)(36906005)(26005)(42186006)(316002)(8936002)(50226002)(68736007)(498600001)(8676002)(69596002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2541;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: 7140cb93-36a2-4393-a0a2-08d6b1be35bf X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN2PR07MB2541; X-MS-TrafficTypeDiagnostic: SN2PR07MB2541: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: SJ20vgrInUtZBAT8QfqwT7d02mj7pufUhldgFrAGYJwHnmj93hkp88wOnSWtjovuu6nZ4+d8Hr8eE018kS8g27G5l/lznsdCy8cV48nFiTrsx2ACyfK/jrZqPswvU/pZgbsafeBg1o0KuidbtGpyxoyarzEUsa+j2a3QdflKPE4Rh8p4vnLUNoLncJgzC1U2QU72XXUhbr4DojgoMqpWaPE8DO306yiO/r41XXVAHKFlWdK5ZKfij9wzoHFIr8wbrkWz7bSQx7oYNrx+iw/OnQMC9QKzVRwaanwH/V5Kh+9oGP8YTs3rNS0nY0SB9itJ9L+9YM13FhiyhWwKETmDR+fGTISjtvFmmcgtPgL2KPlJTBTUR9LZYySn1Guof3FtMiWbHnDgdewcno3ShEb4L+fxBcOjqHCSVZhPKv+D7hA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:41.9814 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7140cb93-36a2-4393-a0a2-08d6b1be35bf 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: SN2PR07MB2541 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 58257ec..ab67056 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 26 07:38: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: 10870515 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 D4CAC17E6 for ; Tue, 26 Mar 2019 07:39:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1D6428FEC for ; Tue, 26 Mar 2019 07:39:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B634A2908B; Tue, 26 Mar 2019 07:39: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 7D23B2907B for ; Tue, 26 Mar 2019 07:39:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731092AbfCZHjr (ORCPT ); Tue, 26 Mar 2019 03:39:47 -0400 Received: from mail-eopbgr710053.outbound.protection.outlook.com ([40.107.71.53]:16736 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730944AbfCZHjq (ORCPT ); Tue, 26 Mar 2019 03:39:46 -0400 Received: from DM5PR07CA0109.namprd07.prod.outlook.com (2603:10b6:4:ae::38) by BN7PR07MB5363.namprd07.prod.outlook.com (2603:10b6:408:2e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:39:44 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::200) by DM5PR07CA0109.outlook.office365.com (2603:10b6:4:ae::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.19 via Frontend Transport; Tue, 26 Mar 2019 07:39:44 +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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:44 +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, 26 Mar 2019 00:39:28 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dRC1026863; Tue, 26 Mar 2019 00:39:27 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dR2N026862; Tue, 26 Mar 2019 00:39:27 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 09/26] qedf: Add missing fc_disc_init call after allocating lport. Date: Tue, 26 Mar 2019 00:38:41 -0700 Message-ID: <20190326073858.26792-10-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595845515314;(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)(39860400002)(136003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(86362001)(8676002)(85426001)(2351001)(4744005)(1076003)(36906005)(54906003)(51416003)(106466001)(6862004)(53936002)(105606002)(4326008)(87636003)(498600001)(26826003)(26005)(76176011)(50226002)(97736004)(5660300002)(305945005)(11346002)(68736007)(8936002)(81156014)(47776003)(126002)(36756003)(446003)(336012)(316002)(476003)(2906002)(16586007)(2616005)(81166006)(356004)(50466002)(48376002)(6666004)(80596001)(69596002)(42186006)(486006);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB5363;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: 7883d40f-0e44-4151-52ed-08d6b1be3714 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB5363; X-MS-TrafficTypeDiagnostic: BN7PR07MB5363: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: S5eY+jDy/zk/Y7eIhBcfPSu4ZSyOgon+narHi3voh6aPtl+I60PPUG+uoMKzjwhtu+pVe5oJWqb8y2KuNjwLHuOcCczM0qxq+jpFQpK66zsHe6ytbs0NS/GulP4O6MNQ2OKk2F1IsXVYX0kqYTDXSXwdlNh02D8AaxGLMqlSeiPmf+uFRJhSlL/akTY4F/Wl7RAoQUmxBX47twApqjCJ5YG3t+g9sG4ivZDj5mFPfZaKJScN16Ax1y2sA0tZ+l4SVKQLS+jndJTewQvdwveeoUYSbc8giGDnDrA57lkv1nNiduHBdPh+yavw2bhKGqEVuNe+Oc+LENu22eKNn26HT/dM2qDDauIS7gTcB6vmxA0UPvpE4Z2fhWn+S5rhA5EyGzX/Znvd61xH8rESzxoAAyZxVFo2jp8s4lpfN/iK3wo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:44.2023 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7883d40f-0e44-4151-52ed-08d6b1be3714 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: BN7PR07MB5363 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 26 07:38: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: 10870519 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 13CA615AC for ; Tue, 26 Mar 2019 07:39:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1F3028FEC for ; Tue, 26 Mar 2019 07:39:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E63D72907D; Tue, 26 Mar 2019 07:39: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 83AB728FEC for ; Tue, 26 Mar 2019 07:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731059AbfCZHju (ORCPT ); Tue, 26 Mar 2019 03:39:50 -0400 Received: from mail-eopbgr690053.outbound.protection.outlook.com ([40.107.69.53]:19781 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726266AbfCZHjt (ORCPT ); Tue, 26 Mar 2019 03:39:49 -0400 Received: from BYAPR07CA0022.namprd07.prod.outlook.com (2603:10b6:a02:bc::35) by DM5PR07MB4021.namprd07.prod.outlook.com (2603:10b6:4:b2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Tue, 26 Mar 2019 07:39:47 +0000 Received: from DM3NAM05FT018.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::201) by BYAPR07CA0022.outlook.office365.com (2603:10b6:a02:bc::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18 via Frontend Transport; Tue, 26 Mar 2019 07:39:47 +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 DM3NAM05FT018.mail.protection.outlook.com (10.152.98.127) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:47 +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, 26 Mar 2019 00:39:31 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dUaa026867; Tue, 26 Mar 2019 00:39:30 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dUpj026866; Tue, 26 Mar 2019 00:39:30 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 10/26] qedf: Check for link state before processing LL2 packets and send fipvlan retries. Date: Tue, 26 Mar 2019 00:38:42 -0700 Message-ID: <20190326073858.26792-11-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595876420767;(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)(396003)(376002)(39860400002)(346002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(16586007)(42186006)(486006)(316002)(446003)(81156014)(2616005)(336012)(26005)(4326008)(47776003)(6862004)(81166006)(356004)(6666004)(8676002)(36906005)(126002)(50226002)(8936002)(476003)(68736007)(11346002)(54906003)(36756003)(106466001)(76176011)(87636003)(53936002)(5660300002)(305945005)(51416003)(80596001)(26826003)(50466002)(498600001)(48376002)(2351001)(105606002)(85426001)(1076003)(69596002)(2906002)(97736004)(86362001)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB4021;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: b615bb03-3513-4d67-e754-08d6b1be38eb X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM5PR07MB4021; X-MS-TrafficTypeDiagnostic: DM5PR07MB4021: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: ahjKSIcX4f+eFeww7KSk54o5AN//hm1uH0fkXF6ECQmAXYdTJu4Skk8RCXRXMLvBi7uRKLlZSXgU86li6Tfk3buEM2qPgpwawdIC/AakfQ1IXYE7Vyo/Y23sVz1B18OxqrjollXEsXIS8Z1HTb7aIlgup28JOjW10rf1ywv4z7gyCE5+u5fRZHJtQtixNDq9V11KWzg9cluzey4rQOmDlM0KQ2RdaSfFpU5XGj/gLnWzVTOMhrzYaZYaMOuBiI/T0vdoE5zSU/5qnT51PhduqxQGprc+UYyiqtKIB+Dhfr4uTeBgbKlNC9Ri9eUNTftqGWhBKtsXPHv8S7Ldm5LMM1Ers1Gz71tfPQJ+B7yM05aSeuNFgFIJizpOjuhwyOHLMBly4Qoygk4Bp5cvl4KC2t9ZWnSv8fZ4gWZ74N9Dd08= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:47.3028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b615bb03-3513-4d67-e754-08d6b1be38eb 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: DM5PR07MB4021 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 26 07:38: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: 10870521 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 C6EA415AC for ; Tue, 26 Mar 2019 07:39:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B300228FEC for ; Tue, 26 Mar 2019 07:39:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A750E2907D; Tue, 26 Mar 2019 07:39:52 +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 A454428FEC for ; Tue, 26 Mar 2019 07:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731114AbfCZHjv (ORCPT ); Tue, 26 Mar 2019 03:39:51 -0400 Received: from mail-eopbgr700083.outbound.protection.outlook.com ([40.107.70.83]:27424 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730935AbfCZHju (ORCPT ); Tue, 26 Mar 2019 03:39:50 -0400 Received: from DM5PR07CA0109.namprd07.prod.outlook.com (2603:10b6:4:ae::38) by CY1PR07MB2540.namprd07.prod.outlook.com (2a01:111:e400:c636::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.19; Tue, 26 Mar 2019 07:39:48 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::200) by DM5PR07CA0109.outlook.office365.com (2603:10b6:4:ae::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.19 via Frontend Transport; Tue, 26 Mar 2019 07:39:48 +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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39: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, 26 Mar 2019 00:39:31 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dVDb026871; Tue, 26 Mar 2019 00:39:31 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dVO4026870; Tue, 26 Mar 2019 00:39:31 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 11/26] qedf: missing kref_put in qedf_xmit() Date: Tue, 26 Mar 2019 00:38:43 -0700 Message-ID: <20190326073858.26792-12-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595887626167;(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)(396003)(136003)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(305945005)(446003)(36906005)(316002)(2616005)(4744005)(16586007)(356004)(6666004)(4326008)(36756003)(6862004)(53936002)(97736004)(42186006)(14444005)(5660300002)(69596002)(81156014)(68736007)(81166006)(85426001)(80596001)(8676002)(48376002)(476003)(126002)(51416003)(26826003)(50226002)(8936002)(105606002)(2351001)(106466001)(1076003)(50466002)(76176011)(26005)(498600001)(2906002)(47776003)(86362001)(486006)(54906003)(11346002)(87636003)(336012);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2540;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: 8b33343f-756c-4b53-e26c-08d6b1be3996 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY1PR07MB2540; X-MS-TrafficTypeDiagnostic: CY1PR07MB2540: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: 8OgbXoVJ8F3F7e7iJJlSrT2I049loFbMEMqnZB+j6NnKd4AYu3mAx1J77k49iip0FSJE+w+236ioaZr4u0XzwknoUOaDXLOBoRne4zVLtg2FRcbg+NAGFqPrlWeahYJmqQMwUnUYMpJhRRxf6Thgqj4M8M9PAJ7OX0wIDcbvid4E3M4XTfA8WvMAxe8r8PzjS+YXZB1zx8ZTRH30mM5y3zoGsF1uBSKiULnYp28M5ZZ2nT3l30CADp/Jir0lRGkAuDJfBYN35TQJ1X5336yo9kvC4rAt7n4+N8aMKJ/3LVQkeY7OoEB8ELY6F5tHqtr75/tcfGVlts+ssdufZLAH6wqfGxgHMw8xq+U2AZWgp6rk26sE80zHYREiFm/goR/TRJLah+ADXohxZdbTH0R9Y5KIC80W8jMQ73m00V6VC1A= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:48.4143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b33343f-756c-4b53-e26c-08d6b1be3996 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: CY1PR07MB2540 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 26 07:38: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: 10870523 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 9954514DE for ; Tue, 26 Mar 2019 07:39:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F76328FEC for ; Tue, 26 Mar 2019 07:39:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73D572907D; Tue, 26 Mar 2019 07:39:54 +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 1D69228FEC for ; Tue, 26 Mar 2019 07:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731118AbfCZHjx (ORCPT ); Tue, 26 Mar 2019 03:39:53 -0400 Received: from mail-eopbgr710059.outbound.protection.outlook.com ([40.107.71.59]:60960 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730935AbfCZHjx (ORCPT ); Tue, 26 Mar 2019 03:39:53 -0400 Received: from DM5PR07CA0087.namprd07.prod.outlook.com (2603:10b6:4:ae::16) by BN3PR07MB2530.namprd07.prod.outlook.com (2a01:111:e400:c5f0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Tue, 26 Mar 2019 07:39:51 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::209) by DM5PR07CA0087.outlook.office365.com (2603:10b6:4:ae::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39:51 +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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:50 +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, 26 Mar 2019 00:39:34 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dY7e026875; Tue, 26 Mar 2019 00:39:34 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dYwR026874; Tue, 26 Mar 2019 00:39:34 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 12/26] qedf: fixup locking in qedf_restart_rport() Date: Tue, 26 Mar 2019 00:38:44 -0700 Message-ID: <20190326073858.26792-13-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595912986861;(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)(136003)(376002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(476003)(80596001)(486006)(68736007)(26005)(126002)(6862004)(81156014)(8676002)(85426001)(81166006)(47776003)(69596002)(8936002)(4326008)(1076003)(50226002)(36756003)(6666004)(76176011)(51416003)(356004)(97736004)(11346002)(2616005)(336012)(446003)(86362001)(16586007)(5660300002)(106466001)(316002)(54906003)(87636003)(105606002)(2351001)(2906002)(26826003)(48376002)(14444005)(36906005)(42186006)(50466002)(498600001)(305945005)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2530;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: ea5b9391-7ac0-401a-dbc0-08d6b1be3b19 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2530; X-MS-TrafficTypeDiagnostic: BN3PR07MB2530: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: RuV7Uur4iluvTe0aDmJu6VIVPTtIWsdcCI3e4uWEeIOMjuDgG5r0XbQ1+k7gew4Wn6LP8OrLoBWnOGrRJ1s8dHCRVesYx4KhCu70dzkD3Ii3xXzzn3ZHzvxG1FF4N8htRQXxKRm1OZFZo4Fx9hJqXb+AfH6mVb7I3KvsdUNSVZpWMAuDKWj8Il0PIBRn/6bi9/rfTLIOvOJ8M4l/yGoCoqs6xH5dYajA5Cz3QdEgEBTac/METqXXQdLr6ngQIRZC2y/n6E/R8WVlKOly/pKRMuiBo2Cg1eN24IPH3VkDx4KgZdjtVZvjJmVlBtLYg1wmhyO8eIICxuNzlhZyOtg3howTlwt2OnvblPVQmj2MXf7XvnpsWilnM2Gg5MF/1FN7TeewPvPsRok8GsLzrXNL9KTB95Y3kI/4vAyhZpxeHu8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:50.9601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea5b9391-7ac0-401a-dbc0-08d6b1be3b19 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: BN3PR07MB2530 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 26 07:38: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: 10870527 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 1474417E6 for ; Tue, 26 Mar 2019 07:39:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0040028FEC for ; Tue, 26 Mar 2019 07:39:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E856D2907D; Tue, 26 Mar 2019 07:39: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 45D2828FEC for ; Tue, 26 Mar 2019 07:39:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731126AbfCZHj5 (ORCPT ); Tue, 26 Mar 2019 03:39:57 -0400 Received: from mail-eopbgr750071.outbound.protection.outlook.com ([40.107.75.71]:44534 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730790AbfCZHj4 (ORCPT ); Tue, 26 Mar 2019 03:39:56 -0400 Received: from BYAPR07CA0034.namprd07.prod.outlook.com (2603:10b6:a02:bc::47) by MW2PR07MB4026.namprd07.prod.outlook.com (2603:10b6:907:6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Tue, 26 Mar 2019 07:39:54 +0000 Received: from DM3NAM05FT018.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::201) by BYAPR07CA0034.outlook.office365.com (2603:10b6:a02:bc::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15 via Frontend Transport; Tue, 26 Mar 2019 07:39:53 +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 DM3NAM05FT018.mail.protection.outlook.com (10.152.98.127) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:53 +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, 26 Mar 2019 00:39:37 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dblO026879; Tue, 26 Mar 2019 00:39:37 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dbhc026878; Tue, 26 Mar 2019 00:39:37 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 13/26] qedf: fixup bit operations. Date: Tue, 26 Mar 2019 00:38:45 -0700 Message-ID: <20190326073858.26792-14-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595936368948;(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)(396003)(136003)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(4326008)(5660300002)(36756003)(446003)(476003)(11346002)(6862004)(69596002)(85426001)(498600001)(8676002)(81166006)(81156014)(87636003)(80596001)(26826003)(8936002)(86362001)(36906005)(50226002)(1076003)(54906003)(336012)(48376002)(76176011)(106466001)(51416003)(6666004)(26005)(50466002)(2351001)(14444005)(305945005)(316002)(53936002)(47776003)(97736004)(42186006)(16586007)(68736007)(486006)(105606002)(2906002)(126002)(356004)(2616005);DIR:OUT;SFP:1101;SCL:1;SRVR:MW2PR07MB4026;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: adb98e18-c05a-45ca-a3ef-08d6b1be3c7e X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:MW2PR07MB4026; X-MS-TrafficTypeDiagnostic: MW2PR07MB4026: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: cswkD9468sskidjbeVdWqEjQhsPI8LhMYXuZ2QwfCTH11asf6A0VHImTIfQDPdHa/B/djljdDMMfm85iP2H3v2K6hev32MdzNmcwrQxuT/NpEXhuDiiTn+dW0rc8RCf1dnXrKkwtZE3swhGgOwWi5xUxe1tlrAycoTYVlko11z6M8YmlUdcVN8KJOVccOckqFXlp+d3/ITWhTa+iWQEPHDE327SmgQyzGIDTEn2nahu6kdUgQPhOMYTdNUnSgyJSkzuYLBuS+tYbyOyyOikNnM+WiwKAqeqk8tN8MV2eVPzKDh67EE7IuTZxCBOMSri7F/V5BsqiyFmmpMiPmEy86+4Gu43Kglsqfa8JwZH7LWL/Efi+y+Ma0H0M9FmmiYWCYGiV8uMLqD3DSdCSFgi+sG8tvYxF/ysmpIxfQ2YT9B4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:53.2886 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: adb98e18-c05a-45ca-a3ef-08d6b1be3c7e 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: MW2PR07MB4026 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 26 07:38: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: 10870525 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 6EFA814DE for ; Tue, 26 Mar 2019 07:39:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A61E2907B for ; Tue, 26 Mar 2019 07:39:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EA9D29087; Tue, 26 Mar 2019 07:39: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 D8A802907B for ; Tue, 26 Mar 2019 07:39:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731128AbfCZHj5 (ORCPT ); Tue, 26 Mar 2019 03:39:57 -0400 Received: from mail-eopbgr800082.outbound.protection.outlook.com ([40.107.80.82]:27204 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730935AbfCZHj5 (ORCPT ); Tue, 26 Mar 2019 03:39:57 -0400 Received: from DM5PR07CA0087.namprd07.prod.outlook.com (2603:10b6:4:ae::16) by SN2PR07MB2541.namprd07.prod.outlook.com (2603:10b6:804:7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:39:55 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::209) by DM5PR07CA0087.outlook.office365.com (2603:10b6:4:ae::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39:55 +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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39: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, 26 Mar 2019 00:39:40 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7de8k026883; Tue, 26 Mar 2019 00:39:40 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dehL026882; Tue, 26 Mar 2019 00:39:40 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 14/26] qedf: Add additional checks for io_req->sc_cmd validity. Date: Tue, 26 Mar 2019 00:38:46 -0700 Message-ID: <20190326073858.26792-15-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595950963872;(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)(396003)(346002)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(2351001)(76176011)(36756003)(6862004)(53936002)(356004)(4326008)(11346002)(476003)(2616005)(486006)(50466002)(51416003)(446003)(126002)(48376002)(336012)(5660300002)(106466001)(86362001)(2906002)(105606002)(81166006)(47776003)(1076003)(26826003)(81156014)(97736004)(54906003)(305945005)(16586007)(80596001)(85426001)(87636003)(36906005)(26005)(42186006)(316002)(8936002)(50226002)(68736007)(498600001)(8676002)(69596002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2541;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: 122e1806-71b3-45c8-7e76-08d6b1be3d5d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN2PR07MB2541; X-MS-TrafficTypeDiagnostic: SN2PR07MB2541: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: xLgvFw9Jw0tSVp9rC8Ahl5CQgv2cboCLAyFHhmcX8imDx54orTPNrUgHhSeHvRl5qSGxO6RLb3/8Mngx/fFzgv72btQ2QSXfSem362jy92JymUZMsyRLxn8gTzObwe9O6E1xGFes2XMiPiiZf6AYNiJPYPR6aAqj06kJBaMU0b7jbHLLAzgknt82PBxYg6yUvDkdTTkpUiZPCpl2bpyuOqQvlvyBJKuX8vdEnGOBp+QlLQDod5Lpy+zJYchJu4OQrdF82aHW0YooMOmZZzunjc5fFxO0Ajv8BQBXWTXdT4z47hIslAlmsjq21mhCbST3eJH3igYgY6oaTOxAFrs+6344znbe0v6Vix6weKqviBsfbofPFo6VisfQgap7yqASF3SnMH+77dssNECmsSNNhLcpa3kUHk9LTqz/IwXBrYE= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:54.7557 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 122e1806-71b3-45c8-7e76-08d6b1be3d5d 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: SN2PR07MB2541 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 ab67056..8d09cf3 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 26 07:38: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: 10870529 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 D681614DE for ; Tue, 26 Mar 2019 07:40:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C01A128FEC for ; Tue, 26 Mar 2019 07:40:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B35C829081; Tue, 26 Mar 2019 07:40:01 +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 114B928FEC for ; Tue, 26 Mar 2019 07:40:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731133AbfCZHkA (ORCPT ); Tue, 26 Mar 2019 03:40:00 -0400 Received: from mail-eopbgr720060.outbound.protection.outlook.com ([40.107.72.60]:58448 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730935AbfCZHkA (ORCPT ); Tue, 26 Mar 2019 03:40:00 -0400 Received: from DM5PR07CA0087.namprd07.prod.outlook.com (2603:10b6:4:ae::16) by BN7PR07MB5364.namprd07.prod.outlook.com (2603:10b6:408:2e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 26 Mar 2019 07:39:57 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::209) by DM5PR07CA0087.outlook.office365.com (2603:10b6:4:ae::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39:57 +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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39:56 +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, 26 Mar 2019 00:39:44 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dhnr026895; Tue, 26 Mar 2019 00:39:43 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dhxJ026886; Tue, 26 Mar 2019 00:39:43 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 15/26] qedf: Wait for upload and link down processing during soft ctx reset. Date: Tue, 26 Mar 2019 00:38:47 -0700 Message-ID: <20190326073858.26792-16-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595969426541;(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)(136003)(346002)(396003)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(6862004)(4326008)(26005)(305945005)(2351001)(50466002)(105606002)(106466001)(51416003)(48376002)(76176011)(36756003)(11346002)(446003)(476003)(2906002)(2616005)(486006)(126002)(5660300002)(47776003)(336012)(14444005)(86362001)(81156014)(81166006)(8936002)(50226002)(16586007)(42186006)(54906003)(85426001)(80596001)(69596002)(8676002)(36906005)(316002)(97736004)(1076003)(68736007)(53936002)(356004)(87636003)(498600001)(26826003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB5364;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: 79eb7ef0-1da0-42c8-0f5f-08d6b1be3e77 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB5364; X-MS-TrafficTypeDiagnostic: BN7PR07MB5364: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: No6dNnkctpzk9KsGb9AbddDTJ36YBudzoz2MeH4ul3Vmqc/kvZMd4QF4eQ7S9/U9EZZdzWOow9NkmAOP2WuR3PnFxpueAWJXjvV8LVZTBHIx0e14R474thJQXmgtFsPRmdgL0YSMPnoKSwsKA3p2TwiU8B/y17A8KiW5emAl+Cj/xxq6YX/KG9FBknJlJvfbwYHjijPt/8nZrbguvCj4IUmf53IBmh98e+GKwDbU6r+4IHdEgLiFXxxNTmdenW/U2OHnEuWCI243ujl4OjQenYJ+9mQL63GRidGaJJRjIeT3zTF6kWW10Wa3VZiqDtAZg9STCsh2d7MGaq7NgKC2A970L0C7MLKb/CFYx/KHQK+w0SNUzIOw+Glkmb9nM1MtRIjZD2lq9L5Z8z5kqCI08ikSdHKT+DY2eCkzGxIFm28= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:56.5913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79eb7ef0-1da0-42c8-0f5f-08d6b1be3e77 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: BN7PR07MB5364 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 26 07:38: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: 10870531 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 C7E2815AC for ; Tue, 26 Mar 2019 07:40:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3B2628FEC for ; Tue, 26 Mar 2019 07:40:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A789E2907D; Tue, 26 Mar 2019 07:40:02 +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 5D83528FEC for ; Tue, 26 Mar 2019 07:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731145AbfCZHkC (ORCPT ); Tue, 26 Mar 2019 03:40:02 -0400 Received: from mail-eopbgr680042.outbound.protection.outlook.com ([40.107.68.42]:60590 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731129AbfCZHkB (ORCPT ); Tue, 26 Mar 2019 03:40:01 -0400 Received: from DM5PR07CA0087.namprd07.prod.outlook.com (2603:10b6:4:ae::16) by BN3PR07MB2530.namprd07.prod.outlook.com (2a01:111:e400:c5f0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Tue, 26 Mar 2019 07:39:59 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::209) by DM5PR07CA0087.outlook.office365.com (2603:10b6:4:ae::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:39: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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:39: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, 26 Mar 2019 00:39:47 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dk7x026899; Tue, 26 Mar 2019 00:39:46 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dkD4026898; Tue, 26 Mar 2019 00:39:46 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 16/26] qedf: Add missing return in qedf_scsi_done(). Date: Tue, 26 Mar 2019 00:38:48 -0700 Message-ID: <20190326073858.26792-17-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980595991127877;(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)(346002)(396003)(136003)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(105606002)(87636003)(26826003)(48376002)(2351001)(2906002)(5660300002)(16586007)(86362001)(316002)(54906003)(106466001)(36906005)(42186006)(53936002)(498600001)(50466002)(305945005)(47776003)(81166006)(85426001)(69596002)(50226002)(1076003)(8936002)(4744005)(4326008)(486006)(80596001)(476003)(8676002)(81156014)(6862004)(68736007)(26005)(126002)(2616005)(336012)(11346002)(446003)(36756003)(51416003)(356004)(97736004)(76176011);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2530;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: b70a5815-9f5b-41b9-594c-08d6b1be3fc2 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN3PR07MB2530; X-MS-TrafficTypeDiagnostic: BN3PR07MB2530: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: 8yXlU68Q74iaXVvh+E7VApL+o1aHajL5tIeoUmg1d280bFYPUb1NIrNjeCJnwd9xYRf4S+naxT2PnEEg1mikGmrze964f+geyEEZfzVEFNhsCq/f2GpyVetQX+4Nl9ENsHZVmca5UphFsosGLpGhNdubK7ixwvhYyelYV7OWpiy7V4UCHEXo1sOAh/heQBUUSUx2AUPi7NTFlBux+MfT4x05m8PD1EtPIi/hzVBijJ78FmHU8wkO3zQz2Wcv6yXIH/LO8IqbjJ1E6L6kFIsMlMikfb0ML33jEyrtNmTVF6exlVR6xp7tXR0ZLWb/53Fo0e3lxhOZ3p1fiJxKMCi6jgDvK9JV8tbkJ+IDfpXcYZsHKOuh92oqqoSGoLapXZCHX+YZ4ScxosnGCCJ6a612PbQXSkwUuTJh02Rp0GFFogs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:39:58.7751 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b70a5815-9f5b-41b9-594c-08d6b1be3fc2 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: BN3PR07MB2530 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 8d09cf3..57c3aa4 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 26 07:38: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: 10870533 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 3756615AC for ; Tue, 26 Mar 2019 07:40:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21F7C28FEC for ; Tue, 26 Mar 2019 07:40:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 161F52907D; Tue, 26 Mar 2019 07:40: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 7E0AB28FEC for ; Tue, 26 Mar 2019 07:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731155AbfCZHkD (ORCPT ); Tue, 26 Mar 2019 03:40:03 -0400 Received: from mail-eopbgr800059.outbound.protection.outlook.com ([40.107.80.59]:5495 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731136AbfCZHkC (ORCPT ); Tue, 26 Mar 2019 03:40:02 -0400 Received: from DM5PR07CA0109.namprd07.prod.outlook.com (52.132.138.38) by SN6PR07MB5373.namprd07.prod.outlook.com (52.135.105.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:40:01 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::200) by DM5PR07CA0109.outlook.office365.com (2603:10b6:4:ae::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.19 via Frontend Transport; Tue, 26 Mar 2019 07:40:01 +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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40:00 +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, 26 Mar 2019 00:39:50 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7do4M026903; Tue, 26 Mar 2019 00:39:50 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dnnu026902; Tue, 26 Mar 2019 00:39:49 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 17/26] qedf: fc_rport_priv reference counting fixes Date: Tue, 26 Mar 2019 00:38:49 -0700 Message-ID: <20190326073858.26792-18-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596010653481;(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)(346002)(39860400002)(136003)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(305945005)(50466002)(48376002)(356004)(69596002)(80596001)(53936002)(81156014)(81166006)(8676002)(105606002)(6862004)(2351001)(85426001)(4326008)(36756003)(106466001)(47776003)(14444005)(498600001)(86362001)(1076003)(446003)(486006)(476003)(8936002)(11346002)(2616005)(126002)(5660300002)(97736004)(2906002)(42186006)(316002)(36906005)(54906003)(26826003)(87636003)(336012)(68736007)(16586007)(50226002)(26005)(76176011)(51416003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5373;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: 3dda155f-1e94-4d9c-21c0-08d6b1be40ec X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5373; X-MS-TrafficTypeDiagnostic: SN6PR07MB5373: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: VB5V6UBTh1YnyOqlWGzSeNgL1+UcE4SzHXLnlzPVYH+uEl3AdGvGrSPlz6Rlp9vRAID3Xs2aC/Gds7gq9WexpTID2prdxl0gW2x7XzwqBiSYwWd8VJ/85UdfxFbu40CaWZPg8yXeQSUgY8bHfB1RsxWlJLC++VeXD+OZUpVM3LFzB4lxsf/pKAz8vPTyxl1pw+BpVkd4ugctTVlVvxsnm9PLKKQQYKYpY1TFS+I4pjEhjAC68yPY29e+TR/KLx3wboAb4H2zq1qlvjp5NXL8JWFL/OXzkmIEGbUy5pOg2rG0bdgk3kNEQxid6fBQaNmNHBHUwcyLid41llvppHvWVh1sGELv04WbY/u8aX3EsOzBJSDgfUFjGdLBvxjYFgYzSFMEI2YwPbwMxAJMvKUIe8iti6E3fAwhaXAklFibI2Y= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:00.7260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3dda155f-1e94-4d9c-21c0-08d6b1be40ec 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: SN6PR07MB5373 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 57c3aa4..56d2116 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 26 07:38: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: 10870535 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 1A04614DE for ; Tue, 26 Mar 2019 07:40:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 036932907D for ; Tue, 26 Mar 2019 07:40:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB680290AC; Tue, 26 Mar 2019 07:40: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 5621A29094 for ; Tue, 26 Mar 2019 07:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731218AbfCZHkG (ORCPT ); Tue, 26 Mar 2019 03:40:06 -0400 Received: from mail-eopbgr800051.outbound.protection.outlook.com ([40.107.80.51]:32564 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731129AbfCZHkF (ORCPT ); Tue, 26 Mar 2019 03:40:05 -0400 Received: from BYAPR07CA0003.namprd07.prod.outlook.com (2603:10b6:a02:bc::16) by CY1PR07MB2538.namprd07.prod.outlook.com (2a01:111:e400:c636::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Tue, 26 Mar 2019 07:40:03 +0000 Received: from DM3NAM05FT018.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::204) by BYAPR07CA0003.outlook.office365.com (2603:10b6:a02:bc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15 via Frontend Transport; Tue, 26 Mar 2019 07:40: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 DM3NAM05FT018.mail.protection.outlook.com (10.152.98.127) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40:02 +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, 26 Mar 2019 00:39:53 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7drpY026907; Tue, 26 Mar 2019 00:39:53 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7drJ6026906; Tue, 26 Mar 2019 00:39:53 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 18/26] qedf: Check both the FCF and fabric ID before servicing clear virtual link. Date: Tue, 26 Mar 2019 00:38:50 -0700 Message-ID: <20190326073858.26792-19-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596032676328;(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)(346002)(136003)(396003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(2906002)(48376002)(97736004)(69596002)(85426001)(305945005)(36756003)(16586007)(5660300002)(68736007)(316002)(50466002)(76176011)(53936002)(51416003)(14444005)(54906003)(1076003)(356004)(498600001)(26826003)(8936002)(81156014)(87636003)(2616005)(86362001)(486006)(80596001)(4326008)(8676002)(42186006)(476003)(11346002)(36906005)(81166006)(126002)(336012)(50226002)(106466001)(2351001)(105606002)(47776003)(446003)(26005)(6862004);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2538;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: e9d80a6e-e31f-45b7-2c7f-08d6b1be423c X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY1PR07MB2538; X-MS-TrafficTypeDiagnostic: CY1PR07MB2538: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: bi2aZ1mtwRiaPdq2krlpOgEtSU8kgPGT36iiG+8aKRC7I+VjY02q+KkiZDejyRbsHACKPgw2wcCRH1gDd7c4rE+kPqDo+GiMr9v72ru4Dda9qfI1Xx0Aj9A7A2NXi/HrFSgJ4dqmy8D/9yPR/0e4sPOxr80cq+oYLqiu3RYS9rVYkAW4JmRZJP3tHC73ruCcWROtpVW4Ydke7zLAyIk8msRHMyjoCwbMGmVpyJEfTRmo4arirBA5Ox9PNlcDzlhIAvfEIgyw/KK0vuFaXxu8fB+Q/FmRpHdx3n+szcPLcL7r1JOhND19vHMWMpsw+Olo7qzU2bnVK/S9+d+Mnt+COKXhjcinmRBNLHUNrsw/qnQUSMAWJqlHlFK4Aaymg2Hp6jqSwvggy29XcoyLN2Q+p5Cem9Aa7h+pifQ/ZPjAlI0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:02.9263 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9d80a6e-e31f-45b7-2c7f-08d6b1be423c 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: CY1PR07MB2538 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 26 07:38: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: 10870537 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 3E69214DE for ; Tue, 26 Mar 2019 07:40:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 277EB290AA for ; Tue, 26 Mar 2019 07:40:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BB2B29094; Tue, 26 Mar 2019 07:40:09 +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 BA35529094 for ; Tue, 26 Mar 2019 07:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731223AbfCZHkI (ORCPT ); Tue, 26 Mar 2019 03:40:08 -0400 Received: from mail-eopbgr760059.outbound.protection.outlook.com ([40.107.76.59]:19270 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731129AbfCZHkH (ORCPT ); Tue, 26 Mar 2019 03:40:07 -0400 Received: from DM5PR07CA0098.namprd07.prod.outlook.com (2603:10b6:4:ae::27) by SN6PR07MB5373.namprd07.prod.outlook.com (2603:10b6:805:74::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:40:05 +0000 Received: from DM3NAM05FT017.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::205) by DM5PR07CA0098.outlook.office365.com (2603:10b6:4:ae::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18 via Frontend Transport; Tue, 26 Mar 2019 07:40:05 +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 DM3NAM05FT017.mail.protection.outlook.com (10.152.98.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40:05 +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, 26 Mar 2019 00:39:56 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7du17026911; Tue, 26 Mar 2019 00:39:56 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7durG026910; Tue, 26 Mar 2019 00:39:56 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 19/26] qedf: Don't queue anything if upload is in progress. Date: Tue, 26 Mar 2019 00:38:51 -0700 Message-ID: <20190326073858.26792-20-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596053518418;(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)(346002)(39860400002)(136003)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(305945005)(50466002)(48376002)(356004)(69596002)(6666004)(80596001)(53936002)(81156014)(81166006)(8676002)(105606002)(6862004)(2351001)(85426001)(4326008)(36756003)(106466001)(47776003)(14444005)(498600001)(86362001)(1076003)(446003)(486006)(476003)(8936002)(11346002)(2616005)(126002)(5660300002)(97736004)(2906002)(42186006)(316002)(36906005)(54906003)(26826003)(87636003)(336012)(68736007)(16586007)(50226002)(26005)(76176011)(51416003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5373;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: 84bd83d2-0050-404e-32dd-08d6b1be437a X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5373; X-MS-TrafficTypeDiagnostic: SN6PR07MB5373: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: L0zvLansqOYqqjp0YD9vr5hWj0m8mhhwnz1Kbd9f6bNq2TO9xqsnJCi50o6jg8I7+oLfVsEbrKLgxKEKZBpLdOniuq5W6wKO8FCmS+xsx3rm//r5Y/aEHGBRymqMN5gIEMDcgsOWidWcJprrR7q/BGBTseL77ysbiWRi0f3rBIrjXhk9QX+Tjemtzuj0Zm8g9CqjM7S+fnCUhW6zMr6W2S1yqZBtBFzw7J/mm9vb2OVniMlvuAzKh/QM5TkHW93ait9OAQF6Yu2vG7+e9hWuMmcRk94oR/l9VGB2fc7gq46Q7nRYjGRfKiW5XywCgsnfiyeLBZEkf3p9erP6PvuhtUbTNBnSOegmTsFoS23Uxqwk0KRRecsXdwlnrJy7or7XceKT57PXI0U5yY0tqkD3d8qttR3tl+YTzHsrmuvpUdw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:05.0100 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84bd83d2-0050-404e-32dd-08d6b1be437a 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: SN6PR07MB5373 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 56d2116..eeb96c7 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 26 07:38: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: 10870539 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 3A93B14DE for ; Tue, 26 Mar 2019 07:40:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2830029083 for ; Tue, 26 Mar 2019 07:40:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C006290AA; Tue, 26 Mar 2019 07:40: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 E16AB290B0 for ; Tue, 26 Mar 2019 07:40:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731056AbfCZHkL (ORCPT ); Tue, 26 Mar 2019 03:40:11 -0400 Received: from mail-eopbgr730070.outbound.protection.outlook.com ([40.107.73.70]:57024 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726042AbfCZHkL (ORCPT ); Tue, 26 Mar 2019 03:40:11 -0400 Received: from DM5PR07CA0033.namprd07.prod.outlook.com (2603:10b6:3:16::19) by DM6PR07MB5369.namprd07.prod.outlook.com (2603:10b6:5:44::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Tue, 26 Mar 2019 07:40:09 +0000 Received: from DM3NAM05FT029.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::203) by DM5PR07CA0033.outlook.office365.com (2603:10b6:3:16::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18 via Frontend Transport; Tue, 26 Mar 2019 07:40:09 +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 DM3NAM05FT029.mail.protection.outlook.com (10.152.98.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40:09 +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, 26 Mar 2019 00:39:59 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7dx1E026915; Tue, 26 Mar 2019 00:39:59 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7dx5W026914; Tue, 26 Mar 2019 00:39:59 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 20/26] qedf: Don't send ABTS for under run scenario. Date: Tue, 26 Mar 2019 00:38:52 -0700 Message-ID: <20190326073858.26792-21-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596094788897;(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)(376002)(346002)(396003)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(81156014)(50226002)(53936002)(26005)(86362001)(36756003)(8936002)(5660300002)(1076003)(81166006)(80596001)(8676002)(69596002)(47776003)(87636003)(26826003)(498600001)(305945005)(16586007)(51416003)(54906003)(476003)(76176011)(2906002)(50466002)(85426001)(356004)(68736007)(48376002)(6666004)(105606002)(36906005)(336012)(316002)(42186006)(6862004)(4326008)(11346002)(106466001)(126002)(97736004)(2616005)(2351001)(446003)(486006);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB5369;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: fbf027a5-a63a-4994-7a92-08d6b1be45ef X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB5369; X-MS-TrafficTypeDiagnostic: DM6PR07MB5369: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: easL+zTnl7EXPaMmVozOlOgTmD5MCsKVs5A8h8dxA8CVFatCyN8HzMBUVsDaEFY27JFN52kvmKqPypCDn9E7eI2scyrkHOq3YQ7n3tDdMQhexz4FqBni+aQp9Wq0ZzgQZUO83KLd5zgSKUpF/d+HuP5Xv2hU8r9m+pUDO3U3UsEqBjPvUImPmOo5JwZLguaMOY807tmOcgJMVDGLaXYniruR94kv2KMQwm6zyQlukYbQ3d5WY5G2cF8Yg+3sEotZ6lUxbSYKtXZetFpzqL4bUetEmBqHGZLedvr1PWvtnZLnQY0u2pQK5nUiO6USHOG6CtqYo4BwdwxzPm7Jd8ngd1CWfuq+tQrDFjt2fFcTUbKg49Dvw+Vbg1ofcGHYQclb5D2B5VUyilHxJ3vV+BguI44bBYTuHPIipwvYfSkKPoE= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:09.1390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fbf027a5-a63a-4994-7a92-08d6b1be45ef 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: DM6PR07MB5369 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 eeb96c7..889b300 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 26 07:38: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: 10870541 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 CDF0C14DE for ; Tue, 26 Mar 2019 07:40:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA6D529094 for ; Tue, 26 Mar 2019 07:40:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEC8029083; Tue, 26 Mar 2019 07:40: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 57C0A29094 for ; Tue, 26 Mar 2019 07:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731088AbfCZHkP (ORCPT ); Tue, 26 Mar 2019 03:40:15 -0400 Received: from mail-eopbgr770058.outbound.protection.outlook.com ([40.107.77.58]:41799 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726042AbfCZHkO (ORCPT ); Tue, 26 Mar 2019 03:40:14 -0400 Received: from DM5PR07CA0032.namprd07.prod.outlook.com (2603:10b6:3:16::18) by SN1PR07MB4030.namprd07.prod.outlook.com (2603:10b6:802:2b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:40:13 +0000 Received: from DM3NAM05FT029.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::205) by DM5PR07CA0032.outlook.office365.com (2603:10b6:3:16::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18 via Frontend Transport; Tue, 26 Mar 2019 07:40: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 DM3NAM05FT029.mail.protection.outlook.com (10.152.98.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40:12 +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, 26 Mar 2019 00:40:02 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7e2F7027001; Tue, 26 Mar 2019 00:40:02 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7e20j026918; Tue, 26 Mar 2019 00:40:02 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 21/26] qedf: Add a flag to help debugging io_req which could not be cleaned. Date: Tue, 26 Mar 2019 00:38:53 -0700 Message-ID: <20190326073858.26792-22-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596131276490;(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)(1109001)(1110001)(339900001)(199004)(189003)(86362001)(1076003)(8676002)(81156014)(81166006)(5660300002)(26826003)(356004)(69596002)(6862004)(48376002)(85426001)(6666004)(80596001)(87636003)(305945005)(4326008)(486006)(11346002)(446003)(8936002)(68736007)(126002)(2351001)(53936002)(476003)(51416003)(498600001)(47776003)(50226002)(106466001)(105606002)(2616005)(76176011)(336012)(36756003)(97736004)(26005)(36906005)(50466002)(316002)(42186006)(16586007)(2906002)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR07MB4030;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: a8cea6cb-e90d-4b48-b161-08d6b1be481c X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN1PR07MB4030; X-MS-TrafficTypeDiagnostic: SN1PR07MB4030: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: CPMyH8v4pcIJu8cegZED/vi0FCGYngFN7Zj/qvhE8pv8DydQ3dsygdhArCQv2xw9+gZHbv/KX59ZY46Cvhv11nLbK9q3kEoiVY7v8akzz2NVxbMe080BSRnKLkxsV+6LmOHNznUOYrPalQE0esM8mBttHPYdY/kaPJvSce7J/k/BiUnw4w3+fu2wmB1ZI2xoXPi4S/A3c3MgbYRbfEnUpU2+mHXCzrLTBWn3uCbANg8Vs0wuT21oc/hvIVhXBUBxOrUxTrnHnujnzAlLVIPp9edlWX8LHJ7dvhV0DFM76mCmR21ZjWdTVXUOhhTeEtbmfBMdzx79Y8k+//RbpHLKOE6ajBT3YVL+emBxQEMlLxGnL2TGvgozIFSj6Pdd3El6jmkw9tejXu1miIn0PGjxgTqfOWXb5wlr3N2RSWmuhBo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:12.7893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8cea6cb-e90d-4b48-b161-08d6b1be481c 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: SN1PR07MB4030 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 889b300..4a792ea 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 26 07:38: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: 10870543 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 5D4F715AC for ; Tue, 26 Mar 2019 07:40:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A8132907D for ; Tue, 26 Mar 2019 07:40:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F59C290AC; Tue, 26 Mar 2019 07:40:21 +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 DE5132907D for ; Tue, 26 Mar 2019 07:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731226AbfCZHkU (ORCPT ); Tue, 26 Mar 2019 03:40:20 -0400 Received: from mail-eopbgr720072.outbound.protection.outlook.com ([40.107.72.72]:31328 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726042AbfCZHkU (ORCPT ); Tue, 26 Mar 2019 03:40:20 -0400 Received: from DM5PR07CA0030.namprd07.prod.outlook.com (2603:10b6:3:16::16) by SN2PR07MB2543.namprd07.prod.outlook.com (2603:10b6:804:7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:40:18 +0000 Received: from DM3NAM05FT029.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::207) by DM5PR07CA0030.outlook.office365.com (2603:10b6:3:16::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18 via Frontend Transport; Tue, 26 Mar 2019 07:40:17 +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 DM3NAM05FT029.mail.protection.outlook.com (10.152.98.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40:17 +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, 26 Mar 2019 00:40:06 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7e5ic027005; Tue, 26 Mar 2019 00:40:05 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7e5hQ027004; Tue, 26 Mar 2019 00:40:05 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 22/26] qedf: Check for tm_flags instead of cmd_type during cleanup. Date: Tue, 26 Mar 2019 00:38:54 -0700 Message-ID: <20190326073858.26792-23-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596177933065;(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)(87636003)(97736004)(6862004)(48376002)(4326008)(2906002)(68736007)(53936002)(51416003)(105606002)(76176011)(476003)(5660300002)(2616005)(126002)(336012)(14444005)(486006)(26005)(4744005)(36756003)(42186006)(81166006)(8676002)(36906005)(106466001)(16586007)(54906003)(356004)(2351001)(6666004)(316002)(85426001)(446003)(86362001)(69596002)(80596001)(50466002)(305945005)(8936002)(81156014)(47776003)(50226002)(1076003)(26826003)(498600001)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2543;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: 7a9bf897-7e17-418e-c4fe-08d6b1be4ae4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN2PR07MB2543; X-MS-TrafficTypeDiagnostic: SN2PR07MB2543: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: MqYrbb+ZztTfRaojYHbcAnN2AUtNC22s4Wtjd67MerLGPM9ItrvpfP53mg30hAEd1cKgVrs7T9KmxLqu7wDr0HW5Gu+umAUziiihBtZ5k+qkRWULEclYb1JCpEleii2HL8C1Hn0x1IW3HhnxslVUut96JGiKXSE0XuILb4yrouK9aaw3Dv9TXNQwn7/pLq1e6ypoXm/wnbw69DG+7ornkhcPHdTjBLyDMgmQXLUKkuQCbRZ84RUdVCMxCInTWWs4ViaUu9lxTFM4MFtFcorqqMuuS7AUMRZxnF1Tw8+Xi92Ko1TeykjTSBxvFdTPbCSyaN5pkvRj21MQGoPUHiHhbYdWqQdMAYva4sw4DFISGbl0dNHvVXV3WgNKuoTXLx/Yo7o8Xyo9lxfZYGxL+mEk0USpmweCVrPX1DOO/wAOia0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:17.4490 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a9bf897-7e17-418e-c4fe-08d6b1be4ae4 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: SN2PR07MB2543 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 4a792ea..ca7ca8c 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 26 07:38: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: 10870545 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 99E0215AC for ; Tue, 26 Mar 2019 07:40:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84B7F29089 for ; Tue, 26 Mar 2019 07:40:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78F1F290A9; Tue, 26 Mar 2019 07:40:27 +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 A7A8C29089 for ; Tue, 26 Mar 2019 07:40:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731229AbfCZHk0 (ORCPT ); Tue, 26 Mar 2019 03:40:26 -0400 Received: from mail-eopbgr800075.outbound.protection.outlook.com ([40.107.80.75]:46816 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726042AbfCZHk0 (ORCPT ); Tue, 26 Mar 2019 03:40:26 -0400 Received: from DM6PR07CA0008.namprd07.prod.outlook.com (2603:10b6:5:94::21) by SN2PR07MB2541.namprd07.prod.outlook.com (2603:10b6:804:7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:40:22 +0000 Received: from DM3NAM05FT029.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::205) by DM6PR07CA0008.outlook.office365.com (2603:10b6:5:94::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:40: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 DM3NAM05FT029.mail.protection.outlook.com (10.152.98.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40:21 +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, 26 Mar 2019 00:40:09 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7e8rs027009; Tue, 26 Mar 2019 00:40:08 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7e80h027008; Tue, 26 Mar 2019 00:40:08 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 23/26] qedf: Cleanup rrq_work after QEDF_CMD_OUTSTANDING is cleared. Date: Tue, 26 Mar 2019 00:38:55 -0700 Message-ID: <20190326073858.26792-24-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596222087185;(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)(396003)(346002)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(2351001)(76176011)(36756003)(6862004)(53936002)(356004)(4326008)(6666004)(11346002)(476003)(2616005)(486006)(50466002)(51416003)(446003)(14444005)(126002)(48376002)(336012)(5660300002)(106466001)(86362001)(2906002)(105606002)(81166006)(47776003)(1076003)(26826003)(81156014)(97736004)(54906003)(305945005)(16586007)(80596001)(85426001)(87636003)(36906005)(26005)(42186006)(316002)(8936002)(50226002)(68736007)(498600001)(8676002)(69596002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2541;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: 81105d1c-4874-48ff-5acc-08d6b1be4d86 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN2PR07MB2541; X-MS-TrafficTypeDiagnostic: SN2PR07MB2541: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: IUtkKTWEO1UkxQ1Gu83GouKDxI5Sz+/lSGAZVEDAZelwmpmfM6qQtI05qnaKATuo5gpwfTaaN1XPZ3WfQB0n0y+zcsDvidq0Z96K/euJFPMB+83qk9pVVe7t6BcBrYJh6K+ODtB6PQkO8PZGm8qu/EsTXi4iECCXf3x52CI2O3TOVi5WA6wI0T23gY+gPrDQ185w9LkdQ+C6uMDBiiJT4FWioosROkVIWQjNvH6CNNof3kOMRaa7hle3fyN1Azjk87MrdSYch4ounZIJM8drj1bUoN2AZSytqYI9Y/JlYqsKtj+ln97DSsNqG2aOPpxeWgsAPSnz0VN2soZADIKtYetwgEanwRdovFMB1TDiUZS2xVS7df/q+c5bkyBprxzjM8OUU12+DAshCWl1h/FOC058qhHn8o63g6UqZxMqTrM= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:21.8638 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81105d1c-4874-48ff-5acc-08d6b1be4d86 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: SN2PR07MB2541 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 ca7ca8c..db5d49e 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 26 07:38: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: 10870547 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 F059E14DE for ; Tue, 26 Mar 2019 07:40:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBDB72909A for ; Tue, 26 Mar 2019 07:40:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9940290B0; Tue, 26 Mar 2019 07:40:29 +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 787A72909A for ; Tue, 26 Mar 2019 07:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731233AbfCZHk3 (ORCPT ); Tue, 26 Mar 2019 03:40:29 -0400 Received: from mail-eopbgr680068.outbound.protection.outlook.com ([40.107.68.68]:49275 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726042AbfCZHk2 (ORCPT ); Tue, 26 Mar 2019 03:40:28 -0400 Received: from DM6PR07CA0033.namprd07.prod.outlook.com (2603:10b6:5:94::46) by CY1PR07MB2539.namprd07.prod.outlook.com (2a01:111:e400:c636::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.19; Tue, 26 Mar 2019 07:40:26 +0000 Received: from DM3NAM05FT029.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::201) by DM6PR07CA0033.outlook.office365.com (2603:10b6:5:94::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16 via Frontend Transport; Tue, 26 Mar 2019 07:40: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 DM3NAM05FT029.mail.protection.outlook.com (10.152.98.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40: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, 26 Mar 2019 00:40:12 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7eCOI027013; Tue, 26 Mar 2019 00:40:12 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7eCNk027012; Tue, 26 Mar 2019 00:40:12 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 24/26] qedf: Correctly handle refcounting of rdata. Date: Tue, 26 Mar 2019 00:38:56 -0700 Message-ID: <20190326073858.26792-25-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596260509232;(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)(39860400002)(136003)(346002)(376002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(26005)(105606002)(498600001)(51416003)(87636003)(69596002)(4326008)(47776003)(80596001)(6666004)(2906002)(106466001)(50466002)(1076003)(305945005)(97736004)(53936002)(48376002)(85426001)(26826003)(6862004)(76176011)(68736007)(476003)(446003)(36756003)(126002)(86362001)(336012)(486006)(8936002)(11346002)(36906005)(316002)(5660300002)(2616005)(8676002)(54906003)(2351001)(42186006)(16586007)(50226002)(356004)(81166006)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2539;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: cc2e1daa-cf7a-4494-a0c1-08d6b1be4fd0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY1PR07MB2539; X-MS-TrafficTypeDiagnostic: CY1PR07MB2539: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: YknOpPR+o1ywxBClspl+oi0+fTrB/18ap3s7xYxpNig0IogR4BdmEYG7tPva5cmbNjMywcxWpKGAMdKpuYbjFqqqDZ68pO78JArva9KmCzgkuqU5MiaXBOxJ3ez526FdqBR7efKkcyfoag0ghtpcZZvPG96KwkB0ynx9AOIrSmEwZfN/XAymPZuT2VRpE4kUhindZv+QbCPns1r1kHsBbHMlEBMHYJ4xe6iUDPIvZ2SHeh8XJNU7/YCasXJHBYNh7Fn8pVh3RtkC5UWISEkwOaKfk1fSlOC6X4vf3nr7wH0xz4VnBZQEEfaQO5kpT1F2IrsZKvIxSAcyinanrQsM4EQqE6YKsAtRTWwQ85kJg6h8kKTrk8GkmqzWO51fqwU/62/h857jeCVbcLzaXZ+1s0OMYpfyQatgrDAk6tZ1S5s= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:25.7124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc2e1daa-cf7a-4494-a0c1-08d6b1be4fd0 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: CY1PR07MB2539 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 db5d49e..b359ae3 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 26 07:38: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: 10870549 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 5240115AC for ; Tue, 26 Mar 2019 07:40:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D63B2908C for ; Tue, 26 Mar 2019 07:40:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AF6629092; Tue, 26 Mar 2019 07:40: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 CE93D28FEC for ; Tue, 26 Mar 2019 07:40:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730587AbfCZHkb (ORCPT ); Tue, 26 Mar 2019 03:40:31 -0400 Received: from mail-eopbgr690073.outbound.protection.outlook.com ([40.107.69.73]:54034 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726042AbfCZHkb (ORCPT ); Tue, 26 Mar 2019 03:40:31 -0400 Received: from DM6PR07CA0003.namprd07.prod.outlook.com (2603:10b6:5:94::16) by DM5PR07MB4022.namprd07.prod.outlook.com (2603:10b6:4:b2::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Tue, 26 Mar 2019 07:40:29 +0000 Received: from DM3NAM05FT029.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::206) by DM6PR07CA0003.outlook.office365.com (2603:10b6:5:94::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:40: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 DM3NAM05FT029.mail.protection.outlook.com (10.152.98.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40: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, 26 Mar 2019 00:40:15 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7eFZV027017; Tue, 26 Mar 2019 00:40:15 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7eFKX027016; Tue, 26 Mar 2019 00:40:15 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 25/26] qedf: Fix lport may be used uninitialezed warning. Date: Tue, 26 Mar 2019 00:38:57 -0700 Message-ID: <20190326073858.26792-26-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596296190103;(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)(39860400002)(376002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(51416003)(86362001)(76176011)(498600001)(87636003)(26826003)(5660300002)(126002)(476003)(486006)(36906005)(42186006)(446003)(11346002)(16586007)(316002)(2616005)(336012)(8676002)(1076003)(97736004)(305945005)(26005)(81156014)(81166006)(54906003)(14444005)(68736007)(85426001)(2906002)(6666004)(36756003)(356004)(69596002)(80596001)(6862004)(50226002)(105606002)(53936002)(106466001)(2351001)(50466002)(8936002)(48376002)(4326008)(47776003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB4022;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: 0781e69c-e984-4b9b-3a37-08d6b1be51f1 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM5PR07MB4022; X-MS-TrafficTypeDiagnostic: DM5PR07MB4022: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: nFcviLax7hDrR4rfTTOj3ON8a/2+NccLneolJfrZn/1q37tmqw5Qyyiv1Ug1junQJisPDkPzbs5UayBwSsY3n1BI95+94i5qILx227g8xVbm+xLF2gWo4zkfsfdp7oExMrHx9GD2m28b7kCmSt3yzqYy7kKTBK0mvZ3fRj9TdDK42skgBJDR8Sykjl6JQOgyoNlj0XIAJqnkC3seyDzOmX42ulrQ7aNX3+KMf8eTaF2C2u1SzfJ4cfQtde5/y7D3NaZzjBKDow3LKd+3ZGP1R9h9Wo0/fh5NbJ7x7/JFKEhEFKX+YRTIQ0YaHJfpOvjpIxFMIzj0C9Hhxx7mORAGKLdfhiayxVC9N5zbxhdn+OP1MJOWjHY2ZIcfRj34604sw35nt7iDay9huzP8RUYpaQO7mTDrgivED7odOpHp7Co= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:29.2802 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0781e69c-e984-4b9b-3a37-08d6b1be51f1 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: DM5PR07MB4022 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 b359ae3..51378e5 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 26 07:38: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: 10870551 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 5EE4015AC for ; Tue, 26 Mar 2019 07:40:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC7F290B2 for ; Tue, 26 Mar 2019 07:40:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FC102909A; Tue, 26 Mar 2019 07:40: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 E6101290AC for ; Tue, 26 Mar 2019 07:40:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730605AbfCZHkg (ORCPT ); Tue, 26 Mar 2019 03:40:36 -0400 Received: from mail-eopbgr810058.outbound.protection.outlook.com ([40.107.81.58]:56675 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726042AbfCZHkg (ORCPT ); Tue, 26 Mar 2019 03:40:36 -0400 Received: from BYAPR07CA0041.namprd07.prod.outlook.com (2603:10b6:a03:60::18) by SN1PR07MB4031.namprd07.prod.outlook.com (2603:10b6:802:2b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Tue, 26 Mar 2019 07:40:34 +0000 Received: from DM3NAM05FT021.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::205) by BYAPR07CA0041.outlook.office365.com (2603:10b6:a03:60::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 26 Mar 2019 07:40:33 +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 DM3NAM05FT021.mail.protection.outlook.com (10.152.98.130) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1750.4 via Frontend Transport; Tue, 26 Mar 2019 07:40: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, 26 Mar 2019 00:40:18 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2Q7eI6o027021; Tue, 26 Mar 2019 00:40:18 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2Q7eIaD027020; Tue, 26 Mar 2019 00:40:18 -0700 From: Saurav Kashyap To: CC: , Subject: [PATCH v2 26/26] qedf: Update the driver version to 8.37.25.19. Date: Tue, 26 Mar 2019 00:38:58 -0700 Message-ID: <20190326073858.26792-27-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190326073858.26792-1-skashyap@marvell.com> References: <20190326073858.26792-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131980596336503019;(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)(396003)(39860400002)(376002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(356004)(6862004)(4326008)(76176011)(36906005)(14444005)(51416003)(53936002)(68736007)(6666004)(8936002)(50226002)(26005)(42186006)(87636003)(54906003)(26826003)(498600001)(16586007)(316002)(11346002)(80596001)(36756003)(15650500001)(50466002)(336012)(85426001)(47776003)(48376002)(69596002)(305945005)(126002)(446003)(2616005)(8676002)(81156014)(486006)(1076003)(4744005)(2351001)(81166006)(86362001)(2906002)(105606002)(5660300002)(106466001)(476003)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR07MB4031;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: 8ae90f72-dff5-4291-be24-08d6b1be5457 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN1PR07MB4031; X-MS-TrafficTypeDiagnostic: SN1PR07MB4031: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09888BC01D X-Microsoft-Antispam-Message-Info: Qpgcr149LAprJ8pujQaLUtGuD6i9em7qKQKDeRTSTrEuGsOZSEga/mfE8DmNmCbmmW8HH+3tcNUkmnntAgQunhcnCdD4OboxhZ+0gIUr5MhruYesYBTW5YaDLCxjL7h4S9hpKsgG/V83qhqwQ3PSLpf2L41P3g82+Ym3cU4tLguAH6PO1YM3VsPKsJTUi3n7sGYyDL+aotrm3nVHaFEQj0ql7qpML04tL5tFkqnu4Bku3dyt1hZ7iCHioP3dhZGptsPwNj8ZVY3biZw7ieFx5UuPmXtt364eKiokYuk1lwR/Xx9cTtrFMR62V6lttGyfw6zGIq1Cp5+xBlssy14NSNNp8ITmHaA059FGSLgHaprkFv9u269pYYm+CISpm5kkV+FPvT71GjZtxAwmm7eEnrAZFEkibOLCQwkctTcX7p8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2019 07:40:33.3130 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ae90f72-dff5-4291-be24-08d6b1be5457 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: SN1PR07MB4031 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