From patchwork Tue Aug 20 09:38:29 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: 13769751 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 EAAB718C911; Tue, 20 Aug 2024 09:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146738; cv=none; b=G6kAozVELGFcWIOqc95LET7oGEmHEyhF46huetr+00FRzYBE7myy0B1kvEoOdbpjvkJEiGvIz43C55HpctvUxZW0QqegT4peI+Hhf/xy2gZvehnoST0Tylc5hjbakOlnLJb0y75xck/4pZouoymUJ8IgfmvDP4hOtdHpGwcX3FU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146738; c=relaxed/simple; bh=nMAXGbI1SeplBdOdZfO9L/lpqog+rO0VsBl0ra0LaGM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DeCjWW6b6ZnZeoE+lOl3EQyqlf/pWqOAHA2IjqUjSu0PYENeWSsOOVRWENm8uf6/IivanZ6LUsfzrNUOuKMcTZN1EiRUXInQyeuM/lvqulznZ3EtuHXJN146i6xAZQh+B1tRDVQZZZAUwhEqEVIkEk1vt9auF+NcHvvTwTwjPxc= 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=WXpMM5pY; arc=none smtp.client-ip=209.85.216.51 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="WXpMM5pY" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2d3dacaccfaso3072042a91.0; Tue, 20 Aug 2024 02:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724146736; x=1724751536; 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=WgQ8xoW2Sz0iprZBFSPkGxeLiY/+7DmIllsVyhzR+sk=; b=WXpMM5pYRUS0xqtMOg/imxWb460SQssvNqz/HexEeF4k1GXO6Js2OvyVxOzz+Q8q9V +FIgvwbWwQTXiQEk45F/DuBnGBSXzNUU5Zy0JzruEPiVl3rVwGBeCFoVD4QKdMDrYiEN MvWKaFC4JJH+j+2AwkcKmiIdEZ63TKhAcI++tLdn5VT4sVO3bddcQ3iSyiWfpIxvx2ug aOdJ7PeEnuwibNml6pSbpSbYitL+Npsc1s/+yDPjwhzx6IYncVIYYBWZU8bXQnhAD3PN 5ETSDYa/A9SgABER2PZOs9+hT8V/0Yg6TYumAVmqhEBcbpKMDwLx+xU0IMKuPMvmcr2F ct2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724146736; x=1724751536; 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=WgQ8xoW2Sz0iprZBFSPkGxeLiY/+7DmIllsVyhzR+sk=; b=euCRcWa8B1FQM/VLHetvig0WCKwQK1Ceq7n9c9zIO4fWmc1AVf6S02RiusC09LAS4Y 4/5+PVrmln3lxLLL0zhavIgid50OlexbpKe/bGzy9jn3A6VWMcoHXi7plh/h1mZHf1HD 4ADY4P9iAb/MnYOX/7iHy+lfvm7KSMN/Qgv5Smbl7IlHU1T1jh35Ov8JBPQvybdN9vhC 8/e/kjt8DzDNYn8bNGhsLakjCBrk1oE/esYQDd6P8HcWbe8CSnolGMpspwV5ly2eTpNu S9EoO7y+3S3LSa2sIZa9K4DfrQddYcoAYfj4O19jx+HXTB6LihGIUWI7ZWi6VH+wBM8F 6pfA== X-Forwarded-Encrypted: i=1; AJvYcCXq6wDRZEMVE/lQ5kWi5LSkQ9ED9uilwvqAUJ33j20fTykZ1TLtEiiEn/h1XV/FxijN+lHVrxOJnzWBLrEBHfC/B43YeZa0qbkPPqdS X-Gm-Message-State: AOJu0Yz8cqsq1C71H942eZCuZp6kKAgEZTVd5kR7LIVnmhqDJ5K9SNOd OxhzFrwnldVl8h8AOavBZnBoDMECoJoS85ehkSNXm3hNQQLx3+u0 X-Google-Smtp-Source: AGHT+IF0cHJ5LSpG8fcKNGdlqkHBNjcLoIXdZg7wjMcEjMwLquCqOwmqA1bmJPrBOQSLM3R3lR2QtA== X-Received: by 2002:a17:90a:c584:b0:2c8:a8f:c97 with SMTP id 98e67ed59e1d1-2d3e03e9b13mr12251597a91.37.1724146735939; Tue, 20 Aug 2024 02:38:55 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d45246061dsm3230608a91.8.2024.08.20.02.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 02:38:55 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Serge Semin , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v4 1/7] net: stmmac: move stmmac_fpe_cfg to stmmac_priv data Date: Tue, 20 Aug 2024 17:38:29 +0800 Message-Id: <2fc5d2d43b583f3e66b843783f067f5420a0c8da.1724145786.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 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 09:38:30 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: 13769752 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 BDF0718E027; Tue, 20 Aug 2024 09:39:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146744; cv=none; b=YCv4R4fvpDlFBHqqwfEVkItEn0H1/+2fIv9OfIV6KkSgTgvsH2V2c4MazDdtVTzVcrOIxtUOvi4H8syEcPStEc2zWyyqikFZendxnljXYBPDjOhVBeGA8kBeC22CjA6dL6E99GEEqm5FEN34hifut3hSYfZEW/MYBOJrRaFEHNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146744; c=relaxed/simple; bh=V1B78nsPXwKtwYadG9TpwoAohUkSiZj7ncPcaNfxp9E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qTtuyTf4UNu0nSKT7cFFbIN4Pxh7kW9hhDv5BB91HKOJPqJV7ABmNEQDGArCcnvD7Jx4JVKByj/gmEKzdCaSffWwSiq4E7DAlfouWdxhb2a56l/sHfW16VLWMwEzyBBcTv7x8uQ5uJWBl+PbOY7ZPS2DSUkDapXKyiegaihRdPI= 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=bi7A+epq; arc=none smtp.client-ip=209.85.215.170 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="bi7A+epq" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7afd1aeac83so4155878a12.0; Tue, 20 Aug 2024 02:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724146742; x=1724751542; 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=e93oae2VnzqVNZVCAViMoa1uvgxDslJYuHwS+x1kihw=; b=bi7A+epqjRi+FrSRrtpmBEo5D0WjpMdVIjX6EwlGk4US/Dvz9FLL1khcCmGuB+nGYk mDwbqS/USc/doogr44TfIOOzA7LGSiHmR8ywrhaU1uqtzThQBhhMKMI5JD82ZqMUD2ZK k0xHUjVsn9SuStGq5hKp6pdd+bh+kQJSjSjg1hGF9jtmhMWU6Wtq0zlCB3F+LZ8kapOr Mwybf8GWJs5kUAtJnvefBKBojQtyv8Q1YtdAeNojBmpZtsyBiwvqi9hOcKGzRK15pSzj ODth9fmkKi3QsPQCM+qPwBohQWzmE7ZNZ4S5PRbDj7GSBX6f3ZLwEli3P4Ytrt27tM5N WynQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724146742; x=1724751542; 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=e93oae2VnzqVNZVCAViMoa1uvgxDslJYuHwS+x1kihw=; b=IOsezS9VqU07ZLrC40sytjbGSqcfEH8CtikZaH6f3fFZskX1/wlGN2n+b6/Zk0p4He UgOi9oZD1NFjrrVymokacKOp3PCaT+PZlpblc/nr1dn5fx7MyhYE5LbD8jBpKhd2w4zR KsVZoEjDrQBwPea8EtOzZJ5AHbr3KTmmKQrrFwT2cwL+Jv9wWNmjMwyh+fLLEAVU4ItH 9KookTA34lgi89uFFXuPUnhvMj/NwLcZt9t0JPzH/4jXMZVUqrKSAIQBX1QGNF3MfYgY Ydo+Cu5xOuFSL1w5Dht3N09tyQKo/dALSohQCJruAfaW9fp6nGc5aud+CMJSQbm7yQTZ Hhaw== X-Forwarded-Encrypted: i=1; AJvYcCWQWuGAnRPf8sGgV42zBprQ4L1Z9M/ZR2Z8nRmfSsVAcahvfLuOuyQcG6yaETFzyne6WVzFLa8kl1Hx/oE=@vger.kernel.org X-Gm-Message-State: AOJu0YxS1TAh+E6M44xh1EiXCls26z1M7d18mmiGsOIWI73fV4bZJx8l IS4GDJWXZfExFvmtMoinBrvPIuSgki6ncNMKgXU6HsmBA9vuR7Ie X-Google-Smtp-Source: AGHT+IH9IHp5PU/VYkc4YktJk5Ok0SiYyDX8GtYRZy3g1/c5AvOIGPY1vcvblQDjo+zjtJkaJDp13w== X-Received: by 2002:a17:90a:8d03:b0:2c2:4109:9466 with SMTP id 98e67ed59e1d1-2d47321b181mr3652350a91.8.1724146741853; Tue, 20 Aug 2024 02:39:01 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d45246061dsm3230608a91.8.2024.08.20.02.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 02:39:01 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Serge Semin , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v4 2/7] net: stmmac: drop stmmac_fpe_handshake Date: Tue, 20 Aug 2024 17:38:30 +0800 Message-Id: <4358074eebdfedf4d129ccce40434af5f6e2b3f9.1724145786.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 --set-mm can trigger FPE verification processe 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 09:38:31 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: 13769753 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (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 9A3D418C93E; Tue, 20 Aug 2024 09:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146751; cv=none; b=Gcbj/dmzVKadAjZJpmWujkP9Y8QbVYzpd87R6C704xx/YqxSveSHz/DhZcAit+7q30EQhQqAomk2etOJEYnAPCSfDPCSXTWI9K9rykk6GtPKpIu0+UT719u+XVSsRAOSA8sPtto2faF17K/LZTpqqHkXBQRzi2Jdm3ScaIYIs78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146751; c=relaxed/simple; bh=itxg/M3lVuoRR78aOEGXiRnc0EI5fRs1aS+pe2oWA8g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rc7zl4VrEuU205my4CXjpdox0oDzesUlIkG6tRmqXRdq4b6qgp/OkGzuYlnEmP8lnJeukNzMKp2nUJt4tg3p7oilv5lUqrTkQZN6NVDDva6L09TVgFY160gMBjg0sJb5G7mERXKPi8e909y7TRoLEykzrZDKe1rJhRMzsXY9dU4= 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=mPykrjTw; arc=none smtp.client-ip=209.85.216.48 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="mPykrjTw" Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-2d3c396787cso4044435a91.1; Tue, 20 Aug 2024 02:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724146749; x=1724751549; 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=YJl6m7/HvoZr28SwAJK1VeVNaeP/xxoxJA+ZuNmUMD8=; b=mPykrjTwYjSglpI+Ilq8UXKuuqL9pBR3EOiHcAHWSExewsJkLdKFfEGbNxplhEpYTy 54dJgmnLNUVoe3W8PXCTBRcHHd67KPk4sXAxrOyJr0c/HloVJA36fjDFsbHNb8B8e8Sh JHboMtTus4/bjnFjE26d0fKHz5muqxz2X1hjiAe/aOLVJja38/NrN/uVFFfMNHtMLFOF VQncMiHc+F0G+lSQV6deQtZ2o13aB15Op7UDbJhm/4ApMEM/H0kSuOYblKzqxMUuPbQc GArI6Emdp8AZoAHnuDe9w3QpXeuPWsOmS2i2Bwn3Id9PhiguvcGjQ/eYONetWNtru5jM H2GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724146749; x=1724751549; 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=SyYRaPfUcZdIMS7mf09Em2kt/Ousi5Ac6023DLKShcnYM0UwNjLWcAA+vX7O02dtG1 0jlGiO7H2ukZg2b/M8anHKrRpjLurvx8GccEslnQNlYF2FaOVEUVLv7Rwuf+NH+c+N45 kBfFAsxhGmo0310cOcKOIuuT6jtHWWbmslF6HigEF0wUeaiGjEh/5pqHdnLsB1feTSlF 3lw/qNKvJQ8xONXjFAY3jhWcgd8BoPSFmwKYqbB4QMZHJUyoj3K/Zxse1lDGT4iI0OLF HZT0bGycAZbHHfe0y7IXOHyOstK5fTZhKRVXJa52zkJ7XEXonoussFEUSgbVy95HlUev rXPA== X-Forwarded-Encrypted: i=1; AJvYcCV8tZTD3/f6fZ1qaVuYO/mlfbFTedkHwNoCQFk32Z2+djcb5VA53A1OIEGeQWM7FgQAdBt12vXeiLLo3QM=@vger.kernel.org X-Gm-Message-State: AOJu0YzBxbrLl/zUYDSZkpbBTVn+52OUPjp6O/6D/oEZFJkGxQ5hv9Sp WixE8eX64hkQyBbVSutluP1e+NZdAVClA0Q+RuVpR+rF9XIO2Zaj X-Google-Smtp-Source: AGHT+IEWvJvyPCpenUFu/CX0YxxvoGQ5X9ndvVt1LC/JpcJaRw96JuDl6cRLq2eoBHrgSnwodk7d8Q== X-Received: by 2002:a17:90a:c58f:b0:2c9:6a2d:b116 with SMTP id 98e67ed59e1d1-2d3dfc2a9dfmr14721226a91.7.1724146748502; Tue, 20 Aug 2024 02:39:08 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d45246061dsm3230608a91.8.2024.08.20.02.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 02:39:08 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Serge Semin , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v4 3/7] net: stmmac: refactor FPE verification process Date: Tue, 20 Aug 2024 17:38:31 +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 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 09:38:32 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: 13769754 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 9323918E763; Tue, 20 Aug 2024 09:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146757; cv=none; b=AH8zaY6B3crASrkNBVNdp+PUKfaXnjsjdfYMyCJaYodDogPpT+fm+C8VifOqdNbGVE1D1o/PTuNoBCzb1VEhw2ZdPU9PmYWVxGGQJLu1lS5s9o/UDVsBglRuraCZ1Xj8I0Ny980JDKBjRJao3879FZDz5mzPRjHd3sy7/+MBg9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146757; c=relaxed/simple; bh=WNQ0RshljzldD5cWUUoDtqvewfaKKWb4ZheNZBYxBgU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a8dTysoDLpc5pfA7usbNupjDmyCogT5c+otRRwefVqHxd4GV8vySLF/SKQgi+eH50E/GpAuw2stSmSo/isEdeEe6qoKgvCqZ6bQVRbu/Knz8B0QFL13Qkt36EyBU1mrq3iAlTpd7vHk/25f+qNO5TKiTnGY/sznsQ092ghvgkSE= 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=RCZqyFDw; arc=none smtp.client-ip=209.85.216.41 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="RCZqyFDw" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2d3c05dc63eso3874389a91.0; Tue, 20 Aug 2024 02:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724146755; x=1724751555; 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=grhhqkwsAeKI7ZYFL13VH9wGAB4d76dHya6ajngYGU0=; b=RCZqyFDw3yhAg6xLUumzmQf85ABO2dZa4LAiKsp6D7KrrrCdT90KzOtpCBxe4onN2A NnthQ08M9vPnX2aVyxnN6plXf/purfEksABeCZUrkQXs/yLXYsdxmKsbMCVr5kHP2Mcq u5px2Eh445Xue31CHyRZvfRgvPcm3BVzuS2+BbDanUVNwU2gKL9SFr+30lb7TtxMD7o8 cv8Nghvx++nK39m0sVCRTZYlcEM8GnY+v54JeKMnS9D5k3q0fGQKTDQR76Bqayoaj7yE T9c07XbXc8qE6KuA3fydfu4HQR8hlAWoUgyhx9C7Czg8fqfoW/xEZri/sTLlTdIX5hfv g0BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724146755; x=1724751555; 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=grhhqkwsAeKI7ZYFL13VH9wGAB4d76dHya6ajngYGU0=; b=GF/Bd4utb0YWcnKC5ypYtYXfbhPeYcDRJBSsQfHOCieNx4EFfN/s5xb4/p2dFaDPOm SBgswx9Q17DTJX5GeATysj6jPDspFGbwVYX7RMzYjuXEcDH5ljt3TeaJGLWqedNGraO4 2vR49UwqY11M9NX+/ZpAfIqvEI6xNTR7NNvz+iEGSdr45te8I8bUw1R2kw4tRbrxKYjr SctDgT0Ju7ecSFwU1CGYTyUGlwMHgyLOxhjwRm4kjvAtl6z3iN6wUytPn3/uOuzdI6gf HYRkW+ZGR8bUO1G1U3MFTpD2HYwbhd/WZp4Dk+tA1aWEb6d6vezf6ZbZwTDv8AWgazSu BO5A== X-Forwarded-Encrypted: i=1; AJvYcCWJnTOY6UezTB9yfp3jepIJouU8D38KChX3Gn7fLFlXCdYV6IL2uslp0FUbs+1weRwIuC+F6SXDZaP737U=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7tYbGlTOIoyCNo2fRQ/y3NIgieX/uW7YszQdLYRmmB6u+t9Oh loZrJeJuvFd0Rmyf/bYnGMbbnjat5rC5wmvO8IG2NVn1CWlAN0ff X-Google-Smtp-Source: AGHT+IGvBkP99oiMIL6fNM7hgoNCPgaz0M5xIEjx9F1NHvWYfEqFWXUAoo9A1Z6YZsxdRHGYiw79nQ== X-Received: by 2002:a17:90b:4a4a:b0:2c9:7e9c:9637 with SMTP id 98e67ed59e1d1-2d5c0db33cbmr2131591a91.13.1724146754622; Tue, 20 Aug 2024 02:39:14 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d45246061dsm3230608a91.8.2024.08.20.02.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 02:39:14 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Serge Semin , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v4 4/7] net: stmmac: configure FPE via ethtool-mm Date: Tue, 20 Aug 2024 17:38:32 +0800 Message-Id: <79c52f8ce576a5bb6027f806250f1f8286707c5b.1724145786.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 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..00ed0543f5cf 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 09:38:33 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: 13769755 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 8132918EFDA; Tue, 20 Aug 2024 09:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146764; cv=none; b=WH0ko85M1ZrXUQICzXPRqIe6OuKZ1v/HKTlIn0kUZCXFbBZ+dmA9Dk52mIrXBGL8QcBCJPgogOYmdyiVtVawuWN9uwbia2sBZIQEvImhu4MqpMpukpiKt/+BAhpdOscPYrhBJJYNf7GO5avIjNxvo8EW4byQcLP6Txx5nf7nFt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146764; c=relaxed/simple; bh=go6EvIB3irC6d4TtKK1wFafcFq0TOIdE0WWhOoeWzCs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PoEqAxldI0BjvHXjo/PuAJh5BRlyiZ5cXLsQWL+WbxsldvYEmFyuPxSuK0M8k6IwNOa4fRhcf25zB1UX5DR2dfVAUZ3NWbUV7IgORJfMPpulGV9JRs7TOG+AzVLIjJzEiL8Gy4Hvs0AuZVw9R8lcncmTzPCXUcGcGlxMy4kaC94= 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=TwmJgLyJ; arc=none smtp.client-ip=209.85.216.45 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="TwmJgLyJ" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-2d3e46ba5bcso2769058a91.0; Tue, 20 Aug 2024 02:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724146762; x=1724751562; 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=dVXB8epwEjzVkWbfqgqRBxkneLzbIU2CAdCCzSl8n9M=; b=TwmJgLyJPtRAhnC2r+SJFBOEzfuOFlwSep2lijsP6hp69i0+dQtkV5xqs65vhphg58 mXFeBK6DcIsfEzEFXHQ00CYiOL4hS4Ba7Y9TtWpwlH/1roRMlQlWlYsnZmJFxSSRx25D SZYxANpWgMAuPrOFYD61UkCERrdIH1evgjpxgxOZTWAVI1XnLVm3GyBA6L45KTD4QD0s kLb+o6IAQ4DLe9yxLq3CvwyES1wiO2pKvKBvwrDNLlugxYbVZS3KW0xCym5jpBWsqe2F v/8I/LIhoYN+5tHTcSOBh3i2uE1ySuBoB0CpZ5ankZN5GIE/wlIeZD+g4hfFo/0w5YMo hosQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724146762; x=1724751562; 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=dVXB8epwEjzVkWbfqgqRBxkneLzbIU2CAdCCzSl8n9M=; b=kPKlsP/v1Bs7gp4VU61f7EmTcFCRtHezW6BYCP5qVD25zvjZkz9aI8gYy95DJKPXo0 4qSGhGsK/+yW1fOg90Qh7NA3spEVupViuLvy6IQ+JSREM/CTl0H4bu8c2hM27ONKpqXa UqT/goawQlpiSRp8S12crXXegqv7nQhiNp64FpI6RdLQU8w1WwEUu3jMjrJI79xqDFvp vg/Zyn4VTSvKr05n7kxMv92a2wy0FjWBFfwy95/Z/M7BwMRgJRm42prCqOnAGhxkED29 NaeJRSdeSCz/SermGCKQMB1e+dNvg5iiw4JLuCaq21+ar6fCUwQFXzE2x/ZCtscK2G6V v4RQ== X-Forwarded-Encrypted: i=1; AJvYcCX5qTl1eTFPkVx0WKWsLndXIXq5G6Sd/wMb86QoUhD57G1QoWIalYvQPziy/WmYBq80xR9dIpic7Y03w2TrP5RqbS5Bp6IIUj8lfY3O X-Gm-Message-State: AOJu0Yy9aASY2AHxQCXMtaJtKkJz16LGNrsQ0sjfZ9X0BPIZ7ptG1Bba J1MCTR0IT+MTka2k3JYOgIrk3Ldq0eCWgvp2JTywTBKi3X9Ue+8P X-Google-Smtp-Source: AGHT+IFAgU0lb/emR5+Mzegc5qF8kgk92zedg/rinAojCtgJNslwopRWjRVI9bbKPOqB4pHduz977Q== X-Received: by 2002:a17:90b:1887:b0:2d3:d066:f58b with SMTP id 98e67ed59e1d1-2d3dfc66beemr12325593a91.12.1724146761535; Tue, 20 Aug 2024 02:39:21 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d45246061dsm3230608a91.8.2024.08.20.02.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 02:39:21 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Serge Semin , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v4 5/7] net: stmmac: support fp parameter of tc-mqprio Date: Tue, 20 Aug 2024 17:38:33 +0800 Message-Id: <413a36781a9b215c857bd8ec3c9ee03462e861d7.1724145786.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-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 | 81 +++++++++++++++++++ 6 files changed, 151 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 00ed0543f5cf..6d7aca411af7 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..f8f09ef2d447 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -4,6 +4,7 @@ * stmmac TC Handling (HW only) */ +#include #include #include #include "common.h" @@ -1174,6 +1175,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 +1198,78 @@ 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; + } + + if (mqprio->preemptible_tcs && !ethtool_dev_mm_supported(ndev)) { + NL_SET_ERR_MSG_MOD(extack, "Device does not support preemption"); + return -EOPNOTSUPP; + } + + 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 +1278,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 09:38:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13769756 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 6167118CBF1; Tue, 20 Aug 2024 09:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146769; cv=none; b=KKMlpNVxmgr9t2rcjuaIozxXsXz4GoX7FjCZKhNxAj/xInEt5OkuVvIdKEcEKXVBclqXJUPyKNvPFS6mK1NnS9ygLAONU+eGV8ylDcbhswF18aK4lL09rrI5x9MVq9Z/uUXZgWdoBbUz1j7A6+K9qe3LonowlGT/sIsCF5MQQtU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146769; c=relaxed/simple; bh=pvuIQuXjkzNMJYT3uEFGY3Kq0l11eWYClalium1xMsc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HNTtWe3dBKnSjFrBhx3oqhay1UG2Twtuj8i0yxBXFHpWQi2yRf/hTYXgKp+zQC9w3whE3Wg/y6Gmzm/P84OJBZNjdR01IYg7ICJRLnzmiaYQ9+qoqRBba7Uvz4msJnXdC52tegyWxFMUNjsUPcJyrG7thDskX6awUdDAj3ybvJk= 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=OTmBr1n9; arc=none smtp.client-ip=209.85.216.41 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="OTmBr1n9" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2d3d0b06a2dso3664538a91.0; Tue, 20 Aug 2024 02:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724146768; x=1724751568; 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=MBziSSli8cMhwVRS/XUpMid3dlyuuWsBGzCQhQohhLw=; b=OTmBr1n9KzylEWmJ2EgK0Gtv5MggkYq8+XMYQCugApXc3Qh0AnBUiExpod5xWRGUm/ 0MpykCIRVllk6fosHl5GVC1HU7x1fH4lFzTa3bLlOwm4apLY4DPtfepf7IrNlda+mCLy 2eFkfN6n3LoF4S5VmuUYG3JL989lHMCvbfw4PZyjgXnNiQjPQU+ySxH4+qgWkOnBDSKp Gtl9t/Z5JEqjxsrRcwcno+1mi/9Lhy/qalp7WS930trSbMGlTJgVdqq5NDsfyy5tHh1J iYorQK1ujjbDV489z6gxMKS/ZgxAqhwJMwZLQiXf6SDmilqLTA2J/49S6SuwIUMrsVAb D7Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724146768; x=1724751568; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MBziSSli8cMhwVRS/XUpMid3dlyuuWsBGzCQhQohhLw=; b=Rrb/6lK11J/qN4XBnVwZq8xkjNne6YnkTrYBfcum15o1rzEfGlmDl6FypIhrZA6t3L 44Yn+fJyxcOSD5fDbRAnAMEtu5a5W1Zt9W8hTIe61QVfztrBHLt6aPHW8gqh4JqbI+O3 JdFSVD9Ej8wXSEDBvcg8uTGhRaIBYPij53OyK5hqFg4OjQtCugTkZ8AXlNgKTau8/BVr duO2JwrNxdxigghvJ/WnBOTxSNunIlQSym+hdqifW/JJAlVFnIQYzgb2k51MXB5MnC8y KFvZ1ZyOeDvwnV8a32mVGRRjTDJ/MnGuYt1wryHY81VQaTggWIyOgHX0nvLIiIaapAD5 vi4Q== X-Forwarded-Encrypted: i=1; AJvYcCVQxYSnoXVUSd4/nrKe+U4quvXWzNMdOq/xeWddiG6CIQ46ddr2ko8oxhQNLJkpuy2sKUzjkvqpE6kgr6s=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1Yf02vmkcY2Kl+gusA/hG/zAH8ZP6An2A/eHwYhsyNkd/kzg+ QSflqnOcES9ch+WFw/DpxmcbQvFGmAFoqs7mTrc85hB/zHlZpAdULXH7+Q== X-Google-Smtp-Source: AGHT+IGv2yZnBNN0ZbnLqzVXOK4cuhP5PFCjq22WGkpxCpnGjZAQC6MUuCRjeBTUVeo52ol6QEcEwg== X-Received: by 2002:a17:90a:db8d:b0:2cb:5aaf:c12e with SMTP id 98e67ed59e1d1-2d3e03e8cfbmr14850301a91.37.1724146767418; Tue, 20 Aug 2024 02:39:27 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d45246061dsm3230608a91.8.2024.08.20.02.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 02:39:27 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Serge Semin , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v4 6/7] net: stmmac: support fp parameter of tc-taprio Date: Tue, 20 Aug 2024 17:38:34 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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. 0) tc qdisc add dev eth1 parent root handle 100 taprio \ num_tc 4 \ map 0 1 2 3 2 2 2 2 2 2 2 2 2 2 2 3 \ queues 1@0 1@1 1@2 1@3 \ base-time 1000000000 \ sched-entry S 03 10000000 \ sched-entry S 0e 10000000 \ flags 0x2 fp P E E E 1) After some traffic tests, MAC merge layer statistics are all good. Local device: [ { "ifname": "eth1", "pmac-enabled": true, "tx-enabled": true, "tx-active": true, "tx-min-frag-size": 60, "rx-min-frag-size": 60, "verify-enabled": true, "verify-time": 100, "max-verify-time": 128, "verify-status": "SUCCEEDED", "statistics": { "MACMergeFrameAssErrorCount": 0, "MACMergeFrameSmdErrorCount": 0, "MACMergeFrameAssOkCount": 0, "MACMergeFragCountRx": 0, "MACMergeFragCountTx": 17837, "MACMergeHoldCount": 18639 } } ] Remote device: [ { "ifname": "end1", "pmac-enabled": true, "tx-enabled": true, "tx-active": true, "tx-min-frag-size": 60, "rx-min-frag-size": 60, "verify-enabled": true, "verify-time": 100, "max-verify-time": 128, "verify-status": "SUCCEEDED", "statistics": { "MACMergeFrameAssErrorCount": 0, "MACMergeFrameSmdErrorCount": 0, "MACMergeFrameAssOkCount": 17189, "MACMergeFragCountRx": 17837, "MACMergeFragCountTx": 0, "MACMergeHoldCount": 0 } } ] Tested on DWMAC CORE 5.10a Signed-off-by: Furong Xu <0x1207@gmail.com> --- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index f8f09ef2d447..589fbe9de09b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -932,9 +932,9 @@ static int tc_taprio_configure(struct stmmac_priv *priv, struct tc_taprio_qopt_offload *qopt) { u32 size, wid = priv->dma_cap.estwid, dep = priv->dma_cap.estdep; + struct netlink_ext_ack *extack = qopt->mqprio.extack; struct timespec64 time, current_time, qopt_time; ktime_t current_time_ns; - bool fpe = false; int i, ret = 0; u64 ctr; @@ -1019,16 +1019,12 @@ static int tc_taprio_configure(struct stmmac_priv *priv, switch (qopt->entries[i].command) { case TC_TAPRIO_CMD_SET_GATES: - if (fpe) - return -EINVAL; break; case TC_TAPRIO_CMD_SET_AND_HOLD: gates |= BIT(0); - fpe = true; break; case TC_TAPRIO_CMD_SET_AND_RELEASE: gates &= ~BIT(0); - fpe = true; break; default: return -EOPNOTSUPP; @@ -1059,7 +1055,8 @@ static int tc_taprio_configure(struct stmmac_priv *priv, tc_taprio_map_maxsdu_txq(priv, qopt); - if (fpe && !priv->dma_cap.fpesel) { + if (qopt->mqprio.preemptible_tcs && !ethtool_dev_mm_supported(priv->dev)) { + NL_SET_ERR_MSG_MOD(extack, "Device does not support preemption"); mutex_unlock(&priv->est_lock); return -EOPNOTSUPP; } @@ -1072,6 +1069,9 @@ static int tc_taprio_configure(struct stmmac_priv *priv, goto disable; } + stmmac_fpe_set_preemptible_tcs(priv, priv->dev, extack, + qopt->mqprio.preemptible_tcs); + netdev_info(priv->dev, "configured EST\n"); return 0; @@ -1090,11 +1090,8 @@ static int tc_taprio_configure(struct stmmac_priv *priv, mutex_unlock(&priv->est_lock); } - stmmac_fpe_configure(priv, priv->ioaddr, - &priv->fpe_cfg, - priv->plat->tx_queues_to_use, - priv->plat->rx_queues_to_use, - false, false); + stmmac_fpe_set_preemptible_tcs(priv, priv->dev, extack, 0); + netdev_info(priv->dev, "disabled FPE\n"); return ret; From patchwork Tue Aug 20 09:38: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: 13769757 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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 1C08D18C924; Tue, 20 Aug 2024 09:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146775; cv=none; b=GBm8l6Gv/lgXv6cCM0ykhySyzC3b7Bj/ipIByR5JML+kkhQGw2BIKg/57MpqvxZyomBOWWtXmcSBrOExIiM2ulTRfcRO0x1iVBMA3Y1q/+NIq2zAVEWs05JCjyoOj+gZrhKumc0LCerptKRR0T1eTuKXLAn5wfDs+a19eY/YRRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724146775; c=relaxed/simple; bh=64jdsCFG/rW/LRC/WmG5Usf3xYiVRC/Y+mGFFtggrAA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oG0cb/puCXSmUKfV077hpCZ1gUjjoQR+tna1kIgWDsq5SmRHp+sC+7/gTa7KFLrhOmsnOEXGEF9d5UNOxYYjH6hFnVuk65bAesfCTpkaCWqYFnx07b5okAJ2rRXDbxSr9mLYVeKJPZaNt4IobhIYTmnpn9fu99A8/aXw1moAudo= 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=Mabgw+CB; arc=none smtp.client-ip=209.85.216.44 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="Mabgw+CB" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2d3d7a1e45fso3042983a91.3; Tue, 20 Aug 2024 02:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724146773; x=1724751573; 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=NDtdR8L72ecyhWl64ylKYwjwtNgYUGDBUuM8QKvBiWw=; b=Mabgw+CBFJR/QSliwCr3tBUr967u5GNuB6Qp5ojU0mdRUJWtXXSpvFcNcMtXOj5iWR K8SrWArRp7CTjNh77pTPnMveu70DMPLpglVx5/oE5Yly5QkBAJqZJtn+hF3YIrATEtyc 9JEzdiv42O9LhYjcisn/xCBQyWzidgasJ0c+JlCRsB5n+1WUUXcjoXFkZvG1mSqy1pEj +hSXOKuBFzv7GUAoHmekpc2ZD8++RYLWKUF3m9L1GW1M1y5WTsS3UWcgf0cPq9CHSzE6 fRZCNstzEQAs0ZseUZDCVtX4rRtCeYl/y0giWgt+I85nJon9UA2VYVgGd9zTpcn9JpXk J25A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724146773; x=1724751573; 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=NDtdR8L72ecyhWl64ylKYwjwtNgYUGDBUuM8QKvBiWw=; b=d2cgYgq0btX8kR8ET69Q9BhcTbqoBZrq3meEuxYA/VgVf5YfmavqcQ8g91P3+ZVBqO FXLqspJ1uQSvl9uek+Vpaij3uTm0Ggf/vZhWTlFOO4CL2heWDefp8BzqWTKg7lVnTbnb h1wBsfaqI+hm1RuyFiFlNKbr2b5k4ZSHXIWzEY5qjILTwWODRCIb82jLAgko2qk1BHSI eOuf0OQdY70iIRImuK7cb2IdICHHv1ugbil3xJAqSMNHHVcKMk62bHRSKiX3xFsv/KHZ ILQh59qg3N5RBZ8M57lwdEbglm/PYvZq1GLCkoJvmRXbSrTHvIsc5MC5whWlohYfhVqv MxLA== X-Forwarded-Encrypted: i=1; AJvYcCUUg6voCBCbOcQlvHE11b931FO7I1ztjbnUbesiyf1UXE4G4A2KIZiClfrops7sjWk+obvg9U1Wn6xkz/w=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6WlHguZ2qTGo8BNzN+GHxpSvc5ANSg91at5SlJTEOWifvaZIh 9ExB/jeg4sBaoC4+iCzanUSbFYGd1AGqN1d23X9e2xJ6alikMF8B X-Google-Smtp-Source: AGHT+IFM4ALEVhEA9jwy8QPIVnmjGZziok5D7VHZfUwJtcYii+q/qpP+UCWZHHS37xt6cRdHvesDRQ== X-Received: by 2002:a17:90a:c918:b0:2c9:7cc8:8e33 with SMTP id 98e67ed59e1d1-2d3dffc0fe9mr13661819a91.13.1724146773301; Tue, 20 Aug 2024 02:39:33 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d45246061dsm3230608a91.8.2024.08.20.02.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 02:39:32 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Serge Semin , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v4 7/7] net: stmmac: silence FPE kernel logs Date: Tue, 20 Aug 2024 17:38:35 +0800 Message-Id: <3d7f0ad310e02b7c604df6da1408e141ad4c2e2e.1724145786.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 | 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 6d7aca411af7..e2e1f1d6ff39 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"); } /**