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,