Skip to contentSkip to conversation

net: mvneta: re-enable percpu interrupt on resume

PATCH In review Arbab Haider 3 participants 9 messages Aug 5 – Aug 6 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 net: mvneta: re-enable percpu interrupt on resume

From: Yun Zhou <[email protected]>

On Marvell MPIC platforms (Armada 370/XP/38x), mvneta uses a percpu IRQ disable/enable scheme for NAPI: the ISR (mvneta_percpu_isr) calls disable_percpu_irq() to mask the MPIC per-CPU interrupt and schedules NAPI poll, which calls enable_percpu_irq() on completion to unmask.

If suspend occurs while NAPI poll is pending (between disable_percpu_irq in the ISR and enable_percpu_irq in poll completion), the interrupt is never re-enabled:

1. mvneta_percpu_isr: disable_percpu_irq() + napi_schedule() => MPIC masked, percpu_enabled cpumask bit cleared
2. NAPI poll does not complete before suspend proceeds (on PREEMPT_RT this is highly likely since softirqs run in ksoftirqd which gets frozen; on non-RT it can happen when softirq processing is deferred to ksoftirqd)
3. mvneta_stop_dev => napi_disable(): cancels the pending poll without executing the completion path
4. suspend_device_irqs => IRQCHIP_MASK_ON_SUSPEND: masks MPIC (already masked, but records IRQS_SUSPENDED)
5. Resume: mpic_resume checks irq_percpu_is_enabled() => false (bit was cleared in step 1) => skips unmask
6. mvneta_start_dev only restores device-level INTR_NEW_MASK, does not touch the MPIC per-CPU mask

Result: MPIC per-CPU interrupt stays masked permanently. The NIC generates interrupts (INTR_NEW_CAUSE != 0) but the CPU never receives them, causing complete loss of network connectivity.

Fix by calling on_each_cpu(mvneta_percpu_enable) in the resume path to unconditionally unmask the MPIC per-CPU interrupt regardless of pre-suspend state.

Fixes 12bb03b436da ("net: mvneta: Handle per-cpu interrupts")
[ Upstream commit fd398d6480987e4c84fff0aaab6b9d6642a93343 ]
---
 drivers/net/ethernet/marvell/mvneta.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvneta.c +3 -0
index 9ba4aef7080c..22da95d46bef 100644
@@ -5897,6 +5897,9 @@ static int mvneta_resume(struct device *device)
 	rtnl_unlock();
 	mvneta_set_rx_mode(dev);
 
+	if (!pp->neta_armada3700)
+		on_each_cpu(mvneta_percpu_enable, pp, true);
+
 	return 0;
 }
 #endif
Signature · 1 line
2.53.0
#1 lore raw

PATCH 2/5 net: mvneta: support EPROBE_DEFER when reading MAC address

From: Rosen Penev <[email protected]>

If nvmem loads after the ethernet driver, mac address assignments will not take effect. of_get_ethdev_address returns EPROBE_DEFER in such a case so we need to handle that to avoid eth_hw_addr_random.

Add extra goto section to just free stats as they are allocated right above.

[ Upstream commit 73a864352570fd30d942652f05bfe9340d7a2055 ]
---
 drivers/net/ethernet/marvell/mvneta.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvneta.c +3 -0
index 22da95d46bef..744d6585a949 100644
@@ -5620,6 +5620,8 @@ static int mvneta_probe(struct platform_device *pdev)
 	}
 
 	err = of_get_ethdev_address(dn, dev);
+	if (err == -EPROBE_DEFER)
+		goto err_free_stats;
 	if (!err) {
 		mac_from = "device tree";
 	} else {
@@ -5755,6 +5757,7 @@ static int mvneta_probe(struct platform_device *pdev)
 				       1 << pp->id);
 		mvneta_bm_put(pp->bm_priv);
 	}
+err_free_stats:
 	free_percpu(pp->stats);
 err_free_ports:
 	free_percpu(pp->ports);
Signature · 1 line
2.53.0
#2 lore raw

