Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3009061pxm; Mon, 28 Feb 2022 10:12:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSUS8X5cR+pljmLA/ZkehWE5ndpgeiBym1mhizQ9mzdK7xVpP289v71ZY2VFTa/hILZxoG X-Received: by 2002:a17:906:fcb9:b0:6d6:e0a5:b6eb with SMTP id qw25-20020a170906fcb900b006d6e0a5b6ebmr827445ejb.757.1646071926936; Mon, 28 Feb 2022 10:12:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646071926; cv=none; d=google.com; s=arc-20160816; b=bMovEkDkls1mv41SNbSAlkBr1pL5pfmgEXtmIP7ZpugPo6EVFP5nyyrjPqTfHvGlsj 6RuXidvlYoYwzFf8LxdU7IbhF9c2fKCk59D/bfBaT+KRmwqOzZb81xNT4kee4q0JKCTa 7QCU5yO6MIXMgizZZgV6Swt7zRD796g8UQyqsDFaqcoGpRfr93U2NRYvP2ITT2aNt9yB C5n/rhE0Njo0yOoyFv+/gUPrAezyN0U0+TFQYCL5/K3dwLV/M2iU+oFEQUDLTO2g4ez3 zQUkZo4TAqltGNtliiM7x9EGQMiRRtvSXpN5Ua9l/2g+igCPZVZEc+1nPvbgyIvbSWig /Mjw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=dCEyW7ZTzV3p9mdJq3TRpmU1X9Z8HYXzMWB66zKGRKs=; b=aBGa45ufSWu2KwHqPrPeC8pgYBYKkltEs0IQAmf+XfCktZcVaPx8kYJcC+niOHb4rG hZF6SUk/pRGOzGtRTLjZN8/t3mPr4y6XtiJnwf+t+VYIYcnRtcDCnnsToI6Ly+70KegW ORj8uWa59ffRFqP0HPjn+fMWDexBi9gE5PvXpnePpNC6UGoZ1jjtgBeyWDbgnV8F9AKL TOvHrqNXqdUvU3EFxPuE4PI4WZg6yA+3FeJuhimmMjCooUX1zyyOop4y2KnEhDAjrVQe ElHv+WuD8Q5runqhCTgM4WKMDlkC7ncQEks3vPpx2Z7SiTZ8sqE1FUPDyKid0gpGmXOW K1Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SO6gfJgm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a170906a21700b006d07ebd77c7si6601769ejy.251.2022.02.28.10.11.45; Mon, 28 Feb 2022 10:12:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SO6gfJgm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232749AbiB1LOZ (ORCPT + 99 others); Mon, 28 Feb 2022 06:14:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233270AbiB1LNF (ORCPT ); Mon, 28 Feb 2022 06:13:05 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71367710F3; Mon, 28 Feb 2022 03:10:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646046605; x=1677582605; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pPM+/dJeHfzqF2MwScC0enTLh1mKtTcaV6SSL4S9rYU=; b=SO6gfJgmLRTjC80MWQvROvwlmmqq015dS5cjNekgYmZJmvFNSutkr9E3 WGjs9xhTdJj6OqvbiownYD1PB5fdconUUePm2JpuFJS1aSSUqUc7ylQtK GUV1RsCwSubrDp0FzUJbXXj+ykLkpWxWGLF3BnUmGe4QJD6gxPLA5jvbQ Uc2ijL/as8b93GuwKW380ARlvtaqK72keAJ9YYdO4u0jVtJK4fMBJGzHG QNCPh1jwH1fnmKLv5x8FzqAm9+bhnZst/1TOUwadi2b7NgaQ5lQKBbxND ZTNZu4e8VYhyZ61Se+Qt7o/NHlmlHWTRarz4UP/Im5iHWhNGCImKgh2G/ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10271"; a="252588367" X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="252588367" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 03:09:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="640854617" Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 28 Feb 2022 03:09:40 -0800 Received: from P12HL01TMIN.png.intel.com (P12HL01TMIN.png.intel.com [10.158.65.75]) by linux.intel.com (Postfix) with ESMTP id 6D3E85805A3; Mon, 28 Feb 2022 03:09:37 -0800 (PST) From: Wong Vee Khee To: "David S . Miller" , Jakub Kicinski , Maxime Coquelin Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pei.lee.ling@intel.com Subject: [PATCH net 1/1] net: stmmac: Resolve poor line rate after switching from TSO off to TSO on Date: Mon, 28 Feb 2022 19:15:58 +0800 Message-Id: <20220228111558.3825974-1-vee.khee.wong@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ling Pei Lee Sequential execution of these steps: i) TSO ON – iperf3 execution, ii) TSO OFF – iperf3 execution, iii) TSO ON – iperf3 execution, it leads to iperf3 0 bytes transfer. Example of mentioned Issue happened: root@TGLA:~# iperf3 -c 169.254.168.191 Connecting to host 169.254.168.191, port 5201 [ 5] local 169.254.50.108 port 45846 connected to 169.254.168.191 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 113 MBytes 947 Mbits/sec 0 378 KBytes [ 5] 1.00-2.00 sec 111 MBytes 933 Mbits/sec 0 378 KBytes [ 5] 2.00-3.00 sec 111 MBytes 933 Mbits/sec 0 378 KBytes [ 5] 3.00-4.00 sec 111 MBytes 929 Mbits/sec 0 378 KBytes [ 5] 4.00-5.00 sec 111 MBytes 934 Mbits/sec 0 378 KBytes [ 5] 5.00-6.00 sec 111 MBytes 932 Mbits/sec 0 378 KBytes [ 5] 6.00-7.00 sec 111 MBytes 932 Mbits/sec 0 378 KBytes [ 5] 7.00-8.00 sec 111 MBytes 932 Mbits/sec 0 378 KBytes [ 5] 8.00-9.00 sec 111 MBytes 931 Mbits/sec 0 378 KBytes [ 5] 9.00-10.00 sec 111 MBytes 932 Mbits/sec 0 378 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 1.09 GBytes 933 Mbits/sec 0 sender [ 5] 0.00-10.00 sec 1.09 GBytes 932 Mbits/sec receiver iperf Done. root@TGLA:~# ethtool -K enp0s30f4 tso off root@TGLA:~# iperf3 -c 169.254.168.191 Connecting to host 169.254.168.191, port 5201 [ 5] local 169.254.50.108 port 45854 connected to 169.254.168.191 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 104 MBytes 870 Mbits/sec 0 352 KBytes [ 5] 1.00-2.00 sec 101 MBytes 850 Mbits/sec 0 369 KBytes [ 5] 2.00-3.00 sec 102 MBytes 860 Mbits/sec 0 369 KBytes [ 5] 3.00-4.00 sec 102 MBytes 853 Mbits/sec 0 369 KBytes [ 5] 4.00-5.00 sec 102 MBytes 855 Mbits/sec 0 369 KBytes [ 5] 5.00-6.00 sec 101 MBytes 849 Mbits/sec 0 369 KBytes [ 5] 6.00-7.00 sec 102 MBytes 860 Mbits/sec 0 369 KBytes [ 5] 7.00-8.00 sec 102 MBytes 853 Mbits/sec 0 369 KBytes [ 5] 8.00-9.00 sec 101 MBytes 851 Mbits/sec 0 369 KBytes [ 5] 9.00-10.00 sec 102 MBytes 856 Mbits/sec 0 369 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 1020 MBytes 856 Mbits/sec 0 sender [ 5] 0.00-10.00 sec 1019 MBytes 854 Mbits/sec receiver iperf Done. root@TGLA:~# ethtool -K enp0s30f4 tso on root@TGLA:~# iperf3 -c 169.254.168.191 Connecting to host 169.254.168.191, port 5201 [ 5] local 169.254.50.108 port 45860 connected to 169.254.168.191 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 107 KBytes 879 Kbits/sec 0 1.41 KBytes [ 5] 1.00-2.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes [ 5] 2.00-3.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes [ 5] 3.00-4.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes [ 5] 4.00-5.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes [ 5] 5.00-6.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes [ 5] 6.00-7.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes [ 5] 7.00-8.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes Clear mss in TDES and call stmmac_enable_tso() to indicate a new TSO transmission when it is enabled from TSO off using ethtool command Fixes: f748be531d70 ("stmmac: support new GMAC4") Signed-off-by: Ling Pei Lee Signed-off-by: Wong Vee Khee --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index b745d624b2cb..9e2ea0e0bd68 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5460,6 +5460,8 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, netdev_features_t features) { struct stmmac_priv *priv = netdev_priv(dev); + u32 tx_cnt = priv->plat->tx_queues_to_use; + u32 chan; if (priv->plat->rx_coe == STMMAC_RX_COE_NONE) features &= ~NETIF_F_RXCSUM; @@ -5483,6 +5485,16 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, priv->tso = false; } + for (chan = 0; chan < tx_cnt; chan++) { + struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan]; + + /* TSO and TBS cannot co-exist */ + if (tx_q->tbs & STMMAC_TBS_AVAIL) + continue; + + tx_q->mss = 0; + stmmac_enable_tso(priv, priv->ioaddr, priv->tso, chan); + } return features; } -- 2.25.1