Received: by 10.213.65.68 with SMTP id h4csp587388imn; Sun, 25 Mar 2018 07:43:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELugPc17MX/GpXNa1ik/LTr8gL0sD+elsjSYOlmAcy66s+Q4dvnh8wlg6RZb2Iyw6V+920S4 X-Received: by 10.101.91.133 with SMTP id i5mr25899171pgr.249.1521988980778; Sun, 25 Mar 2018 07:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521988980; cv=none; d=google.com; s=arc-20160816; b=GuggsEbpj13IqMG2YHg//Xee1t4ZHTVhoaTfBm6KX5VngfM1yRQnqOeS8jQpXWUISj l7SunC/7TmJgqZgeoe17QMPNjK5vbEEMp1UPkD4cem61uVZQTt8DYjrBkfe2qozxGqcG 5rhkikdKzYPYCGq7aKoh3K30XDCZlzNTiw924xgf1brS6NJQgHASwonkYj9ZBKtW5VWm 28to8yzg/iMin7AvoaXwam9jrjVSTZjqOcJGV0ZwrOnJTDvidT1uorzer7XnQoS9ydTD B3/T+wGwww3Z8c9lCAIJkDDdiw8d5HHJD5XnOB4hjEEFZ/2LPdH5uNw0k6N4eC3NQ6ep 12wA== 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=K93sIxJaPER5CBymOo3R1NJXJWj681X9ZFCCgYwvgoc=; b=sMcjwYShbgFAzaqNvDBfD0XJpMxZW+zv2q5MpvyiQicFaViyen2xHieCeQbyCamj1K Jai1TEqdgtjURlf8owxZM21ye3+kL8q0laN/BruqZkEiszckQjykg1CD9rl5IKMfak5C hiCFo6JHZ/wiB5JQcdJ029OwbmYr8UVs8XWjSmHJM7NUQGdQ0Nr0bAZVT6bm6HTRuTYM TpdQ7FXmcu45PLbQ93/S2gwyttirNmE+uwM1R1xNIpCGNiN34UnMYegyX62FVlaLEuOG V92VYkd2eUo6yQ2FcvdOc/RLVOVCeq+kKNdFnc4VTceSjwhpGyT4rDtZbFtjSw/1Fruw j20g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=g/tgS8gt; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZxfSUTwD; 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 134si6296407pge.565.2018.03.25.07.42.46; Sun, 25 Mar 2018 07:43:00 -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=g/tgS8gt; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZxfSUTwD; 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 S1753633AbeCYOlE (ORCPT + 99 others); Sun, 25 Mar 2018 10:41:04 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59468 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753433AbeCYOjh (ORCPT ); Sun, 25 Mar 2018 10:39:37 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2A9E260590; Sun, 25 Mar 2018 14:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521988777; bh=dJLe4crswKcKInp5/XACikj5cN1X8z4XG7UnJF8YLMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/tgS8gtHuhkiT8q3oZRWfQhM+r3hIFDhfq3dAlgxO7ke/qeWLexREZqvln063bsD /wHBxFrqDqU/1GWA4kb7HoDG/IGHOcd4LNmH8sxMHA5+OOsauvoFZwlDkDOmuG334d Mg9uunIbx5iJcC/Zuj4r5NTXdNrUjxSe8VdtbnQU= 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 8E1C160F8D; Sun, 25 Mar 2018 14:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521988775; bh=dJLe4crswKcKInp5/XACikj5cN1X8z4XG7UnJF8YLMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZxfSUTwD7GSQqjatqmqjlk/2UbGb6o6lqhsBpi+d/mnGqAKyU5WKTTKcnDo/w8G4W VirLY+/wUB2+K9U0GHZAuvy17B2Hzo7Oms6nv+9FK0TCr163uwMJvgTcHrRzaMgtP0 aTt+3Ud44harB/YVrePr+kAsXBPvwMK1lo9l4oN8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8E1C160F8D 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 v7 6/7] bnxt_en: Eliminate duplicate barriers on weakly-ordered archs Date: Sun, 25 Mar 2018 10:39:20 -0400 Message-Id: <1521988761-30344-7-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521988761-30344-1-git-send-email-okaya@codeaurora.org> References: <1521988761-30344-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 | 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) { -- 2.7.4