From patchwork Fri Aug 23 10:50:13 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: 13774999 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 86656C52D7C for ; Fri, 23 Aug 2024 10:56:40 +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=Rn9x4OSvYb1tZhR2Q2By2Fv2d/ O27gaqQlxQy+APoFQVXmDdCVErRBOsiRxa0VpFlTEvUBzD3Nlc39w7ewz92ElDuOmz6ebL9tfrxuE 00leVq2p5TY2iZWxbYMHIbr3FS2ewmHANM0S6cyNbBMqAWD6MJvAZG27gIX8YdY7zoXeDRzsDrHZJ irBOd94wRs9OnZ5oycXgPxrgAjdxohhjERF8uRkDAAq6kmzYtL7m2lPOutjaXMjiiGapuvGXWQpSq A5QeODXjCpxFs1ObiQUIUv7dBRoxDax9Gyva3+2u86/iRww1df2YG/ae3ssfR11cxlXUAvD+GFEzS cS9fvNKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRy3-0000000GS0U-1TAb; Fri, 23 Aug 2024 10:56:31 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRsl-0000000GQZz-3eqs for linux-arm-kernel@bombadil.infradead.org; Fri, 23 Aug 2024 10:51:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=f93INA09DMIOXaqhvfxTfomEqawOII5zBMQHUuwv7xk=; b=iOuslcnAo7JlknccDYQ4E8xo1x nsnrOGQPGkJJC/pOSN7icPlSuclWvrPRdTf3+ekfdMZ/px1eISAKjPSt0W4oHa+dwRDEnJ9wbvqf4 rkfZ0X99njRXDQKA7ppHSuK9H2erDHfUw7q72TKkViaZUGIS9prneT72dd01ShYVhSKcZ8xaAmiv3 3LIxZzwAiJEVuy1RrFP4246mzC/2gKM5IXy3GjD72MbYraXGtd9jBZLX8ejULtTVsI16qxVug2XGL 4+edE4AtM4vc7qQseBU1eJ/DBSFpOdrBvPKwR/A/TAerY4iiKiEqH/SAsewbA977FwuWue+Tj0I8Y Mue3c19Q==; Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRsh-0000000A7Zq-3qJX for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:51:02 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-20208830de8so14594885ad.1 for ; Fri, 23 Aug 2024 03:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724410257; x=1725015057; 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=O5v6zrZ0jCgYjjztiJV909T8EAngfStwrkUM1rbRzTo/lqghLggvsbN6ZQ0w5XSckF +8QXZ4qeLRGFge9F3TgNclbfrDF0/lUNgYKBcAeZA2Ipiu96PisG3sEHpJN2TOUoLSyf IGbkq6IGvVts3XAhfywKoUJgMPUs8KW0u1/w0yZCriTVGmphk0Z4WQQ5Y4d0GGyYJHC3 u6Eo7CWOuS8nkJJMy6MEKJX+yQJ8mm8wQ9K1wEeSbocoz2936fqkml+31776sHSiGNQG KwEWvgYb03n2JhkX/xpDWZGa/E+DsCMDB5iFfslVfvclbFVoDD36DL0GjdVe4wlrt5+M cVuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724410257; x=1725015057; 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=upyBMhDfe1q/OsRMi7Rzky9/e8BrvokDv06pO/DRpm8fhzBHiRPLNMf8MXlBpAQ+YP 5v1JbUkUjlCXUb8gTgybyHJPrxStJDzAmHcobgjXwYyUs7mOkmWTLpPFvNx6eHgb0Z5x 0zZBjh7FP0V2MBhmXbMF6V8i0bA8BQhx5Trk5qSRVYHa6cL/C9aefKUk7aeu0kfPAOjI bXbeb+FA4jncv23r1xV0ksAkuRlvUPWHKBNGQ8j29HmXA8ySpruf6pX08BgP3OJvMGnp OexklLzhuDunRIc3+sN3lv4wZBMrxAg47sgI3Axb88VLv43sgOQOvi1yCB8y69NV60H9 SXSA== X-Forwarded-Encrypted: i=1; AJvYcCUwlTTLZyzvQ8RK2dhecxLYX/ax7lZQtvkbJJfojOrKUndCXHJEzhkARbv+5WonNVhi851NIaWBX8WxKsINvKhg@lists.infradead.org X-Gm-Message-State: AOJu0YyErqEpCWU+wDfZT8ks7p5MlSDrfbgfwAkTJWGoX5hpdt8Dxk8D hV6GZkwUYfaipEdn+ie0/u7lu2nV2vo3RyBZBFViiG1EcISjCyL5 X-Google-Smtp-Source: AGHT+IGa/HwxAbfGXoohHLJe07ikWhB7h+IWxFOP+Tprs/Yn6gPEHjeEofcppIScMpwvZlvrBuHsOA== X-Received: by 2002:a17:90b:3144:b0:2d3:dca0:89b7 with SMTP id 98e67ed59e1d1-2d646bd1a32mr2029277a91.3.1724410256674; Fri, 23 Aug 2024 03:50:56 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d5eb8d235esm6074344a91.6.2024.08.23.03.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:50:56 -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, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v6 6/7] net: stmmac: support fp parameter of tc-taprio Date: Fri, 23 Aug 2024 18:50:13 +0800 Message-Id: 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-20240823_115100_069769_7707E4CE X-CRM114-Status: GOOD ( 12.35 ) 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;