net: airoha: Stop TX queues on error path in airoha_dev_open
Subsystems (4)
PATCH v2 1/1 net: airoha: Stop TX queues on error path in airoha_dev_open
In airoha_dev_open(), if airoha_set_vip_for_gdm_port() fails after netif_tx_start_all_queues() has been called, the TX queues remain started while the device configuration is incomplete. This leaves the device in an inconsistent state where packets could be transmitted before the VIP/IFC port configuration is complete.
Add netif_tx_stop_all_queues() call on the error path to properly roll back the TX queue state.
--- drivers/net/ethernet/airoha/airoha_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/airoha/airoha_eth.c +3 -1
@@ -1715,8 +1715,10 @@ static int airoha_dev_open(struct net_device *dev)netif_tx_start_all_queues (dev); err =airoha_set_vip_for_gdm_port (port, true); -if (err) +if (err) { +netif_tx_stop_all_queues (dev);return err; + }if (netdev_uses_dsa (dev)) airoha_fe_set(qdma->eth, REG_GDM_INGRESS_CFG(port->id),
Signature · 1 line
2.51.0
Lorenzo Bianconi
maintainerQuoted 20 lines
In
airoha_dev_open(), ifairoha_set_vip_for_gdm_port()fails afternetif_tx_start_all_queues()has been called, the TX queues remain started while the device configuration is incomplete. This leaves the device in an inconsistent state where packets could be transmitted before the VIP/IFC port configuration is complete.Add
netif_tx_stop_all_queues()call on the error path to properly roll back the TX queue state.Fixes 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")Signed-off-by Wayen Yan <[email protected]>--- drivers/net/ethernet/airoha/airoha_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ethernet/airoha/airoha_eth.c +0
-0
drivers/net/ethernet/airoha/airoha_eth.c static int airoha_dev_open(struct net_device *dev) · line 1719
Quoted 6 lines
drivers/net/ethernet/airoha/airoha_eth.c +2
-1@@ -1715,8 +1715,10 @@ static int airoha_dev_open(struct net_device *dev)netif_tx_start_all_queues (dev); err =airoha_set_vip_for_gdm_port (port, true); -if (err) +if (err) { +netif_tx_stop_all_queues (dev);
I do not think this is necessary since if ndo_open() callback fails, the net_device is not marked as running.
Regards,
Lorenzo
Quoted 9 lines
drivers/net/ethernet/airoha/airoha_eth.c +1
-0return err; + }if (netdev_uses_dsa (dev)) airoha_fe_set(qdma->eth, REG_GDM_INGRESS_CFG(port->id),Signature · 1 line
2.51.0
Thanks Lorenzo, you're right. Since ndo_open() failure prevents the net_device from being marked as running, the extra stop is unnecessary. I'll drop this patch.
Regards,
Wayen