PATCH 3/5 net: macb: drop in-flight Tx SKBs on close

In reply to Arbab Haider

From: Théo Lebrun <[email protected]>

The MACB driver has since forever leaked the outgoing SKBs that have not yet been marked as completed. They live in queue->tx_skb which gets freed without remorse nor checking.

macb_free_consistent() gets called in a few codepaths, but only close will trigger the added expressions. In macb_open() and macb_alloc_consistent() failure cases, queues' tx_skb just got allocated and are empty.

Fixes 89e5785fc8a6 ("[PATCH] Atmel MACB ethernet driver")
[ Upstream commit 27f575836cfebbf872dec020428742b10650a955 ]
---
 drivers/net/ethernet/cadence/macb_main.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +19 -2
index 99e7d5cf3786..68dae92205e0 100644
@@ -2551,8 +2551,25 @@ static void macb_free_consistent(struct macb *bp)
 	dma_free_coherent(dev, size, bp->queues[0].rx_ring, bp->queues[0].rx_ring_dma);
 
 	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
-		kfree(queue->tx_skb);
-		queue->tx_skb = NULL;
+		if (queue->tx_skb) {
+			unsigned int dropped = 0, tail;
+
+			for (tail = queue->tx_tail; tail != queue->tx_head;
+			     tail++) {
+				if (macb_tx_skb(queue, tail)->skb)
+					dropped++;
+				macb_tx_unmap(bp, macb_tx_skb(queue, tail), 0);
+			}
+
+			queue->stats.tx_dropped += dropped;
+			bp->dev->stats.tx_dropped += dropped;
+
+			kfree(queue->tx_skb);
+			queue->tx_skb = NULL;
+		}
+
+		queue->tx_head = 0;
+		queue->tx_tail = 0;
 		queue->tx_ring = NULL;
 		queue->rx_ring = NULL;
 	}
Signature · 1 line
2.53.0
#3 lore raw

PATCH 4/5 net: cpsw_new: unregister devlink on port registration failure

In reply to Arbab Haider

From: Guangshuo Li <[email protected]>

cpsw_probe() registers devlink before registering the CPSW ports.

If cpsw_register_ports() fails, the error path only unregisters the notifiers and then releases the lower level resources. It does not undo the successful cpsw_register_devlink() call, leaving the devlink instance and its parameters registered after probe has failed.

Add a devlink cleanup label for the path where devlink registration has already succeeded, and use it when port registration fails.

---
 drivers/net/ethernet/ti/cpsw_new.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw_new.c +3 -1
index c5be359f3c66..b6e25a4658d1 100644
@@ -2050,7 +2050,7 @@ static int cpsw_probe(struct platform_device *pdev)
 
 	ret = cpsw_register_ports(cpsw);
 	if (ret)
-		goto clean_unregister_notifiers;
+		goto clean_unregister_devlink;
 
 	dev_notice(dev, "initialized (regs %pa, pool size %d) hw_ver:%08X %d.%d (%d)\n",
 		   &ss_res->start, descs_pool_size,
@@ -2062,6 +2062,8 @@ static int cpsw_probe(struct platform_device *pdev)
 
 	return 0;
 
+clean_unregister_devlink:
+	cpsw_unregister_devlink(cpsw);
 clean_unregister_notifiers:
 	cpsw_unregister_notifiers(cpsw);
 clean_cpts:
Signature · 1 line
2.53.0
#4 lore raw

PATCH 5/5 net: stmmac: fix transmit interrupt coalescing

In reply to Arbab Haider

From: "Russell King (Oracle)" <[email protected]>

The accounting for transmit frames does not count the descriptors correctly. It uses:

	tx_packets = (tx_q->cur_tx + 1) - first_tx;

however, these are indexes into a circular buffer, so cur_tx can be less than first_tx, and when that happens, tx_packets becomes a very large unsigned integer. When this is added to tx_q->tx_count_frames, it has the effect of reducing the count of frames, possibly causing it to also wrap to a very large unsigned integer.

Fix this by using CIRC_CNT() to calculate the number of descriptors used.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -2
index 81a6ab19a45b..0266b09f0faf 100644
@@ -14,6 +14,7 @@
 	https://bugzilla.stlinux.com/
 *******************************************************************************/
 
+#include <linux/circ_buf.h>
 #include <linux/clk.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
@@ -4511,7 +4512,8 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
 	tx_q->tx_skbuff_dma[tx_q->cur_tx].buf_type = STMMAC_TXBUF_T_SKB;
 
 	/* Manage tx mitigation */
-	tx_packets = (tx_q->cur_tx + 1) - first_tx;
+	tx_packets = CIRC_CNT(tx_q->cur_tx + 1, first_tx,
+			      priv->dma_conf.dma_tx_size);
 	tx_q->tx_count_frames += tx_packets;
 
 	if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && priv->hwts_tx_en)
