From patchwork Thu Mar 19 13:47:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_van_Dorst?= X-Patchwork-Id: 11447243 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5155714B4 for ; Thu, 19 Mar 2020 13:48:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E3DAA2080C for ; Thu, 19 Mar 2020 13:48:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JBhf8lnk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=vdorst.com header.i=@vdorst.com header.b="noV2Bi8S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3DAA2080C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=vdorst.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org 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: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:In-Reply-To:References: List-Owner; bh=Kfu4QhKbpLNiT1Y6/+mV/nhnjJMabUrH9ohXEm1L3BQ=; b=JBhf8lnkCSeL/e 9Fzo0V8eL5cMfN1J5DmBmhpZX/VErec3R480XDKOqOhzLTx2GW9Ht08J6sTfmAVdDDLK5H1zFyl0y rXPyq42T92fykgHaSBPMKTAPuSOF4GhanD6zLLd+TWtWx97jUU8f/pnAxwYj3klMjQwQwae2fiagI 6sxorqGrYaBzfeLdb8k7hdf+5xFTRlLilVJTo/G3snYtY0a9tu0W8dikloolqlajl0se7Kh23zhZu 49CHYgbz51wcU4iHRDMFI/imtBqDZNXItpp/YjX1x4RthvbSPwYoZ/cUD8ekqImQe61jfiH24E1oa 0Iuz/oQjwf+AOMkH3xGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jEvX5-0007Cl-B2; Thu, 19 Mar 2020 13:48:23 +0000 Received: from mx.0dd.nl ([2a04:52c0:101:921::25]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jEvX0-0007BB-Uz for linux-mediatek@lists.infradead.org; Thu, 19 Mar 2020 13:48:21 +0000 Received: from mail.vdorst.com (mail.vdorst.com [IPv6:fd01::250]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx.0dd.nl (Postfix) with ESMTPS id 0BB065FAE6; Thu, 19 Mar 2020 14:48:14 +0100 (CET) Authentication-Results: mx.0dd.nl; dkim=pass (2048-bit key; secure) header.d=vdorst.com header.i=@vdorst.com header.b="noV2Bi8S"; dkim-atps=neutral Received: from pc-rene-vdorst-com.vdorst.com (pc-rene-vdorst-com.vdorst.com [192.168.2.14]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.vdorst.com (Postfix) with ESMTPSA id B65A424FCBC; Thu, 19 Mar 2020 14:48:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.vdorst.com B65A424FCBC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vdorst.com; s=default; t=1584625693; bh=O6YczJK1x6AOo1kB2bIezDwDRopcG6VypEaDqIBfUMM=; h=From:To:Cc:Subject:Date:From; b=noV2Bi8S9TcIClj7xR6/P0K1PQmfRwkoO4jN2XGaSGv4LIWM/62TmvBatR57czl/6 sy/4wFrEg2MF6bJoLFxGrmJ+E/J5ZxetESI6iy5pfW786/vqUFvhZ0/omebB2oRYuG UUCcO/riKC6BYTspGaK/l67IdOuTChEF0/Ybykcd+X7gA+i8NMNRp+TX4zS5d/G+jB UJYaLV5ELFKMXpsQU8QYRCT5Y4ZStzHdE6/kuC6gNxvuDJWZ3pUD8r0z76mYXiI4QC 8KQ+h3lymmO9AlYtkWfWFt9LHV8wAcpjMvQqiC2HEADRk6w9vbGrEBFw0D8vzn0IKk +H8D2ybk/7Kdw== From: =?utf-8?q?Ren=C3=A9_van_Dorst?= To: netdev@vger.kernel.org Subject: [[PATCH, net]] net: dsa: mt7530: Change the LINK bit to reflect the link status Date: Thu, 19 Mar 2020 14:47:56 +0100 Message-Id: <20200319134756.46428-1-opensource@vdorst.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200319_064819_551753_065540C0 X-CRM114-Status: GOOD ( 14.19 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Landen Chao , Florian Fainelli , Frank Wunderlich , Sean Wang , Russell King , "David S. Miller" , DENG Qingfang , linux-mediatek@lists.infradead.org, =?utf-8?q?Ren=C3=A9_van_Dorst?= , Matthias Brugger , Andrew Smith , Vivien Didelot Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Andrew reported: After a number of network port link up/down changes, sometimes the switch port gets stuck in a state where it thinks it is still transmitting packets but the cpu port is not actually transmitting anymore. In this state you will see a message on the console "mtk_soc_eth 1e100000.ethernet eth0: transmit timed out" and the Tx counter in ifconfig will be incrementing on virtual port, but not incrementing on cpu port. The issue is that MAC TX/RX status has no impact on the link status or queue manager of the switch. So the queue manager just queues up packets of a disabled port and sends out pause frames when the queue is full. Change the LINK bit to reflect the link status. Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch") Reported-by: Andrew Smith Signed-off-by: René van Dorst Reviewed-by: Vivien Didelot Reviewed-by: Florian Fainelli --- drivers/net/dsa/mt7530.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 9ee3f263d529..d422d3d6a129 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -566,7 +566,7 @@ mt7530_mib_reset(struct dsa_switch *ds) static void mt7530_port_set_status(struct mt7530_priv *priv, int port, int enable) { - u32 mask = PMCR_TX_EN | PMCR_RX_EN; + u32 mask = PMCR_TX_EN | PMCR_RX_EN | PMCR_FORCE_LNK; if (enable) mt7530_set(priv, MT7530_PMCR_P(port), mask); @@ -1512,7 +1512,7 @@ static void mt7530_phylink_mac_config(struct dsa_switch *ds, int port, mcr_new &= ~(PMCR_FORCE_SPEED_1000 | PMCR_FORCE_SPEED_100 | PMCR_FORCE_FDX | PMCR_TX_FC_EN | PMCR_RX_FC_EN); mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN | - PMCR_BACKPR_EN | PMCR_FORCE_MODE | PMCR_FORCE_LNK; + PMCR_BACKPR_EN | PMCR_FORCE_MODE; /* Are we connected to external phy */ if (port == 5 && dsa_is_user_port(ds, 5))