mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v3 0/3] Fix switch mode for offload and non-offload cases
@ 2026-11-10 12:26 Meghana Malladi
  2026-11-10 12:26 ` [PATCH net v3 1/3] net: ti: icssg-prueth: Fix TX timestamp cleanup crash Meghana Malladi
  2026-11-10 12:27 ` [PATCH net v3 2/3] net: ti: icssg-prueth: Fix phylib stop/start in emac_restart Meghana Malladi
  0 siblings, 2 replies; 3+ messages in thread
From: Meghana Malladi @ 2026-11-10 12:26 UTC (permalink / raw)
  To: diogo.ivo, philippe.schenker, haokexin, devnexen, horms,
	jacob.e.keller, m-malladi, pabeni, kuba, edumazet, davem,
	andrew+netdev
  Cc: linux-kernel, netdev, linux-arm-kernel, srk, Vignesh Raghavendra,
	danishanwar

Non-offloaded switch mode is failing to forward packets. This patch series
introduces fixes to ensure smooth operation of switch mode in both offload
and non-offload cases.

patch(1/3): Fix TX timestamp cleanup crash (ERR_PTR slot handling)
patch(2/3): Fix phylib stop/start in emac_restart (R30 command race)
patch(3/3): Fix bridge port_vlan and flooding state (multicast/unicast forwarding)

v2: https://lore.kernel.org/all/20261027131732.3411403-1-m-malladi@ti.com/

Meghana Malladi (3):
  net: ti: icssg-prueth: Fix TX timestamp cleanup crash
  net: ti: icssg-prueth: Fix phylib stop/start in emac_restart
  net: ti: icssg-prueth: Fix bridge port_vlan and flooding state

 drivers/net/ethernet/ti/icssg/icssg_common.c |  9 ++--
 drivers/net/ethernet/ti/icssg/icssg_prueth.c | 46 ++++++++++++++++++--
 drivers/net/ethernet/ti/icssg/icssg_prueth.h |  4 ++
 3 files changed, 52 insertions(+), 7 deletions(-)


base-commit: af6f95c3300e3d234c813b80f831dd7b80b3eaf2
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net v3 1/3] net: ti: icssg-prueth: Fix TX timestamp cleanup crash
  2026-11-10 12:26 [PATCH net v3 0/3] Fix switch mode for offload and non-offload cases Meghana Malladi
@ 2026-11-10 12:26 ` Meghana Malladi
  2026-11-10 12:27 ` [PATCH net v3 2/3] net: ti: icssg-prueth: Fix phylib stop/start in emac_restart Meghana Malladi
  1 sibling, 0 replies; 3+ messages in thread
From: Meghana Malladi @ 2026-11-10 12:26 UTC (permalink / raw)
  To: diogo.ivo, philippe.schenker, haokexin, devnexen, horms,
	jacob.e.keller, m-malladi, pabeni, kuba, edumazet, davem,
	andrew+netdev
  Cc: linux-kernel, netdev, linux-arm-kernel, srk, Vignesh Raghavendra,
	danishanwar

prueth_cleanup_tx_ts() incorrectly frees ERR_PTR(-EBUSY) slots. The TX
path reserves slots with ERR_PTR(-EBUSY) before storing the real skb
pointer. Use IS_ERR_OR_NULL() to skip these reserved slots during
cleanup, preventing NULL pointer dereference and freeing errors.

Fixes: e2dc7bfd677fc ("net: ti: icssg-prueth: Move common functions into a separate file")
Signed-off-by: Meghana Malladi <m-malladi@ti.com>
---

Changes from v2(v3-v2):
- Added this commit in the series which fixes the pre-existing issues
  flagged by sashiko

 drivers/net/ethernet/ti/icssg/icssg_common.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c
