From patchwork Wed Sep 4 09:21:21 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: 13790318 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 0D8DFCD3431 for ; Wed, 4 Sep 2024 10:02:48 +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=f93INA09DMIOXaqhvfxTfomEqawOII5zBMQHUuwv7xk=; b=yAyd/ms6fosMJSoE/gwD5IDAG/ WxA/SW8pCJclkPoFmEoKvqjjXGsJZiH4+M1MFrglVF90bWJEcWUHIwdlEU3CBKFqgLEtTAYWhM5qS 3TmXLTe5WCROipdQZ5Jg2qLEWwtHw/GKRSBvlLiph9ZkqooEgqNWBJVyNf7ukfmndlqtw7tGeJbrv NKVpV9FhmsmiWSPisEy9GNDHxT9lFSOFoVfBC2iD4Zg+KA4Om8LSnbHvp3Z434YPcLmgIRqmq7QJf QZh9kZh1WXdKd19V+ARwqF5VKUeLkKqBNm8TOhXVvPH7vExvsqOZeNbqtHooJkLiwlkNW/E2WZq3z sUrxKkmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slmqS-00000003oPO-1BLS; Wed, 04 Sep 2024 10:02:36 +0000 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slmDt-00000003eXs-1chE for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 09:22:47 +0000 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-277c28fac92so3623772fac.3 for ; Wed, 04 Sep 2024 02:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725441764; x=1726046564; 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=f93INA09DMIOXaqhvfxTfomEqawOII5zBMQHUuwv7xk=; b=WN+pBtcKyfdCQ5gA1haheWM0lQQc6LQwwgzW/pHcUGMBbqIGVvEx16ntuyjPwM2yEP 4rT/I7sYp7f7F+IIQETi8sXI5Q8Y8W0uD8I/hjjp0lgVcHDmRXewR0B1bWjw6q3JbIvs cFcqRqgsKsUSeDZORSaDdnmEFTiiu0uxFiiBr0d5Je4gLl3qXd9yFf2TN/jmPfOU6QiX RT0JJAnqlR0P9NYlimy+WxD4T48W5rYVLtgl0zY0YkTptZgLojEt9fUaUcJ2D0ZRe96n cazrwEOKfVcU0E4lo+CGibesMeELNUtF48RmwQcVPT82dHHLO2oqThKFKle37gl21gSc v0ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725441764; x=1726046564; 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=f93INA09DMIOXaqhvfxTfomEqawOII5zBMQHUuwv7xk=; b=tLqSFGnr6mzMpgBNpy6SHBjWUEKftCopFxn81hcasuUwc7TjqDAhCfcGOVZLZa6ZMq jOZ1Xf2YTfy21x4gKYY4C2va4nEtGMbVeyWrRdx5w4T1MaMNTuXl1WTjZ/UvbBA6H9CK GwlNDjW8qmnpI0hxq65kxgPpi33dH7O5zoAxXEj2XhKU5fGC9iJY5C27JeMYwcxjz6pM D/IAXpH90mqbMqYYj/91m+OpAW4Jzq02p4wX1J+zAj300HHIsvWOhfzzdtl79zH7SAMP 41qm6A7+OXGUYIWwlAhQCAR7Jg1RcakA7iOWQXbuYn/f8zw+cUEKRUGYic9mxhSLfET0 veKg== X-Forwarded-Encrypted: i=1; AJvYcCVFg7w8QNwZ46TSk+Jc6+KT5N6vJtrbAyuQKcUUGQOnu/DcrQSdcXuz9yx1YjOWWGtWXOOkXWH2fw0YB/j7x29I@lists.infradead.org X-Gm-Message-State: AOJu0YxQQM0oZ8wOkY4hsuODkB9+a7t00EIrixZnhG5/XISWDEqylrm1 MhJohukdRtTufRuMA3G6Txg61YwGgRZeZzAfy6ImF+NCk9/RWzMg X-Google-Smtp-Source: AGHT+IHfYqlv3eIcYyWGBnu/IU/NNPsjKTuOUdU83UVXH4tEzccuzhL00qdC/ENlfqKhPKlAdB5TgQ== X-Received: by 2002:a05:6870:b508:b0:277:d563:9b41 with SMTP id 586e51a60fabf-27810b27c69mr6792025fac.9.1725441764098; Wed, 04 Sep 2024 02:22:44 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-7177859968csm1232048b3a.146.2024.09.04.02.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 02:22:43 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Vladimir Oltean , Alexander Lobakin , Serge Semin , "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, rmk+kernel@armlinux.org.uk, linux@armlinux.org.uk, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v7 6/7] net: stmmac: support fp parameter of tc-taprio Date: Wed, 4 Sep 2024 17:21:21 +0800 Message-Id: <3bf0857f46b15980e60f3ec71acd0f80452863e4.1725441317.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-20240904_022245_892812_31002B55 X-CRM114-Status: GOOD ( 12.84 ) 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> --- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 9ec2e6ab81aa..2bdb22e175bc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -931,9 +931,9 @@ static int tc_taprio_configure(struct stmmac_priv *priv, struct tc_taprio_qopt_offload *qopt) { u32 size, wid = priv->dma_cap.estwid, dep = priv->dma_cap.estdep; + struct netlink_ext_ack *extack = qopt->mqprio.extack; struct timespec64 time, current_time, qopt_time; ktime_t current_time_ns; - bool fpe = false; int i, ret = 0; u64 ctr; @@ -1018,16 +1018,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,11 +1054,6 @@ static int tc_taprio_configure(struct stmmac_priv *priv, tc_taprio_map_maxsdu_txq(priv, qopt); - if (fpe && !priv->dma_cap.fpesel) { - mutex_unlock(&priv->est_lock); - return -EOPNOTSUPP; - } - ret = stmmac_est_configure(priv, priv, priv->est, priv->plat->clk_ptp_rate); mutex_unlock(&priv->est_lock); @@ -1071,6 +1062,11 @@ static int tc_taprio_configure(struct stmmac_priv *priv, goto disable; } + ret = stmmac_fpe_map_preemption_class(priv, priv->dev, extack, + qopt->mqprio.preemptible_tcs); + if (ret) + goto disable; + netdev_info(priv->dev, "configured EST\n"); return 0; @@ -1089,11 +1085,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_map_preemption_class(priv, priv->dev, extack, 0); + netdev_info(priv->dev, "disabled FPE\n"); return ret;