Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3668588pxb; Mon, 24 Jan 2022 14:56:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3Mr3DflMwRwwZdsL6QWfpeXvXgkyHKJzOR0dYwCu8eWAUb9MgLxiyRMNvR9+Ai+awCYPz X-Received: by 2002:a17:90a:4610:: with SMTP id w16mr409924pjg.175.1643064967369; Mon, 24 Jan 2022 14:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064967; cv=none; d=google.com; s=arc-20160816; b=sXgbEXl0qEsvmNYrmttI2YcCQejlx+4s7VSbfYexvEnYVzB/PlqUDiD7UEb+1KJsyE UGQJgPO+UWgE5XtMYfjELfEb5KK4wp45ioaX0x+MjGv+6m+C+MN0MjSbyz92XSoJ8Q1W WCK+RFw6zJlZgA1c8gIGw3vxw8r9HBMF0THfM5snCqCqYhQLgK1iL7SbdMcDIFQNNuu9 cYx4V7ILRDoHhCGkAChd7qwqRHfEdyIOuzjq8EjOFa0awqrqEy5K1hTVSCpf4LPT3w+q bD3+UV9iN7ArMFGogmLe8/Zao4FU608kADjwOibMpegVQNzZG9rT196HPveT2EKcUEbj 45kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gX8NdCep706VYOXFx2pL8v3Ytyv6YN32GtUCxSeyyA0=; b=IRPVFXrXU3AiY1cOCTCKYdG8eh87yJ77ZwQl9u3rQ8VW3HLcNtBkyH0rL9vbBO+S3m M2e5171cL7VKEZkV5UxUuauJgHRpZyxhYsHOcsXUu1g1didZHhJrTQ3TQUXuYjakO9Gm RFbLb+cjB1BTAhJrjmWMgRhKJaSo/k1zKPHgtp8J9hazEsVWM8f2jp2cLIV6urCbIVbs LaS7V60ktq6WVn8nclTTJJhFkkNwWEvvrKrn7tpNnTQNLPv0M5E7gTwJaPeSSxKu8jhe qOfBf7T/9K02+rdLmF03qKZKlRZngbNJVHDmQ1snwuLofP5CJNIi2bWQfqsHUPLqpy7m JOhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n129BOGy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si527920pjp.56.2022.01.24.14.55.55; Mon, 24 Jan 2022 14:56:07 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n129BOGy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840083AbiAXWwe (ORCPT + 99 others); Mon, 24 Jan 2022 17:52:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60776 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573576AbiAXVpP (ORCPT ); Mon, 24 Jan 2022 16:45:15 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9867961320; Mon, 24 Jan 2022 21:45:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B57C340E4; Mon, 24 Jan 2022 21:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060715; bh=TomM5/zNbvP8Y6ADovDptTISBPYpvN9S8HOB+kRGEio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n129BOGy76FWKo/8wfPtTDuPRJyc9K/sb/3N13LdsMCxyQvq1vMZU5rKci5cnND4a 3DTrRiebPmGMiHlL6rYlDa/CV1U45GHU+zVboB6iSVXRFKwAEH/5P3hz9VwGvVpBB5 9MeGuXvrvEn+X6mrqT8jDnRs06b86eGo6hvDQH0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoliang Yang , Vladimir Oltean , Florian Fainelli , "David S. Miller" Subject: [PATCH 5.16 1012/1039] net: mscc: ocelot: dont let phylink re-enable TX PAUSE on the NPI port Date: Mon, 24 Jan 2022 19:46:41 +0100 Message-Id: <20220124184159.306281184@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean commit 33cb0ff30cff104e753f7882c99e54cf67ea7903 upstream. Since commit b39648079db4 ("net: mscc: ocelot: disable flow control on NPI interface"), flow control should be disabled on the DSA CPU port when used in NPI mode. However, the commit blamed in the Fixes: tag below broke this, because it allowed felix_phylink_mac_link_up() to overwrite SYS_PAUSE_CFG_PAUSE_ENA for the DSA CPU port. This issue became noticeable since the device tree update from commit 8fcea7be5736 ("arm64: dts: ls1028a: mark internal links between Felix and ENETC as capable of flow control"). The solution is to check whether this is the currently configured NPI port from ocelot_phylink_mac_link_up(), and to not modify the statically disabled PAUSE frame transmission if it is. When the port is configured for lossless mode as opposed to tail drop mode, but the link partner (DSA master) doesn't observe the transmitted PAUSE frames, the switch termination throughput is much worse, as can be seen below. Before: root@debian:~# iperf3 -c 192.168.100.2 Connecting to host 192.168.100.2, port 5201 [ 5] local 192.168.100.1 port 37504 connected to 192.168.100.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 28.4 MBytes 238 Mbits/sec 357 22.6 KBytes [ 5] 1.00-2.00 sec 33.6 MBytes 282 Mbits/sec 426 19.8 KBytes [ 5] 2.00-3.00 sec 34.0 MBytes 285 Mbits/sec 343 21.2 KBytes [ 5] 3.00-4.00 sec 32.9 MBytes 276 Mbits/sec 354 22.6 KBytes [ 5] 4.00-5.00 sec 32.3 MBytes 271 Mbits/sec 297 18.4 KBytes ^C[ 5] 5.00-5.06 sec 2.05 MBytes 270 Mbits/sec 45 19.8 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.06 sec 163 MBytes 271 Mbits/sec 1822 sender [ 5] 0.00-5.06 sec 0.00 Bytes 0.00 bits/sec receiver After: root@debian:~# iperf3 -c 192.168.100.2 Connecting to host 192.168.100.2, port 5201 [ 5] local 192.168.100.1 port 49470 connected to 192.168.100.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 112 MBytes 941 Mbits/sec 259 143 KBytes [ 5] 1.00-2.00 sec 110 MBytes 920 Mbits/sec 329 144 KBytes [ 5] 2.00-3.00 sec 112 MBytes 936 Mbits/sec 255 144 KBytes [ 5] 3.00-4.00 sec 110 MBytes 927 Mbits/sec 355 105 KBytes [ 5] 4.00-5.00 sec 110 MBytes 926 Mbits/sec 350 156 KBytes [ 5] 5.00-6.00 sec 110 MBytes 925 Mbits/sec 305 148 KBytes [ 5] 6.00-7.00 sec 110 MBytes 924 Mbits/sec 320 143 KBytes [ 5] 7.00-8.00 sec 110 MBytes 925 Mbits/sec 273 97.6 KBytes [ 5] 8.00-9.00 sec 109 MBytes 913 Mbits/sec 299 141 KBytes [ 5] 9.00-10.00 sec 110 MBytes 922 Mbits/sec 287 146 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 1.08 GBytes 926 Mbits/sec 3032 sender [ 5] 0.00-10.00 sec 1.08 GBytes 925 Mbits/sec receiver Fixes: de274be32cb2 ("net: dsa: felix: set TX flow control according to the phylink_mac_link_up resolution") Reported-by: Xiaoliang Yang Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mscc/ocelot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -692,7 +692,10 @@ void ocelot_phylink_mac_link_up(struct o ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port); - ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, tx_pause); + /* Don't attempt to send PAUSE frames on the NPI port, it's broken */ + if (port != ocelot->npi) + ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, + tx_pause); /* Undo the effects of ocelot_phylink_mac_link_down: * enable MAC module