From patchwork Tue Aug 20 11:20:40 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: 13769985 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 5576BC3DA4A for ; Tue, 20 Aug 2024 11:26:25 +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=s8g4Op27qwr2/uTcnTjiy2kZfiW5TvWb5gnrsh3SjPg=; b=U9WvrTWRF1zVwl7y+uVdQ83CV2 y2GkUtJ7FZNMcZpbs4vUIzg4OXqcZk6IF0ErCPutOeKourLiFpuAuXF2CUvXVD8+rfzXMUR8ECTe1 XjgJABvbsbhoVnTFkC4yVOTaZ+Z/fCAj30jzZlJBZVTnuSzotSNimzeLvIlLySTHumQmbHRfdoJia Xn2ihDcB59pDUJJu3tslmfRzn4yh1fhfFP7Jk1K7yylJFRrc/Jc1N/P2fPGbj6fi1YdDcVFALjuAd 8q8NjifEbT4tAh+nQhKuPlU/Pg+z3YowGbFM0BMq5C98ngW78Ovyg8BOp9sVoc9tuRJcSuOCaU7uY tRKHKRqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgN08-000000050eF-3VT4; Tue, 20 Aug 2024 11:26:12 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMvy-00000004zdS-3T1q for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 11:21:56 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-201d5af11a4so49683145ad.3 for ; Tue, 20 Aug 2024 04:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724152914; x=1724757714; 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=s8g4Op27qwr2/uTcnTjiy2kZfiW5TvWb5gnrsh3SjPg=; b=RuGNZLoA+UfcyC1JCfrM2elOSHbZiDnTyLHltxHPwwdSXcK9/Ob+cP8F1XRe5Adstq zBzf2Rj9rkWEcfRmC9onH30AcSylAxMnbn0YucyzevHPpR2BfU7qeTaFrbAT85rxTZqn gM+q1SM1HQHXTAB0rYPzoSINIfniDl7rr7iuhM4IteD3wT6Kte4kpfQKCFDxT6zdRiRM fyzqoOmBwk7HdIfP79+rEclr2lj07sVypfI62kNBtsf2jSybX5CXYqqKl9NUxc+JaBfP hCNHfIim7eaxLu0tG9Y6qDhld3580s1eUseB0EmtRw1npupQpPMSg75fBkf+GP7O95/M JEdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724152914; x=1724757714; 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=s8g4Op27qwr2/uTcnTjiy2kZfiW5TvWb5gnrsh3SjPg=; b=mY2VklgKZy7kgRIYTj2yKFvyuKEL5gSZmxKv2i6+KaMwCHPzNPNXUHLwfUiN6w9jvI N5IheYx06/zLNGGxFNEo7WqoJLLJYEV7fHxHP2jqE278vftfKKt++K+oNl367pNOV9qp zp9FxqSCAAXShcvKzaatiiM1Y66Wm/XllCL9PzDiL2saSU6xCt/sXy/TywN9q3IvW2ab P+KdsHC9rfQ70XBFSl3GY+SkgZAJMn9j6Tfcb68REPDajV0Rb/IYBt1gLeYx2KA/5J6g 7lDDbDH3ceaoT3zWBOFFyjnmRNSDFYmmxPVEewp/s2sXfCjDnDyU5Kn0Xqd0IEkcxM82 EfCg== X-Forwarded-Encrypted: i=1; AJvYcCVePFIl+CWIrTEFE0hyFVHssFZcF5pjL/tN4Lp7+KgunuftJL9A8e1FcuEZ51xeSDfKrxkStZ/moxcXEKiqmvCSYL+gj6Tfnq42Hw7J8k3LqKB6nY0= X-Gm-Message-State: AOJu0YwMWQsQWiMWptPPR7/0zsAdI2S1rHYBiynszHDywADo5ae0ar/7 CJObwAyg8XLv+5Lc60smO+HO1D0zoRMWUv7U86MBdtVLzL+QiVHK X-Google-Smtp-Source: AGHT+IFoakYw/z/6J97NlZxGYjThK4OBQnPRiS4KWgOFICCw1vB9echW2rbYnDYD5YFBvqlJnKRRLA== X-Received: by 2002:a17:902:e885:b0:202:3174:9d44 with SMTP id d9443c01a7336-2023174a2fcmr102827975ad.20.1724152913439; Tue, 20 Aug 2024 04:21:53 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-201f03756f6sm76465355ad.172.2024.08.20.04.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 04:21:53 -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 v5 6/7] net: stmmac: support fp parameter of tc-taprio Date: Tue, 20 Aug 2024 19:20:40 +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_042154_894778_801A3FCB X-CRM114-Status: GOOD ( 12.11 ) 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 | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 08fda0ed5ff3..84b566351c5d 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,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; @@ -1089,11 +1083,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;