From patchwork Wed Jul 31 10:43:14 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: 13748472 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 668CDC3DA64 for ; Wed, 31 Jul 2024 10:45:56 +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=RikSfSLSzK3NY5MUlBg8b34sVeLezToR4ZzwAPjg5Sw=; b=w28Xng7zbVFukdxH40LsKnEK5Q TUgAcsIXC696/VQiZRiaDoEOaUlYiWuRoRg2Z6GhrfpECr4KomESbtmO0o/bFJ8rUxzePyTHA+c7C OeC46bSSnU+6WDs43eaaQ4nhGOLSrBxHSKy4eMkFQPd4z52eEmdyPr/xjoiSjF3rXVNOzPMxC0EJp lCCWqRBZwaQUGAbwVUYuwLcuo5X2c0Dz/4dLY7B+wlnGIf7HVjHJnvs43CjpSPWSuDg28wSZ33iTD d+anH5OnShJhVucTyvqHB+OsdKt+xVC1FjLxhLXdK3EmVoCLdwg5eijoV6vmBQnQp/BFuBZy0Yra1 YKcbkBJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZ6q1-00000000m3o-36JW; Wed, 31 Jul 2024 10:45:45 +0000 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZ6od-00000000lX6-3uHz for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2024 10:44:21 +0000 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-70945a007f0so2595158a34.2 for ; Wed, 31 Jul 2024 03:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722422659; x=1723027459; 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=RikSfSLSzK3NY5MUlBg8b34sVeLezToR4ZzwAPjg5Sw=; b=gtsR8UOATl+nhYKuiJNe5AmL07+CwgYnIQM6/rsgChgtWBU0HvxW71/922x1QrF34+ CpuK9/0+EhqYgVzlToALcIWIYeT/5pCxl9W7Q+afLFaarI62um5IGCxt+K72WYxK0uTx 53bdoQUQO7ol/Nidc3mpRfIrg1Mhy0EqTT20dbf4S00HhKsJh8NPFjUyVSQyIwe89bxj wBas2NfAm8hlvhCAQIRlFah1zxPHa4mejWrf0QhxsxU79lc+U5CgEYEhuRCc2e2GCG0t 3Kaz19HevY8RgA3WGMM07iNnb/Rbne6C2FqLZqw4jDt8qrbIlbKMIKVUyIM4Xfds/bDn ymOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722422659; x=1723027459; 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=RikSfSLSzK3NY5MUlBg8b34sVeLezToR4ZzwAPjg5Sw=; b=sLxHnVmt/zdJhh5MaNWTsd6/mMDlT9Xz+jz9eyx/ua+IlZGAMd0xO0D/etMmgjwgxE OMCQ7IjgG0ezBzR4FdVXbf+33ru2VkRZ5cOVy8oEio9UHrP3xvFHG1Z+Vj6jAGQEJJva Uh3r9rmEeQqUL2r6grGcBuQMs5RyXUXaGzeUnf/yp4LJGl3x6JM86kxj546FVOKgdXJf qaFSY+N5NSMUq/T7h9htSqMI4ckp+c8gyE84zXBdO2Nan0zBbIoQqWuTvCkH/FzuXg7K CAMGHrNwCdMIZcB9X6FUUhWIZkdQa4LMWcoiU3FAvd9IJVbuqgxfzi3SnI6OB19SW/a3 Wdig== X-Forwarded-Encrypted: i=1; AJvYcCW7Oqd2ApfbJT9A36/ACzYSAEGqFJriRA218V5RvJ6SOiYFRs8k/TYMkPNu12cmCtIExOYnYdyvX3CZ+a7K3O+/4TJ41rA9Hp7pemYb6BQU/pQnQ1k= X-Gm-Message-State: AOJu0Yw2OI5S12JIhIdFb9dfC1mm17CkCdvfLoBLtUhm+1e/j/MyaCdV l3f5SRGy+hUVziV0Us6Oz7d5fFdeg6zfbcK8uZuS/0uDK14Ud08H X-Google-Smtp-Source: AGHT+IE2jiVapYwFvA5Ymfuzc66v1gbK3DosbYWq6PakXzXkcZhsXP+tkGA7JHLN1NMmna4+AcYEmA== X-Received: by 2002:a05:6358:d3aa:b0:1af:1b40:5357 with SMTP id e5c5f4694b2df-1af1b405467mr466369255d.24.1722422658533; Wed, 31 Jul 2024 03:44:18 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-7a9f816da59sm8791375a12.29.2024.07.31.03.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 03:44:17 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: 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, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 3/5] net: stmmac: support fp parameter of tc-taprio Date: Wed, 31 Jul 2024 18:43:14 +0800 Message-Id: <4603a4f68616ce41aca97bac2f55e5d51c865f53.1722421644.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-20240731_034419_995747_63AFACFF X-CRM114-Status: GOOD ( 12.45 ) 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. After some traffic tests, MAC merge layer statistics are all good. Local device: ethtool --include-statistics --json --show-mm eth1 [ { "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": 1398, "MACMergeHoldCount": 15783 } } ] Remote device: ethtool --include-statistics --json --show-mm eth1 [ { "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": 1388, "MACMergeFragCountRx": 1398, "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 | 34 ++----------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 494fe2f68300..eeb5eb453b98 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -943,7 +943,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; @@ -1028,16 +1027,6 @@ 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; @@ -1068,16 +1057,11 @@ 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; } - /* Actual FPE register configuration will be done after FPE handshake - * is success. - */ - priv->plat->fpe_cfg->enable = fpe; - ret = stmmac_est_configure(priv, priv, priv->est, priv->plat->clk_ptp_rate); mutex_unlock(&priv->est_lock); @@ -1088,10 +1072,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, netdev_info(priv->dev, "configured EST\n"); - if (fpe) { - stmmac_fpe_handshake(priv, true); - netdev_info(priv->dev, "start FPE handshake\n"); - } + stmmac_fpe_set_preemptible_tcs(priv, priv->ioaddr, qopt->mqprio.preemptible_tcs); return 0; @@ -1109,16 +1090,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, mutex_unlock(&priv->est_lock); } - priv->plat->fpe_cfg->enable = false; - stmmac_fpe_configure(priv, priv->ioaddr, - priv->plat->fpe_cfg, - priv->plat->tx_queues_to_use, - priv->plat->rx_queues_to_use, - false); - netdev_info(priv->dev, "disabled FPE\n"); - - stmmac_fpe_handshake(priv, false); - netdev_info(priv->dev, "stop FPE handshake\n"); + stmmac_fpe_set_preemptible_tcs(priv, priv->ioaddr, 0); return ret; }