From patchwork Tue Mar 5 10:58:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C33D217E4 for ; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B16602B352 for ; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5D7C2B360; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 472E52B2A9 for ; Tue, 5 Mar 2019 10:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727451AbfCEK7c (ORCPT ); Tue, 5 Mar 2019 05:59:32 -0500 Received: from mail-eopbgr730071.outbound.protection.outlook.com ([40.107.73.71]:37511 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727439AbfCEK7c (ORCPT ); Tue, 5 Mar 2019 05:59:32 -0500 Received: from BYAPR07CA0018.namprd07.prod.outlook.com (2603:10b6:a02:bc::31) by DM6PR07MB4377.namprd07.prod.outlook.com (2603:10b6:5:bf::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:30 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::209) by BYAPR07CA0018.outlook.office365.com (2603:10b6:a02:bc::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1665.18 via Frontend Transport; Tue, 5 Mar 2019 10:59:29 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:29 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:27 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x25AxQwx013252; Tue, 5 Mar 2019 02:59:26 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxQHd013251; Tue, 5 Mar 2019 02:59:26 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 08/26] qedf: Correct the memory barriers in qedf_ring_doorbell. Date: Tue, 5 Mar 2019 02:58:43 -0800 Message-ID: <20190305105901.13185-9-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571699184746;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(376002)(346002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(2906002)(81166006)(356004)(8936002)(80596001)(8676002)(6666004)(81156014)(68736007)(26005)(97736004)(48376002)(4326008)(6862004)(50466002)(50226002)(53936002)(486006)(1076003)(2616005)(69596002)(85426001)(126002)(476003)(105606002)(498600001)(106466001)(26826003)(36906005)(446003)(54906003)(47776003)(87636003)(16586007)(2351001)(76176011)(42186006)(86362001)(336012)(11346002)(5660300002)(51416003)(36756003)(14444005)(316002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4377;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a57c4e1-8012-4b46-6f24-08d6a159a43d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM6PR07MB4377; X-MS-TrafficTypeDiagnostic: DM6PR07MB4377: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4377;23:8fiALP9Q8I1FCXRqtbTRil9SjCc787ZTCKPAEXXFypRsMvIFioVUb5HLaOf5ZSAtKrOXmtOBWW1Nl5Z/Zxn2RiYRsRGNCpEXBzENSvGTTFu7BH3XYEh7mDE+a4jbOs5mHx0rLav0zX4+1WN/3VZzkHwFZvr4+u0LFxnhMGAW1OEb9W9BTExzT3nUIP0AcbS921KT8NT+7wKBvAz5AqxV4q9HTgg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Message-Info: 7GN6WCWJn2eSuQPjsDHfs9yJjoeL3jCU4LLmdcyU4PNKnbQ/txjD1Epf1wRL4ROPP2OjsThGTvWIYRXsMaqSb3YROLWXyGNr26qkWRWb9qOSQgjyfS99HcLWOrcPsOgQHhDeDk8rnk78ZEHgqLbaHvV69bXTwFFQghj/6EysceJpsogDt+HiTHXpm8kKdEnJTsNP9/FfK6V5Ao+aZBEQ6USoauHA5R8nMnczqjuKfD0i7KWsRdorH8Sb+oGzbPnB7cIk324t79RTk6OZL/2QvVRX1oKc6AQpteAT8nAQtelUSgnFVxdnLEQ3aiyzV97knFeTkxV3e9iktgR55hG/QjIb495ip290nNSvbrEZzzSZhxsK+oWwq0gV4QzAvjTPgkhPX6/ttyGDNmqJWix1Dt7dLwlv9Z7Qbjr9fxLs5kg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:29.6706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a57c4e1-8012-4b46-6f24-08d6a159a43d X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4377 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andrew Vasquez - Correct memory barriers to make sure all cmnds are flushed. Signed-off-by: Andrew Vasquez Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_io.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 1a36ab5..f04191f 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -773,10 +773,18 @@ void qedf_ring_doorbell(struct qedf_rport *fcport) FCOE_DB_DATA_AGG_VAL_SEL_SHIFT; dbell.sq_prod = fcport->fw_sq_prod_idx; + /* wmb makes sure that the BDs data is updated before updating the + * producer, otherwise FW may read old data from the BDs. + */ + wmb(); + barrier(); writel(*(u32 *)&dbell, fcport->p_doorbell); - /* Make sure SQ index is updated so f/w prcesses requests in order */ + /* + * Fence required to flush the write combined buffer, since another + * CPU may write to the same doorbell address and data may be lost + * due to relaxed order nature of write combined bar. + */ wmb(); - mmiowb(); } static void qedf_trace_io(struct qedf_rport *fcport, struct qedf_ioreq *io_req,