* [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames
@ 2026-03-13 9:46 Wei Fang
2026-03-13 9:46 ` [PATCH v5 net 1/3] net: enetc: reset PIR and CIR if they are not equal when initializing TX ring Wei Fang
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Wei Fang @ 2026-03-13 9:46 UTC (permalink / raw)
To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
davem, edumazet, kuba, pabeni, linux, Frank.Li, horms,
saikrishnag
Cc: netdev, linux-kernel, imx
Currently the driver does not reset the producer index register (PIR) and
consumer index register (CIR) when initializing a TX BD ring. The driver
only reads the PIR and CIR and initializes the software indexes. If the
TX BD ring is reinitialized when it still contains unsent frames, its PIR
and CIR will not be equal after the reinitialization. However, the BDs
between CIR and PIR have been freed and become invalid and this can lead
to a hardware malfunction, causing the TX BD ring will not work properly.
Since the PIR and CIR are sofeware-configurable on ENETC v4. Therefore,
the driver must reset them if they are not equal when reinitializing
the TX BD ring.
However, resetting the PIR and CIR alone is insufficient, it cannot
completely solve the problem. When a link-down event occurs while the TX
BD ring is transmitting frames, subsequent reinitialization of the TX BD
ring may cause it to malfunction. Because enetc4_pl_mac_link_down() only
clears PMa_COMMAND_CONFIG[TX_EN] to disable MAC transmit data path. It
doesn't set PORT[TXDIS] to 1 to flush the TX BD ring. Therefore, it is
not safe to reinitialize the TX BD ring at this point.
To safely reinitialize the TX BD ring after a link-down event, we checked
with the NETC IP team, a proper Ethernet MAC graceful stop is necessary.
Therefore, add the Ethernet MAC graceful stop to the link-down event
handler enetc4_pl_mac_link_down(). Note that this patch set is not
applicable to ENETC v1 (LS1028A).
---
v5:
1. Add patch 3
2. Correct the typo in commit message of patch 1
v4 link: https://lore.kernel.org/imx/20260312095415.669128-1-wei.fang@nxp.com/
v4:
Correct the offset of ENETC4_PSR
v3 link: https://lore.kernel.org/imx/20260311084105.3982037-1-wei.fang@nxp.com/
v3:
1. Split the v2 patch into two parts
2. Update the comments regarding PIR and CIR in enetc_setup_txbdr()
3. Use read_poll_timeout() instead of the while loop
v2 link: https://lore.kernel.org/imx/20260309030412.2716984-1-wei.fang@nxp.com/
v2:
1. Remove unused register macros (ENETC_SISR and SISR_TX_BUSY)
2. Remove spurious semicolon from enetc4_mac_wait_rx_empty()
---
Wei Fang (3):
net: enetc: reset PIR and CIR if they are not equal when initializing
TX ring
net: enetc: add graceful stop to safely reinitialize the TX Ring
net: enetc: do not access non-existent registers on pseudo MAC
drivers/net/ethernet/freescale/enetc/enetc.c | 13 +-
.../net/ethernet/freescale/enetc/enetc4_hw.h | 11 ++
.../net/ethernet/freescale/enetc/enetc4_pf.c | 118 +++++++++++++++---
3 files changed, 127 insertions(+), 15 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v5 net 1/3] net: enetc: reset PIR and CIR if they are not equal when initializing TX ring
2026-03-13 9:46 [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
@ 2026-03-13 9:46 ` Wei Fang
2026-03-16 14:12 ` Claudiu Manoil
2026-03-13 9:46 ` [PATCH v5 net 2/3] net: enetc: add graceful stop to safely reinitialize the TX Ring Wei Fang
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Wei Fang @ 2026-03-13 9:46 UTC (permalink / raw)
To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
davem, edumazet, kuba, pabeni, linux, Frank.Li, horms,
saikrishnag
Cc: netdev, linux-kernel, imx
Currently the driver does not reset the producer index register (PIR) and
consumer index register (CIR) when initializing a TX BD ring. The driver
only reads the PIR and CIR and initializes the software indexes. If the
TX BD ring is reinitialized when it still contains unsent frames, its PIR
and CIR will not be equal after the reinitialization. However, the BDs
between CIR and PIR have been freed and become invalid and this can lead
to a hardware malfunction, causing the TX BD ring will not work properly.
For ENETC v4, it supports software to set the PIR and CIR, so the driver
can reset these two registers if they are not equal when reinitializing
the TX BD ring. Therefore, add this solution for ENETC v4. Note that this
patch does not work for ENETC v1 because it does not support software to
set the PIR and CIR.
Fixes: 99100d0d9922 ("net: enetc: add preliminary support for i.MX95 ENETC PF")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
drivers/net/ethernet/freescale/enetc/enetc.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index a146ceaf2ed6..aa8a87124b10 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -2578,6 +2578,7 @@ EXPORT_SYMBOL_GPL(enetc_free_si_resources);
static void enetc_setup_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring)
{
+ struct enetc_si *si = container_of(hw, struct enetc_si, hw);
int idx = tx_ring->index;
u32 tbmr;
@@ -2591,10 +2592,20 @@ static void enetc_setup_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring)
enetc_txbdr_wr(hw, idx, ENETC_TBLENR,
ENETC_RTBLENR_LEN(tx_ring->bd_count));
- /* clearing PI/CI registers for Tx not supported, adjust sw indexes */
+ /* For ENETC v1, clearing PI/CI registers for Tx not supported,
+ * adjust sw indexes
+ */
tx_ring->next_to_use = enetc_txbdr_rd(hw, idx, ENETC_TBPIR);
tx_ring->next_to_clean = enetc_txbdr_rd(hw, idx, ENETC_TBCIR);
+ if (tx_ring->next_to_use != tx_ring->next_to_clean &&
+ !is_enetc_rev1(si)) {
+ tx_ring->next_to_use = 0;
+ tx_ring->next_to_clean = 0;
+ enetc_txbdr_wr(hw, idx, ENETC_TBPIR, 0);
+ enetc_txbdr_wr(hw, idx, ENETC_TBCIR, 0);
+ }
+
/* enable Tx ints by setting pkt thr to 1 */
enetc_txbdr_wr(hw, idx, ENETC_TBICR0, ENETC_TBICR0_ICEN | 0x1);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v5 net 2/3] net: enetc: add graceful stop to safely reinitialize the TX Ring
2026-03-13 9:46 [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
2026-03-13 9:46 ` [PATCH v5 net 1/3] net: enetc: reset PIR and CIR if they are not equal when initializing TX ring Wei Fang
@ 2026-03-13 9:46 ` Wei Fang
2026-03-16 14:13 ` Claudiu Manoil
2026-03-13 9:46 ` [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC Wei Fang
2026-03-23 10:40 ` [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
3 siblings, 1 reply; 12+ messages in thread
From: Wei Fang @ 2026-03-13 9:46 UTC (permalink / raw)
To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
davem, edumazet, kuba, pabeni, linux, Frank.Li, horms,
saikrishnag
Cc: netdev, linux-kernel, imx
For ENETC v4, the PIR and CIR will be reset if they are not equal when
reinitializing the TX BD ring. However, resetting the PIR and CIR alone
is insufficient. When a link-down event occurs while the TX BD ring is
transmitting frames, subsequent reinitialization of the TX BD ring may
cause it to malfunction. For example, the below steps can reproduce the
problem.
1. Unplug the cable when the TX BD ring is busy transmitting frames.
2. Disable the network interface (ifconfig eth0 down).
3. Re-enable the network interface (ifconfig eth0 up).
4. Plug in the cable, the TX BD ring may fail to transmit packets.
When the link-down event occurs, enetc4_pl_mac_link_down() only clears
PMa_COMMAND_CONFIG[TX_EN] to disable MAC transmit data path. It doesn't
set PORT[TXDIS] to 1 to flush the TX BD ring. Therefore, reinitializing
the TX BD ring at this point is unsafe. To safely reinitialize the TX BD
ring after a link-down event, we checked with the NETC IP team, a proper
Ethernet MAC graceful stop is necessary. Therefore, add the Ethernet MAC
graceful stop to the link-down event handler enetc4_pl_mac_link_down().
Fixes: 99100d0d9922 ("net: enetc: add preliminary support for i.MX95 ENETC PF")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
.../net/ethernet/freescale/enetc/enetc4_hw.h | 11 ++
.../net/ethernet/freescale/enetc/enetc4_pf.c | 111 +++++++++++++++---
2 files changed, 108 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
index 3ed0f7a02767..719c88ceb801 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
@@ -134,6 +134,12 @@
/* Port operational register */
#define ENETC4_POR 0x4100
+#define POR_TXDIS BIT(0)
+#define POR_RXDIS BIT(1)
+
+/* Port status register */
+#define ENETC4_PSR 0x4104
+#define PSR_RX_BUSY BIT(1)
/* Port traffic class a transmit maximum SDU register */
#define ENETC4_PTCTMSDUR(a) ((a) * 0x20 + 0x4208)
@@ -173,6 +179,11 @@
/* Port internal MDIO base address, use to access PCS */
#define ENETC4_PM_IMDIO_BASE 0x5030
+/* Port MAC 0/1 Interrupt Event Register */
+#define ENETC4_PM_IEVENT(mac) (0x5040 + (mac) * 0x400)
+#define PM_IEVENT_TX_EMPTY BIT(5)
+#define PM_IEVENT_RX_EMPTY BIT(6)
+
/* Port MAC 0/1 Pause Quanta Register */
#define ENETC4_PM_PAUSE_QUANTA(mac) (0x5054 + (mac) * 0x400)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
index 689b9f13c5eb..53cecbb23a97 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
@@ -444,20 +444,11 @@ static void enetc4_set_trx_frame_size(struct enetc_pf *pf)
enetc4_pf_reset_tc_msdu(&si->hw);
}
-static void enetc4_enable_trx(struct enetc_pf *pf)
-{
- struct enetc_hw *hw = &pf->si->hw;
-
- /* Enable port transmit/receive */
- enetc_port_wr(hw, ENETC4_POR, 0);
-}
-
static void enetc4_configure_port(struct enetc_pf *pf)
{
enetc4_configure_port_si(pf);
enetc4_set_trx_frame_size(pf);
enetc_set_default_rss_key(pf);
- enetc4_enable_trx(pf);
}
static int enetc4_init_ntmp_user(struct enetc_si *si)
@@ -801,15 +792,105 @@ static void enetc4_set_tx_pause(struct enetc_pf *pf, int num_rxbdr, bool tx_paus
enetc_port_wr(hw, ENETC4_PPAUOFFTR, pause_off_thresh);
}
-static void enetc4_enable_mac(struct enetc_pf *pf, bool en)
+static void enetc4_mac_wait_tx_empty(struct enetc_si *si, int mac)
+{
+ u32 val;
+
+ if (read_poll_timeout(enetc_port_rd, val,
+ val & PM_IEVENT_TX_EMPTY,
+ 100, 10000, false, &si->hw,
+ ENETC4_PM_IEVENT(mac)))
+ dev_warn(&si->pdev->dev,
+ "MAC %d TX is not empty\n", mac);
+}
+
+static void enetc4_mac_tx_graceful_stop(struct enetc_pf *pf)
+{
+ struct enetc_hw *hw = &pf->si->hw;
+ struct enetc_si *si = pf->si;
+ u32 val;
+
+ val = enetc_port_rd(hw, ENETC4_POR);
+ val |= POR_TXDIS;
+ enetc_port_wr(hw, ENETC4_POR, val);
+
+ enetc4_mac_wait_tx_empty(si, 0);
+ if (si->hw_features & ENETC_SI_F_QBU)
+ enetc4_mac_wait_tx_empty(si, 1);
+
+ val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0));
+ val &= ~PM_CMD_CFG_TX_EN;
+ enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val);
+}
+
+static void enetc4_mac_tx_enable(struct enetc_pf *pf)
{
+ struct enetc_hw *hw = &pf->si->hw;
struct enetc_si *si = pf->si;
u32 val;
val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0));
- val &= ~(PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN);
- val |= en ? (PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN) : 0;
+ val |= PM_CMD_CFG_TX_EN;
+ enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val);
+
+ val = enetc_port_rd(hw, ENETC4_POR);
+ val &= ~POR_TXDIS;
+ enetc_port_wr(hw, ENETC4_POR, val);
+}
+
+static void enetc4_mac_wait_rx_empty(struct enetc_si *si, int mac)
+{
+ u32 val;
+
+ if (read_poll_timeout(enetc_port_rd, val,
+ val & PM_IEVENT_RX_EMPTY,
+ 100, 10000, false, &si->hw,
+ ENETC4_PM_IEVENT(mac)))
+ dev_warn(&si->pdev->dev,
+ "MAC %d RX is not empty\n", mac);
+}
+
+static void enetc4_mac_rx_graceful_stop(struct enetc_pf *pf)
+{
+ struct enetc_hw *hw = &pf->si->hw;
+ struct enetc_si *si = pf->si;
+ u32 val;
+
+ if (si->hw_features & ENETC_SI_F_QBU) {
+ val = enetc_port_rd(hw, ENETC4_PM_CMD_CFG(1));
+ val &= ~PM_CMD_CFG_RX_EN;
+ enetc_port_wr(hw, ENETC4_PM_CMD_CFG(1), val);
+ enetc4_mac_wait_rx_empty(si, 1);
+ }
+
+ val = enetc_port_rd(hw, ENETC4_PM_CMD_CFG(0));
+ val &= ~PM_CMD_CFG_RX_EN;
+ enetc_port_wr(hw, ENETC4_PM_CMD_CFG(0), val);
+ enetc4_mac_wait_rx_empty(si, 0);
+
+ if (read_poll_timeout(enetc_port_rd, val,
+ !(val & PSR_RX_BUSY),
+ 100, 10000, false, hw,
+ ENETC4_PSR))
+ dev_warn(&si->pdev->dev, "Port RX busy\n");
+
+ val = enetc_port_rd(hw, ENETC4_POR);
+ val |= POR_RXDIS;
+ enetc_port_wr(hw, ENETC4_POR, val);
+}
+
+static void enetc4_mac_rx_enable(struct enetc_pf *pf)
+{
+ struct enetc_hw *hw = &pf->si->hw;
+ struct enetc_si *si = pf->si;
+ u32 val;
+
+ val = enetc_port_rd(hw, ENETC4_POR);
+ val &= ~POR_RXDIS;
+ enetc_port_wr(hw, ENETC4_POR, val);
+ val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0));
+ val |= PM_CMD_CFG_RX_EN;
enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val);
}
@@ -853,7 +934,8 @@ static void enetc4_pl_mac_link_up(struct phylink_config *config,
enetc4_set_hd_flow_control(pf, hd_fc);
enetc4_set_tx_pause(pf, priv->num_rx_rings, tx_pause);
enetc4_set_rx_pause(pf, rx_pause);
- enetc4_enable_mac(pf, true);
+ enetc4_mac_tx_enable(pf);
+ enetc4_mac_rx_enable(pf);
}
static void enetc4_pl_mac_link_down(struct phylink_config *config,
@@ -862,7 +944,8 @@ static void enetc4_pl_mac_link_down(struct phylink_config *config,
{
struct enetc_pf *pf = phylink_to_enetc_pf(config);
- enetc4_enable_mac(pf, false);
+ enetc4_mac_rx_graceful_stop(pf);
+ enetc4_mac_tx_graceful_stop(pf);
}
static const struct phylink_mac_ops enetc_pl_mac_ops = {
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC
2026-03-13 9:46 [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
2026-03-13 9:46 ` [PATCH v5 net 1/3] net: enetc: reset PIR and CIR if they are not equal when initializing TX ring Wei Fang
2026-03-13 9:46 ` [PATCH v5 net 2/3] net: enetc: add graceful stop to safely reinitialize the TX Ring Wei Fang
@ 2026-03-13 9:46 ` Wei Fang
2026-03-16 14:13 ` Claudiu Manoil
2026-03-23 10:40 ` [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
3 siblings, 1 reply; 12+ messages in thread
From: Wei Fang @ 2026-03-13 9:46 UTC (permalink / raw)
To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
davem, edumazet, kuba, pabeni, linux, Frank.Li, horms,
saikrishnag
Cc: netdev, linux-kernel, imx
The ENETC4_PM_IEVENT and ENETC4_PM_CMD_CFG registers do not exist on the
ENETC pseudo MAC, so the driver should prevent from accessing them.
Fixes: 5175c1e4adca ("net: enetc: add basic support for the ENETC with pseudo MAC for i.MX94")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
Note that the commit 5175c1e4adca ("net: enetc: add basic support for
the ENETC with pseudo MAC for i.MX94") does not have such issue, this
patch depends on the patch 2 in this patch set.
---
drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
index 53cecbb23a97..56899f2254aa 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
@@ -814,6 +814,9 @@ static void enetc4_mac_tx_graceful_stop(struct enetc_pf *pf)
val |= POR_TXDIS;
enetc_port_wr(hw, ENETC4_POR, val);
+ if (enetc_is_pseudo_mac(si))
+ return;
+
enetc4_mac_wait_tx_empty(si, 0);
if (si->hw_features & ENETC_SI_F_QBU)
enetc4_mac_wait_tx_empty(si, 1);
@@ -856,6 +859,9 @@ static void enetc4_mac_rx_graceful_stop(struct enetc_pf *pf)
struct enetc_si *si = pf->si;
u32 val;
+ if (enetc_is_pseudo_mac(si))
+ goto check_rx_busy;
+
if (si->hw_features & ENETC_SI_F_QBU) {
val = enetc_port_rd(hw, ENETC4_PM_CMD_CFG(1));
val &= ~PM_CMD_CFG_RX_EN;
@@ -868,6 +874,7 @@ static void enetc4_mac_rx_graceful_stop(struct enetc_pf *pf)
enetc_port_wr(hw, ENETC4_PM_CMD_CFG(0), val);
enetc4_mac_wait_rx_empty(si, 0);
+check_rx_busy:
if (read_poll_timeout(enetc_port_rd, val,
!(val & PSR_RX_BUSY),
100, 10000, false, hw,
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* RE: [PATCH v5 net 1/3] net: enetc: reset PIR and CIR if they are not equal when initializing TX ring
2026-03-13 9:46 ` [PATCH v5 net 1/3] net: enetc: reset PIR and CIR if they are not equal when initializing TX ring Wei Fang
@ 2026-03-16 14:12 ` Claudiu Manoil
0 siblings, 0 replies; 12+ messages in thread
From: Claudiu Manoil @ 2026-03-16 14:12 UTC (permalink / raw)
To: Wei Fang, Vladimir Oltean, Clark Wang, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux@armlinux.org.uk, Frank Li,
horms@kernel.org, saikrishnag@marvell.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
> -----Original Message-----
> From: Wei Fang <wei.fang@nxp.com>
> Sent: Friday, March 13, 2026 11:47 AM
[...]
> Subject: [PATCH v5 net 1/3] net: enetc: reset PIR and CIR if they are not equal
> when initializing TX ring
>
> Currently the driver does not reset the producer index register (PIR) and
> consumer index register (CIR) when initializing a TX BD ring. The driver
> only reads the PIR and CIR and initializes the software indexes. If the
> TX BD ring is reinitialized when it still contains unsent frames, its PIR
> and CIR will not be equal after the reinitialization. However, the BDs
> between CIR and PIR have been freed and become invalid and this can lead
> to a hardware malfunction, causing the TX BD ring will not work properly.
>
> For ENETC v4, it supports software to set the PIR and CIR, so the driver
> can reset these two registers if they are not equal when reinitializing
> the TX BD ring. Therefore, add this solution for ENETC v4. Note that this
> patch does not work for ENETC v1 because it does not support software to
> set the PIR and CIR.
>
> Fixes: 99100d0d9922 ("net: enetc: add preliminary support for i.MX95 ENETC
> PF")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC
2026-03-13 9:46 ` [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC Wei Fang
@ 2026-03-16 14:13 ` Claudiu Manoil
2026-03-17 2:15 ` Wei Fang
0 siblings, 1 reply; 12+ messages in thread
From: Claudiu Manoil @ 2026-03-16 14:13 UTC (permalink / raw)
To: Wei Fang, Vladimir Oltean, Clark Wang, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux@armlinux.org.uk, Frank Li,
horms@kernel.org, saikrishnag@marvell.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
> -----Original Message-----
> From: Wei Fang <wei.fang@nxp.com>
> Sent: Friday, March 13, 2026 11:47 AM
[...]
> Subject: [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on
> pseudo MAC
>
> The ENETC4_PM_IEVENT and ENETC4_PM_CMD_CFG registers do not exist on
> the
> ENETC pseudo MAC, so the driver should prevent from accessing them.
>
> Fixes: 5175c1e4adca ("net: enetc: add basic support for the ENETC with pseudo
> MAC for i.MX94")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> Note that the commit 5175c1e4adca ("net: enetc: add basic support for
> the ENETC with pseudo MAC for i.MX94") does not have such issue, this
> patch depends on the patch 2 in this patch set.
> ---
> drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> index 53cecbb23a97..56899f2254aa 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> @@ -814,6 +814,9 @@ static void enetc4_mac_tx_graceful_stop(struct enetc_pf
> *pf)
> val |= POR_TXDIS;
> enetc_port_wr(hw, ENETC4_POR, val);
>
> + if (enetc_is_pseudo_mac(si))
> + return;
> +
Shouldn't the ~PM_CMD_CFG_TX_EN step apply to pseudo-MACs too?
> enetc4_mac_wait_tx_empty(si, 0);
> if (si->hw_features & ENETC_SI_F_QBU)
> enetc4_mac_wait_tx_empty(si, 1);
> @@ -856,6 +859,9 @@ static void enetc4_mac_rx_graceful_stop(struct enetc_pf
> *pf)
> struct enetc_si *si = pf->si;
> u32 val;
>
> + if (enetc_is_pseudo_mac(si))
> + goto check_rx_busy;
> +
Shouldn't the ~PM_CMD_CFG_RX_EN step apply to pseudo-MACs too?
> if (si->hw_features & ENETC_SI_F_QBU) {
> val = enetc_port_rd(hw, ENETC4_PM_CMD_CFG(1));
> val &= ~PM_CMD_CFG_RX_EN;
> @@ -868,6 +874,7 @@ static void enetc4_mac_rx_graceful_stop(struct enetc_pf
> *pf)
> enetc_port_wr(hw, ENETC4_PM_CMD_CFG(0), val);
> enetc4_mac_wait_rx_empty(si, 0);
>
> +check_rx_busy:
> if (read_poll_timeout(enetc_port_rd, val,
> !(val & PSR_RX_BUSY),
> 100, 10000, false, hw,
> --
> 2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v5 net 2/3] net: enetc: add graceful stop to safely reinitialize the TX Ring
2026-03-13 9:46 ` [PATCH v5 net 2/3] net: enetc: add graceful stop to safely reinitialize the TX Ring Wei Fang
@ 2026-03-16 14:13 ` Claudiu Manoil
0 siblings, 0 replies; 12+ messages in thread
From: Claudiu Manoil @ 2026-03-16 14:13 UTC (permalink / raw)
To: Wei Fang, Vladimir Oltean, Clark Wang, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux@armlinux.org.uk, Frank Li,
horms@kernel.org, saikrishnag@marvell.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
> -----Original Message-----
> From: Wei Fang <wei.fang@nxp.com>
> Sent: Friday, March 13, 2026 11:47 AM
[...]
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; imx@lists.linux.dev
> Subject: [PATCH v5 net 2/3] net: enetc: add graceful stop to safely reinitialize
> the TX Ring
>
> For ENETC v4, the PIR and CIR will be reset if they are not equal when
> reinitializing the TX BD ring. However, resetting the PIR and CIR alone
> is insufficient. When a link-down event occurs while the TX BD ring is
> transmitting frames, subsequent reinitialization of the TX BD ring may
> cause it to malfunction. For example, the below steps can reproduce the
> problem.
>
> 1. Unplug the cable when the TX BD ring is busy transmitting frames.
> 2. Disable the network interface (ifconfig eth0 down).
> 3. Re-enable the network interface (ifconfig eth0 up).
> 4. Plug in the cable, the TX BD ring may fail to transmit packets.
>
> When the link-down event occurs, enetc4_pl_mac_link_down() only clears
> PMa_COMMAND_CONFIG[TX_EN] to disable MAC transmit data path. It
> doesn't
> set PORT[TXDIS] to 1 to flush the TX BD ring. Therefore, reinitializing
> the TX BD ring at this point is unsafe. To safely reinitialize the TX BD
> ring after a link-down event, we checked with the NETC IP team, a proper
> Ethernet MAC graceful stop is necessary. Therefore, add the Ethernet MAC
> graceful stop to the link-down event handler enetc4_pl_mac_link_down().
>
> Fixes: 99100d0d9922 ("net: enetc: add preliminary support for i.MX95 ENETC
> PF")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> .../net/ethernet/freescale/enetc/enetc4_hw.h | 11 ++
> .../net/ethernet/freescale/enetc/enetc4_pf.c | 111 +++++++++++++++---
> 2 files changed, 108 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
> b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
> index 3ed0f7a02767..719c88ceb801 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h
> @@ -134,6 +134,12 @@
>
> /* Port operational register */
> #define ENETC4_POR 0x4100
> +#define POR_TXDIS BIT(0)
> +#define POR_RXDIS BIT(1)
> +
> +/* Port status register */
> +#define ENETC4_PSR 0x4104
> +#define PSR_RX_BUSY BIT(1)
>
> /* Port traffic class a transmit maximum SDU register */
> #define ENETC4_PTCTMSDUR(a) ((a) * 0x20 + 0x4208)
> @@ -173,6 +179,11 @@
> /* Port internal MDIO base address, use to access PCS */
> #define ENETC4_PM_IMDIO_BASE 0x5030
>
> +/* Port MAC 0/1 Interrupt Event Register */
> +#define ENETC4_PM_IEVENT(mac) (0x5040 + (mac) * 0x400)
> +#define PM_IEVENT_TX_EMPTY BIT(5)
> +#define PM_IEVENT_RX_EMPTY BIT(6)
> +
> /* Port MAC 0/1 Pause Quanta Register */
> #define ENETC4_PM_PAUSE_QUANTA(mac) (0x5054 + (mac) * 0x400)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> index 689b9f13c5eb..53cecbb23a97 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> @@ -444,20 +444,11 @@ static void enetc4_set_trx_frame_size(struct
> enetc_pf *pf)
> enetc4_pf_reset_tc_msdu(&si->hw);
> }
>
> -static void enetc4_enable_trx(struct enetc_pf *pf)
> -{
> - struct enetc_hw *hw = &pf->si->hw;
> -
> - /* Enable port transmit/receive */
> - enetc_port_wr(hw, ENETC4_POR, 0);
> -}
> -
> static void enetc4_configure_port(struct enetc_pf *pf)
> {
> enetc4_configure_port_si(pf);
> enetc4_set_trx_frame_size(pf);
> enetc_set_default_rss_key(pf);
> - enetc4_enable_trx(pf);
> }
>
> static int enetc4_init_ntmp_user(struct enetc_si *si)
> @@ -801,15 +792,105 @@ static void enetc4_set_tx_pause(struct enetc_pf
> *pf, int num_rxbdr, bool tx_paus
> enetc_port_wr(hw, ENETC4_PPAUOFFTR, pause_off_thresh);
> }
>
> -static void enetc4_enable_mac(struct enetc_pf *pf, bool en)
> +static void enetc4_mac_wait_tx_empty(struct enetc_si *si, int mac)
> +{
> + u32 val;
> +
> + if (read_poll_timeout(enetc_port_rd, val,
> + val & PM_IEVENT_TX_EMPTY,
> + 100, 10000, false, &si->hw,
> + ENETC4_PM_IEVENT(mac)))
> + dev_warn(&si->pdev->dev,
> + "MAC %d TX is not empty\n", mac);
> +}
> +
> +static void enetc4_mac_tx_graceful_stop(struct enetc_pf *pf)
> +{
> + struct enetc_hw *hw = &pf->si->hw;
> + struct enetc_si *si = pf->si;
> + u32 val;
> +
> + val = enetc_port_rd(hw, ENETC4_POR);
> + val |= POR_TXDIS;
> + enetc_port_wr(hw, ENETC4_POR, val);
> +
> + enetc4_mac_wait_tx_empty(si, 0);
> + if (si->hw_features & ENETC_SI_F_QBU)
> + enetc4_mac_wait_tx_empty(si, 1);
> +
> + val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0));
> + val &= ~PM_CMD_CFG_TX_EN;
> + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val);
> +}
> +
> +static void enetc4_mac_tx_enable(struct enetc_pf *pf)
> {
> + struct enetc_hw *hw = &pf->si->hw;
> struct enetc_si *si = pf->si;
> u32 val;
>
> val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0));
> - val &= ~(PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN);
> - val |= en ? (PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN) : 0;
> + val |= PM_CMD_CFG_TX_EN;
> + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val);
> +
> + val = enetc_port_rd(hw, ENETC4_POR);
> + val &= ~POR_TXDIS;
> + enetc_port_wr(hw, ENETC4_POR, val);
Nice, taking care that the MAC->Port enabling order on Tx is opposite to the order
on Rx (Port->MAC).
> +}
> +
> +static void enetc4_mac_wait_rx_empty(struct enetc_si *si, int mac)
> +{
> + u32 val;
> +
> + if (read_poll_timeout(enetc_port_rd, val,
> + val & PM_IEVENT_RX_EMPTY,
> + 100, 10000, false, &si->hw,
> + ENETC4_PM_IEVENT(mac)))
> + dev_warn(&si->pdev->dev,
> + "MAC %d RX is not empty\n", mac);
> +}
> +
> +static void enetc4_mac_rx_graceful_stop(struct enetc_pf *pf)
> +{
> + struct enetc_hw *hw = &pf->si->hw;
> + struct enetc_si *si = pf->si;
> + u32 val;
> +
> + if (si->hw_features & ENETC_SI_F_QBU) {
> + val = enetc_port_rd(hw, ENETC4_PM_CMD_CFG(1));
> + val &= ~PM_CMD_CFG_RX_EN;
> + enetc_port_wr(hw, ENETC4_PM_CMD_CFG(1), val);
> + enetc4_mac_wait_rx_empty(si, 1);
> + }
> +
> + val = enetc_port_rd(hw, ENETC4_PM_CMD_CFG(0));
> + val &= ~PM_CMD_CFG_RX_EN;
> + enetc_port_wr(hw, ENETC4_PM_CMD_CFG(0), val);
> + enetc4_mac_wait_rx_empty(si, 0);
> +
> + if (read_poll_timeout(enetc_port_rd, val,
> + !(val & PSR_RX_BUSY),
> + 100, 10000, false, hw,
> + ENETC4_PSR))
> + dev_warn(&si->pdev->dev, "Port RX busy\n");
> +
> + val = enetc_port_rd(hw, ENETC4_POR);
> + val |= POR_RXDIS;
> + enetc_port_wr(hw, ENETC4_POR, val);
> +}
> +
> +static void enetc4_mac_rx_enable(struct enetc_pf *pf)
> +{
> + struct enetc_hw *hw = &pf->si->hw;
> + struct enetc_si *si = pf->si;
> + u32 val;
> +
> + val = enetc_port_rd(hw, ENETC4_POR);
> + val &= ~POR_RXDIS;
> + enetc_port_wr(hw, ENETC4_POR, val);
>
> + val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0));
> + val |= PM_CMD_CFG_RX_EN;
> enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val);
> }
>
> @@ -853,7 +934,8 @@ static void enetc4_pl_mac_link_up(struct
> phylink_config *config,
> enetc4_set_hd_flow_control(pf, hd_fc);
> enetc4_set_tx_pause(pf, priv->num_rx_rings, tx_pause);
> enetc4_set_rx_pause(pf, rx_pause);
> - enetc4_enable_mac(pf, true);
> + enetc4_mac_tx_enable(pf);
> + enetc4_mac_rx_enable(pf);
> }
>
Nothing for me to object on so far in this patch.
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC
2026-03-16 14:13 ` Claudiu Manoil
@ 2026-03-17 2:15 ` Wei Fang
2026-03-17 10:32 ` Claudiu Manoil
0 siblings, 1 reply; 12+ messages in thread
From: Wei Fang @ 2026-03-17 2:15 UTC (permalink / raw)
To: Claudiu Manoil, Vladimir Oltean, Clark Wang,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk,
Frank Li, horms@kernel.org, saikrishnag@marvell.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
> > -----Original Message-----
> > From: Wei Fang <wei.fang@nxp.com>
> > Sent: Friday, March 13, 2026 11:47 AM
> [...]
> > Subject: [PATCH v5 net 3/3] net: enetc: do not access non-existent
> > registers on pseudo MAC
> >
> > The ENETC4_PM_IEVENT and ENETC4_PM_CMD_CFG registers do not exist
> on
> > the ENETC pseudo MAC, so the driver should prevent from accessing
> > them.
> >
> > Fixes: 5175c1e4adca ("net: enetc: add basic support for the ENETC with
> > pseudo MAC for i.MX94")
> > Signed-off-by: Wei Fang <wei.fang@nxp.com>
> > ---
> > Note that the commit 5175c1e4adca ("net: enetc: add basic support for
> > the ENETC with pseudo MAC for i.MX94") does not have such issue, this
> > patch depends on the patch 2 in this patch set.
> > ---
> > drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> > b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> > index 53cecbb23a97..56899f2254aa 100644
> > --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> > +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> > @@ -814,6 +814,9 @@ static void enetc4_mac_tx_graceful_stop(struct
> > enetc_pf
> > *pf)
> > val |= POR_TXDIS;
> > enetc_port_wr(hw, ENETC4_POR, val);
> >
> > + if (enetc_is_pseudo_mac(si))
> > + return;
> > +
>
> Shouldn't the ~PM_CMD_CFG_TX_EN step apply to pseudo-MACs too?
Based on the NETC block guide, the pseudo MAC does not have
PMa_COMMAND_CONFIG register. So no need to set PM_CMD_CFG_TX_EN
and PM_CMD_CFG_RX_EN bits for pseudo MAC.
>
> > enetc4_mac_wait_tx_empty(si, 0);
> > if (si->hw_features & ENETC_SI_F_QBU)
> > enetc4_mac_wait_tx_empty(si, 1);
> > @@ -856,6 +859,9 @@ static void enetc4_mac_rx_graceful_stop(struct
> > enetc_pf
> > *pf)
> > struct enetc_si *si = pf->si;
> > u32 val;
> >
> > + if (enetc_is_pseudo_mac(si))
> > + goto check_rx_busy;
> > +
>
> Shouldn't the ~PM_CMD_CFG_RX_EN step apply to pseudo-MACs too?
>
> > if (si->hw_features & ENETC_SI_F_QBU) {
> > val = enetc_port_rd(hw, ENETC4_PM_CMD_CFG(1));
> > val &= ~PM_CMD_CFG_RX_EN;
> > @@ -868,6 +874,7 @@ static void enetc4_mac_rx_graceful_stop(struct
> > enetc_pf
> > *pf)
> > enetc_port_wr(hw, ENETC4_PM_CMD_CFG(0), val);
> > enetc4_mac_wait_rx_empty(si, 0);
> >
> > +check_rx_busy:
> > if (read_poll_timeout(enetc_port_rd, val,
> > !(val & PSR_RX_BUSY),
> > 100, 10000, false, hw,
> > --
> > 2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC
2026-03-17 2:15 ` Wei Fang
@ 2026-03-17 10:32 ` Claudiu Manoil
0 siblings, 0 replies; 12+ messages in thread
From: Claudiu Manoil @ 2026-03-17 10:32 UTC (permalink / raw)
To: Wei Fang, Vladimir Oltean, Clark Wang, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux@armlinux.org.uk, Frank Li,
horms@kernel.org, saikrishnag@marvell.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
> -----Original Message-----
> From: Wei Fang <wei.fang@nxp.com>
> Sent: Tuesday, March 17, 2026 4:15 AM
[...]
> Subject: RE: [PATCH v5 net 3/3] net: enetc: do not access non-existent
> registers on pseudo MAC
>
> > > -----Original Message-----
> > > From: Wei Fang <wei.fang@nxp.com>
> > > Sent: Friday, March 13, 2026 11:47 AM
> > [...]
> > > Subject: [PATCH v5 net 3/3] net: enetc: do not access non-existent
> > > registers on pseudo MAC
> > >
> > > The ENETC4_PM_IEVENT and ENETC4_PM_CMD_CFG registers do not exist
> > on
> > > the ENETC pseudo MAC, so the driver should prevent from accessing
> > > them.
> > >
> > > Fixes: 5175c1e4adca ("net: enetc: add basic support for the ENETC with
> > > pseudo MAC for i.MX94")
> > > Signed-off-by: Wei Fang <wei.fang@nxp.com>
> > > ---
> > > Note that the commit 5175c1e4adca ("net: enetc: add basic support for
> > > the ENETC with pseudo MAC for i.MX94") does not have such issue, this
> > > patch depends on the patch 2 in this patch set.
> > > ---
> > > drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 7 +++++++
> > > 1 file changed, 7 insertions(+)
> > >
> > > diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> > > b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> > > index 53cecbb23a97..56899f2254aa 100644
> > > --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> > > +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> > > @@ -814,6 +814,9 @@ static void enetc4_mac_tx_graceful_stop(struct
> > > enetc_pf
> > > *pf)
> > > val |= POR_TXDIS;
> > > enetc_port_wr(hw, ENETC4_POR, val);
> > >
> > > + if (enetc_is_pseudo_mac(si))
> > > + return;
> > > +
> >
> > Shouldn't the ~PM_CMD_CFG_TX_EN step apply to pseudo-MACs too?
>
> Based on the NETC block guide, the pseudo MAC does not have
> PMa_COMMAND_CONFIG register. So no need to set PM_CMD_CFG_TX_EN
> and PM_CMD_CFG_RX_EN bits for pseudo MAC.
>
Right, sorry, I misread the manual. After all, excluding these registers is partly
the point of this last patch, as discussed.
Meanwhile, I was also able to test your patches on my setup with pseudo-MACs
only and it passed.
"
[ 159.469353] nxp_enetc4 0000:00:00.0 enp0s0f0: configuring for fixed/internal link mode
[ 159.469605] nxp_enetc4 0000:00:00.0 enp0s0f0: Link is Up - 2.5Gbps/Full - flow control off
"
so,
Tested-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames
2026-03-13 9:46 [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
` (2 preceding siblings ...)
2026-03-13 9:46 ` [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC Wei Fang
@ 2026-03-23 10:40 ` Wei Fang
2026-03-23 21:37 ` Jakub Kicinski
3 siblings, 1 reply; 12+ messages in thread
From: Wei Fang @ 2026-03-23 10:40 UTC (permalink / raw)
To: kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, linux@armlinux.org.uk, Frank Li,
horms@kernel.org, saikrishnag@marvell.com, Claudiu Manoil,
Vladimir Oltean, Clark Wang, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com
> Currently the driver does not reset the producer index register (PIR) and
> consumer index register (CIR) when initializing a TX BD ring. The driver
> only reads the PIR and CIR and initializes the software indexes. If the
> TX BD ring is reinitialized when it still contains unsent frames, its PIR
> and CIR will not be equal after the reinitialization. However, the BDs
> between CIR and PIR have been freed and become invalid and this can lead
> to a hardware malfunction, causing the TX BD ring will not work properly.
>
> Since the PIR and CIR are sofeware-configurable on ENETC v4. Therefore,
> the driver must reset them if they are not equal when reinitializing
> the TX BD ring.
>
> However, resetting the PIR and CIR alone is insufficient, it cannot
> completely solve the problem. When a link-down event occurs while the TX
> BD ring is transmitting frames, subsequent reinitialization of the TX BD
> ring may cause it to malfunction. Because enetc4_pl_mac_link_down() only
> clears PMa_COMMAND_CONFIG[TX_EN] to disable MAC transmit data path. It
> doesn't set PORT[TXDIS] to 1 to flush the TX BD ring. Therefore, it is
> not safe to reinitialize the TX BD ring at this point.
>
> To safely reinitialize the TX BD ring after a link-down event, we checked
> with the NETC IP team, a proper Ethernet MAC graceful stop is necessary.
> Therefore, add the Ethernet MAC graceful stop to the link-down event
> handler enetc4_pl_mac_link_down(). Note that this patch set is not
> applicable to ENETC v1 (LS1028A).
>
> ---
> v5:
> 1. Add patch 3
> 2. Correct the typo in commit message of patch 1
> v4 link:
> https://lore.kernel.org/imx/20260312095415.669128-1-wei.fang@nxp.com/
Hi Jakub, Paolo,
Can this series be applied? Or is further improvement needed?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames
2026-03-23 10:40 ` [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
@ 2026-03-23 21:37 ` Jakub Kicinski
2026-03-24 1:55 ` Wei Fang
0 siblings, 1 reply; 12+ messages in thread
From: Jakub Kicinski @ 2026-03-23 21:37 UTC (permalink / raw)
To: Wei Fang
Cc: pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux@armlinux.org.uk, Frank Li, horms@kernel.org,
saikrishnag@marvell.com, Claudiu Manoil, Vladimir Oltean,
Clark Wang, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com
On Mon, 23 Mar 2026 10:40:03 +0000 Wei Fang wrote:
> Can this series be applied? Or is further improvement needed?
It's too old now, please repost and reflect the discussion in
the commit messages.
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames
2026-03-23 21:37 ` Jakub Kicinski
@ 2026-03-24 1:55 ` Wei Fang
0 siblings, 0 replies; 12+ messages in thread
From: Wei Fang @ 2026-03-24 1:55 UTC (permalink / raw)
To: Jakub Kicinski
Cc: pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux@armlinux.org.uk, Frank Li, horms@kernel.org,
saikrishnag@marvell.com, Claudiu Manoil, Vladimir Oltean,
Clark Wang, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com
> Cc: pabeni@redhat.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> imx@lists.linux.dev; linux@armlinux.org.uk; Frank Li <frank.li@nxp.com>;
> horms@kernel.org; saikrishnag@marvell.com; Claudiu Manoil
> <claudiu.manoil@nxp.com>; Vladimir Oltean <vladimir.oltean@nxp.com>; Clark
> Wang <xiaoning.wang@nxp.com>; andrew+netdev@lunn.ch;
> davem@davemloft.net; edumazet@google.com
> Subject: Re: [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it
> has unsent frames
>
> On Mon, 23 Mar 2026 10:40:03 +0000 Wei Fang wrote:
> > Can this series be applied? Or is further improvement needed?
>
> It's too old now, please repost and reflect the discussion in
> the commit messages.
Okay, I will resend this patch set.
Regarding the discussion in patch 3, I have actually already explained it in
the commit message, Claudiu misread the manual. So no need to update
the commit message.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-03-24 1:55 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13 9:46 [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
2026-03-13 9:46 ` [PATCH v5 net 1/3] net: enetc: reset PIR and CIR if they are not equal when initializing TX ring Wei Fang
2026-03-16 14:12 ` Claudiu Manoil
2026-03-13 9:46 ` [PATCH v5 net 2/3] net: enetc: add graceful stop to safely reinitialize the TX Ring Wei Fang
2026-03-16 14:13 ` Claudiu Manoil
2026-03-13 9:46 ` [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC Wei Fang
2026-03-16 14:13 ` Claudiu Manoil
2026-03-17 2:15 ` Wei Fang
2026-03-17 10:32 ` Claudiu Manoil
2026-03-23 10:40 ` [PATCH v5 net 0/3] net: enetc: safely reinitialize TX BD ring when it has unsent frames Wei Fang
2026-03-23 21:37 ` Jakub Kicinski
2026-03-24 1:55 ` Wei Fang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox