From patchwork Mon Aug 19 07:25:19 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: 13768024 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 7CDE8C3DA4A for ; Mon, 19 Aug 2024 07:31:15 +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=LUC60dy1YEE37Zn2Nf/SEhoaXa YLzXumUN+pBpkZy/Q4ys4KnrSHEKPO+ee6eHiwlasaROprG8uRetiKjMP0GPVk93AqSAYH+3J3Rlq Nqe4nuDiz4OiYS+zVoy+w/oPZoGBWIrhxcR2knoadXeL8JrD0ftHVB1R+lKPQi5rvufwCYCqa8ChP kjotVkn2Zl/iaqpbxodHm4lv+u3wf6Uu1bQjcyggSDsrULHpUDR4xmp6Al9zoHKx0gQfSRN1s4NDm vZrbaB5fLhXvXwjw/b9s1Xmou7yBbKVFm8KPz97N+zW98CBi7GjpT3peChtVTTQZ8vjs45MLEcZ2f IIC8yazA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfwr2-00000000eNi-1UiP; Mon, 19 Aug 2024 07:31:04 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfwmh-00000000dMU-3OJz for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 07:27:03 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1fc47abc040so30154175ad.0 for ; Mon, 19 Aug 2024 00:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724052395; x=1724657195; 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=N51hgZyOciMZnMRl34JBBpNX1IIGcBYX4neCRuBL8s49T4AwE06AOkyHyw+/PtuUMX OmjgiqaT2hbYMYusHXClsWaZbxZiefIMvbGKiB5gZTU4wvykTUhz3ekuM3kODuqBiEFc hfcIz3rhpg5I6gL11nxKorS/0LSGQPPRg61WoCUHi4h2wli6kpyUFlPsmBPc6n0vVSnH sScP7n4NM6uWc5qt0Yfls3yOk/7J2O/wNAgweqP6yJCq8xvxcUozZmhi3Xj+orq/fQoK 7zXruQHY2bqrBfkrxvqmX4v6GYkcoTXRsqj3HPZwZIRq7056ErHVstWUX5RQSk+aSbVL Nd1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724052395; x=1724657195; 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=fnhE2H+Xu04GZvP5tWhRNGB5SznW+btck80EQ1W0Ngv8wurhiSLKzix1dMeA7Mfv5I V/1UJbBsib+pJpYV7U/wTBleanx90v5sctjfT45L39CmMNQOuz9kBcklWnS3/hEslj8v q8xZnm2fZ9eIZ3cP2CoFKofW7yHw28PgUEFyi8RRs1Xjuw1bxmckmHeJh0Hh7Npw/Q0R RGkgqjmoSPKS1puaTchg3tmigtpzBiiCW39BXSt9B4IuaLyFoanrCPvGbtIt/Gg7NpkZ 6HnKIDm8+8jHsJ5E8/HNs7dlOkJziJNnmqih3um6PmMLDjqTSLBfe5FNeCNddU7z/3gF y3Dw== X-Forwarded-Encrypted: i=1; AJvYcCVmfsRB1qd4mZmqe3wU+npyQs7cTL4tbYahhxmQD4JqB9TIz76SJDjB7cyuJiADeuzRNhm6q75HW1b2cPQh/Qq+HnQbqU4aBzRD+a9tj1IXSxthy3Q= X-Gm-Message-State: AOJu0YwKJJFpBQe+XWJD3DGCaSGH8NbnBn9b0slhEQBRxBN6XlrL4f/P h0tZFKpBLcrTfIUQSP6UymVTO4A26MJTfGPe9rzWbQIEOS+0uAlh X-Google-Smtp-Source: AGHT+IEA3vuuj8hHvQm/FT75+3Cmov/g2QhDCgVu6DKTepAiVLdnHDZxmVIV9K1VMgQFzR5yfzj/JQ== X-Received: by 2002:a17:902:f68d:b0:1fd:93d2:fb67 with SMTP id d9443c01a7336-20219696b8bmr66815325ad.52.1724052394666; Mon, 19 Aug 2024 00:26:34 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-201f02faa5dsm58340855ad.2.2024.08.19.00.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 00:26:34 -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, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v3 6/7] net: stmmac: support fp parameter of tc-taprio Date: Mon, 19 Aug 2024 15:25:19 +0800 Message-Id: <28f3b68dd0e0744e851a0b9d90fdee69792fbc0f.1724051326.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-20240819_002635_920907_DE4067AC X-CRM114-Status: GOOD ( 12.18 ) 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;