Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3077218pxu; Mon, 19 Oct 2020 03:24:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8XoC4dGtGNPRSizRcmaGdMbKVwiGB4E2/GlCiJc1fVwhZS/PdaEFHHh/sP1C7ZGtTVnRA X-Received: by 2002:a05:6402:124a:: with SMTP id l10mr17067175edw.99.1603103058122; Mon, 19 Oct 2020 03:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603103058; cv=none; d=google.com; s=arc-20160816; b=Nr7zt4Xp0ZJ4z9cISoDfdg0UmVeomVD3ORBpE19L0UaDnHLE7MGiQAI6AmWJd59X9W 5gFiSxD5uYqIjQEm7LBUJWO8fGKlEmFlR8723Pau32+0mdWE9Qf5vXumh+lPGn1DyhtW UKy3BNv0R3z7niAD/Od2F76nNyk68UkoOKBKgWU/b/mWt392RmkxPn7LTrRHhn4XwrSY M3txZ23WEY6rwpnThohWiNfa80HPtgCq93Z8kJnrxC0DQ8haIvsFD7KDrju+shg5jXg4 JA8Msyboe1F5KwzbqB8CpNXH98RqVmM8p5E1ELoH70pa79FeAbrDvQDrWJq5gUA6Vi69 X0PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=o/DLD8UyJT+ZeXB7TqEENl6KdTGLokiQR4X8974K7DE=; b=kPo6S2sgOKkV0iC2iXvP2erAMaob5sY8th21njZsiUaq3AmULMVh8XC0AnmMVgHvkN QUgtokUS1eDjRXCWnfIa+ILdBXC7ImEQ3ByLX9CN6I4T+hyFAa48ghz3NGpz+vcTPvEs oLeaT0R+9A4j2cwPDWLKCYf/rkS/Xvh3eqvPii9TxxdSNist71tt+QFZ+bREVYPV1Ciu gcYTQ8cnxdebnN87LJDT3zhtSODxg2QYTXQeDE3QIZvN/DV7dFfbmvTPE+oHcLFHjhQn mlNqIIBSBdj2sluB8mlP3GkwjED+e9HGkhenO2RuTBtfF7cMNi4k6Yfou2BbyzLU4tQd qjtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si2475836ejk.48.2020.10.19.03.23.54; Mon, 19 Oct 2020 03:24:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727801AbgJSHjw (ORCPT + 99 others); Mon, 19 Oct 2020 03:39:52 -0400 Received: from twspam01.aspeedtech.com ([211.20.114.71]:48121 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727768AbgJSHjw (ORCPT ); Mon, 19 Oct 2020 03:39:52 -0400 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 09J7anxl039002; Mon, 19 Oct 2020 15:36:49 +0800 (GMT-8) (envelope-from dylan_hung@aspeedtech.com) Received: from localhost.localdomain (192.168.10.9) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 19 Oct 2020 15:39:25 +0800 From: Dylan Hung To: , , , , , , CC: Subject: [PATCH] net: ftgmac100: Fix missing TX-poll issue Date: Mon, 19 Oct 2020 15:39:08 +0800 Message-ID: <20201019073908.32262-1-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.10.9] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 09J7anxl039002 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpu accesses the register and the memory via different bus/path on aspeed soc. So we can not guarantee that the tx-poll command (register access) is always behind the tx descriptor (memory). In other words, the HW may start working even the data is not yet ready. By adding a dummy read after the last data write, we can ensure the data are pushed to the memory, then guarantee the processing sequence Signed-off-by: Dylan Hung --- drivers/net/ethernet/faraday/ftgmac100.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 00024dd41147..9a99a87f29f3 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -804,7 +804,8 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb, * before setting the OWN bit on the first descriptor. */ dma_wmb(); - first->txdes0 = cpu_to_le32(f_ctl_stat); + WRITE_ONCE(first->txdes0, cpu_to_le32(f_ctl_stat)); + READ_ONCE(first->txdes0); /* Update next TX pointer */ priv->tx_pointer = pointer; -- 2.17.1