Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3782759ybi; Mon, 29 Jul 2019 12:32:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqywWzOwCPaVCHsNv74KnuCbCbCm6lekH0Phsfjo1/kHDb8xubzjX9D76BWTUlMtUJs0irZU X-Received: by 2002:a17:902:2929:: with SMTP id g38mr91153324plb.163.1564428722444; Mon, 29 Jul 2019 12:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428722; cv=none; d=google.com; s=arc-20160816; b=lbH9rlapf7XEvQwgE+rO9nfdPrjbDqO2RsiosRrStB/FsY7FjNzIZFO0a3kJOYVELX sk8uYHom5UqkSb1OSiZL9u6gxL2pu5UKX8eAbU3XoI56hVVUWB0yGTnzvQpPEeBErWc7 iXBdDNfNlBBS1yxOhf55MHSevqEQasbWtI0TiEg19qurNRMJyKicP7vLMALGkG/KLCHd +sVobfXtIoS1e/14nDGA4+50xIo4psLEJJTBr7nOfieZX01IfSEpKj6VqirkRT0lDUNk lSU4LDxU7Yn57XI9wv3HIvSYgsVOwW8Sy4XT6BdTMSqWIWS5NDtAInqCDB/Z4sp04n0x jNlQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N0/buMSOD+hk7hgtLwEYsTa6arJQhCPlz/vRBaUIa9w=; b=krbOIbB/5VYdLJDQmFDBoWm+8hJYJ34XxJswBabuoptOJO6zugGsCpe/jombd5jQ3l FJjlkcj21PSirwENVYDFqHPFxqf6VmbeJow56fr5kyDecSW7jfxWgOx+k9Uv9htuJhl2 kktMVH7bRfBvky3aCl4NdPggzRVozurHp5e7YcYSow8n3BtGQPcMyEVYdHG6TNmKavXh GbktkyWmreVohTkyjePLIGSj223xRQc7N/b/JIpTPsUX2o6e6UFZREdRuN07QZ7gOiRs rxuh7qnBhVIXuHAYIi2udjxy1GQV8fReBpUnn2E3KJ1X0siS63tfFdZU3qVxla+40Aup lzRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=efrCiiCd; 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 u46si28010415pgn.578.2019.07.29.12.31.47; Mon, 29 Jul 2019 12:32:02 -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=@kernel.org header.s=default header.b=efrCiiCd; 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 S1729611AbfG2TZH (ORCPT + 99 others); Mon, 29 Jul 2019 15:25:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:37346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729595AbfG2TZE (ORCPT ); Mon, 29 Jul 2019 15:25:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B467621655; Mon, 29 Jul 2019 19:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428304; bh=tMEmiguX2xAF7coy7XsImyDwSDGVwzm2dbXTDCPnWGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=efrCiiCdOtKP4DMzPKpY+GlmYAUy1GJsfP1Y2vmxNmzJI5vpwrZlHKFy7RNtbx4C7 OYf88+nAQHS1nCd9n5i/dMLiV5jXQV498qZo09NqP5ozqDhXjnpQcqn0Hjk5IEhGKf rtzouQoXkNihZnz4AFWM67uDKBiwFsZnRk+YArHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biao Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 034/293] net: stmmac: dwmac4: fix flow control issue Date: Mon, 29 Jul 2019 21:18:45 +0200 Message-Id: <20190729190824.745579097@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit ee326fd01e79dfa42014d55931260b68b9fa3273 ] Current dwmac4_flow_ctrl will not clear GMAC_RX_FLOW_CTRL_RFE/GMAC_RX_FLOW_CTRL_RFE bits, so MAC hw will keep flow control on although expecting flow control off by ethtool. Add codes to fix it. Fixes: 477286b53f55 ("stmmac: add GMAC4 core support") Signed-off-by: Biao Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index ed5fcd4994f2..8445af580cb6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -474,8 +474,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, if (fc & FLOW_RX) { pr_debug("\tReceive Flow-Control ON\n"); flow |= GMAC_RX_FLOW_CTRL_RFE; - writel(flow, ioaddr + GMAC_RX_FLOW_CTRL); } + writel(flow, ioaddr + GMAC_RX_FLOW_CTRL); + if (fc & FLOW_TX) { pr_debug("\tTransmit Flow-Control ON\n"); @@ -483,7 +484,7 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, pr_debug("\tduplex mode: PAUSE %d\n", pause_time); for (queue = 0; queue < tx_cnt; queue++) { - flow |= GMAC_TX_FLOW_CTRL_TFE; + flow = GMAC_TX_FLOW_CTRL_TFE; if (duplex) flow |= @@ -491,6 +492,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, writel(flow, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue)); } + } else { + for (queue = 0; queue < tx_cnt; queue++) + writel(0, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue)); } } -- 2.20.1