index 4a7d1a6f470b..8cb2ad2ebece 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_common.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_common.c
@@ -1426,10 +1426,13 @@ void prueth_cleanup_tx_ts(struct prueth_emac *emac)
 	int i;
 
 	for (i = 0; i < PRUETH_MAX_TX_TS_REQUESTS; i++) {
-		if (emac->tx_ts_skb[i]) {
+		/* Slot may hold ERR_PTR(-EBUSY) if the TX path reserved it
+		 * but has not yet stored the real skb pointer.  Skip the free
+		 * but still clear the slot so it can be reused.
+		 */
+		if (!IS_ERR_OR_NULL(emac->tx_ts_skb[i]))
 			dev_kfree_skb_any(emac->tx_ts_skb[i]);
-			emac->tx_ts_skb[i] = NULL;
-		}
+		emac->tx_ts_skb[i] = NULL;
 	}
 }
 EXPORT_SYMBOL_GPL(prueth_cleanup_tx_ts);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net v3 2/3] net: ti: icssg-prueth: Fix phylib stop/start in emac_restart
  2026-11-10 12:26 [PATCH net v3 0/3] Fix switch mode for offload and non-offload cases Meghana Malladi
  2026-11-10 12:26 ` [PATCH net v3 1/3] net: ti: icssg-prueth: Fix TX timestamp cleanup crash Meghana Malladi
@ 2026-11-10 12:27 ` Meghana Malladi
  1 sibling, 0 replies; 3+ messages in thread
From: Meghana Malladi @ 2026-11-10 12:27 UTC (permalink / raw)
  To: diogo.ivo, philippe.schenker, haokexin, devnexen, horms,
	jacob.e.keller, m-malladi, pabeni, kuba, edumazet, davem,
	andrew+netdev
  Cc: linux-kernel, netdev, linux-arm-kernel, srk, Vignesh Raghavendra,
	danishanwar

Call phy_stop()/phy_start() around the firmware halt in
prueth_emac_restart() to prevent phylib from issuing R30 commands
to the stopped PRU. Without this, emac_adjust_link() can race with
firmware reload and write invalid state.

Fixes: 9facce84f4062 ("net: ti: icssg-prueth: Fix firmware load sequence.")
Signed-off-by: Meghana Malladi <m-malladi@ti.com>
---

Changes from v2(v3-v2):
- Added this commit in the series which fixes the pre-existing issues
  flagged by sashiko

 drivers/net/ethernet/ti/icssg/icssg_prueth.c | 21 +++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 591be5c8056b..ef5dce595f68 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -1837,6 +1837,14 @@ static int prueth_emac_restart(struct prueth *prueth)
 	struct prueth_emac *emac1 = prueth->emac[PRUETH_MAC1];
 	int ret;
 
+	/* Halt phylib to stop emac_adjust_link() from issuing R30 commands
+	 * to the PRU while the firmware is stopped.
+	 */
+	if (emac0->ndev->phydev)
+		phy_stop(emac0->ndev->phydev);
+	if (emac1->ndev->phydev)
+		phy_stop(emac1->ndev->phydev);
+
 	/* Detach the net_device for both PRUeth ports*/
 	if (netif_running(emac0->ndev))
 		netif_device_detach(emac0->ndev);
@@ -1847,20 +1855,20 @@ static int prueth_emac_restart(struct prueth *prueth)
 	ret = icssg_set_port_state(emac0, ICSSG_EMAC_PORT_DISABLE);
 	ret |= icssg_set_port_state(emac1, ICSSG_EMAC_PORT_DISABLE);
 	if (ret)
-		return ret;
+		goto restart_phy;
 
 	/* Stop both pru cores for both PRUeth ports*/
 	ret = prueth_emac_common_stop(prueth);
 	if (ret) {
 		dev_err(prueth->dev, "Failed to stop the firmwares");
-		return ret;
+		goto restart_phy;
 	}
 
 	/* Start both pru cores for both PRUeth ports */
 	ret = prueth_emac_common_start(prueth);
 	if (ret) {
 		dev_err(prueth->dev, "Failed to start the firmwares");
-		return ret;
+		goto restart_phy;
 	}
 
 	/* Enable forwarding for both PRUeth ports */
@@ -1871,6 +1879,13 @@ static int prueth_emac_restart(struct prueth *prueth)
 	netif_device_attach(emac0->ndev);
 	netif_device_attach(emac1->ndev);
 
+restart_phy:
+	/* Resume phylib now that the firmware is running again. */
+	if (emac0->ndev->phydev)
+		phy_start(emac0->ndev->phydev);
+	if (emac1->ndev->phydev)
+		phy_start(emac1->ndev->phydev);
+
 	return ret;
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-10 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 12:26 [PATCH net v3 0/3] Fix switch mode for offload and non-offload cases Meghana Malladi
2026-11-10 12:26 ` [PATCH net v3 1/3] net: ti: icssg-prueth: Fix TX timestamp cleanup crash Meghana Malladi
2026-11-10 12:27 ` [PATCH net v3 2/3] net: ti: icssg-prueth: Fix phylib stop/start in emac_restart Meghana Malladi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®