From patchwork Wed Jul 31 10:43:12 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: 13748464 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 649E01AC43C; Wed, 31 Jul 2024 10:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422642; cv=none; b=SE2eJsSzq9KlLC3GGoz4YNOVo+MCL+huUekMpWwkWVF5nG0koOdROEvVzE1x/81op6H7PV7qYa21lcmt9QFmGUN7bLrT5nzWTxbqfxxu0ECeIwgp4zevakfJmeiGO2+mYLxJHif4O9g7WOjTBp0rWxsS/uBh1M98Q3O5zbfsiYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422642; c=relaxed/simple; bh=cwE18384uqPuD1tFF56u+x14DWLh518w7m2ga33PTvA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ji9HOTTijHsF1jmSiLhoLbX5QQFLnSP2Lic1Y3h7StuHPYb+Suyw0K9B39clgcsZiNwGKIq0hgUZnFR3DzOPq4TEb979XBkQbBjB+AlK7HVs9kcuoW4gDWTUFmvbaNNuGidbalHhttBUUPP361awUy7EBFmoG4jQA8GcCOZiN+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NAVMyj00; arc=none smtp.client-ip=209.85.167.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NAVMyj00" Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3db16b2c1d2so3987023b6e.2; Wed, 31 Jul 2024 03:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722422639; x=1723027439; darn=vger.kernel.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=snaCsACqyJEvDPoCe8c6j2mEdiz6XpKSMeazDSmVYA8=; b=NAVMyj00p353ssTioSK5kETYSykfIAdkl2SeHtzXHSmRo9Mlcbfo/NwAfMEkOxxon5 ypspudPwgdm3UzNmGPJGacCqy5KAyWNCfaU6HBIwo70oXfzRlBMAF/t5B3a5bE63XLAu nWtkeZPklLpoMZJ6tn/P3ghW5TyyxfGHB9Yh6tgONNLVHtGCiLggIIr7ui9GZbPIJIeW /x5rcowM1Il6Io1x3sI7R1Ry/AFj4OvlFOc0RrUj9gMGR2CmOPrizA6BfMUdWhpYRtu5 dz1vRj9DHkV+tVGLXSgjXKIATRUk29gpqGwib0frTntU+sa/wJdnhdE+wH9OhGNB+Fq4 Bu+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722422639; x=1723027439; 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=snaCsACqyJEvDPoCe8c6j2mEdiz6XpKSMeazDSmVYA8=; b=YePpXQP3+ObEzh320zmPuA1ol/8un5lbPV2ehyyQUOFVhPn1fiYlp37ipfkWtUy0I8 OHUsRaf4xLbfQnBVuCOODwNROuC59TmDIKDfLAg6+46RTvMBEN+E3Y4oFbm8WLls3n8l G9zhHdb0Oay732aazB6dAG8rt4vyavOM6oGqtOViY77Di6HLylNX/DA8vrdzEmIzFQzk I5bp3Xd2cheX886y6Qm8rdb6R45/icg1kMAg7CXMWFXFoH0OjAXtuBuL7C0QbBJgi+Nx MjaSzCZrRb7wAAdCdA0r8Ish9/mSagJBgALF+RSfmhpuPmEGVN3s8wtTYoj+1Ex7rQlK N9iQ== X-Forwarded-Encrypted: i=1; AJvYcCWCWd9NwCsYEtcdntouJ9HUyNlGXKnlUCnlEiVKbT1N1hCiZYgiqG2C9uPd3PvqVKKB4IVwtl62r7caC04=@vger.kernel.org X-Gm-Message-State: AOJu0YybDTO0M0DGOLCGEe+bjaDOUVV+C0N9nm3C60NtblY1canYddFI yGh1D97fTkcpGi7CU1lj7plg/OVbzdrei8FZDdo97qDycXfMeaPZ X-Google-Smtp-Source: AGHT+IFvZHTHnA2mtTbaHt9st4XF5vvQ0tz9N8ooQBOxEewsYWTEfsn8Xwb59WNXcqec07rlupgtug== X-Received: by 2002:a05:6870:1685:b0:25e:24a0:4c96 with SMTP id 586e51a60fabf-267d4d0710bmr16665666fac.11.1722422639081; Wed, 31 Jul 2024 03:43:59 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-7a9f816da59sm8791375a12.29.2024.07.31.03.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 03:43:58 -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 1/5] net: stmmac: configure FPE via ethtool-mm Date: Wed, 31 Jul 2024 18:43:12 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Implement ethtool --show-mm and --set-mm callbacks. 0) Setup two DWMAC CORE 5.10a devices, connect in a back-to-back manner. 1) After kernel booted, get initial status: ethtool --include-statistics --json --show-mm eth1 [ { "ifname": "eth1", "pmac-enabled": true, "tx-enabled": false, "tx-active": false, "tx-min-frag-size": 60, "rx-min-frag-size": 60, "verify-enabled": false, "verify-time": 0, "max-verify-time": 128, "verify-status": "DISABLED", "statistics": { "MACMergeFrameAssErrorCount": 0, "MACMergeFrameSmdErrorCount": 0, "MACMergeFrameAssOkCount": 0, "MACMergeFragCountRx": 0, "MACMergeFragCountTx": 0, "MACMergeHoldCount": 0 } } ] 3) Enable FPE on local device, keep FPE disabled on remote device: ethtool --set-mm eth1 verify-enabled on verify-time 100 tx-enabled on 4) Get status on local device: ethtool --include-statistics --json --show-mm eth1 [ { "ifname": "eth1", "pmac-enabled": true, "tx-enabled": true, "tx-active": false, "tx-min-frag-size": 60, "rx-min-frag-size": 60, "verify-enabled": true, "verify-time": 100, "max-verify-time": 128, "verify-status": "VERIFYING", "statistics": { "MACMergeFrameAssErrorCount": 0, "MACMergeFrameSmdErrorCount": 0, "MACMergeFrameAssOkCount": 0, "MACMergeFragCountRx": 0, "MACMergeFragCountTx": 0, "MACMergeHoldCount": 0 } } ] 5) Enable FPE on remote device, handshake can be finished now: ethtool --set-mm eth1 verify-enabled on verify-time 100 tx-enabled on 6) Get status on local and remote device, both report SUCCEEDED: 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": 0, "MACMergeHoldCount": 0 } } ] 7) tc-mqprio or tc-taprio can be used to select whether traffic classes are express or preemptible. Signed-off-by: Furong Xu <0x1207@gmail.com> --- .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 + drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 17 +++ drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 5 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 6 + drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 + .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 111 ++++++++++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +- include/linux/stmmac.h | 1 + 8 files changed, 149 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index f98741d2607e..af871cce767e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -1268,6 +1268,8 @@ const struct stmmac_ops dwmac410_ops = { .fpe_configure = dwmac5_fpe_configure, .fpe_send_mpacket = dwmac5_fpe_send_mpacket, .fpe_irq_status = dwmac5_fpe_irq_status, + .fpe_get_add_frag_size = dwmac5_fpe_get_add_frag_size, + .fpe_set_add_frag_size = dwmac5_fpe_set_add_frag_size, .add_hw_vlan_rx_fltr = dwmac4_add_hw_vlan_rx_fltr, .del_hw_vlan_rx_fltr = dwmac4_del_hw_vlan_rx_fltr, .restore_hw_vlan_rx_fltr = dwmac4_restore_hw_vlan_rx_fltr, @@ -1320,6 +1322,8 @@ const struct stmmac_ops dwmac510_ops = { .fpe_configure = dwmac5_fpe_configure, .fpe_send_mpacket = dwmac5_fpe_send_mpacket, .fpe_irq_status = dwmac5_fpe_irq_status, + .fpe_get_add_frag_size = dwmac5_fpe_get_add_frag_size, + .fpe_set_add_frag_size = dwmac5_fpe_set_add_frag_size, .add_hw_vlan_rx_fltr = dwmac4_add_hw_vlan_rx_fltr, .del_hw_vlan_rx_fltr = dwmac4_del_hw_vlan_rx_fltr, .restore_hw_vlan_rx_fltr = dwmac4_restore_hw_vlan_rx_fltr, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c index e02cebc3f1b7..5d132bada3fe 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -638,3 +638,20 @@ void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, writel(value, ioaddr + MAC_FPE_CTRL_STS); } + +int dwmac5_fpe_get_add_frag_size(void __iomem *ioaddr) +{ + return FIELD_GET(AFSZ, readl(ioaddr + MTL_FPE_CTRL_STS)); +} + +void dwmac5_fpe_set_add_frag_size(void __iomem *ioaddr, u32 add_frag_size) +{ + u32 value; + + value = readl(ioaddr + MTL_FPE_CTRL_STS); + + value &= ~AFSZ; + value |= FIELD_PREP(AFSZ, add_frag_size); + + writel(value, ioaddr + MTL_FPE_CTRL_STS); +} diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h index bf33a51d229e..6b1c9d2da308 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h @@ -39,6 +39,9 @@ #define MAC_PPSx_INTERVAL(x) (0x00000b88 + ((x) * 0x10)) #define MAC_PPSx_WIDTH(x) (0x00000b8c + ((x) * 0x10)) +#define MTL_FPE_CTRL_STS 0x00000c90 +#define AFSZ GENMASK(1, 0) + #define MTL_RXP_CONTROL_STATUS 0x00000ca0 #define RXPI BIT(31) #define NPE GENMASK(23, 16) @@ -109,5 +112,7 @@ void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, enum stmmac_mpacket_type type); int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev); +int dwmac5_fpe_get_add_frag_size(void __iomem *ioaddr); +void dwmac5_fpe_set_add_frag_size(void __iomem *ioaddr, u32 add_frag_size); #endif /* __DWMAC5_H__ */ diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index e53c32362774..f868ffc3e64f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -425,6 +425,8 @@ struct stmmac_ops { struct stmmac_fpe_cfg *cfg, enum stmmac_mpacket_type type); int (*fpe_irq_status)(void __iomem *ioaddr, struct net_device *dev); + int (*fpe_get_add_frag_size)(void __iomem *ioaddr); + void (*fpe_set_add_frag_size)(void __iomem *ioaddr, u32 add_frag_size); }; #define stmmac_core_init(__priv, __args...) \ @@ -529,6 +531,10 @@ struct stmmac_ops { stmmac_do_void_callback(__priv, mac, fpe_send_mpacket, __args) #define stmmac_fpe_irq_status(__priv, __args...) \ stmmac_do_callback(__priv, mac, fpe_irq_status, __args) +#define stmmac_fpe_get_add_frag_size(__priv, __args...) \ + stmmac_do_callback(__priv, mac, fpe_get_add_frag_size, __args) +#define stmmac_fpe_set_add_frag_size(__priv, __args...) \ + stmmac_do_void_callback(__priv, mac, fpe_set_add_frag_size, __args) /* PTP and HW Timer helpers */ struct stmmac_hwtimestamp { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index b23b920eedb1..5228493bc68c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -345,6 +345,9 @@ struct stmmac_priv { struct work_struct fpe_task; char wq_name[IFNAMSIZ + 4]; + /* Serialize access to MAC Merge state between ethtool requests */ + struct mutex mm_lock; + /* TC Handling */ unsigned int tc_entries_max; unsigned int tc_off_max; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 7008219fd88d..ca85e8694285 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -19,6 +19,7 @@ #include "stmmac.h" #include "dwmac_dma.h" #include "dwxgmac2.h" +#include "dwmac5.h" #define REG_SPACE_SIZE 0x1060 #define GMAC4_REG_SPACE_SIZE 0x116C @@ -1270,6 +1271,113 @@ static int stmmac_set_tunable(struct net_device *dev, return ret; } +static int stmmac_get_mm(struct net_device *ndev, + struct ethtool_mm_state *state) +{ + struct stmmac_priv *priv = netdev_priv(ndev); + enum stmmac_fpe_state lo_state = priv->plat->fpe_cfg->lo_fpe_state; + u32 add_frag_size; + + if (!priv->dma_cap.fpesel) + return -EOPNOTSUPP; + + mutex_lock(&priv->mm_lock); + + /* If FPE is supported by hardware, preemptible MAC is always enabled */ + state->pmac_enabled = true; + + state->verify_time = priv->plat->fpe_cfg->verify_time; + + /* 802.3-2018 clause 30.14.1.6, says that the aMACMergeVerifyTime + * variable has a range between 1 and 128 ms inclusive. Limit to that. + */ + state->max_verify_time = 128; + + if (lo_state == FPE_STATE_CAPABLE) + state->verify_status = ETHTOOL_MM_VERIFY_STATUS_VERIFYING; + else if (lo_state == FPE_STATE_ENTERING_ON || lo_state == FPE_STATE_ON) + state->verify_status = ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED; + else if (lo_state == FPE_STATE_OFF) + state->verify_status = ETHTOOL_MM_VERIFY_STATUS_DISABLED; + else + state->verify_status = ETHTOOL_MM_VERIFY_STATUS_UNKNOWN; + + /* Cannot read MAC_FPE_CTRL_STS register here, or FPE interrupt events + * can lose. + * + * See commit 37e4b8df27bc ("net: stmmac: fix FPE events losing") + */ + state->tx_enabled = !!(priv->plat->fpe_cfg->fpe_csr == EFPE); + + /* FPE active if common tx_enabled and verification success or disabled (forced) */ + state->tx_active = state->tx_enabled && + (state->verify_status == ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED || + state->verify_status == ETHTOOL_MM_VERIFY_STATUS_DISABLED); + + state->verify_enabled = priv->plat->fpe_cfg->hs_enable; + + add_frag_size = stmmac_fpe_get_add_frag_size(priv, priv->ioaddr); + state->tx_min_frag_size = ethtool_mm_frag_size_add_to_min(add_frag_size); + + state->rx_min_frag_size = ETH_ZLEN; + + mutex_unlock(&priv->mm_lock); + + return 0; +} + +static int stmmac_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg, + struct netlink_ext_ack *extack) +{ + struct stmmac_priv *priv = netdev_priv(ndev); + u32 add_frag_size; + int err; + + if (!priv->dma_cap.fpesel) + return -EOPNOTSUPP; + + err = ethtool_mm_frag_size_min_to_add(cfg->tx_min_frag_size, + &add_frag_size, extack); + if (err) + return err; + + mutex_lock(&priv->mm_lock); + + priv->plat->fpe_cfg->verify_time = cfg->verify_time; + + stmmac_fpe_configure(priv, priv->ioaddr, priv->plat->fpe_cfg, + priv->plat->tx_queues_to_use, + priv->plat->rx_queues_to_use, + cfg->tx_enabled); + + stmmac_fpe_set_add_frag_size(priv, priv->ioaddr, add_frag_size); + + stmmac_fpe_handshake(priv, cfg->verify_enabled); + + mutex_unlock(&priv->mm_lock); + + return 0; +} + +static void stmmac_get_mm_stats(struct net_device *ndev, + struct ethtool_mm_stats *s) +{ + struct stmmac_priv *priv = netdev_priv(ndev); + struct stmmac_counters *mmc = &priv->mmc; + + if (!priv->dma_cap.rmon) + return; + + stmmac_mmc_read(priv, priv->mmcaddr, mmc); + + s->MACMergeFrameAssErrorCount = mmc->mmc_rx_packet_assembly_err_cntr; + s->MACMergeFrameSmdErrorCount = mmc->mmc_rx_packet_smd_err_cntr; + s->MACMergeFrameAssOkCount = mmc->mmc_rx_packet_assembly_ok_cntr; + s->MACMergeFragCountRx = mmc->mmc_rx_fpe_fragment_cntr; + s->MACMergeFragCountTx = mmc->mmc_tx_fpe_fragment_cntr; + s->MACMergeHoldCount = mmc->mmc_tx_hold_req_cntr; +} + static const struct ethtool_ops stmmac_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES, @@ -1309,6 +1417,9 @@ static const struct ethtool_ops stmmac_ethtool_ops = { .set_tunable = stmmac_set_tunable, .get_link_ksettings = stmmac_ethtool_get_link_ksettings, .set_link_ksettings = stmmac_ethtool_set_link_ksettings, + .get_mm = stmmac_get_mm, + .set_mm = stmmac_set_mm, + .get_mm_stats = stmmac_get_mm_stats, }; void stmmac_set_ethtool_ops(struct net_device *netdev) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 12689774d755..9b1cf81c50ea 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7384,7 +7384,6 @@ static void stmmac_fpe_lp_task(struct work_struct *work) enum stmmac_fpe_state *lo_state = &fpe_cfg->lo_fpe_state; enum stmmac_fpe_state *lp_state = &fpe_cfg->lp_fpe_state; bool *hs_enable = &fpe_cfg->hs_enable; - bool *enable = &fpe_cfg->enable; int retries = 20; while (retries-- > 0) { @@ -7394,11 +7393,6 @@ static void stmmac_fpe_lp_task(struct work_struct *work) if (*lo_state == FPE_STATE_ENTERING_ON && *lp_state == FPE_STATE_ENTERING_ON) { - stmmac_fpe_configure(priv, priv->ioaddr, - fpe_cfg, - priv->plat->tx_queues_to_use, - priv->plat->rx_queues_to_use, - *enable); netdev_info(priv->dev, "configured FPE\n"); @@ -7418,7 +7412,7 @@ static void stmmac_fpe_lp_task(struct work_struct *work) MPACKET_VERIFY); } /* Sleep then retry */ - msleep(500); + msleep(fpe_cfg->verify_time); } clear_bit(__FPE_TASK_SCHED, &priv->fpe_task_state); @@ -7720,6 +7714,7 @@ int stmmac_dvr_probe(struct device *device, stmmac_napi_add(ndev); mutex_init(&priv->lock); + mutex_init(&priv->mm_lock); /* If a specific clk_csr value is passed from the platform * this means that the CSR Clock Range selection cannot be diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 84e13bd5df28..707a6916e51a 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -162,6 +162,7 @@ struct stmmac_fpe_cfg { enum stmmac_fpe_state lp_fpe_state; /* Link Partner FPE state */ enum stmmac_fpe_state lo_fpe_state; /* Local station FPE state */ u32 fpe_csr; /* MAC_FPE_CTRL_STS reg cache */ + u32 verify_time; /* see struct ethtool_mm_state */ }; struct stmmac_safety_feature_cfg { From patchwork Wed Jul 31 10:43: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: 13748465 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D11B21AC43C; Wed, 31 Jul 2024 10:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422651; cv=none; b=rhXNlwAlXNwGLlRYSDiEud7VUfAx1VA/6yvcChSeOgCHasqX+vig6rCAdjin6Vw+3ThAsYsGK+6UtgmWcAweqckZEN/3wpecrTQ4WYAtZtA2OQkWhcn6d3voOPeVAOI4vopDNy/SmnFYNzVhks3cr2JSgvXoM6CgSmc56vTpLpQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422651; c=relaxed/simple; bh=zVer1X4pD3xyz04ZGh4eaC6+zbTxi9uUKqGhpGLnAPc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l3vLX5zJVvZDMnJTSHoyM8gEDEjfyMcTimCBzPP+HCgISEdiSC5WgyCciuVSUfg2h+9zkHn6YC3/DZNZswgLsDDIy1k44U4oBx7sYbmBvyD6Zvy/z8X3GcF4rQglG52bRfyiVSuXW/qikXZ6Q48/ED23f4CGOemnVhbo24allZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HQZ9e9G8; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HQZ9e9G8" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3db19caec60so4025504b6e.1; Wed, 31 Jul 2024 03:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722422649; x=1723027449; darn=vger.kernel.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=C5uCSeDS2KlYFiPNdbR3vKj49AmACS3RssJxcitTbJU=; b=HQZ9e9G82hNygqNV+r4aqCasZPzxTJPPDo1M8k5pZMhXACLk5x2jeMRYdlr1qXO9jJ LavaZ6Ai0uZ0IiUsklbqd0EhFzAi+eCaOuwNxYHEPilrhNd1P53XpgLICoFfeBC0zuBJ FGx7uUzVuj7UA+BISRmZmArO239sW8iPzGIiVVmTjg1+Owq4jqyHSkWU7JX2wrlC+fAG 5g6gKIbeW/bOLno+IPczRIhJCFLjK6/4FBkzIKGnP9mNoSQe4RcDagvswCETiOluEKDj NaSS42JXx7MiHDvPnmSJQkUEkRFNu4hRgf2fnjGvF+HcD7C9AcFz7riA2G0X0wWrMD9J 2ttQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722422649; x=1723027449; 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=C5uCSeDS2KlYFiPNdbR3vKj49AmACS3RssJxcitTbJU=; b=tgnhKWnTy9LePP98yNf0TGJiuVXQiZemNGhUmTfqJG+EguJkGy1hOz4cBB2VgOfxxG SvzaD0Dp5HvztsGqvRylGh16mc/a2XQ1KX0rAqJb6TT4xD/MRR+hYWKuhf9flavgHUH9 PGAdDCs3utY4rlbBWIFVx2GwLN7ZBEXxebpx17KorpnexCB+2IOTJqOUTAMKnRPLDsQg vmbPjtYe8IuKbOVbjYSYvE3lsV8kgsOAqwEEKMQYZgzXDaqV6vBFUHjy/6UP/mjnd0/H BH+O3pobsX6wA6Q4acb2Xz8d0bWnBNn+85trd7HFmFNfCXanxSlBefIZbmJc08x7RQ6j Jueg== X-Forwarded-Encrypted: i=1; AJvYcCXCaRh9Za9IC4hnb/NjiWuolvw3qxJh8naoYGX4qyD+sCaRfJKnpxNEeNP3nZj62vKHUCuMbwydlAYCB+fK2J94EYqqGwI23XAwFbQk X-Gm-Message-State: AOJu0Yzigo4cLYGoTP5c0yWDArRxMZkNth6OUJzmwfQxhRrHYtdCzpVu Rs2TbSQtlx4+0sIU4KHdTmxkpaUwu+rUFTuOZLMyrS+dNUR/mBwN X-Google-Smtp-Source: AGHT+IHcHs92dpP656QF9x0ILt6Q+QZ+HokBNWMSIIQRCqfEkorPMSQjHNCWI7OPXpiMNpEaK7cxPQ== X-Received: by 2002:aca:905:0:b0:3da:aae9:718e with SMTP id 5614622812f47-3db23d7a442mr14618692b6e.46.1722422648801; Wed, 31 Jul 2024 03:44:08 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-7a9f816da59sm8791375a12.29.2024.07.31.03.43.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 03:44:08 -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 2/5] net: stmmac: support fp parameter of tc-mqprio Date: Wed, 31 Jul 2024 18:43:13 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org tc-mqprio can select whether traffic classes are express or preemptible. Tested on DWMAC CORE 5.10a Signed-off-by: Furong Xu <0x1207@gmail.com> --- .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 + drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 12 ++++ drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 2 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 8 +++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 2 + .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 61 +++++++++++++++++++ 6 files changed, 87 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index af871cce767e..68cdfd9e7c8c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -1270,6 +1270,7 @@ const struct stmmac_ops dwmac410_ops = { .fpe_irq_status = dwmac5_fpe_irq_status, .fpe_get_add_frag_size = dwmac5_fpe_get_add_frag_size, .fpe_set_add_frag_size = dwmac5_fpe_set_add_frag_size, + .fpe_set_preemptible_tcs = dwmac5_fpe_set_preemptible_tcs, .add_hw_vlan_rx_fltr = dwmac4_add_hw_vlan_rx_fltr, .del_hw_vlan_rx_fltr = dwmac4_del_hw_vlan_rx_fltr, .restore_hw_vlan_rx_fltr = dwmac4_restore_hw_vlan_rx_fltr, @@ -1324,6 +1325,7 @@ const struct stmmac_ops dwmac510_ops = { .fpe_irq_status = dwmac5_fpe_irq_status, .fpe_get_add_frag_size = dwmac5_fpe_get_add_frag_size, .fpe_set_add_frag_size = dwmac5_fpe_set_add_frag_size, + .fpe_set_preemptible_tcs = dwmac5_fpe_set_preemptible_tcs, .add_hw_vlan_rx_fltr = dwmac4_add_hw_vlan_rx_fltr, .del_hw_vlan_rx_fltr = dwmac4_del_hw_vlan_rx_fltr, .restore_hw_vlan_rx_fltr = dwmac4_restore_hw_vlan_rx_fltr, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c index 5d132bada3fe..068859284691 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -655,3 +655,15 @@ void dwmac5_fpe_set_add_frag_size(void __iomem *ioaddr, u32 add_frag_size) writel(value, ioaddr + MTL_FPE_CTRL_STS); } + +void dwmac5_fpe_set_preemptible_tcs(void __iomem *ioaddr, unsigned long tcs) +{ + u32 value; + + value = readl(ioaddr + MTL_FPE_CTRL_STS); + + value &= ~PEC; + value |= FIELD_PREP(PEC, tcs); + + writel(value, ioaddr + MTL_FPE_CTRL_STS); +} diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h index 6b1c9d2da308..bce7e88418ac 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h @@ -40,6 +40,7 @@ #define MAC_PPSx_WIDTH(x) (0x00000b8c + ((x) * 0x10)) #define MTL_FPE_CTRL_STS 0x00000c90 +#define PEC GENMASK(15, 8) #define AFSZ GENMASK(1, 0) #define MTL_RXP_CONTROL_STATUS 0x00000ca0 @@ -114,5 +115,6 @@ void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev); int dwmac5_fpe_get_add_frag_size(void __iomem *ioaddr); void dwmac5_fpe_set_add_frag_size(void __iomem *ioaddr, u32 add_frag_size); +void dwmac5_fpe_set_preemptible_tcs(void __iomem *ioaddr, unsigned long tcs); #endif /* __DWMAC5_H__ */ diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index f868ffc3e64f..109699d3df0a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -7,6 +7,7 @@ #include #include +#include #define stmmac_do_void_callback(__priv, __module, __cname, __arg0, __args...) \ ({ \ @@ -427,6 +428,7 @@ struct stmmac_ops { int (*fpe_irq_status)(void __iomem *ioaddr, struct net_device *dev); int (*fpe_get_add_frag_size)(void __iomem *ioaddr); void (*fpe_set_add_frag_size)(void __iomem *ioaddr, u32 add_frag_size); + void (*fpe_set_preemptible_tcs)(void __iomem *ioaddr, unsigned long tcs); }; #define stmmac_core_init(__priv, __args...) \ @@ -535,6 +537,8 @@ struct stmmac_ops { stmmac_do_callback(__priv, mac, fpe_get_add_frag_size, __args) #define stmmac_fpe_set_add_frag_size(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, fpe_set_add_frag_size, __args) +#define stmmac_fpe_set_preemptible_tcs(__priv, __args...) \ + stmmac_do_void_callback(__priv, mac, fpe_set_preemptible_tcs, __args) /* PTP and HW Timer helpers */ struct stmmac_hwtimestamp { @@ -622,6 +626,8 @@ struct stmmac_tc_ops { struct tc_etf_qopt_offload *qopt); int (*query_caps)(struct stmmac_priv *priv, struct tc_query_caps_base *base); + int (*setup_mqprio)(struct stmmac_priv *priv, + struct tc_mqprio_qopt_offload *qopt); }; #define stmmac_tc_init(__priv, __args...) \ @@ -638,6 +644,8 @@ struct stmmac_tc_ops { stmmac_do_callback(__priv, tc, setup_etf, __args) #define stmmac_tc_query_caps(__priv, __args...) \ stmmac_do_callback(__priv, tc, query_caps, __args) +#define stmmac_tc_setup_mqprio(__priv, __args...) \ + stmmac_do_callback(__priv, tc, setup_mqprio, __args) struct stmmac_counters; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9b1cf81c50ea..a5e3316bc410 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6256,6 +6256,8 @@ static int stmmac_setup_tc(struct net_device *ndev, enum tc_setup_type type, switch (type) { case TC_QUERY_CAPS: return stmmac_tc_query_caps(priv, priv, type_data); + case TC_SETUP_QDISC_MQPRIO: + return stmmac_tc_setup_mqprio(priv, priv, type_data); case TC_SETUP_BLOCK: return flow_block_cb_setup_simple(type_data, &stmmac_block_cb_list, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 996f2bcd07a2..494fe2f68300 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -1198,6 +1198,13 @@ static int tc_query_caps(struct stmmac_priv *priv, struct tc_query_caps_base *base) { switch (base->type) { + case TC_SETUP_QDISC_MQPRIO: { + struct tc_mqprio_caps *caps = base->caps; + + caps->validate_queue_counts = true; + + return 0; + } case TC_SETUP_QDISC_TAPRIO: { struct tc_taprio_caps *caps = base->caps; @@ -1214,6 +1221,59 @@ static int tc_query_caps(struct stmmac_priv *priv, } } +static void stmmac_reset_tc_mqprio(struct net_device *ndev) +{ + struct stmmac_priv *priv = netdev_priv(ndev); + + netdev_reset_tc(ndev); + netif_set_real_num_tx_queues(ndev, priv->plat->tx_queues_to_use); + + stmmac_fpe_set_preemptible_tcs(priv, priv->ioaddr, 0); +} + +static int tc_setup_mqprio(struct stmmac_priv *priv, + struct tc_mqprio_qopt_offload *mqprio) +{ + struct tc_mqprio_qopt *qopt = &mqprio->qopt; + struct net_device *ndev = priv->dev; + int num_stack_tx_queues = 0; + int num_tc = qopt->num_tc; + int offset, count; + int tc, err; + + if (!num_tc) { + stmmac_reset_tc_mqprio(ndev); + return 0; + } + + err = netdev_set_num_tc(ndev, num_tc); + if (err) + return err; + + for (tc = 0; tc < num_tc; tc++) { + offset = qopt->offset[tc]; + count = qopt->count[tc]; + num_stack_tx_queues += count; + + err = netdev_set_tc_queue(ndev, tc, count, offset); + if (err) + goto err_reset_tc; + } + + err = netif_set_real_num_tx_queues(ndev, num_stack_tx_queues); + if (err) + goto err_reset_tc; + + stmmac_fpe_set_preemptible_tcs(priv, priv->ioaddr, mqprio->preemptible_tcs); + + return 0; + +err_reset_tc: + stmmac_reset_tc_mqprio(ndev); + + return err; +} + const struct stmmac_tc_ops dwmac510_tc_ops = { .init = tc_init, .setup_cls_u32 = tc_setup_cls_u32, @@ -1222,4 +1282,5 @@ const struct stmmac_tc_ops dwmac510_tc_ops = { .setup_taprio = tc_setup_taprio, .setup_etf = tc_setup_etf, .query_caps = tc_query_caps, + .setup_mqprio = tc_setup_mqprio, }; 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: 13748466 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3CB11AC43C; Wed, 31 Jul 2024 10:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422661; cv=none; b=m4IXbuG2h/SHdEsYhoLThsgAwGjShthkDxg4WkafinF7eQdYy2pVfH9mj2RBBQ2/aAeDhPknHCkwo+y+G0HOpxy3KeQuUrifMSmZYmxz+ZLuDFKdB72ar+jS6594nnOPJ2zmjS747hQargtxX8CVaWhaXQgTD2k4rpWiHmrB0AU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422661; c=relaxed/simple; bh=p11lj5iJV2QtSeN2s6BsoXJxSTFxLs1xnjmR/evjQ4g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qisNQ1SrHUA+bAP+8endEnPNMOXWGHV87LrX/GZ3RxHbaDx+LSZmBcnB/bbgY7X3ZD6rrJ5Kkvp2BtYy1Jh/nbJVJpZaxru9BDkvV+C0Gv7kesxv7877HNZt705vJa8QzmkxeM6FF08l77/vo1sUVC0dHM3k694SkXY/BqNk7OI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HDBG9O8N; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HDBG9O8N" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-7093f6adc4aso2034026a34.3; 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=vger.kernel.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=HDBG9O8NF6TCCutWe6mUOZ8cawmHtLuoTdyZr2cVxZrTVw4gz6HKcDbQVjc5DaDmIg qlligkriXrSvtBwQWGPsV7ZuB/kAos5cFiwrKF2I+QuoVKOE5LpPAc2igr854RdNVdUp 7RsXoh2JOZIDBjy9neUVkHipt/iSkSx52/+uDZa8tOHlHLWyCAdD3h71GYcVSPoGzDLD gUS/KTvERiy4rzz3rOS+LdwQOi1oFj4m/pFS5wFht+9XqPnb4ew4lKsd7cfYH2MBfFS6 RD+HHqL+yP+c6pQ2wkMpyzafNS0O159/dNIMlg+YY6RWeuD26Ozm57gMbbOusNmdz5Bs OfvQ== 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=KjN8Cbv9xIPkoKv9i7meetGFAOn0wCFKXDDdoVAyvYoqFa1ghPGekruAsh8OG7yR+O TKFwpWLoQHPQAAh4TdZ/rB/Udv1ypHROzoMiMi8seswVAiiLWk+7tHTbVJbaUCoBvE+T qty1duYRTGTcht6HwzC6fqo6CIV21OYVpKgsKvVJXYBnYY8bdOIV5uuObzw0TwRvQmEP xOLiS6As4xdIVEE0aNW1zGcor7bt6kTpvyGA/0lx65qyPyw/CDkPtb7lqjwcmAIMQTMd 3BNX15O+TOw+NcBK4f5Qh0e0/CxKo2RWC3MYs30VG5wtjKDDprCeGRgZdBQ8kF1hTwrR 1sSw== X-Forwarded-Encrypted: i=1; AJvYcCXPxa3Dl3B1GmnlSL3jn2QWnGhQS2O++1nP+tG2osTSPYWVg2j/0i3gV/gM9VjG9OCQEYchQaGnC6av0f/6MNfjuUmWWt9k/wLJ3Al+ X-Gm-Message-State: AOJu0YwtIZ9IbXPgxMsVEhWp+wSeyPc6TE/1VKjXQ4w7xQTvshuRWmk/ 1FEiazLQe2Oy6+SVhrbdvF+SiFoDp8u9BakHoW4bFOv7pT9cPsT0 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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; } From patchwork Wed Jul 31 10:43:15 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: 13748467 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D2341AC44C; Wed, 31 Jul 2024 10:44:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422670; cv=none; b=NG3eIFDyYnhJVGROhQlJ9gGZBelD6KwBGyeqQ7XKPD4ZPNhcJ8+wjLFNn1lY2C8+4d9jVs9wx4ij3Yp7njwgj/sQDR6eQ5SF7ZBsTLM2OjcceiNKkC5wFlPmBm/n65NEXBoNzyEhmeDkVNTU0OixiScqI4xpNu3wNLN2b/sarR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422670; c=relaxed/simple; bh=ZXDpUjreLVo/wT4q+0h35tB7/2043nuYSnJ13PFOakI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TmV8S2nXEm4KhflaJTmPlnoSfMcSwmp/28BwnIcAgaI2vbwCukxf6974x3pf445fEIZz9ratywDCxXs0E3LTe84FSFvDGZutDW2kVHlsVWO0g+vw16B51zMnw3ET51YC0mOyS5d2u55aVS/UKqiASpll+Q6TdMBHgJLplgpF+gk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DQyTarBD; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DQyTarBD" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-70d2ae44790so3917148b3a.2; Wed, 31 Jul 2024 03:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722422668; x=1723027468; darn=vger.kernel.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=DPGHY6v5CIr+Eb9z9smFgMyzujoybq7sK/FaJAiXSc0=; b=DQyTarBDOIko5G3vS6ZwcUWfZ8mTNq5vMvred2Nj5lOvsJN4iKzx22w1FhInDwR7WJ PCJX5EtEyiKbVysVWMachldXsfTkGLlJYRmC1NNqT6X7B99A1huYOysLGNNGkOr3kUp+ e3iB4fJ9ZTHeSRaDLQ+MLjGm1n93Tt8JnpliwAwtLZ3zSsDhPaGGNu+x58aGrrWv3jHm 07rrOr+ZIs/5BOmsKhtPYgMkg1Te/Xjj90pXQGzOz6VnnUaw5Ch4yS71IHazAmYpXx7/ 0zxj+HIRUPUBZKfIYhi5yrvw/c5aZ24mEnrdgeyHsNDa/kpyURbt4rdqcr5qMNMtfV6J 7fwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722422668; x=1723027468; 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=DPGHY6v5CIr+Eb9z9smFgMyzujoybq7sK/FaJAiXSc0=; b=ZQOE6IcfppuN7xSxm0UcFKDMwNcFegdLzb86WEg0FKlOOYRxNVVEMsQ0IIcC9OIZpN DXRg9R2JssHr32wlBfKXm5dHqVFyyC4Y2JUFrELx8a06WyjHpmPvDfYT+fTQ1jnUh7wr cWqIch+PsLUhgwHJQjF0JO7Uu4bZcbD7dz1YVfM1gplRiV9NkgszbZ5pEAWiA8ZU5wi/ mP9TOHv34JImy5E/I+tCBm2pmWPLM2ZI/j6dpYAMuIzDAOYiodO868UBAyhjmxb1kfu6 VRX7mqnbHvcyYm6tbFTqKde0p3orFdZT/30I41pMKiiVYjKLjGaEkS49j6pVy73f7HGt mwEw== X-Forwarded-Encrypted: i=1; AJvYcCVo+bJXeJEUanWw4JeVpJp//mmisLbqamIAASmhM9U77u6w37cwkVJh7KqI7n0KAIut6lFdA+AWGeomFQbtcI2NNKXQpIjYCuvqQAaS X-Gm-Message-State: AOJu0YwAmOU5ZRc8CbqLnamw77vyGgozjeTSC4ulbBSxxmW8tneRhkJQ dtgI2gmm6dXXUZK+1lmqAwZNiHx81QhPkRxfnJZZZAtoDdrUzfQx X-Google-Smtp-Source: AGHT+IFTctTZ1qQ55uQCVBFKWaKO8LVEq4OqBYk1wWdf3UiDgyEsaVyIy02DJQJqJ0/PrRnYWTUxGA== X-Received: by 2002:a05:6a00:21c9:b0:70e:a4ef:e5c2 with SMTP id d2e1a72fcca58-70ecea30033mr13327588b3a.13.1722422668091; Wed, 31 Jul 2024 03:44:28 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 03:44:27 -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 4/5] net: stmmac: drop unneeded FPE handshake code Date: Wed, 31 Jul 2024 18:43:15 +0800 Message-Id: <62d2b178672ced64f98d51bff17006728e77dea9.1722421644.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org FPE is configured via ethtool-mm, the hardcoded way shall be no more. Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +----- include/linux/stmmac.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a5e3316bc410..fba44bd1990a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3532,13 +3532,9 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) stmmac_set_hw_vlan_mode(priv, priv->hw); - if (priv->dma_cap.fpesel) { + if (priv->dma_cap.fpesel) stmmac_fpe_start_wq(priv); - if (priv->plat->fpe_cfg->enable) - stmmac_fpe_handshake(priv, true); - } - return 0; } diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 707a6916e51a..66eb4627bd47 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -157,7 +157,6 @@ enum stmmac_fpe_task_state_t { }; struct stmmac_fpe_cfg { - bool enable; /* FPE enable */ bool hs_enable; /* FPE handshake enable */ enum stmmac_fpe_state lp_fpe_state; /* Link Partner FPE state */ enum stmmac_fpe_state lo_fpe_state; /* Local station FPE state */ From patchwork Wed Jul 31 10:43:16 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: 13748468 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBFD91AD413; Wed, 31 Jul 2024 10:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422680; cv=none; b=RRD5VdIl1c5thPO7bNMc9g8OuQKNl0OIh6/Y4Fohpgq4N+GlcpxFkOB9Iw2FpwKgyEqQ23+VRTP4EoKtqzcXDHd2txIA9U4WKd++/+19VtXaATscpCoy7avOY/vPdVObchVYobY92LxWcGhPZrLkGexjqy+HCpql/oce3AZXsbY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722422680; c=relaxed/simple; bh=DCREtrJVG7yWVGe5DWmw9oaJV0MdvmZNjnV9p+LXy/c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=up2K/tHX5bSBFb8zAiBUyWwmI9YMEzATVa9VKkUM5VrWG8AuY7ut61Yu9v8Jyp4B+RnujDFdg8RHDtpndV7O5RsNDRguU0eePXRitAJSi5mFz2b5zxLDy6HKwxbe7EjOs8hfdz3MscLh9y6Ll3JqAqv3Hy8iZ3QiEX04pn33aVo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RNJRSQIp; arc=none smtp.client-ip=209.85.160.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RNJRSQIp" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-260f1664fdfso3078928fac.1; Wed, 31 Jul 2024 03:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722422678; x=1723027478; darn=vger.kernel.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=fu1ouNnrG9bF+uAnA7GwZya1Ys3715c6hhI6EtcZ2RA=; b=RNJRSQIp7K+XF7C7OuNDXnV6TI0O1/8yAm8dfb0wqm8lkczj/SXibT9RjxF3VZ5aMs ds4IUMSW/xfdZ7MlpbPJ0545J8qzz1HvgxyswrQQBa+VrNUNRu7LSprYSO6JppswWeMr B8pymbZcpBJYbdQ+8v/1mv6opRSMv5wb52O8QKpXMmpVlYVoHF081GsyKKWQpspR2QWV +V/A/4Jus1KeYpO+XppBt6oi1N99aDS8yqBwfBNmQwtCfQxsbcHbCfFFYkP7imojnTq4 efBRjpDq1y8BTZcQ1Msthebr6L1LJchjO1Ojt5uwnN/hR4FsThGCuvNqjopOFuHDZ2IF 3Zxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722422678; x=1723027478; 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=fu1ouNnrG9bF+uAnA7GwZya1Ys3715c6hhI6EtcZ2RA=; b=YbqB8AsfJolHEo+m40GX/kps+PsjoOKrmZckPqAUtNfd4+gttxowVis6zjzfC9i5Mv pUe9aAfqHoR+NiPTAjDuS++haZ65CIIUjH/qRNLaxBMDx+xrfWPO0fQ5Y+n5kllCf/cn MsTGySxkQ/vbw+wZid8kl+oCVNowrCfYj1QLeu/xeINOMYBUMBdF7QQKze9mH+TPnAS7 uW08qYhKiZsgHWy6fjZTgElmvCHvQyY01JjAX3HU2sivk0fdt3OUDRwV/mQTEGWX/n6G RY8tqaQY37p1Kc8Mp1/q65weZg9IirDD31W+1n3l519vKaBRevDbIrt/sXLhmsUQtNaq j4LA== X-Forwarded-Encrypted: i=1; AJvYcCUchPB3Z9tnp7FZDOjnNasiBErkEJRP6nuWr+V/4CmLh07SSvH6aAyn7hw2nSiK5aFbkOABkC7bJoXr28TeKOz/913BD7kYygHLRuTX X-Gm-Message-State: AOJu0YwV8McGnxU2Q/33v+spLU3EKLyFEsFxG++kVR2RQMvfbF+mouuw GmEucdwFIcA4pQ2/GhOO+Etr0gRk1s+MunVYsXAs7mP5rzkUQ2Qh X-Google-Smtp-Source: AGHT+IEvFA1K3zu3i0XikbrUbT49e6jRM+kXTRxXXH210S3QRwo16GCTK94T7ErsdT4YoniWaIZ6jg== X-Received: by 2002:a05:6870:e244:b0:25e:7a9:b603 with SMTP id 586e51a60fabf-267d4ccf5a4mr14061153fac.5.1722422677818; Wed, 31 Jul 2024 03:44:37 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 03:44:37 -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 5/5] net: stmmac: silence FPE kernel logs Date: Wed, 31 Jul 2024 18:43:16 +0800 Message-Id: <370d89a46a15856856c601e1c8036cbb4bc7bb4e.1722421644.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org ethtool --show-mm can get real-time state of FPE. Those kernel logs should keep quiet. Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 8 ++++---- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c index 068859284691..3abacd863fe4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -605,22 +605,22 @@ int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) if (value & TRSP) { status |= FPE_EVENT_TRSP; - netdev_info(dev, "FPE: Respond mPacket is transmitted\n"); + netdev_dbg(dev, "FPE: Respond mPacket is transmitted\n"); } if (value & TVER) { status |= FPE_EVENT_TVER; - netdev_info(dev, "FPE: Verify mPacket is transmitted\n"); + netdev_dbg(dev, "FPE: Verify mPacket is transmitted\n"); } if (value & RRSP) { status |= FPE_EVENT_RRSP; - netdev_info(dev, "FPE: Respond mPacket is received\n"); + netdev_dbg(dev, "FPE: Respond mPacket is received\n"); } if (value & RVER) { status |= FPE_EVENT_RVER; - netdev_info(dev, "FPE: Verify mPacket is received\n"); + netdev_dbg(dev, "FPE: Verify mPacket is received\n"); } return status; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index fba44bd1990a..5531c26cba34 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7392,19 +7392,19 @@ static void stmmac_fpe_lp_task(struct work_struct *work) if (*lo_state == FPE_STATE_ENTERING_ON && *lp_state == FPE_STATE_ENTERING_ON) { - netdev_info(priv->dev, "configured FPE\n"); + netdev_dbg(priv->dev, "configured FPE\n"); *lo_state = FPE_STATE_ON; *lp_state = FPE_STATE_ON; - netdev_info(priv->dev, "!!! BOTH FPE stations ON\n"); + netdev_dbg(priv->dev, "!!! BOTH FPE stations ON\n"); break; } if ((*lo_state == FPE_STATE_CAPABLE || *lo_state == FPE_STATE_ENTERING_ON) && *lp_state != FPE_STATE_ON) { - netdev_info(priv->dev, SEND_VERIFY_MPAKCET_FMT, - *lo_state, *lp_state); + netdev_dbg(priv->dev, SEND_VERIFY_MPAKCET_FMT, + *lo_state, *lp_state); stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg, MPACKET_VERIFY);