From patchwork Tue Mar 5 10:58:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 530AE1803 for ; Tue, 5 Mar 2019 10:59:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FB372B2A9 for ; Tue, 5 Mar 2019 10:59:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33E352B352; Tue, 5 Mar 2019 10:59:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7EC72B2A9 for ; Tue, 5 Mar 2019 10:59:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727474AbfCEK7g (ORCPT ); Tue, 5 Mar 2019 05:59:36 -0500 Received: from mail-eopbgr700083.outbound.protection.outlook.com ([40.107.70.83]:56622 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727432AbfCEK7g (ORCPT ); Tue, 5 Mar 2019 05:59:36 -0500 Received: from BYAPR07CA0018.namprd07.prod.outlook.com (2603:10b6:a02:bc::31) by SN6PR07MB4766.namprd07.prod.outlook.com (2603:10b6:805:3c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:34 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by BYAPR07CA0018.outlook.office365.com (2603:10b6:a02:bc::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:34 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:34 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:30 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x25AxUOf013260; Tue, 5 Mar 2019 02:59:30 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxUXw013259; Tue, 5 Mar 2019 02:59:30 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 10/26] qedf: Check for link state before processing LL2 packets and send fipvlan retries. Date: Tue, 5 Mar 2019 02:58:45 -0800 Message-ID: <20190305105901.13185-11-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571743296825;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(136003)(396003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(81156014)(81166006)(51416003)(16586007)(69596002)(26826003)(53936002)(356004)(498600001)(86362001)(8676002)(87636003)(6862004)(36906005)(47776003)(305945005)(6666004)(80596001)(316002)(26005)(5660300002)(54906003)(76176011)(2906002)(42186006)(126002)(50226002)(336012)(446003)(48376002)(97736004)(486006)(105606002)(2616005)(476003)(11346002)(50466002)(36756003)(85426001)(106466001)(2351001)(4326008)(68736007)(8936002)(1076003)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB4766;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d56900fb-a8f1-4f66-af08-08d6a159a6de X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB4766; X-MS-TrafficTypeDiagnostic: SN6PR07MB4766: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB4766;23:MVLPNu2bX9wK542fVFMd2cRQjtG7CKafSzCuiObpp8OPEWgkXw2osbmxGLK5yVkd53+ebOOlaJrZ9pmygCsD8tkoZwlt2b/isgqk5Ky/taFLEScl+gHQI9HB5PA6KGtfD4o7gRoR/RMAi2msGEuNU2gKhcbj/WpTQFavb1kD0upRGqUX1HOoDGhLUn4pr4B4u+OFGR7Q0qBYyVz0IVEthY1zGT7p+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info: /2gPBXwoGXB4HVoJTZsPYMoEvU5nM6PdU+ZGFpDg9BiA4eBXAtFffVsFCHc2Cg2GKkGsXOmhDrkQ4TaICSq9xfEZ1JGJ7kn3JhEpTF3r2DagqoWFeKy1KficfZRIvNjh28VFAxZIsw0/DBONOOU9Y/K2tWzOxO4xHQyCMVC7k/MnWBK0POW+LJrjHemjRDTG9XS5QcQPwUa5qnYBB60Szp69TUPTLTZuKufBkC9sPkj4tFQhCOCUebloY9mAr/S+e4LtrCMRcSkxA7NEuRricKFz+y1fHoWLeqiq5ChOf6IRZxf8+4E/JaTfCHgNLJWiIdWJUSzlayaWENF9yelV4w9TW650RbqTun45hubCvpOQhlxnsYGCmOWK6JlzmzNR6WHOY/kEXjXjfP0+mM5AYgk8HRXNAEi4B5TBP+WiQ0A= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:34.0777 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d56900fb-a8f1-4f66-af08-08d6a159a6de X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4766 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - Check if link is UP before sending and processing any packets on wire. Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_fip.c | 6 ++++++ drivers/scsi/qedf/qedf_main.c | 28 ++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c index 3fd3af7..e669679 100644 --- a/drivers/scsi/qedf/qedf_fip.c +++ b/drivers/scsi/qedf/qedf_fip.c @@ -95,6 +95,12 @@ static void qedf_fcoe_process_vlan_resp(struct qedf_ctx *qedf, rlen -= dlen; } + if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, + "Dropping VLAN response as link is down.\n"); + return; + } + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "VLAN response, " "vid=0x%x.\n", vid); diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index dee6fef..f84552e 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -124,21 +124,24 @@ static bool qedf_initiate_fipvlan_req(struct qedf_ctx *qedf) { int rc; - if (atomic_read(&qedf->link_state) != QEDF_LINK_UP) { - QEDF_ERR(&(qedf->dbg_ctx), "Link not up.\n"); - return false; - } - while (qedf->fipvlan_retries--) { + /* This is to catch if link goes down during fipvlan retries */ + if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) { + QEDF_ERR(&qedf->dbg_ctx, "Link not up.\n"); + return false; + } + if (qedf->vlan_id > 0) return true; + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Retry %d.\n", qedf->fipvlan_retries); init_completion(&qedf->fipvlan_compl); qedf_fcoe_send_vlan_req(qedf); rc = wait_for_completion_timeout(&qedf->fipvlan_compl, 1 * HZ); - if (rc > 0) { + if (rc > 0 && + (atomic_read(&qedf->link_state) == QEDF_LINK_UP)) { fcoe_ctlr_link_up(&qedf->ctlr); return true; } @@ -159,6 +162,12 @@ static void qedf_handle_link_update(struct work_struct *work) rc = qedf_initiate_fipvlan_req(qedf); if (rc) return; + + if (atomic_read(&qedf->link_state) != QEDF_LINK_UP) { + qedf->vlan_id = 0; + return; + } + /* * If we get here then we never received a repsonse to our * fip vlan request so set the vlan_id to the default and @@ -2412,6 +2421,13 @@ static int qedf_ll2_rx(void *cookie, struct sk_buff *skb, struct qedf_ctx *qedf = (struct qedf_ctx *)cookie; struct qedf_skb_work *skb_work; + if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) { + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_LL2, + "Dropping frame as link state is down.\n"); + kfree_skb(skb); + return 0; + } + skb_work = kzalloc(sizeof(struct qedf_skb_work), GFP_ATOMIC); if (!skb_work) { QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate skb_work so "