@@ -4789,7 +4791,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * This approach takes care about the fragments: desc is the first
 	 * element in case of no SG.
 	 */
-	tx_packets = (entry + 1) - first_tx;
+	tx_packets = CIRC_CNT(entry + 1, first_tx, priv->dma_conf.dma_tx_size);
 	tx_q->tx_count_frames += tx_packets;
 
 	if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && priv->hwts_tx_en)
Signature · 1 line
2.53.0
maintainer
#5 lore raw
In reply to Arbab Haider
Quoted 6 lines · Arbab Haider

From: Yun Zhou <[email protected]>

On Marvell MPIC platforms (Armada 370/XP/38x), mvneta uses a percpu IRQ disable/enable scheme for NAPI: the ISR (mvneta_percpu_isr) calls disable_percpu_irq() to mask the MPIC per-CPU interrupt and schedules NAPI poll, which calls enable_percpu_irq() on completion to unmask.

7.0 is EOL?

Signature · 2 lines
Thanks,
Sasha
#6 lore raw

From: Arbab Haider <[email protected]>

Hi Sasha,

Yes, it is. My mistake. 7.0.y went end-of-life with 7.0.14 (2026-06-27), and I overlooked that when preparing the series.

For context: these five patches are backports of mainline fixes that I carry in a private 7.0.14 tree used on embedded boards that are not moving off the 7.0 series in the near term. I sent them to stable intending to add them to the stable queue, but an EOL branch is the wrong target. Please drop them.

Since all of them are already in mainline, and therefore in 7.1.y and the longterm branches, nothing further is needed there. I will keep the backports as out-of-tree patches for the private tree.

Sorry for the noise.

Thanks,
Arbab

#7 lore raw
In reply to Sasha Levin

From: Arbab Haider <[email protected]>

Hi Sasha,

Yes, it is. My mistake. 7.0.y went end-of-life with 7.0.14 (2026-06-27), and I overlooked that when preparing the series.

For context: these five patches are backports of mainline fixes that I carry in a private 7.0.14 tree used on embedded boards that are not moving off the 7.0 series in the near term. I sent them to stable intending to add them to the stable queue, but an EOL branch is the wrong target. Please drop them.

Since all of them are already in mainline, and therefore in 7.1.y and the longterm branches, nothing further is needed there. I will keep the backports as out-of-tree patches for the private tree.

Sorry for the noise.

Thanks,
Arbab

maintainer
#8 lore raw
Quoted 4 lines · Arbab Haider

From: Arbab Haider <[email protected]>

Hi Sasha,

Quoted 8 lines

Yes, it is. My mistake. 7.0.y went end-of-life with 7.0.14 (2026-06-27), and I overlooked that when preparing the series.

For context: these five patches are backports of mainline fixes that I carry in a private 7.0.14 tree used on embedded boards that are not moving off the 7.0 series in the near term. I sent them to stable intending to add them to the stable queue, but an EOL branch is the wrong target. Please drop them.

Please note that as of right now, the 7.0.14 kernel currently has:

	Total Vulnerable CVE's in 7.0.14 : 387

which might not be good for your embedded systems :)

thanks,

greg k-h