Received: by 10.213.65.68 with SMTP id h4csp750962imn; Fri, 23 Mar 2018 15:25:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELvzPjBYiC8zH9qfTIn3wbdI4su9bhz1IWpx3wCQWDO7L03ZRd98mtjroO30KZ1vJfEUiNNQ X-Received: by 10.98.178.207 with SMTP id z76mr16013187pfl.37.1521843904424; Fri, 23 Mar 2018 15:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521843904; cv=none; d=google.com; s=arc-20160816; b=F3WbosJLh8lizFrywTrX/l11hO3TsfBUSsW3Y5EHqqNaqtO5uEFD9RgvyTds2ZGCH0 5hHfXakm+WrMWJmpv2U0dzkMYFMiO0y5HHEh4N7hmjPloWcQ6m3Ez9pTEqC6J/xn9MLW /OU+AFTO9HIkFIRerWFIAsnXk0+fSUxPGfWhlVHmG6StgYVMRXXa4Y9DhXQMXoxLHpr4 ohRRjb76raX/B3x8yvmlGhou0ExK0ETCEgo+tJiKshUSidRBhwVaIYk11Kl+woWF9mys GxPV47zuaK+k+rOrMISTaNCQxXQjT5t3rcUf5pbe3TCFYbcSW4x4PbCXBX0XfOxs/IoT DSVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=62pCVr2WbybHRBNNt3l7AaGAtZ7nzem6crHl0UsWRBg=; b=rDJzMQcHtTgNXLio2Yr0jyBJm3XxsKMeHXyQNttuEQElzxeeH0LmCCS9y9qayKrRUH 7DfUEr/O2BVgezJNeErV8Y2/I2yDn8Z37u1mTzJK3v3ANZ0yLkVdfL+BcKBZi4v05cbM u+Amvn3pKYwARN0eiLpgDBNCfc4Pop1SL6ao1pm8Y9G/j7v2FN4clcByEF5JP3/oTcwQ YTG2jcxzakU4IPRQYgjBwfjyW4pvFFoVleasjkEcENsNPj3f2GAJ2cWkJ3xKHHMliBwU DY0YBMiDdUzVnGsuMHhC6rZSaCfmXXBbSr5XltUhTEwh3WKPc2mEE99lxo/R9wrdM+kN 1cTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=OJaCkBvI; dkim=pass header.i=@codeaurora.org header.s=default header.b=VdAb4xRk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 73si3058492pgg.68.2018.03.23.15.24.49; Fri, 23 Mar 2018 15:25:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=OJaCkBvI; dkim=pass header.i=@codeaurora.org header.s=default header.b=VdAb4xRk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752546AbeCWWXu (ORCPT + 99 others); Fri, 23 Mar 2018 18:23:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:35916 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440AbeCWWX1 (ORCPT ); Fri, 23 Mar 2018 18:23:27 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 063B560F61; Fri, 23 Mar 2018 22:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521843806; bh=D96YlfEiyLWZM1uPPaglTZrrOTW2zgYr9TxIgng2H24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OJaCkBvIryV3AwCXUaBIeDW2+tddhd/E07dDVAD++AcKHCBNyTvVhZzCQE9fJr0bN 1S9LNivi5/s0lMBpUV5YLO7mWlAH/ZiMEDBzRhctkPKxeMGS+6kBkbKEHhw06SAIMB gighIoHB7TPFvKCLr146ELaHfpYkDfm8V3GP/Tv8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 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 5426B60F6D; Fri, 23 Mar 2018 22:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521843805; bh=D96YlfEiyLWZM1uPPaglTZrrOTW2zgYr9TxIgng2H24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VdAb4xRk6XhHA2ZgC63jyDTUhkmxKqbF0FgvGEE2iEbBf6/l0hxjq0mwGxjOaLH+t Nhqax7PgHvR6STu3JA0rMHPeSGxUD4GxFLYmaB2MFkVX+V0skNrRAuuTe+ksKKsNoz IZd3ETWkKWL9zfwbTreDc6Gcl3TCL4y1Gt2lYKWY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5426B60F6D 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 Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Michael Chan , linux-kernel@vger.kernel.org Subject: [PATCH v6 6/6] bnxt_en: Eliminate duplicate barriers on weakly-ordered archs Date: Fri, 23 Mar 2018 18:23:11 -0400 Message-Id: <1521843791-21201-7-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521843791-21201-1-git-send-email-okaya@codeaurora.org> References: <1521843791-21201-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). Also add mmiowb() so that write code doesn't move outside of scope. Signed-off-by: Sinan Kaya --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 1500243..fc8ea0d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1922,7 +1922,8 @@ 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); + mmiowb(); } 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) { -- 2.7.4