From patchwork Tue Aug 13 11:47:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13761881 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 6D6E3C52D7C for ; Tue, 13 Aug 2024 11:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aMG2j52tw1mgszoYcGKshXhchCJaL/s4L2M1KESDv+U=; b=XdvjUuRJmU6Usf5JCV3JLfEA5s fLWnBOJKC+SHEo58p/FTcif2Mc7iZcfrOnlcdZMVfOKFikp/pmxQRoq1CIJke6hdiKvyfbZSPMW8F q2h8JCjLI4NKu076l1ejRlc3ssXm2loMaO/Opqp5SCc0GmhEZqUTvWReabkh3j+cGIK+hOG78rwnG BcP1WGczdi4rzcyEHBr+2cHbZOXSZhFTw4X8BOofktNgWjRaItK9U+DUF7+vZEtc7yixX/Ce7Skae mcDPW4yvVwjQUsmzgJo4j7MZkbP9VwngPRxOEbvFzo6VOmG4Z1Y+sdXsTYv39Hx4O6YmTubsU85R1 QVsAfZbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdq4d-00000003aCS-119J; Tue, 13 Aug 2024 11:52:23 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdq1U-00000003ZDs-2haY for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 11:49:09 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-710ffaf921fso1353356b3a.1 for ; Tue, 13 Aug 2024 04:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723549747; x=1724154547; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aMG2j52tw1mgszoYcGKshXhchCJaL/s4L2M1KESDv+U=; b=aR2MpQMwlooGOKRUdBKvGy8681f/z9wayTIotNFdSm78b5CilbaJQCjyA+TkeQ/sP3 AhAx86YX3fbbJagPo7M8IHeowb5Fj9wrpEP9YsGdpWxRy/erjyAMU/PjvCi46QgpKiHu mc5UosCmwtWQETz3wdIsYIbZWN8q2JnBa1411NjX1theOVpnN/TKhaRrRD171fwqCKFN D6Q2KQ4IGP0g8/TEd12EuBWwcZxuzWu/JPXJPXfs05hTMgMwto0q9dnG/njSIB5ma5xO kGQOhhnlno5EgpfDlZNAkAFJwy822QtoSQGIUkYf9QoIx7r1LZ7B1e3Ziq0TUNM72pKf CrXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723549747; x=1724154547; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aMG2j52tw1mgszoYcGKshXhchCJaL/s4L2M1KESDv+U=; b=C0dvX9o3BpP0IJuqhkxcnaDQurswIZhGfePxFKEMwH3R2rkWQ39ZTam4dthYfTfbwr Rl8HgxBGYQFNiEm9Zmt6u9DF4uhYGxxh3NKltNVbuxL6qSJSe6ZPnE+wclvwcvgLKXSV 0wt/DjXfl+DT1Z6OR7sWgpMEPkj4CC9ss633YxzV8vkwxVdyRavWVoeP8KT36d7/4/WX 2yERso7CU4L3Q4fJMvge0zawutxrYJe8XvjSEB2q0hUdVMzBJJao2idHS9CUivSO4qRL iq8NRPZJ8UKCNzar4WZZVOrLtYc+ygncCty23wdygXK59IfNzggiwcxdQvO7ysGxZcnv xriA== X-Forwarded-Encrypted: i=1; AJvYcCVQd+PARW9UvY9t+2oLjXzOYws4gTv9q9MK95Sl9u2wLTkB2FjbSpODC+FuTFLjgOEOGTmTi+VUia7bka2o4GuG9Ztj5REzSoWORuO1yfIyK8ALQ6c= X-Gm-Message-State: AOJu0Yzu1v4zox8E8ptHhML69/8vik/2U19mtehPKlZq+lWeCR6yQY7v DRRZATbKLoY92KZnrejJA9ZhbMq89uXiEAH81WRZ6O+tTT0v/e2E X-Google-Smtp-Source: AGHT+IHg9p5XaWZp0fr8FwtTPtazfdJh8IlGlsjar3+6d5LzFggbsasYv2qGTijgOoDA9e+iE9Xztw== X-Received: by 2002:a05:6a00:9188:b0:70e:cf2a:4503 with SMTP id d2e1a72fcca58-71257011c24mr4195800b3a.11.1723549747060; Tue, 13 Aug 2024 04:49:07 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-710e5a562bbsm5548755b3a.111.2024.08.13.04.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 04:49:06 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Serge Semin , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v2 6/7] net: stmmac: support fp parameter of tc-taprio Date: Tue, 13 Aug 2024 19:47:32 +0800 Message-Id: <7ae5ca1f640f298cd0409553886693e8989c87cc.1723548320.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_044908_711379_DF156C79 X-CRM114-Status: GOOD ( 12.38 ) 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 tc-taprio can select whether traffic classes are express or preemptible. 0) tc qdisc add dev eth1 parent root handle 100 taprio \ num_tc 4 \ map 0 1 2 3 2 2 2 2 2 2 2 2 2 2 2 3 \ queues 1@0 1@1 1@2 1@3 \ base-time 1000000000 \ sched-entry S 03 10000000 \ sched-entry S 0e 10000000 \ flags 0x2 fp P E E E 1) After some traffic tests, MAC merge layer statistics are all good. Local device: [ { "ifname": "eth1", "pmac-enabled": true, "tx-enabled": true, "tx-active": true, "tx-min-frag-size": 60, "rx-min-frag-size": 60, "verify-enabled": true, "verify-time": 100, "max-verify-time": 128, "verify-status": "SUCCEEDED", "statistics": { "MACMergeFrameAssErrorCount": 0, "MACMergeFrameSmdErrorCount": 0, "MACMergeFrameAssOkCount": 0, "MACMergeFragCountRx": 0, "MACMergeFragCountTx": 17837, "MACMergeHoldCount": 18639 } } ] Remote device: [ { "ifname": "end1", "pmac-enabled": true, "tx-enabled": true, "tx-active": true, "tx-min-frag-size": 60, "rx-min-frag-size": 60, "verify-enabled": true, "verify-time": 100, "max-verify-time": 128, "verify-status": "SUCCEEDED", "statistics": { "MACMergeFrameAssErrorCount": 0, "MACMergeFrameSmdErrorCount": 0, "MACMergeFrameAssOkCount": 17189, "MACMergeFragCountRx": 17837, "MACMergeFragCountTx": 0, "MACMergeHoldCount": 0 } } ] Tested on DWMAC CORE 5.10a Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index a967c6f01e4e..05b870b35947 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -933,7 +933,6 @@ static int tc_taprio_configure(struct stmmac_priv *priv, u32 size, wid = priv->dma_cap.estwid, dep = priv->dma_cap.estdep; struct timespec64 time, current_time, qopt_time; ktime_t current_time_ns; - bool fpe = false; int i, ret = 0; u64 ctr; @@ -1018,16 +1017,12 @@ static int tc_taprio_configure(struct stmmac_priv *priv, switch (qopt->entries[i].command) { case TC_TAPRIO_CMD_SET_GATES: - if (fpe) - return -EINVAL; break; case TC_TAPRIO_CMD_SET_AND_HOLD: gates |= BIT(0); - fpe = true; break; case TC_TAPRIO_CMD_SET_AND_RELEASE: gates &= ~BIT(0); - fpe = true; break; default: return -EOPNOTSUPP; @@ -1058,7 +1053,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, tc_taprio_map_maxsdu_txq(priv, qopt); - if (fpe && !priv->dma_cap.fpesel) { + if (qopt->mqprio.preemptible_tcs && !priv->dma_cap.fpesel) { mutex_unlock(&priv->est_lock); return -EOPNOTSUPP; } @@ -1071,6 +1066,9 @@ static int tc_taprio_configure(struct stmmac_priv *priv, goto disable; } + stmmac_fpe_set_preemptible_tcs(priv, priv->dev, qopt->mqprio.extack, + qopt->mqprio.preemptible_tcs); + netdev_info(priv->dev, "configured EST\n"); return 0; @@ -1089,11 +1087,8 @@ static int tc_taprio_configure(struct stmmac_priv *priv, mutex_unlock(&priv->est_lock); } - stmmac_fpe_configure(priv, priv->ioaddr, - &priv->fpe_cfg, - priv->plat->tx_queues_to_use, - priv->plat->rx_queues_to_use, - false, false); + stmmac_fpe_set_preemptible_tcs(priv, priv->dev, qopt->mqprio.extack, 0); + netdev_info(priv->dev, "disabled FPE\n"); return ret;