From patchwork Mon Feb 28 11:15:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wong Vee Khee X-Patchwork-Id: 12763045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A5E59C433EF for ; Mon, 28 Feb 2022 11:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=MMhXhklhIylxFT6poHWQCvmxXA9K7KT+JUDF+If2QXQ=; b=S529ol/QOp1uow NyQvxJ4FaR9czGb7aTeb67KtvP3Fd4Oz9C/X1BT+hcIDL4uvvOGDJ4DDaW35LX9EweX3T1IiO5JUF qK2cjJTpSvDcvy+jwTcuJVb3lUCH3BSzqbKS0yTEqOJXeD9BpDDsil9S61zcoXYZACmS27XHRR0Pq xl3k1kPA+krFaxGhnYy6zPP+XzKWePfE8WwGlbEyvljkVs+n9CPyjntG2NqhJze7c9+b8SeTf0SPr rojZ/FsxgeUSgOm466NBFk3EjeSdrUHJTrzL2Rnihbb7iNQkJRoxaGn42Emd+hWODNhSetvMaKdtF 25jVumEZ5T/ZJ6WLdHBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOeFb-00BtR2-1W; Mon, 28 Feb 2022 11:31:35 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOduR-00Bj27-Fm for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 11:09:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646046583; x=1677582583; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pPM+/dJeHfzqF2MwScC0enTLh1mKtTcaV6SSL4S9rYU=; b=AOQeVn3RpB+7gfZBn4raY+QMp1K0MrbavwGDwFkCl6rvtcykIk86E/xQ x7QedkNnYq+pWRyLPvTGUDBSWtsIe2PfvDUu1IIe2D21SDozi/S3UzZ/L WiILk5q+wUpRPchgKm204BpAeC8vML4tzBDt//gu/Ka1GtHE4Y9Y85Kro 2WFa4oelh0O4Bcl/zQisV/zTKVYLU8iH/CZuhx65+H/jadCpisRL691Mr TGVSRHhP46cKP1Tn+Zdy6OAU2Edl6jsPeGqwpSc3htsL/LptG03BpwXf5 6PRhFRQ4AJwh5AefYez7Zx/AuCDZvqatBS+cV6QMKNl5zrQt7VLZ+DLia Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10271"; a="250441529" X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="250441529" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220228_030943_618857_58D533E6 X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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; }