From patchwork Tue Aug 20 09:38:34 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: 13769779 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 2A72AC3DA4A for ; Tue, 20 Aug 2024 09:43:55 +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=MBziSSli8cMhwVRS/XUpMid3dlyuuWsBGzCQhQohhLw=; b=YhzNRai+J/0+BIWnoSdIBxVS7V 1WhUuEh8PlQXr35WhYLyMIXYTeKyh6u8dF3nma/lfBR7n5F2H6yh6A4d9zfs4Eswm0tL/XPr7u2Lc JUfkXus12qcjleICUrin35JtPlbhUEzXeLwvfDC7+R2hin1tBAZ6qv7jZBtyU/VYfdibTxBmULZ03 FMqVCtax+TN3YHZXUL2SugJgPad6QLr+aJYdIe1IUp1bqVeTrWkdIhWwcAvwXVVe8iaacjjyHtMXG vfoigzF690lyD7nIcONV0Ly/Vcx7AI6AkRXVSCQg0CPhFD3QvQ0ONH9/tLOhS1dwPaUj1ElLM20T+ rLZANx3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgLOx-00000004dcC-1YjC; Tue, 20 Aug 2024 09:43:43 +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 1sgLKv-00000004cLJ-2dhG for linux-arm-kernel@bombadil.infradead.org; Tue, 20 Aug 2024 09:39:33 +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=MBziSSli8cMhwVRS/XUpMid3dlyuuWsBGzCQhQohhLw=; b=ooI23dw6J9MqO+sxCjqAoQvE2o 7OuGz2NmxYAadzOiJlGsU/KXh1sHY/xQBPkOv+qy1jv1j3DH6PGRvzVlFeq1dCn+IA1jta9Sdjeyh LueDheDRo3NqG3kEODnDByOghuRo1cQA73aYSUBVAQISArOJ0IQiSYhjeUabttQmxAzkB0eRn3Kwf PZn5kQRasd95BAMxvMLy2w9G6t1yrvOqMUbZ12lTnfBd/DBryqloed9neOGaDxy5bQ+3lVgt4URLx r++D9vxFlbtJC9iLAOhITi3Y9woRBf6F1v0UgZomZYhkMy0CWuXKwKILjg2ou8lUMQz9OYkZ27Itu HjSNGaAQ==; Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgLKs-00000009IXI-1hkP for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 09:39:32 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2d3bc043e81so4038136a91.2 for ; Tue, 20 Aug 2024 02:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724146768; x=1724751568; 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=MBziSSli8cMhwVRS/XUpMid3dlyuuWsBGzCQhQohhLw=; b=CvBtJLJXpADDZhgysf2UpyXndOVtHfQ43J1FiXoZ88Rzhy94lhnpHMonH7BiJRnsU5 Pc3V7BgOndubqSFCUc2gdcxNZJsrUTdf4nTVWkgNUrRi4d33p0JXPaxf8xiLI9bnROE6 27Nyodf59Iaf8Dx9siROAzmQcrY5/Yb4J4LIpCpcEYgZSJpVgBWuSbfa+d7szYTu1VAL dsuhP1+b2gtvict9bCa8EDFih1gyZDFt4PLeNgGK0Yv5CxO7GJ4ovfLDOLHUEF++swa8 ySorK53MzyOEu6WAhCag+4andmhpyij5cHu6ZvxQVXIO2JY6UmyOaGmtsuOOD2uuziuP OJnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724146768; x=1724751568; 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=MBziSSli8cMhwVRS/XUpMid3dlyuuWsBGzCQhQohhLw=; b=R7I3JpX+5nkXgPmGL0E6fmFnN8X9bKpGpdhYjBSm6s5qEUJMFdk6F8+FdAmAoVDH/Z /T9N9X0xkxFGQbYv8kcoGZ+7E7+PVJhtFG4ajGah06CBj05S1cicumjniEd1DXEirnPZ fz9kzEk0cgYXW1s5PUBDY2FFqG289tz8bDjm1onAyD1TuMNfZGSQbXHlJugN1dkcjf6P PH5PLShxwcPaLh84DQZ4FDge0bL+tO1g/Vsqj6qB+Q+juCKScZ5uk0GutCfVAH72dyii lo5fd/p2MTwcLZ975LYamHeGBFe19lEzwI5w7z7krHk3avAe9ZcpNMbBEppCgNbV1rM8 +36A== X-Forwarded-Encrypted: i=1; AJvYcCVMSvo/fXLTZvQVGp9J5Rqi7H8aI1Fw1naKDMfgqVeUa9Sswe7NdgzLdFNpA74REx5tHEvLbhkdlBRfj6b3gx9U@lists.infradead.org X-Gm-Message-State: AOJu0YydgDoepju48p8SuKNXDh6R2PNfwfEBCehg/0n+yeGj8INdn991 +2gM79MRPmZysWjf74yxYKw9Lbw771hNho+PIV3Toej/uXJbrTpq X-Google-Smtp-Source: AGHT+IGv2yZnBNN0ZbnLqzVXOK4cuhP5PFCjq22WGkpxCpnGjZAQC6MUuCRjeBTUVeo52ol6QEcEwg== X-Received: by 2002:a17:90a:db8d:b0:2cb:5aaf:c12e with SMTP id 98e67ed59e1d1-2d3e03e8cfbmr14850301a91.37.1724146767418; Tue, 20 Aug 2024 02:39:27 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d45246061dsm3230608a91.8.2024.08.20.02.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 02:39:27 -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 v4 6/7] net: stmmac: support fp parameter of tc-taprio Date: Tue, 20 Aug 2024 17:38:34 +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-20240820_103930_713064_600BEB8C X-CRM114-Status: GOOD ( 12.82 ) 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 | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index f8f09ef2d447..589fbe9de09b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -932,9 +932,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; @@ -1019,16 +1019,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; @@ -1059,7 +1055,8 @@ 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 && !ethtool_dev_mm_supported(priv->dev)) { + NL_SET_ERR_MSG_MOD(extack, "Device does not support preemption"); mutex_unlock(&priv->est_lock); return -EOPNOTSUPP; } @@ -1072,6 +1069,9 @@ static int tc_taprio_configure(struct stmmac_priv *priv, goto disable; } + stmmac_fpe_set_preemptible_tcs(priv, priv->dev, extack, + qopt->mqprio.preemptible_tcs); + netdev_info(priv->dev, "configured EST\n"); return 0; @@ -1090,11 +1090,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, extack, 0); + netdev_info(priv->dev, "disabled FPE\n"); return ret;