From patchwork Thu Mar 22 17:10:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10301959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E66EF605F3 for ; Thu, 22 Mar 2018 17:13:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4CF42881C for ; Thu, 22 Mar 2018 17:13:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A291A28837; Thu, 22 Mar 2018 17:13:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5B99028857 for ; Thu, 22 Mar 2018 17:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hSg2tJJWa1RdJREDZjCN3RCQXiKkXuAPoUpEdJQZBDU=; b=YwJcrbUWOML6rJ rDHEo+3fih+f7KIBLawd4PXtrUu0PDev6GnaO+pP0HAmlCHTm0EQXPG501SZIU2VvbYl5itymnOC5 YUFNbWQT/dZ3WGHBcd6HMU/U5d3WHo/E7lq2gKp5FfIkk6Tv29KL2TqC1SoGxBVZhBeAbKCKP2Vtu DXmsi3HYQpjtQo9xxW8r7EZ9cVyAJLsKlYriIDwJuKoEYhJdnHo/OpHlAiLt+UgIYZ2W5w7UFp8sq Kj6zihydewHvwyR7JogKIHo2Yuq068EZp+dVgpcLHgvcHKJcRIxJPBVycD6N+eecTzs0sdyScQqMk wypQtXhWZrN0eRZ928Vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ez3l6-0000Lt-NS; Thu, 22 Mar 2018 17:12:12 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ez3jT-0007oZ-9N for linux-arm-kernel@lists.infradead.org; Thu, 22 Mar 2018 17:10:36 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5213B60F8F; Thu, 22 Mar 2018 17:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521738617; bh=fhgmTYymUEqMW7E8+GmLYIdCqwADNl4j47AuHx88DJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJJ/tAZQOMBe29q6+jQUsituO+YqODQQg6O9PtvTdVYvPEK5ajpgBN+JB4l5Hxx+G 7ssw/cftCUUoT6WLlDTnS6DWHFHMxFD9o6QHxV8W2m3bqjjoMOA2NJx9BdpiirTS2C Jv3E8/QEyr1SMGCBdsX7inM4TjORbF8fujTr8T70= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 830DA6030F; Thu, 22 Mar 2018 17:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521738616; bh=fhgmTYymUEqMW7E8+GmLYIdCqwADNl4j47AuHx88DJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2q8XWPOAb5vU2LiNXsllHwFGsDbG4gDkJ+H1gqjMjhy5nWr4J3jXtULSDN+ne4PM O+xn6XMG1Ln1TSl6kuy3mJAiilozu2KzqyzhuHHK7Fiak+Tz8XABwYir/Zmbqck8aR z+Zc0Z22GIXc5gbq5LJyVdBq1V45HYCzpEU+Qe70= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 830DA6030F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: netdev@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org Subject: [PATCH v5 5/5] bnxt_en: Eliminate duplicate barriers on weakly-ordered archs Date: Thu, 22 Mar 2018 13:10:02 -0400 Message-Id: <1521738603-23596-6-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521738603-23596-1-git-send-email-okaya@codeaurora.org> References: <1521738603-23596-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180322_101032_084104_EF440749 X-CRM114-Status: GOOD ( 13.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sinan Kaya , linux-arm-msm@vger.kernel.org, Michael Chan , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Code includes wmb() followed by writel(). writel() already has a barrier on some architectures like arm64. This ends up CPU observing two barriers back to back before executing the register write. Create a new wrapper function with relaxed write operator. Use the new wrapper when a write is following a wmb(). Since code already has an explicit barrier call, changing writel() to writel_relaxed(). Signed-off-by: Sinan Kaya --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 1500243..befb538 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1922,7 +1922,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) /* Sync BD data before updating doorbell */ wmb(); - bnxt_db_write(bp, db, DB_KEY_TX | prod); + bnxt_db_write_relaxed(bp, db, DB_KEY_TX | prod); } cpr->cp_raw_cons = raw_cons; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 1989c47..5e453b9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1401,6 +1401,15 @@ static inline u32 bnxt_tx_avail(struct bnxt *bp, struct bnxt_tx_ring_info *txr) ((txr->tx_prod - txr->tx_cons) & bp->tx_ring_mask); } +/* For TX and RX ring doorbells with no ordering guarantee*/ +static inline void bnxt_db_write_relaxed(struct bnxt *bp, void __iomem *db, + u32 val) +{ + writel_relaxed(val, db); + if (bp->flags & BNXT_FLAG_DOUBLE_DB) + writel_relaxed(val, db); +} + /* For TX and RX ring doorbells */ static inline void bnxt_db_write(struct bnxt *bp, void __iomem *db, u32 val) {