From patchwork Tue Aug 20 11:20:35 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: 13769981 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 CA17AC3DA4A for ; Tue, 20 Aug 2024 11:22:57 +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=g7SyoZHnYM2LI5K05hiBb+2ztbIHleQxiNZgpgIVXhw=; b=w8ES7VNyPcLQ9buhahGHFHU1w+ Szubr1Sb28sN9OBfH6HMHYlfsqLhwgjzymbaq7N90n+4wfgT2nqd36CCz7zpg3fPDqYvtAw8S+T0U 77PSYuxFj1xM4MepAEH4tba2fHTJUUJCOt7vnFqA3+cGSGU6ZBXn8N2rMCah6ONH+B/h1UwL1Sg/j bfgOyK0GeWBI9UC1REtH4BBI4ojxun0F2gbxhy/RZtAVe0bUA3DRZLMRvCiWUUAhSHojUSDYWvIs/ zPSwW1dnrkB63pEeYK2Kz4Ce9TdSUh3ibniTlyFUaGNsD4UplSid42bE7gjiE91z8ZLOuaZwDjk80 NDsKkh8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMwp-00000004zsx-3BKo; Tue, 20 Aug 2024 11:22:47 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMvW-00000004zUq-3jnY for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 11:21:28 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20202df1c2fso26665335ad.1 for ; Tue, 20 Aug 2024 04:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724152886; x=1724757686; 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=g7SyoZHnYM2LI5K05hiBb+2ztbIHleQxiNZgpgIVXhw=; b=K+PrxFMRcZhvhTXZGk9hJupypB7HtwCglTkFR7kfNf/NdHpwjUMUJhLP23brYrCMkC bYyPfvK+DaPOEIOAcCqYSxiSZf+A3yFNElHUNFYR8Ug6H8Qzu3NlQuWeBgN4DNVkPCdp XlaCrvbcNQqLOyLBG3PYmLvkM+gOi7BBHMERrlzztig31FF3ZfsuY0/ngfYEh2oRCg9o IXqEBZcMJjCqlVvBNBuWgZog1R4JuzqSF6sHXvSXeJ8Ly77LNjxiwXMOjhHhdWqTdv9o /vr30u2hImsvZ5UIzhBGz0EQVcHlqPnkBjhcybenev4xH38dDKkSuWhO0ddtqm8F6l9k LHuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724152886; x=1724757686; 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=g7SyoZHnYM2LI5K05hiBb+2ztbIHleQxiNZgpgIVXhw=; b=Yv+ik8zbqlQxSF0plIwr/hFFgUPdowhc/xik7lUC1SpPD4xSnyG5VpoWA/2Adx89Do unBzbGFucPd8+/GCe4R6Uv8o7ICagxI9sovc8kWYhepsEfJ3T2IjLqiAHV9TmgydlZSZ C+5i55pErsIYiDS6Pgc8k6vLfFNjMgx0Z/VNAfvYNESqGnmDcJiXliiQquqB+DFap2dD f70nor0HH/oHu0LZ92vzi8Na/2c3p9Y6Q3tBnIJ9YS/RhxpsUFi3GZarTPV9+oYo3w05 GRszMnqI3e+MbllFInjuUXyNIpVuA9xXTQ2bIjf5Ar0WDJcVa5tj6b/5C4oCXWikDvaK Uhyw== X-Forwarded-Encrypted: i=1; AJvYcCWFhiSN2/+yXjK/wd1HBKuIOzqZvhFSp5RWFklnw3JK9W8Ay/wpb9zYn0qZHHGfUhS7wM+bg9h7IT2APjWlmRVeKI3aJXjPVLlKNtpuRXwhkXyfsLw= X-Gm-Message-State: AOJu0Ywbk3XeYBxlln5pqplLyfdYMXdV2+vK2krRtjElliCX5bmn0iRo hiB5RC/hEX9r/0EcmKn+7y0ZwpI7QJAZ9T5UJKWThsVVIm1M3Bu1 X-Google-Smtp-Source: AGHT+IFuyw7nrLnv3O6ckoG5u7U3xQFtd3l/rn5w9Jo1yx2l1aOHO7p6V2AuYfz9IXurZteA0/GBJg== X-Received: by 2002:a17:902:d4ca:b0:201:e2db:7be7 with SMTP id d9443c01a7336-2025f097e26mr31823355ad.13.1724152886040; Tue, 20 Aug 2024 04:21:26 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 04:21:25 -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 1/7] net: stmmac: move stmmac_fpe_cfg to stmmac_priv data Date: Tue, 20 Aug 2024 19:20:35 +0800 Message-Id: <0f2db940a153db056180d9a529c4af4d6e60feb8.1724152528.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-20240820_042126_957201_4BB0E44B X-CRM114-Status: GOOD ( 19.67 ) 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 By moving the fpe_cfg field to the stmmac_priv data, stmmac_fpe_cfg becomes platform-data eventually, instead of a run-time config. Suggested-by: Serge Semin Signed-off-by: Furong Xu <0x1207@gmail.com> Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 30 ++++++++++++++++++- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 20 ++++++------- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 16 ++-------- include/linux/stmmac.h | 28 ----------------- 5 files changed, 44 insertions(+), 52 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 7e90f34b8c88..d3da82982012 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -26,6 +26,8 @@ }) struct stmmac_extra_stats; +struct stmmac_fpe_cfg; +enum stmmac_mpacket_type; struct stmmac_priv; struct stmmac_safety_stats; struct dma_desc; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index b23b920eedb1..458d6b16ce21 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -146,6 +146,33 @@ struct stmmac_channel { u32 index; }; +/* FPE link state */ +enum stmmac_fpe_state { + FPE_STATE_OFF = 0, + FPE_STATE_CAPABLE = 1, + FPE_STATE_ENTERING_ON = 2, + FPE_STATE_ON = 3, +}; + +/* FPE link-partner hand-shaking mPacket type */ +enum stmmac_mpacket_type { + MPACKET_VERIFY = 0, + MPACKET_RESPONSE = 1, +}; + +enum stmmac_fpe_task_state_t { + __FPE_REMOVING, + __FPE_TASK_SCHED, +}; + +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 */ + u32 fpe_csr; /* MAC_FPE_CTRL_STS reg cache */ +}; + struct stmmac_tc_entry { bool in_use; bool in_hw; @@ -339,11 +366,12 @@ struct stmmac_priv { struct workqueue_struct *wq; struct work_struct service_task; - /* Workqueue for handling FPE hand-shaking */ + /* Frame Preemption feature (FPE) */ unsigned long fpe_task_state; struct workqueue_struct *fpe_wq; struct work_struct fpe_task; char wq_name[IFNAMSIZ + 4]; + struct stmmac_fpe_cfg fpe_cfg; /* TC Handling */ unsigned int tc_entries_max; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d9fca8d1227c..529fe31f8b04 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -968,7 +968,7 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, static void stmmac_fpe_link_state_handle(struct stmmac_priv *priv, bool is_up) { - struct stmmac_fpe_cfg *fpe_cfg = priv->plat->fpe_cfg; + struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; 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; @@ -3536,7 +3536,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) if (priv->dma_cap.fpesel) { stmmac_fpe_start_wq(priv); - if (priv->plat->fpe_cfg->enable) + if (priv->fpe_cfg.enable) stmmac_fpe_handshake(priv, true); } @@ -5982,7 +5982,7 @@ static int stmmac_set_features(struct net_device *netdev, static void stmmac_fpe_event_status(struct stmmac_priv *priv, int status) { - struct stmmac_fpe_cfg *fpe_cfg = priv->plat->fpe_cfg; + struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; 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; @@ -7381,7 +7381,7 @@ static void stmmac_fpe_lp_task(struct work_struct *work) { struct stmmac_priv *priv = container_of(work, struct stmmac_priv, fpe_task); - struct stmmac_fpe_cfg *fpe_cfg = priv->plat->fpe_cfg; + struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; 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; @@ -7427,17 +7427,17 @@ static void stmmac_fpe_lp_task(struct work_struct *work) void stmmac_fpe_handshake(struct stmmac_priv *priv, bool enable) { - if (priv->plat->fpe_cfg->hs_enable != enable) { + if (priv->fpe_cfg.hs_enable != enable) { if (enable) { stmmac_fpe_send_mpacket(priv, priv->ioaddr, - priv->plat->fpe_cfg, + &priv->fpe_cfg, MPACKET_VERIFY); } else { - priv->plat->fpe_cfg->lo_fpe_state = FPE_STATE_OFF; - priv->plat->fpe_cfg->lp_fpe_state = FPE_STATE_OFF; + priv->fpe_cfg.lo_fpe_state = FPE_STATE_OFF; + priv->fpe_cfg.lp_fpe_state = FPE_STATE_OFF; } - priv->plat->fpe_cfg->hs_enable = enable; + priv->fpe_cfg.hs_enable = enable; } } @@ -7898,7 +7898,7 @@ int stmmac_suspend(struct device *dev) if (priv->dma_cap.fpesel) { /* Disable FPE */ stmmac_fpe_configure(priv, priv->ioaddr, - priv->plat->fpe_cfg, + &priv->fpe_cfg, priv->plat->tx_queues_to_use, priv->plat->rx_queues_to_use, false); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 996f2bcd07a2..9cc41ed01882 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -282,16 +282,6 @@ static int tc_init(struct stmmac_priv *priv) if (ret) return -ENOMEM; - if (!priv->plat->fpe_cfg) { - priv->plat->fpe_cfg = devm_kzalloc(priv->device, - sizeof(*priv->plat->fpe_cfg), - GFP_KERNEL); - if (!priv->plat->fpe_cfg) - return -ENOMEM; - } else { - memset(priv->plat->fpe_cfg, 0, sizeof(*priv->plat->fpe_cfg)); - } - /* Fail silently as we can still use remaining features, e.g. CBS */ if (!dma_cap->frpsel) return 0; @@ -1076,7 +1066,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, /* Actual FPE register configuration will be done after FPE handshake * is success. */ - priv->plat->fpe_cfg->enable = fpe; + priv->fpe_cfg.enable = fpe; ret = stmmac_est_configure(priv, priv, priv->est, priv->plat->clk_ptp_rate); @@ -1109,9 +1099,9 @@ static int tc_taprio_configure(struct stmmac_priv *priv, mutex_unlock(&priv->est_lock); } - priv->plat->fpe_cfg->enable = false; + priv->fpe_cfg.enable = false; stmmac_fpe_configure(priv, priv->ioaddr, - priv->plat->fpe_cfg, + &priv->fpe_cfg, priv->plat->tx_queues_to_use, priv->plat->rx_queues_to_use, false); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 338991c08f00..d79ff252cfdc 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -138,33 +138,6 @@ struct stmmac_txq_cfg { int tbs_en; }; -/* FPE link state */ -enum stmmac_fpe_state { - FPE_STATE_OFF = 0, - FPE_STATE_CAPABLE = 1, - FPE_STATE_ENTERING_ON = 2, - FPE_STATE_ON = 3, -}; - -/* FPE link-partner hand-shaking mPacket type */ -enum stmmac_mpacket_type { - MPACKET_VERIFY = 0, - MPACKET_RESPONSE = 1, -}; - -enum stmmac_fpe_task_state_t { - __FPE_REMOVING, - __FPE_TASK_SCHED, -}; - -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 */ - u32 fpe_csr; /* MAC_FPE_CTRL_STS reg cache */ -}; - struct stmmac_safety_feature_cfg { u32 tsoee; u32 mrxpee; @@ -232,7 +205,6 @@ struct plat_stmmacenet_data { struct fwnode_handle *port_node; struct device_node *mdio_node; struct stmmac_dma_cfg *dma_cfg; - struct stmmac_fpe_cfg *fpe_cfg; struct stmmac_safety_feature_cfg *safety_feat_cfg; int clk_csr; int has_gmac; From patchwork Tue Aug 20 11:20:36 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: 13770063 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 C99EFC3DA4A for ; Tue, 20 Aug 2024 12:30:44 +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=LVDwdCzbnOeidXl/hDBd3l3mbR23PEP/JczHyoisLlw=; b=qS7lO4yKu8/yoUSOTrMGJhVnZd 0rkRkGpYOVrRMxB6NRksirQ99gV6GJTIuYt4bNSkrqSoDNaC+o6vOCZLa6pfywq1XOd4Mwqy2xY1/ gwS9T+sDzmeK0dUaIEQEZLDjeLK0/gP3IFiHBodo8iRRIk+Vj+6HaCJRBLmUNajBQPfQjbej8N7xM sfHCDJQDR7oJuDnj8NSpUKmLoS23nkJ2J/cwbhQmA/4uk5Ii5yUIrc4gs7Nnr5YUcifqdR32L2OVO 59M7QbXIQLElUEQkaxX+dpwtIxUNd3hWwigdE4IfZLvBNEmcqV+/uanx5UUKHqUAtFwvdpKkZE7ag /xtSDkkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgO0O-00000005CSs-2Hgp; Tue, 20 Aug 2024 12:30:32 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMvc-00000004zW3-32ky for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 11:21:34 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-201fba05363so35040585ad.3 for ; Tue, 20 Aug 2024 04:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724152892; x=1724757692; 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=LVDwdCzbnOeidXl/hDBd3l3mbR23PEP/JczHyoisLlw=; b=fAGVznhY+ko816vjX185J9hrsYMupScSNVMHkGajz2ZGhrMfVcPmXFXU5nmAjdQ+Q7 Fr/vL34KND2z3eXyeNPLNu0JtBaAJMoupDqQDoWV3rsKJKc/ikvWsBi9kDr21bn7X2G8 igmqYeSqC1FN5r9JAHC0xz9J0m59B8qQ6FPP0wCq78bq0WLpFlDa7iT4YJoVWIWzxu21 i1ckb7UqsnMPZoHylwdt/TJ7tM4UsW6KGyw3lMOReKsGv9Zr6ULk7LYkgTuRngBez6dx 8KcnhCRAjN+cVBQTatj40wF2jLH5X8wl0D/VotIbx1uSMk8wE+/lo7TNQ9yKMxqlkB9p aA2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724152892; x=1724757692; 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=LVDwdCzbnOeidXl/hDBd3l3mbR23PEP/JczHyoisLlw=; b=qTRpOW+uHHYcQWRyqlo/F+3tG7mv9OkiWoIBju7fO2V+KLaaf2xuwGh+IQuehssYz+ /qvi0mHLnqS4w8NCiVYDJe53O6Ne1fC/JYW6hjuwkzOvFR5X4Lo6Y+TlhUVTi4ZH7MnH VWNm4gfSB/hPL0JzWoiT7GTZLX3ENbG1Tr+used75qsuEs7MgNlowZSGz9dDIn90XE0s PhcxhqJhyP4jI2mBTnR+XBakAXHeqcPktqeTjMloTLgYQazQJZQbZw+VN7jb+xLoMM2/ ya7xWhExA79+vna6eVCmbNkLUj2Cr9JURcswpsozC8zG1fP/sb48NKbe6/1Q67E2Uvhf hxlA== X-Forwarded-Encrypted: i=1; AJvYcCVFakdiXiKq3rvuGundi8Wzh7jg0rJq7X1NZK1eofep3gH23Gc1HkQvGpsGltWtvRn6pooMCuWr5gr9xU8OFyAfqEjCXQt7dqu9nfJ8JsV6QXgdLic= X-Gm-Message-State: AOJu0YzON7DX4VUwK9stNM6GPEdSepRR+sBgJcH3sw65T4kui5Ywvr8T cZaKq8MdnICBezlCdFhYRNu38SsrAKGekS/7aMVOIAPEz7bkX3ZE X-Google-Smtp-Source: AGHT+IFudCQbVwdrFeCFCkW6U4cd9Z6nyRYFjjSO2yta7woZbYAqM+UwO/W6VYoUoKZuIjA8vY3X+Q== X-Received: by 2002:a17:902:c942:b0:201:ffef:4652 with SMTP id d9443c01a7336-20203e4f49fmr155363785ad.2.1724152891473; Tue, 20 Aug 2024 04:21:31 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 04:21:30 -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 2/7] net: stmmac: drop stmmac_fpe_handshake Date: Tue, 20 Aug 2024 19:20:36 +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_042132_784309_ECC1FC5A X-CRM114-Status: GOOD ( 12.92 ) 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 ethtool --set-mm can trigger FPE verification process by calling stmmac_fpe_send_mpacket, stmmac_fpe_handshake should be gone. Signed-off-by: Furong Xu <0x1207@gmail.com> Reviewed-by: Vladimir Oltean --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 23 +------------------ .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 8 ------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 529fe31f8b04..3072ad33b105 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3533,13 +3533,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->fpe_cfg.enable) - stmmac_fpe_handshake(priv, true); - } - return 0; } @@ -7425,22 +7421,6 @@ static void stmmac_fpe_lp_task(struct work_struct *work) clear_bit(__FPE_TASK_SCHED, &priv->fpe_task_state); } -void stmmac_fpe_handshake(struct stmmac_priv *priv, bool enable) -{ - if (priv->fpe_cfg.hs_enable != enable) { - if (enable) { - stmmac_fpe_send_mpacket(priv, priv->ioaddr, - &priv->fpe_cfg, - MPACKET_VERIFY); - } else { - priv->fpe_cfg.lo_fpe_state = FPE_STATE_OFF; - priv->fpe_cfg.lp_fpe_state = FPE_STATE_OFF; - } - - priv->fpe_cfg.hs_enable = enable; - } -} - static int stmmac_xdp_rx_timestamp(const struct xdp_md *_ctx, u64 *timestamp) { const struct stmmac_xdp_buff *ctx = (void *)_ctx; @@ -7902,7 +7882,6 @@ int stmmac_suspend(struct device *dev) priv->plat->tx_queues_to_use, priv->plat->rx_queues_to_use, false); - stmmac_fpe_handshake(priv, false); stmmac_fpe_stop_wq(priv); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 9cc41ed01882..b0cc45331ff7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -1078,11 +1078,6 @@ 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"); - } - return 0; disable: @@ -1107,9 +1102,6 @@ static int tc_taprio_configure(struct stmmac_priv *priv, false); netdev_info(priv->dev, "disabled FPE\n"); - stmmac_fpe_handshake(priv, false); - netdev_info(priv->dev, "stop FPE handshake\n"); - return ret; } From patchwork Tue Aug 20 11:20:37 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: 13769982 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 7A4C1C3DA4A for ; Tue, 20 Aug 2024 11:24:20 +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=YJl6m7/HvoZr28SwAJK1VeVNaeP/xxoxJA+ZuNmUMD8=; b=bALgphO6R56Gw+/wtfYdEvceGm oxL32yHEbr9EQgUzppfFFe2v+/EwkbTNsMyVHmmcAibwkZcR9hvU0s3HaOG3AzRc1now7TEM/uRpX velTM5wBMVQuss8bUJ+FDivlHB4aGK2GZpz9LE9r1hbTd0jl5zag7f5BqcnfIaUc+OrMUGLvi3j3w NWq9J1Lusxh2In0RH6F2QZorZ9rqimC7KCDlv7IAKou3dlMvl62YIBdwq+oFezht3BqXsJqq87IZi xw9OJCl9vrjxZo9Ig5oh9hhyzWTBpDnSivIcanmtgikmwEqX8bSbOpjMPFgA4ArcvOpgRDb20nL0J iHmWlThA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMy9-000000050CN-34UG; Tue, 20 Aug 2024 11:24:10 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMvi-00000004zYY-1eO2 for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 11:21:39 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-201fba05363so35041455ad.3 for ; Tue, 20 Aug 2024 04:21:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724152897; x=1724757697; 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=YJl6m7/HvoZr28SwAJK1VeVNaeP/xxoxJA+ZuNmUMD8=; b=OTQO8oQ1KM9w2Plea8vOptevqWJ972xundCcS2g+yM0akExKoOXJkrnVRHeJQtCi3w T6A5xgD13XcDN8RhJw5W2Xs0o+HO7CVQshB+4xDEwHAOg9M5GlWl8qgfAuY92qHC5qWR pnQtA+zSSSY2S6oDFpRpiUIx4lhe0q8yyEBOuD1SUmTPXz0xs8apJbS6eBeeD+ROhhrq DzrnT/pz+F71MEnT09Mc1t/jvAnk+SAoolCwNgwu4MhgWd9d2FW966n8lM8KnXwdKKnP Ngz5UP19tzGJfcJuDdib+g8nuxo7mLysl0uIRQZRbOgjfdpVSdT7GecArw+Os1S7TGDP 9LVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724152897; x=1724757697; 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=YJl6m7/HvoZr28SwAJK1VeVNaeP/xxoxJA+ZuNmUMD8=; b=sTbWZsR/RhtbXOhznwGaMmexdimD4k6VoW5NkRj792gWjYzTqFNvtOcFAkHmIZmOcQ 2xBQrm1GP9z+vvVE9nSugUpOtBKpr/C16TYQvOWKZyuc+GUBSW8XK7YLKLqH1G82tXYN MofonUFOklbVkWU6qGwmyCcT9jk9diTvwvDilK+7KCPynbwZK4QbOC4qhG2GEFL1bpl+ 7brNEa1B4c03GYogUpxVbQhS/U/wD2zb4HvNW0uVUZVAF8MC+//a6mFDRA5PF4QTAcA5 IEjbVPQpMr875oMgtshjqghnOtjXU4EQR0Sedj9ojnXGAYM9CGn1e/rfKF871LR7uz2n Q05Q== X-Forwarded-Encrypted: i=1; AJvYcCXIvOtgiBOgzCIuzgCuG1xX8ojx6xD3Fx5kWQN7L1mO+VUdF7SCbss5z4t7s0u7FIN7HlwxSFng8ACEquerxMKjPcsPwB6H13qArDX0BlFr1DyeKSU= X-Gm-Message-State: AOJu0YzkrylJKhUiK7P6wNpmBSBMIwKVELxEvWF26A76+ep9hKRtSrh5 Xdw8T3aFOXZ1uXHvhdBNFK93eXuTWwZRCUK65i+QW0EvaxyjxsLx X-Google-Smtp-Source: AGHT+IGe5BFxs1AQfs90pXsGi5w0aye2mA4qHJ+p+gJsrCmYIFXiJU4W1X1G5ba0+PPEiMN3O++v+w== X-Received: by 2002:a17:903:2303:b0:1fd:93d2:fba4 with SMTP id d9443c01a7336-20203f321efmr127668655ad.48.1724152897013; Tue, 20 Aug 2024 04:21:37 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 04:21:36 -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 3/7] net: stmmac: refactor FPE verification process Date: Tue, 20 Aug 2024 19:20:37 +0800 Message-Id: <23ec4bb2d86cb086b7d285f397411dc089a582b7.1724152528.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-20240820_042138_532825_47372465 X-CRM114-Status: GOOD ( 26.34 ) 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 Drop driver defined stmmac_fpe_state, and switch to common ethtool_mm_verify_status for local TX verification status. Local side and remote side verification processes are completely independent. There is no reason at all to keep a local state and a remote state. Add a spinlock to avoid races among ISR, workqueue, link update and register configuration. Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 21 +-- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 172 ++++++++++-------- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 6 - 3 files changed, 102 insertions(+), 97 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 458d6b16ce21..407b59f2783f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -146,14 +146,6 @@ struct stmmac_channel { u32 index; }; -/* FPE link state */ -enum stmmac_fpe_state { - FPE_STATE_OFF = 0, - FPE_STATE_CAPABLE = 1, - FPE_STATE_ENTERING_ON = 2, - FPE_STATE_ON = 3, -}; - /* FPE link-partner hand-shaking mPacket type */ enum stmmac_mpacket_type { MPACKET_VERIFY = 0, @@ -166,11 +158,16 @@ 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 */ + /* Serialize access to MAC Merge state between ethtool requests + * and link state updates. + */ + spinlock_t lock; + u32 fpe_csr; /* MAC_FPE_CTRL_STS reg cache */ + u32 verify_time; /* see ethtool_mm_state */ + bool pmac_enabled; /* see ethtool_mm_state */ + bool verify_enabled; /* see ethtool_mm_state */ + enum ethtool_mm_verify_status status; }; struct stmmac_tc_entry { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3072ad33b105..6ae95f20b24f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -969,17 +969,21 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, static void stmmac_fpe_link_state_handle(struct stmmac_priv *priv, bool is_up) { struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; - 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; + unsigned long flags; + + spin_lock_irqsave(&priv->fpe_cfg.lock, flags); + + if (!fpe_cfg->pmac_enabled) + goto __unlock_out; - if (is_up && *hs_enable) { + if (is_up && fpe_cfg->verify_enabled) stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg, MPACKET_VERIFY); - } else { - *lo_state = FPE_STATE_OFF; - *lp_state = FPE_STATE_OFF; - } + else + fpe_cfg->status = ETHTOOL_MM_VERIFY_STATUS_DISABLED; + +__unlock_out: + spin_unlock_irqrestore(&priv->fpe_cfg.lock, flags); } static void stmmac_mac_link_down(struct phylink_config *config, @@ -4091,11 +4095,25 @@ static int stmmac_release(struct net_device *dev) stmmac_release_ptp(priv); - pm_runtime_put(priv->device); - - if (priv->dma_cap.fpesel) + if (priv->dma_cap.fpesel) { stmmac_fpe_stop_wq(priv); + /* stmmac_ethtool_ops.begin() guarantees that all ethtool + * requests to fail with EBUSY when !netif_running() + * + * Prepare some params here, then fpe_cfg can keep consistent + * with the register states after a SW reset by __stmmac_open(). + */ + priv->fpe_cfg.pmac_enabled = false; + priv->fpe_cfg.verify_enabled = false; + priv->fpe_cfg.status = ETHTOOL_MM_VERIFY_STATUS_DISABLED; + + /* Reset MAC_FPE_CTRL_STS reg cache */ + priv->fpe_cfg.fpe_csr = 0; + } + + pm_runtime_put(priv->device); + return 0; } @@ -5979,44 +5997,34 @@ static int stmmac_set_features(struct net_device *netdev, static void stmmac_fpe_event_status(struct stmmac_priv *priv, int status) { struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; - 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; - if (status == FPE_EVENT_UNKNOWN || !*hs_enable) - return; + spin_lock(&priv->fpe_cfg.lock); - /* If LP has sent verify mPacket, LP is FPE capable */ - if ((status & FPE_EVENT_RVER) == FPE_EVENT_RVER) { - if (*lp_state < FPE_STATE_CAPABLE) - *lp_state = FPE_STATE_CAPABLE; + if (!fpe_cfg->pmac_enabled || status == FPE_EVENT_UNKNOWN) + goto __unlock_out; - /* If user has requested FPE enable, quickly response */ - if (*hs_enable) - stmmac_fpe_send_mpacket(priv, priv->ioaddr, - fpe_cfg, - MPACKET_RESPONSE); - } + /* LP has sent verify mPacket */ + if ((status & FPE_EVENT_RVER) == FPE_EVENT_RVER) + stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg, + MPACKET_RESPONSE); - /* If Local has sent verify mPacket, Local is FPE capable */ - if ((status & FPE_EVENT_TVER) == FPE_EVENT_TVER) { - if (*lo_state < FPE_STATE_CAPABLE) - *lo_state = FPE_STATE_CAPABLE; - } + /* Local has sent verify mPacket */ + if ((status & FPE_EVENT_TVER) == FPE_EVENT_TVER && + fpe_cfg->status != ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED) + fpe_cfg->status = ETHTOOL_MM_VERIFY_STATUS_VERIFYING; - /* If LP has sent response mPacket, LP is entering FPE ON */ + /* LP has sent response mPacket */ if ((status & FPE_EVENT_RRSP) == FPE_EVENT_RRSP) - *lp_state = FPE_STATE_ENTERING_ON; - - /* If Local has sent response mPacket, Local is entering FPE ON */ - if ((status & FPE_EVENT_TRSP) == FPE_EVENT_TRSP) - *lo_state = FPE_STATE_ENTERING_ON; + fpe_cfg->status = ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED; if (!test_bit(__FPE_REMOVING, &priv->fpe_task_state) && !test_and_set_bit(__FPE_TASK_SCHED, &priv->fpe_task_state) && priv->fpe_wq) { queue_work(priv->fpe_wq, &priv->fpe_task); } + +__unlock_out: + spin_unlock(&priv->fpe_cfg.lock); } static void stmmac_common_interrupt(struct stmmac_priv *priv) @@ -7372,50 +7380,57 @@ int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size) return ret; } -#define SEND_VERIFY_MPAKCET_FMT "Send Verify mPacket lo_state=%d lp_state=%d\n" -static void stmmac_fpe_lp_task(struct work_struct *work) +static void stmmac_fpe_verify_task(struct work_struct *work) { struct stmmac_priv *priv = container_of(work, struct stmmac_priv, fpe_task); struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; - 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) { - /* Bail out immediately if FPE handshake is OFF */ - if (*lo_state == FPE_STATE_OFF || !*hs_enable) + int verify_limit = 3; /* defined by 802.3 */ + unsigned long flags; + u32 sleep_ms; + + spin_lock(&priv->fpe_cfg.lock); + sleep_ms = fpe_cfg->verify_time; + spin_unlock(&priv->fpe_cfg.lock); + + while (1) { + /* The initial VERIFY was triggered by linkup event or + * stmmac_set_mm(), sleep then check MM_VERIFY_STATUS. + */ + msleep(sleep_ms); + + if (!netif_running(priv->dev)) break; - 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); + spin_lock_irqsave(&priv->fpe_cfg.lock, flags); - netdev_info(priv->dev, "configured FPE\n"); + if (fpe_cfg->status == ETHTOOL_MM_VERIFY_STATUS_DISABLED || + fpe_cfg->status == ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED || + !fpe_cfg->pmac_enabled || !fpe_cfg->verify_enabled) { + spin_unlock_irqrestore(&priv->fpe_cfg.lock, flags); + break; + } - *lo_state = FPE_STATE_ON; - *lp_state = FPE_STATE_ON; - netdev_info(priv->dev, "!!! BOTH FPE stations ON\n"); + if (verify_limit == 0) { + fpe_cfg->verify_enabled = false; + fpe_cfg->status = ETHTOOL_MM_VERIFY_STATUS_FAILED; + stmmac_fpe_configure(priv, priv->ioaddr, fpe_cfg, + priv->plat->tx_queues_to_use, + priv->plat->rx_queues_to_use, + false); + spin_unlock_irqrestore(&priv->fpe_cfg.lock, flags); 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); - stmmac_fpe_send_mpacket(priv, priv->ioaddr, - fpe_cfg, + if (fpe_cfg->status == ETHTOOL_MM_VERIFY_STATUS_VERIFYING) + stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg, MPACKET_VERIFY); - } - /* Sleep then retry */ - msleep(500); + + sleep_ms = fpe_cfg->verify_time; + + spin_unlock_irqrestore(&priv->fpe_cfg.lock, flags); + + verify_limit--; } clear_bit(__FPE_TASK_SCHED, &priv->fpe_task_state); @@ -7535,8 +7550,8 @@ int stmmac_dvr_probe(struct device *device, INIT_WORK(&priv->service_task, stmmac_service_task); - /* Initialize Link Partner FPE workqueue */ - INIT_WORK(&priv->fpe_task, stmmac_fpe_lp_task); + /* Initialize FPE verify workqueue */ + INIT_WORK(&priv->fpe_task, stmmac_fpe_verify_task); /* Override with kernel parameters if supplied XXX CRS XXX * this needs to have multiple instances @@ -7702,6 +7717,12 @@ int stmmac_dvr_probe(struct device *device, mutex_init(&priv->lock); + spin_lock_init(&priv->fpe_cfg.lock); + priv->fpe_cfg.pmac_enabled = false; + priv->fpe_cfg.verify_time = 128; /* ethtool_mm_state.max_verify_time */ + priv->fpe_cfg.verify_enabled = false; + priv->fpe_cfg.status = ETHTOOL_MM_VERIFY_STATUS_DISABLED; + /* If a specific clk_csr value is passed from the platform * this means that the CSR Clock Range selection cannot be * changed at run-time and it is fixed. Viceversa the driver'll try to @@ -7875,15 +7896,8 @@ int stmmac_suspend(struct device *dev) } rtnl_unlock(); - if (priv->dma_cap.fpesel) { - /* Disable FPE */ - stmmac_fpe_configure(priv, priv->ioaddr, - &priv->fpe_cfg, - priv->plat->tx_queues_to_use, - priv->plat->rx_queues_to_use, false); - + if (priv->dma_cap.fpesel) stmmac_fpe_stop_wq(priv); - } priv->speed = SPEED_UNKNOWN; return 0; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index b0cc45331ff7..783829a6479c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -1063,11 +1063,6 @@ static int tc_taprio_configure(struct stmmac_priv *priv, return -EOPNOTSUPP; } - /* Actual FPE register configuration will be done after FPE handshake - * is success. - */ - priv->fpe_cfg.enable = fpe; - ret = stmmac_est_configure(priv, priv, priv->est, priv->plat->clk_ptp_rate); mutex_unlock(&priv->est_lock); @@ -1094,7 +1089,6 @@ static int tc_taprio_configure(struct stmmac_priv *priv, mutex_unlock(&priv->est_lock); } - priv->fpe_cfg.enable = false; stmmac_fpe_configure(priv, priv->ioaddr, &priv->fpe_cfg, priv->plat->tx_queues_to_use, From patchwork Tue Aug 20 11:20:38 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: 13769983 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 0B5EBC531DF for ; Tue, 20 Aug 2024 11:25:04 +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=dZz2NAEXYWWgXfDrArGrQdZXL2FPNbqUoBX6awsOn9o=; b=cQLkGtGxzZ4929nx3b5EcmL5OK 3N22rdoFeRsKkZc2WJLcbkPVF9CGmAfxKpJoGOpjbgivbV5OVXUFKtr5rut8wTEMIJ21fUmxen7eB XsrtpPzIyM1eDus6xrc+C7NunjQn/+9tyvG3ltJoI8HtX83QvEtuk4Qk4Wvd5iSe2JOKXF/ogFeqk dcGkVGY1tjblSeywvNDcJUgRAHutrdvEWRJ4lI3fGs/0STRZCxLcLPm8nJvxeMNq+JTrXilxsDmlV fe3EgZxRSKTkaUJgrODJpZN3yv5UTOFIuAxXG1robNfyAhaby712FM1wbDgPYE5lRD3Ld2muBNWGI kJwJYI/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMyp-000000050MA-0YZk; Tue, 20 Aug 2024 11:24:51 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMvo-00000004zad-04x9 for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 11:21:45 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2023dd9b86aso16391245ad.1 for ; Tue, 20 Aug 2024 04:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724152903; x=1724757703; 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=dZz2NAEXYWWgXfDrArGrQdZXL2FPNbqUoBX6awsOn9o=; b=So8y9e4RzoGMzqqNC6SGqudCAw/AE7MKAXWYwJOHEL7CER5afP2Qf4wYZWwo7ucN/X O7K9sxWl76ogMlVTvAJBl8mVqIMuwgO//km8ykq3G4HSKB9LFkR4bdb0uj7mymiHfsgc o1emwwv/XtEa3fgbOgD69mAh1n/fw2uC0Tkw07gy1X51MDhHVihjzU8Fk5N1URBj50qk T6H05e8LrRhP3WMLgYRM+fEfzUp2NCGNkMJtICUUeWps1eBDqhHc/9X7+RorUDfal154 s+5Z2K3chS/3Evb4QpHqtFqBcY0enFDZE0/leBt2GUE/6Hu5KL5ua9WeAeNbnvNqHuS9 jkJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724152903; x=1724757703; 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=dZz2NAEXYWWgXfDrArGrQdZXL2FPNbqUoBX6awsOn9o=; b=v55m0v8AWSa8Uu+vp9c0rkhOCVIQLuaQ11+7qDFd6+xY5ycdGO1UEiEONqOe6DEgti Cl3NB/Y7FByDiUfY9bzBXspnHa0jr0UWqU/bSMNHUowxyH9uZaYzgjZxuXFYICxEWFBy iB5PjE4NywCr+VNTYJUh9n9kOa/r2wVuBLtGGp2QPZupaDrpX881c38UevNKAdGmuw1i tqDKY7m3HDrMZ3BmrEARTM22RUYErfgjiTfsElT6xbgcr1HXr5OGb/SniA5QoCTbH7ic pG3M1H96jRFRxX2WMq1n9bWrvOoYNVHvlVrGE44u/cp4T5PFVUtxouqGIgI4On+Q0qEB EBVw== X-Forwarded-Encrypted: i=1; AJvYcCUSOyI1GT+8VPXV4f5GF3KFWA4wDLl0Tlt690qx3Q2QR5gFsUMMPiBZpC4mjlM2s7741ZM3yzn+vr/c3g8rq56q@lists.infradead.org X-Gm-Message-State: AOJu0YzyS7dj/RUZQuGGbEmnXymKlA9W5FDcFW/Vr80k2GXJOUJzG+r+ RX93JdHg17MZTDDSnYAqadEDgPKuXu5eRCOVEqde25BvmOT8ZrcF X-Google-Smtp-Source: AGHT+IGtjGQs7JRxLOObHAgpuSB/pcN4Ela8EgoiSbpVTxAYXtViJRltryBQyo9GmHk+VsznnivHGw== X-Received: by 2002:a17:902:da8b:b0:201:fac8:ff67 with SMTP id d9443c01a7336-20203e9b6c1mr151337895ad.17.1724152902687; Tue, 20 Aug 2024 04:21:42 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 04:21:42 -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 4/7] net: stmmac: configure FPE via ethtool-mm Date: Tue, 20 Aug 2024 19:20:38 +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_042144_088443_49BC3370 X-CRM114-Status: GOOD ( 22.33 ) 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 Implement ethtool --show-mm and --set-mm callbacks. NIC up/down, link up/down, suspend/resume, kselftest-ethtool_mm, all tested okay. Signed-off-by: Furong Xu <0x1207@gmail.com> --- .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 8 +- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 36 +++++- drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 7 +- .../ethernet/stmicro/stmmac/dwxgmac2_core.c | 4 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 8 +- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 110 ++++++++++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 17 ++- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 2 +- 8 files changed, 179 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index 31c387cc5f26..679efcc631f1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -58,10 +58,6 @@ static void dwmac4_core_init(struct mac_device_info *hw, if (hw->pcs) value |= GMAC_PCS_IRQ_DEFAULT; - /* Enable FPE interrupt */ - if ((GMAC_HW_FEAT_FPESEL & readl(ioaddr + GMAC_HW_FEATURE3)) >> 26) - value |= GMAC_INT_FPE_EN; - writel(value, ioaddr + GMAC_INT_EN); if (GMAC_INT_DEFAULT_ENABLE & GMAC_INT_TSIE) @@ -1268,6 +1264,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 +1318,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..4c91fa766b13 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -575,11 +575,11 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, u32 num_txq, u32 num_rxq, - bool enable) + bool tx_enable, bool pmac_enable) { u32 value; - if (enable) { + if (tx_enable) { cfg->fpe_csr = EFPE; value = readl(ioaddr + GMAC_RXQ_CTRL1); value &= ~GMAC_RXQCTRL_FPRQ; @@ -589,6 +589,21 @@ void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, cfg->fpe_csr = 0; } writel(cfg->fpe_csr, ioaddr + MAC_FPE_CTRL_STS); + + value = readl(ioaddr + GMAC_INT_EN); + + if (pmac_enable) { + if (!(value & GMAC_INT_FPE_EN)) { + /* Dummy read to clear any pending masked interrupts */ + (void)readl(ioaddr + MAC_FPE_CTRL_STS); + + value |= GMAC_INT_FPE_EN; + } + } else { + value &= ~GMAC_INT_FPE_EN; + } + + writel(value, ioaddr + GMAC_INT_EN); } int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) @@ -638,3 +653,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..e369e65920fc 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) @@ -104,10 +107,12 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, u32 sub_second_inc, u32 systime_flags); void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, u32 num_txq, u32 num_rxq, - bool enable); + bool tx_enable, bool pmac_enable); 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/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index cbf2dd976ab1..55a175ced77f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -1506,11 +1506,11 @@ static void dwxgmac2_set_arp_offload(struct mac_device_info *hw, bool en, static void dwxgmac3_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, u32 num_txq, - u32 num_rxq, bool enable) + u32 num_rxq, bool tx_enable, bool pmac_enable) { u32 value; - if (!enable) { + if (!tx_enable) { value = readl(ioaddr + XGMAC_FPE_CTRL_STS); value &= ~XGMAC_EFPE; diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index d3da82982012..ba4418eaa8ba 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -421,11 +421,13 @@ struct stmmac_ops { void (*set_arp_offload)(struct mac_device_info *hw, bool en, u32 addr); void (*fpe_configure)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, u32 num_txq, u32 num_rxq, - bool enable); + bool tx_enable, bool pmac_enable); void (*fpe_send_mpacket)(void __iomem *ioaddr, 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...) \ @@ -530,6 +532,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_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 7008219fd88d..a8cdcacecc26 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,112 @@ 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); + unsigned long flags; + u32 add_frag_size; + + if (!priv->dma_cap.fpesel) + return -EOPNOTSUPP; + + spin_lock_irqsave(&priv->fpe_cfg.lock, flags); + + state->pmac_enabled = priv->fpe_cfg.pmac_enabled; + state->verify_time = priv->fpe_cfg.verify_time; + state->verify_enabled = priv->fpe_cfg.verify_enabled; + state->verify_status = priv->fpe_cfg.status; + state->rx_min_frag_size = ETH_ZLEN; + + /* 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; + + /* Cannot read MAC_FPE_CTRL_STS register here, or FPE interrupt events + * can be lost. + * + * See commit 37e4b8df27bc ("net: stmmac: fix FPE events losing") + */ + state->tx_enabled = !!(priv->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); + + 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); + + spin_unlock_irqrestore(&priv->fpe_cfg.lock, flags); + + 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); + struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; + unsigned long flags; + u32 add_frag_size; + int err; + + if (!priv->dma_cap.fpesel) + return -EOPNOTSUPP; + + /* Wait for the fpe_task that's currently in progress to finish */ + flush_workqueue(priv->fpe_wq); + + err = ethtool_mm_frag_size_min_to_add(cfg->tx_min_frag_size, + &add_frag_size, extack); + if (err) + return err; + + spin_lock_irqsave(&priv->fpe_cfg.lock, flags); + + fpe_cfg->pmac_enabled = cfg->pmac_enabled; + fpe_cfg->verify_time = cfg->verify_time; + fpe_cfg->verify_enabled = cfg->verify_enabled; + + stmmac_fpe_configure(priv, priv->ioaddr, fpe_cfg, + priv->plat->tx_queues_to_use, + priv->plat->rx_queues_to_use, + cfg->tx_enabled, cfg->pmac_enabled); + + stmmac_fpe_set_add_frag_size(priv, priv->ioaddr, add_frag_size); + + if (cfg->verify_enabled) + stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg, + MPACKET_VERIFY); + else + fpe_cfg->status = ETHTOOL_MM_VERIFY_STATUS_DISABLED; + + spin_unlock_irqrestore(&priv->fpe_cfg.lock, flags); + + 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 +1416,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 6ae95f20b24f..3df9cad0848b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3537,8 +3537,21 @@ 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) { + /* A SW reset just happened in stmmac_init_dma_engine(), + * we should restore fpe_cfg to HW, or FPE will stop working + * from suspend/resume. + */ + spin_lock(&priv->fpe_cfg.lock); + stmmac_fpe_configure(priv, priv->ioaddr, + &priv->fpe_cfg, + priv->plat->tx_queues_to_use, + priv->plat->rx_queues_to_use, + false, priv->fpe_cfg.pmac_enabled); + spin_unlock(&priv->fpe_cfg.lock); + stmmac_fpe_start_wq(priv); + } return 0; } @@ -7417,7 +7430,7 @@ static void stmmac_fpe_verify_task(struct work_struct *work) stmmac_fpe_configure(priv, priv->ioaddr, fpe_cfg, priv->plat->tx_queues_to_use, priv->plat->rx_queues_to_use, - false); + false, fpe_cfg->pmac_enabled); spin_unlock_irqrestore(&priv->fpe_cfg.lock, flags); break; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 783829a6479c..a58282d6458c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -1093,7 +1093,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, &priv->fpe_cfg, priv->plat->tx_queues_to_use, priv->plat->rx_queues_to_use, - false); + false, false); netdev_info(priv->dev, "disabled FPE\n"); return ret; From patchwork Tue Aug 20 11:20:39 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: 13769984 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 3CFF8C531DF for ; Tue, 20 Aug 2024 11:25:41 +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=j/aJc9+9xdfuPZ/VxZzm8eq35BLsN4q6LSrKAyr/ZlM=; b=SAcN/sV9TGXuoffXzZB0laoFrT FFoN2MsV6jZvUqb3khhEKJXXXt2LAtljPp9V8B+JgUNahicEWxBEtPqA/n1B6QLVGK5hbDPyL33oB fPeHWeVXZGX4amMP9dJJDh5LpXKRDxXa/HPMJqQW/w4MlNANeAvym3rA0O5wdHH/bun+6z0+0FSvU wWiNRFz4y8r/KYluLMwe1nrlK5j6p4uIEEY5ne2/H9+pY61/jsSvNo99VP7WjGeWx3T/QzHxME6eQ xE14TWghx73IVy5q8zTki43hHK2vk2WIhbHIhwdccavguMEjCvuGHtoZXnMVdykKWAJ7PSk705dSg QUqja4wQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMzU-000000050Wi-05jr; Tue, 20 Aug 2024 11:25:32 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMvt-00000004zc1-2Hz5 for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 11:21:50 +0000 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7140ff4b1e9so293045b3a.3 for ; Tue, 20 Aug 2024 04:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724152908; x=1724757708; 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=j/aJc9+9xdfuPZ/VxZzm8eq35BLsN4q6LSrKAyr/ZlM=; b=jFaRFfkul7eJNLRvzjWm4lILCSfBaZqgC5WEcROrBBcXEo8ZFzvGYQ/I/bBnNnqqds e85tDJT/KY2nftT15PxfcOv5daVPoJg6sbeTRmOdgjYGyMHYmWHf1b6oto5ZXVBdkZqZ 7OpDPLqAhCzZtUkedOJtq1cxLUb15Eehc23QbhROOkAuiaRFhKTybOUBHj3il5pvI+vH LbcEs+VDs1XHhqkUNO3TvocZkVGYIZvHyOIBulpNphkHKD8wZPySKsW25AkjQmDzzla3 arbyppYNH0+gCKjlg5dLTmAJOkZPdGuaHSoj3AS38QTbpySzekEtyqMGvsIgEliEYCg7 Dekg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724152908; x=1724757708; 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=j/aJc9+9xdfuPZ/VxZzm8eq35BLsN4q6LSrKAyr/ZlM=; b=HhaLZwJvY91kn3TwaGcQO1wm/o/aNqKTyVqdKgVK+dZ6tgUEVZqfwFMbCEkRKB9WDZ KqjTrqNNBMT4tsdfMlXb6sV5TNy/UQptNTMTpnhCFTXWtrolMdKXcZrO6o/F/Nnvnu3r uLCRi1jstzOpQO3rA+p6ftGtAQdioMRfMmNgmCG9TQrMaFjAZDggr8k5T/dGB1q2LV4t h/o/ii8pPCK2JUfrsdM8zBpziWastB4kPWTEWuCP59Teq6gJT1RnDzZkm2pv9Kn+bPSj iSDDxBeEkEDn1fl4wZ1vNgP5Tol57dxAB9+A0FpEefX098jg5xBoSYjsoJr/gaSpQuIm jGbA== X-Forwarded-Encrypted: i=1; AJvYcCV7d1OEHQrMdy6phh0G5+Zmn3XAqPRRb3QvYNtdC8BTpF9jvCnFv9N5/ov6BuxxZ9/Nd22a+kjPnwjFB0m2FSs2qiD14yi1+xGSDbZJGP1PDgO6DYg= X-Gm-Message-State: AOJu0YzwGIPjWatpKMRrqLk3YNKKfNGKGyOUJFsWIyeyDMazFuQfNZgz 4Qux7FhPFfGY6LdzHthS7MbTJzQSK+ED6HmCIpS0Vub3gkYZDiFC X-Google-Smtp-Source: AGHT+IGDlpZPnd+1Hs3ow7GKM5yzJrl94B9V0i46yogLFzH4zaSzezv4Rjaw4bTXARImMwOKvpaX5A== X-Received: by 2002:a05:6a21:e8c:b0:1c2:8d72:67ce with SMTP id adf61e73a8af0-1c904f90da4mr13971819637.15.1724152908171; Tue, 20 Aug 2024 04:21:48 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 04:21:47 -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 5/7] net: stmmac: support fp parameter of tc-mqprio Date: Tue, 20 Aug 2024 19:20:39 +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_042149_618105_EAD03241 X-CRM114-Status: GOOD ( 22.74 ) 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-mqprio 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": 35105, "MACMergeHoldCount": 0 } } ] Remote device: ethtool --include-statistics --json --show-mm end1 [ { "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": 35105, "MACMergeFragCountRx": 35105, "MACMergeFragCountTx": 0, "MACMergeHoldCount": 0 } } ] 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 | 52 +++++++++++++ drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 4 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 10 +++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 2 + .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 75 +++++++++++++++++++ 6 files changed, 145 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index 679efcc631f1..4722bac7e3d4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -1266,6 +1266,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, @@ -1320,6 +1321,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 4c91fa766b13..1e87dbc9a406 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -670,3 +670,55 @@ void dwmac5_fpe_set_add_frag_size(void __iomem *ioaddr, u32 add_frag_size) writel(value, ioaddr + MTL_FPE_CTRL_STS); } + +int dwmac5_fpe_set_preemptible_tcs(struct net_device *ndev, + struct netlink_ext_ack *extack, + unsigned long tcs) +{ + struct stmmac_priv *priv = netdev_priv(ndev); + void __iomem *ioaddr = priv->ioaddr; + unsigned long queue_tcs = 0; + int num_tc = ndev->num_tc; + u32 value, queue_weight; + u16 offset, count; + int tc, i; + + if (!tcs) + goto __update_queue_tcs; + + for (tc = 0; tc < num_tc; tc++) { + count = ndev->tc_to_txq[tc].count; + offset = ndev->tc_to_txq[tc].offset; + + if (tcs & BIT(tc)) + queue_tcs |= GENMASK(offset + count - 1, offset); + + /* This is 1:1 mapping, go to next TC */ + if (count == 1) + continue; + + if (priv->plat->tx_sched_algorithm == MTL_TX_ALGORITHM_SP) { + NL_SET_ERR_MSG_MOD(extack, "TX algorithm SP is not suitable for one TC to multiple TXQs mapping"); + return -EINVAL; + } + + queue_weight = priv->plat->tx_queues_cfg[offset].weight; + for (i = 1; i < count; i++) { + if (queue_weight != priv->plat->tx_queues_cfg[offset + i].weight) { + NL_SET_ERR_MSG_FMT_MOD(extack, "TXQ weight [%u] differs across other TXQs in TC: [%u]", + queue_weight, tc); + return -EINVAL; + } + } + } + +__update_queue_tcs: + value = readl(ioaddr + MTL_FPE_CTRL_STS); + + value &= ~PEC; + value |= FIELD_PREP(PEC, queue_tcs); + + writel(value, ioaddr + MTL_FPE_CTRL_STS); + + return 0; +} diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h index e369e65920fc..d3191c48354d 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,8 @@ 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); +int dwmac5_fpe_set_preemptible_tcs(struct net_device *ndev, + struct netlink_ext_ack *extack, + 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 ba4418eaa8ba..37e8fecaf042 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...) \ ({ \ @@ -428,6 +429,9 @@ 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); + int (*fpe_set_preemptible_tcs)(struct net_device *ndev, + struct netlink_ext_ack *extack, + unsigned long tcs); }; #define stmmac_core_init(__priv, __args...) \ @@ -536,6 +540,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_callback(__priv, mac, fpe_set_preemptible_tcs, __args) /* PTP and HW Timer helpers */ struct stmmac_hwtimestamp { @@ -623,6 +629,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...) \ @@ -639,6 +647,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 3df9cad0848b..dcf2b5ea7b4f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6274,6 +6274,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 a58282d6458c..08fda0ed5ff3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -1174,6 +1174,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; @@ -1190,6 +1197,73 @@ static int tc_query_caps(struct stmmac_priv *priv, } } +static void stmmac_reset_tc_mqprio(struct net_device *ndev, + struct netlink_ext_ack *extack) +{ + 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, ndev, extack, 0); +} + +static int tc_setup_mqprio(struct stmmac_priv *priv, + struct tc_mqprio_qopt_offload *mqprio) +{ + struct netlink_ext_ack *extack = mqprio->extack; + 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; + u16 offset, count; + int tc, err; + + if (!num_tc) { + stmmac_reset_tc_mqprio(ndev, extack); + return 0; + } + + err = netdev_set_num_tc(ndev, num_tc); + if (err) + return err; + + /* DWMAC CORE4+ can not programming TC:TXQ mapping to hardware. + * Synopsys Databook: + * "The number of Tx DMA channels is equal to the number of Tx queues, + * and is direct one-to-one mapping." + * + * Luckily, DWXGMAC CORE can. + * + * Thus preemptible_tcs should be handled in a per core manner. + */ + 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; + + err = stmmac_fpe_set_preemptible_tcs(priv, ndev, extack, + mqprio->preemptible_tcs); + if (err) + goto err_reset_tc; + + return 0; + +err_reset_tc: + stmmac_reset_tc_mqprio(ndev, extack); + + return err; +} + const struct stmmac_tc_ops dwmac510_tc_ops = { .init = tc_init, .setup_cls_u32 = tc_setup_cls_u32, @@ -1198,4 +1272,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 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; From patchwork Tue Aug 20 11:20:41 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: 13769986 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 C5537C531DF for ; Tue, 20 Aug 2024 11:27:02 +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=uH60Yd1GI3CU3D/wod3TAuxBQI34Kzg4R4dXcyLgk6M=; b=1MtQhy/JtRBo68JPTYgOOK46Y6 KZ5+vlT9VaFev6AwzhRqjK1QGN0fHDPL6WTVbV5UJ46fE5bdIkGz3L91aX0hRJJapPSEz3sm2OI4K 3TTA6CKEBq2FAHG4kJU/3Om0qv1+kvMvWn0H6B6KND4VR9homUD7+OiVpqSxk8PrXMYt+9pqfVlp1 EDiwtA58z/LwdWO42cFkNd0cz+Kh054ZRuY/LtDBgwNcReC+/rYnVZwisTPY0hBoy0Gi1YFZUXHbJ RAT67oSzSXVx+w6Nbi8ci7B4I2/yncWmPF2+R7yzuBgd9sdeuPYNaPVUYvUpPF0RxQnGSO7Ng+HpV MDrY0lEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgN0n-000000050qP-317g; Tue, 20 Aug 2024 11:26:53 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgMw3-00000004zfV-2JEZ for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 11:22:00 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2020ac89cabso30024995ad.1 for ; Tue, 20 Aug 2024 04:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724152919; x=1724757719; 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=uH60Yd1GI3CU3D/wod3TAuxBQI34Kzg4R4dXcyLgk6M=; b=AKYwVYLk40+V+y2bicPeZc10aDhS15UKXiyPD3tP9CI+CcUHqzhOno4dCcGQZM3cHG tMg/u6ayXZICGH4xhvlEbO6B6BMbVqOuCZMbR1LxX1Z10XobOl+kHoWBc+mL4nLiSjuq jX9P+V2d+OrCfI9JLSva4WvHGUpPxaECQwXBMkBu4P8acuSh2zcOJoLu0UGRIogeE3rg e2QB0muOdEjvnaG3IzoKyF6hPFWYGvykAar7VuMPC01kFyKOsOy56Y7g6Obpx7LGGCyh mRZwo6YJxKpHy1W4nDkgjyRz9JKG++z+PvFNiqC/PByGuDgVkzf3jrhl9zUehUSaS1ET h7Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724152919; x=1724757719; 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=uH60Yd1GI3CU3D/wod3TAuxBQI34Kzg4R4dXcyLgk6M=; b=pM3Aka46nJrrkoPTdAWXF79guQxhP3hq54JmHZS0kVucjN2qOn8NTuYz9npTT6//BT yoxmEZTA4OvMU4IlMLMz5SgFngjig4zbxpV5/oLqq09VR85taIWLUYUrx+CN7xbBooGK 3gLhNOuqhaCTFNqM570x2Xp5woDBtCMiej9cyjm+MI9ejzcs7LorqRWa/SszAgCiQEbV zVRN6K8q+7GgDRghHi0C66ZuCj6wLgO8jVIGw8e740xzD14RTGmDKooziPJA9bABPdsB Zb3V4rH238Cn7S5A8Pl15965cmIZgTAO5tO5Y7uxQDHREFIGDiTkhghEBZWbYxIwO/zn fhjA== X-Forwarded-Encrypted: i=1; AJvYcCUZXE+FKvytoUK+LBsO4B79Q33tngZm/xoAq8ALPtrnJSy6KmBSYnUmZBuam9rUTp6yOnGxYHYbyo1Xqfl+BgLOa2myzn8K5OUMsqb4hGczYYA3EGw= X-Gm-Message-State: AOJu0YwFHvpFeANlhQ5FgE5TLtsNKFs+1IL6MdxOxhkUbw1uvEXS+q4s R39AV9RhPwS6+dPwjLg5cARPi0N9JjjwfBhl9jMQeroV8zWzGEO8 X-Google-Smtp-Source: AGHT+IG4H2W2UWmxm3iIQNPissd+E2bV0K2IjKg1ybnv6wOED4VkqMdaFdnlLdQ2a9a2rhVaCne0HQ== X-Received: by 2002:a17:902:e5c8:b0:202:35e0:deaf with SMTP id d9443c01a7336-20235e0e226mr80591885ad.39.1724152918682; Tue, 20 Aug 2024 04:21:58 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 04:21:58 -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 7/7] net: stmmac: silence FPE kernel logs Date: Tue, 20 Aug 2024 19:20:41 +0800 Message-Id: <07ea91555fe6bcf86f287549ebb23fcfbe5cc115.1724152528.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-20240820_042159_701326_DAC1CDE4 X-CRM114-Status: GOOD ( 12.72 ) 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 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 | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c index 1e87dbc9a406..c9905caf97ff 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -620,22 +620,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 dcf2b5ea7b4f..a5d01162fcc5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3378,7 +3378,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv) return -ENOMEM; } - netdev_info(priv->dev, "FPE workqueue start"); + netdev_dbg(priv->dev, "FPE workqueue start"); return 0; } @@ -4058,7 +4058,7 @@ static void stmmac_fpe_stop_wq(struct stmmac_priv *priv) priv->fpe_wq = NULL; } - netdev_info(priv->dev, "FPE workqueue stop"); + netdev_dbg(priv->dev, "FPE workqueue stop"); } /**