* [PATCH net v4 1/4] net: dsa: lantiq_gswip: fix order in .remove operation
2025-12-09 1:27 [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Daniel Golle
@ 2025-12-09 1:28 ` Daniel Golle
2025-12-09 1:28 ` [PATCH net v4 2/4] net: dsa: mxl-gsw1xx: " Daniel Golle
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Daniel Golle @ 2025-12-09 1:28 UTC (permalink / raw)
To: Hauke Mehrtens, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King,
Daniel Golle, netdev, linux-kernel
Cc: Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
Russell King pointed out that disabling the switch by clearing
GSWIP_MDIO_GLOB_ENABLE before calling dsa_unregister_switch() is
problematic, as it violates a Golden Rule of driver development to
always first unpublish userspace interfaces and then disable the
hardware.
Fix this, and also simplify the probe() function, by introducing a
dsa_switch_ops teardown() operation which takes care of clearing the
GSWIP_MDIO_GLOB_ENABLE bit.
Fixes: 14fceff4771e5 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
Suggested-by: "Russell King (Oracle)" <linux@armlinux.org.uk>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
v4: initial submission, not present in previous versions
drivers/net/dsa/lantiq/lantiq_gswip.c | 3 ---
drivers/net/dsa/lantiq/lantiq_gswip_common.c | 13 ++++++++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq/lantiq_gswip.c
index 57dd063c07403..b094001a7c805 100644
--- a/drivers/net/dsa/lantiq/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq/lantiq_gswip.c
@@ -444,9 +444,6 @@ static void gswip_remove(struct platform_device *pdev)
if (!priv)
return;
- /* disable the switch */
- gswip_disable_switch(priv);
-
dsa_unregister_switch(priv->ds);
for (i = 0; i < priv->num_gphy_fw; i++)
diff --git a/drivers/net/dsa/lantiq/lantiq_gswip_common.c b/drivers/net/dsa/lantiq/lantiq_gswip_common.c
index 9da39edf8f574..6b171d58e1862 100644
--- a/drivers/net/dsa/lantiq/lantiq_gswip_common.c
+++ b/drivers/net/dsa/lantiq/lantiq_gswip_common.c
@@ -752,6 +752,13 @@ static int gswip_setup(struct dsa_switch *ds)
return 0;
}
+static void gswip_teardown(struct dsa_switch *ds)
+{
+ struct gswip_priv *priv = ds->priv;
+
+ regmap_clear_bits(priv->mdio, GSWIP_MDIO_GLOB, GSWIP_MDIO_GLOB_ENABLE);
+}
+
static enum dsa_tag_protocol gswip_get_tag_protocol(struct dsa_switch *ds,
int port,
enum dsa_tag_protocol mp)
@@ -1629,6 +1636,7 @@ static const struct phylink_mac_ops gswip_phylink_mac_ops = {
static const struct dsa_switch_ops gswip_switch_ops = {
.get_tag_protocol = gswip_get_tag_protocol,
.setup = gswip_setup,
+ .teardown = gswip_teardown,
.port_setup = gswip_port_setup,
.port_enable = gswip_port_enable,
.port_disable = gswip_port_disable,
@@ -1718,15 +1726,14 @@ int gswip_probe_common(struct gswip_priv *priv, u32 version)
err = gswip_validate_cpu_port(priv->ds);
if (err)
- goto disable_switch;
+ goto unregister_switch;
dev_info(priv->dev, "probed GSWIP version %lx mod %lx\n",
GSWIP_VERSION_REV(version), GSWIP_VERSION_MOD(version));
return 0;
-disable_switch:
- gswip_disable_switch(priv);
+unregister_switch:
dsa_unregister_switch(priv->ds);
return err;
--
2.52.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net v4 2/4] net: dsa: mxl-gsw1xx: fix order in .remove operation
2025-12-09 1:27 [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Daniel Golle
2025-12-09 1:28 ` [PATCH net v4 1/4] net: dsa: lantiq_gswip: fix order in .remove operation Daniel Golle
@ 2025-12-09 1:28 ` Daniel Golle
2025-12-09 1:29 ` [PATCH net v4 3/4] net: dsa: mxl-gsw1xx: fix .shutdown driver operation Daniel Golle
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Daniel Golle @ 2025-12-09 1:28 UTC (permalink / raw)
To: Hauke Mehrtens, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King,
Daniel Golle, netdev, linux-kernel
Cc: Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
The driver's .remove operation was calling gswip_disable_switch() which
clears the GSWIP_MDIO_GLOB_ENABLE bit before calling
dsa_unregister_switch() and thereby violating a Golden Rule of driver
development to always unpublish userspace interfaces before disabling
hardware, as pointed out by Russell King.
Fix this by relying in GSWIP_MDIO_GLOB_ENABLE being cleared by the
.teardown operation introduced by the previous commit
("net: dsa: lantiq_gswip: fix teardown order").
Fixes: 22335939ec907 ("net: dsa: add driver for MaxLinear GSW1xx switch family")
Suggested-by: "Russell King (Oracle)" <linux@armlinux.org.uk>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
v4: initial submission, not present in previous versions
drivers/net/dsa/lantiq/mxl-gsw1xx.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
index cf33a16fd183b..cda966d71e889 100644
--- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
+++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
@@ -652,8 +652,6 @@ static void gsw1xx_remove(struct mdio_device *mdiodev)
if (!priv)
return;
- gswip_disable_switch(priv);
-
dsa_unregister_switch(priv->ds);
}
--
2.52.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net v4 3/4] net: dsa: mxl-gsw1xx: fix .shutdown driver operation
2025-12-09 1:27 [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Daniel Golle
2025-12-09 1:28 ` [PATCH net v4 1/4] net: dsa: lantiq_gswip: fix order in .remove operation Daniel Golle
2025-12-09 1:28 ` [PATCH net v4 2/4] net: dsa: mxl-gsw1xx: " Daniel Golle
@ 2025-12-09 1:29 ` Daniel Golle
2025-12-09 1:29 ` [PATCH net v4 4/4] net: dsa: mxl-gsw1xx: manually clear RANEG bit Daniel Golle
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Daniel Golle @ 2025-12-09 1:29 UTC (permalink / raw)
To: Hauke Mehrtens, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King,
Daniel Golle, netdev, linux-kernel
Cc: Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
The .shutdown operation should call dsa_switch_shutdown() just like
it is done also by the sibling lantiq_gswip driver. Not doing that
results in shutdown or reboot hanging and waiting for the CPU port
becoming free, which introduces a longer delay and a WARNING before
shutdown or reboot in case the driver is built-into the kernel.
Fix this by calling dsa_switch_shutdown() in the driver's shutdown
operation, harmonizing it with what is done in the lantiq_gswip
driver. As a side-effect this now allows to remove the previously
exported gswip_disable_switch() function which no longer got any
users.
Fixes: 22335939ec907 ("net: dsa: add driver for MaxLinear GSW1xx switch family")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
v4: initial submission, not present in previous versions
drivers/net/dsa/lantiq/lantiq_gswip.h | 2 --
drivers/net/dsa/lantiq/lantiq_gswip_common.c | 6 ------
drivers/net/dsa/lantiq/mxl-gsw1xx.c | 4 ++--
3 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.h b/drivers/net/dsa/lantiq/lantiq_gswip.h
index 9c38e51a75e80..2e0f2afbadbbc 100644
--- a/drivers/net/dsa/lantiq/lantiq_gswip.h
+++ b/drivers/net/dsa/lantiq/lantiq_gswip.h
@@ -294,8 +294,6 @@ struct gswip_priv {
u16 version;
};
-void gswip_disable_switch(struct gswip_priv *priv);
-
int gswip_probe_common(struct gswip_priv *priv, u32 version);
#endif /* __LANTIQ_GSWIP_H */
diff --git a/drivers/net/dsa/lantiq/lantiq_gswip_common.c b/drivers/net/dsa/lantiq/lantiq_gswip_common.c
index 6b171d58e1862..e790f2ef75884 100644
--- a/drivers/net/dsa/lantiq/lantiq_gswip_common.c
+++ b/drivers/net/dsa/lantiq/lantiq_gswip_common.c
@@ -1664,12 +1664,6 @@ static const struct dsa_switch_ops gswip_switch_ops = {
.port_hsr_leave = dsa_port_simple_hsr_leave,
};
-void gswip_disable_switch(struct gswip_priv *priv)
-{
- regmap_clear_bits(priv->mdio, GSWIP_MDIO_GLOB, GSWIP_MDIO_GLOB_ENABLE);
-}
-EXPORT_SYMBOL_GPL(gswip_disable_switch);
-
static int gswip_validate_cpu_port(struct dsa_switch *ds)
{
struct gswip_priv *priv = ds->priv;
diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
index cda966d71e889..4dc287ad141e1 100644
--- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
+++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
@@ -662,9 +662,9 @@ static void gsw1xx_shutdown(struct mdio_device *mdiodev)
if (!priv)
return;
- dev_set_drvdata(&mdiodev->dev, NULL);
+ dsa_switch_shutdown(priv->ds);
- gswip_disable_switch(priv);
+ dev_set_drvdata(&mdiodev->dev, NULL);
}
static const struct gswip_hw_info gsw12x_data = {
--
2.52.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net v4 4/4] net: dsa: mxl-gsw1xx: manually clear RANEG bit
2025-12-09 1:27 [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Daniel Golle
` (2 preceding siblings ...)
2025-12-09 1:29 ` [PATCH net v4 3/4] net: dsa: mxl-gsw1xx: fix .shutdown driver operation Daniel Golle
@ 2025-12-09 1:29 ` Daniel Golle
2025-12-10 15:52 ` Vladimir Oltean
2025-12-10 16:16 ` [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Vladimir Oltean
2025-12-18 12:00 ` patchwork-bot+netdevbpf
5 siblings, 1 reply; 11+ messages in thread
From: Daniel Golle @ 2025-12-09 1:29 UTC (permalink / raw)
To: Hauke Mehrtens, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King,
Daniel Golle, netdev, linux-kernel
Cc: Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
Despite being documented as self-clearing, the RANEG bit sometimes
remains set, preventing auto-negotiation from happening.
Manually clear the RANEG bit after 10ms as advised by MaxLinear.
In order to not hold RTNL during the 10ms of waiting schedule
delayed work to take care of clearing the bit asynchronously, which
is similar to the self-clearing behavior.
Fixes: 22335939ec90 ("net: dsa: add driver for MaxLinear GSW1xx switch family")
Reported-by: Rasmus Villemoes <ravi@prevas.dk>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
v4:
* fix order of operations in remove and shutdown functions
v3:
* fix wrong parameter name in call of cancel_delayed_work_sync
v2:
* cancel pending work before setting RANEG bit
* cancel pending work on remove and shutdown
* document that GSW1XX_RST_REQ_SGMII_SHELL also clears RANEG bit
* improve commit message
drivers/net/dsa/lantiq/mxl-gsw1xx.c | 34 ++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
index 4dc287ad141e1..f8ff8a604bf53 100644
--- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
+++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
@@ -11,10 +11,12 @@
#include <linux/bits.h>
#include <linux/delay.h>
+#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_mdio.h>
#include <linux/regmap.h>
+#include <linux/workqueue.h>
#include <net/dsa.h>
#include "lantiq_gswip.h"
@@ -29,6 +31,7 @@ struct gsw1xx_priv {
struct regmap *clk;
struct regmap *shell;
struct phylink_pcs pcs;
+ struct delayed_work clear_raneg;
phy_interface_t tbi_interface;
struct gswip_priv gswip;
};
@@ -145,7 +148,9 @@ static void gsw1xx_pcs_disable(struct phylink_pcs *pcs)
{
struct gsw1xx_priv *priv = pcs_to_gsw1xx(pcs);
- /* Assert SGMII shell reset */
+ cancel_delayed_work_sync(&priv->clear_raneg);
+
+ /* Assert SGMII shell reset (will also clear RANEG bit) */
regmap_set_bits(priv->shell, GSW1XX_SHELL_RST_REQ,
GSW1XX_RST_REQ_SGMII_SHELL);
@@ -428,12 +433,29 @@ static int gsw1xx_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
return 0;
}
+static void gsw1xx_pcs_clear_raneg(struct work_struct *work)
+{
+ struct gsw1xx_priv *priv =
+ container_of(work, struct gsw1xx_priv, clear_raneg.work);
+
+ regmap_clear_bits(priv->sgmii, GSW1XX_SGMII_TBI_ANEGCTL,
+ GSW1XX_SGMII_TBI_ANEGCTL_RANEG);
+}
+
static void gsw1xx_pcs_an_restart(struct phylink_pcs *pcs)
{
struct gsw1xx_priv *priv = pcs_to_gsw1xx(pcs);
+ cancel_delayed_work_sync(&priv->clear_raneg);
+
regmap_set_bits(priv->sgmii, GSW1XX_SGMII_TBI_ANEGCTL,
GSW1XX_SGMII_TBI_ANEGCTL_RANEG);
+
+ /* despite being documented as self-clearing, the RANEG bit
+ * sometimes remains set, preventing auto-negotiation from happening.
+ * MaxLinear advises to manually clear the bit after 10ms.
+ */
+ schedule_delayed_work(&priv->clear_raneg, msecs_to_jiffies(10));
}
static void gsw1xx_pcs_link_up(struct phylink_pcs *pcs,
@@ -636,6 +658,8 @@ static int gsw1xx_probe(struct mdio_device *mdiodev)
if (ret)
return ret;
+ INIT_DELAYED_WORK(&priv->clear_raneg, gsw1xx_pcs_clear_raneg);
+
ret = gswip_probe_common(&priv->gswip, version);
if (ret)
return ret;
@@ -648,16 +672,21 @@ static int gsw1xx_probe(struct mdio_device *mdiodev)
static void gsw1xx_remove(struct mdio_device *mdiodev)
{
struct gswip_priv *priv = dev_get_drvdata(&mdiodev->dev);
+ struct gsw1xx_priv *gsw1xx_priv;
if (!priv)
return;
dsa_unregister_switch(priv->ds);
+
+ gsw1xx_priv = container_of(priv, struct gsw1xx_priv, gswip);
+ cancel_delayed_work_sync(&gsw1xx_priv->clear_raneg);
}
static void gsw1xx_shutdown(struct mdio_device *mdiodev)
{
struct gswip_priv *priv = dev_get_drvdata(&mdiodev->dev);
+ struct gsw1xx_priv *gsw1xx_priv;
if (!priv)
return;
@@ -665,6 +694,9 @@ static void gsw1xx_shutdown(struct mdio_device *mdiodev)
dsa_switch_shutdown(priv->ds);
dev_set_drvdata(&mdiodev->dev, NULL);
+
+ gsw1xx_priv = container_of(priv, struct gsw1xx_priv, gswip);
+ cancel_delayed_work_sync(&gsw1xx_priv->clear_raneg);
}
static const struct gswip_hw_info gsw12x_data = {
--
2.52.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH net v4 4/4] net: dsa: mxl-gsw1xx: manually clear RANEG bit
2025-12-09 1:29 ` [PATCH net v4 4/4] net: dsa: mxl-gsw1xx: manually clear RANEG bit Daniel Golle
@ 2025-12-10 15:52 ` Vladimir Oltean
2025-12-10 16:03 ` Daniel Golle
0 siblings, 1 reply; 11+ messages in thread
From: Vladimir Oltean @ 2025-12-10 15:52 UTC (permalink / raw)
To: Daniel Golle
Cc: Hauke Mehrtens, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Russell King, netdev, linux-kernel,
Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
On Tue, Dec 09, 2025 at 01:29:34AM +0000, Daniel Golle wrote:
> Despite being documented as self-clearing, the RANEG bit sometimes
> remains set, preventing auto-negotiation from happening.
>
> Manually clear the RANEG bit after 10ms as advised by MaxLinear.
> In order to not hold RTNL during the 10ms of waiting schedule
> delayed work to take care of clearing the bit asynchronously, which
> is similar to the self-clearing behavior.
>
> Fixes: 22335939ec90 ("net: dsa: add driver for MaxLinear GSW1xx switch family")
> Reported-by: Rasmus Villemoes <ravi@prevas.dk>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> v4:
> * fix order of operations in remove and shutdown functions
>
> v3:
> * fix wrong parameter name in call of cancel_delayed_work_sync
>
> v2:
> * cancel pending work before setting RANEG bit
> * cancel pending work on remove and shutdown
> * document that GSW1XX_RST_REQ_SGMII_SHELL also clears RANEG bit
> * improve commit message
>
> drivers/net/dsa/lantiq/mxl-gsw1xx.c | 34 ++++++++++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> index 4dc287ad141e1..f8ff8a604bf53 100644
> --- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> +++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> @@ -11,10 +11,12 @@
>
> #include <linux/bits.h>
> #include <linux/delay.h>
> +#include <linux/jiffies.h>
> #include <linux/module.h>
> #include <linux/of_device.h>
> #include <linux/of_mdio.h>
> #include <linux/regmap.h>
> +#include <linux/workqueue.h>
> #include <net/dsa.h>
>
> #include "lantiq_gswip.h"
> @@ -29,6 +31,7 @@ struct gsw1xx_priv {
> struct regmap *clk;
> struct regmap *shell;
> struct phylink_pcs pcs;
> + struct delayed_work clear_raneg;
> phy_interface_t tbi_interface;
> struct gswip_priv gswip;
> };
> @@ -145,7 +148,9 @@ static void gsw1xx_pcs_disable(struct phylink_pcs *pcs)
> {
> struct gsw1xx_priv *priv = pcs_to_gsw1xx(pcs);
>
> - /* Assert SGMII shell reset */
> + cancel_delayed_work_sync(&priv->clear_raneg);
> +
> + /* Assert SGMII shell reset (will also clear RANEG bit) */
> regmap_set_bits(priv->shell, GSW1XX_SHELL_RST_REQ,
> GSW1XX_RST_REQ_SGMII_SHELL);
>
> @@ -428,12 +433,29 @@ static int gsw1xx_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
> return 0;
> }
>
> +static void gsw1xx_pcs_clear_raneg(struct work_struct *work)
> +{
> + struct gsw1xx_priv *priv =
> + container_of(work, struct gsw1xx_priv, clear_raneg.work);
> +
> + regmap_clear_bits(priv->sgmii, GSW1XX_SGMII_TBI_ANEGCTL,
> + GSW1XX_SGMII_TBI_ANEGCTL_RANEG);
> +}
> +
> static void gsw1xx_pcs_an_restart(struct phylink_pcs *pcs)
> {
> struct gsw1xx_priv *priv = pcs_to_gsw1xx(pcs);
>
> + cancel_delayed_work_sync(&priv->clear_raneg);
> +
> regmap_set_bits(priv->sgmii, GSW1XX_SGMII_TBI_ANEGCTL,
> GSW1XX_SGMII_TBI_ANEGCTL_RANEG);
> +
> + /* despite being documented as self-clearing, the RANEG bit
> + * sometimes remains set, preventing auto-negotiation from happening.
> + * MaxLinear advises to manually clear the bit after 10ms.
> + */
> + schedule_delayed_work(&priv->clear_raneg, msecs_to_jiffies(10));
> }
>
> static void gsw1xx_pcs_link_up(struct phylink_pcs *pcs,
> @@ -636,6 +658,8 @@ static int gsw1xx_probe(struct mdio_device *mdiodev)
> if (ret)
> return ret;
>
> + INIT_DELAYED_WORK(&priv->clear_raneg, gsw1xx_pcs_clear_raneg);
> +
> ret = gswip_probe_common(&priv->gswip, version);
> if (ret)
> return ret;
> @@ -648,16 +672,21 @@ static int gsw1xx_probe(struct mdio_device *mdiodev)
> static void gsw1xx_remove(struct mdio_device *mdiodev)
> {
> struct gswip_priv *priv = dev_get_drvdata(&mdiodev->dev);
> + struct gsw1xx_priv *gsw1xx_priv;
>
> if (!priv)
> return;
>
> dsa_unregister_switch(priv->ds);
> +
> + gsw1xx_priv = container_of(priv, struct gsw1xx_priv, gswip);
> + cancel_delayed_work_sync(&gsw1xx_priv->clear_raneg);
> }
>
> static void gsw1xx_shutdown(struct mdio_device *mdiodev)
> {
> struct gswip_priv *priv = dev_get_drvdata(&mdiodev->dev);
> + struct gsw1xx_priv *gsw1xx_priv;
>
> if (!priv)
> return;
> @@ -665,6 +694,9 @@ static void gsw1xx_shutdown(struct mdio_device *mdiodev)
> dsa_switch_shutdown(priv->ds);
>
> dev_set_drvdata(&mdiodev->dev, NULL);
> +
> + gsw1xx_priv = container_of(priv, struct gsw1xx_priv, gswip);
> + cancel_delayed_work_sync(&gsw1xx_priv->clear_raneg);
Nitpick: why did you place this after dev_set_drvdata(dev, NULL) and not before?
The work item doesn't call dev_get_drvdata(), true, but it's one more refactoring
step that needs to be taken care of if it should.
> }
>
> static const struct gswip_hw_info gsw12x_data = {
> --
> 2.52.0
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net v4 4/4] net: dsa: mxl-gsw1xx: manually clear RANEG bit
2025-12-10 15:52 ` Vladimir Oltean
@ 2025-12-10 16:03 ` Daniel Golle
0 siblings, 0 replies; 11+ messages in thread
From: Daniel Golle @ 2025-12-10 16:03 UTC (permalink / raw)
To: Vladimir Oltean
Cc: Hauke Mehrtens, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Russell King, netdev, linux-kernel,
Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
On Wed, Dec 10, 2025 at 05:52:49PM +0200, Vladimir Oltean wrote:
> On Tue, Dec 09, 2025 at 01:29:34AM +0000, Daniel Golle wrote:
> > [...]
> > @@ -665,6 +694,9 @@ static void gsw1xx_shutdown(struct mdio_device *mdiodev)
> > dsa_switch_shutdown(priv->ds);
> >
> > dev_set_drvdata(&mdiodev->dev, NULL);
> > +
> > + gsw1xx_priv = container_of(priv, struct gsw1xx_priv, gswip);
> > + cancel_delayed_work_sync(&gsw1xx_priv->clear_raneg);
>
> Nitpick: why did you place this after dev_set_drvdata(dev, NULL) and not before?
> The work item doesn't call dev_get_drvdata(), true, but it's one more refactoring
> step that needs to be taken care of if it should.
As the order of those two doesn't matter I thought the best would be
to do cancel_delayed_work_sync() as the last thing because it is
obviously correct. Eventhough even doing that at all doesn't matter
much in the shutdown() path anyway...
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes
2025-12-09 1:27 [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Daniel Golle
` (3 preceding siblings ...)
2025-12-09 1:29 ` [PATCH net v4 4/4] net: dsa: mxl-gsw1xx: manually clear RANEG bit Daniel Golle
@ 2025-12-10 16:16 ` Vladimir Oltean
2025-12-16 18:08 ` Daniel Golle
2025-12-18 12:00 ` patchwork-bot+netdevbpf
5 siblings, 1 reply; 11+ messages in thread
From: Vladimir Oltean @ 2025-12-10 16:16 UTC (permalink / raw)
To: Daniel Golle
Cc: Hauke Mehrtens, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Russell King, netdev, linux-kernel,
Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
On Tue, Dec 09, 2025 at 01:27:42AM +0000, Daniel Golle wrote:
> This series is the continuation and result of comments received for a fix
> for the SGMII restart-an bit not actually being self-clearing, which was
> reported by by Rasmus Villemoes.
>
> A closer investigation and testing the .remove and the .shutdown paths
> of the mxl-gsw1xx.c and lantiq_gswip.c drivers has revealed a couple of
> existing problems, which are also addressed in this series.
>
> Daniel Golle (4):
> net: dsa: lantiq_gswip: fix order in .remove operation
> net: dsa: mxl-gsw1xx: fix order in .remove operation
> net: dsa: mxl-gsw1xx: fix .shutdown driver operation
> net: dsa: mxl-gsw1xx: manually clear RANEG bit
>
> drivers/net/dsa/lantiq/lantiq_gswip.c | 3 --
> drivers/net/dsa/lantiq/lantiq_gswip.h | 2 --
> drivers/net/dsa/lantiq/lantiq_gswip_common.c | 19 +++++-----
> drivers/net/dsa/lantiq/mxl-gsw1xx.c | 38 +++++++++++++++++---
> 4 files changed, 44 insertions(+), 18 deletions(-)
>
> --
> 2.52.0
From a DSA API perspective this seems fine.
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes
2025-12-10 16:16 ` [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Vladimir Oltean
@ 2025-12-16 18:08 ` Daniel Golle
2025-12-16 18:13 ` Vladimir Oltean
0 siblings, 1 reply; 11+ messages in thread
From: Daniel Golle @ 2025-12-16 18:08 UTC (permalink / raw)
To: Vladimir Oltean
Cc: Hauke Mehrtens, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Russell King, netdev, linux-kernel,
Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
On Wed, Dec 10, 2025 at 06:16:33PM +0200, Vladimir Oltean wrote:
> On Tue, Dec 09, 2025 at 01:27:42AM +0000, Daniel Golle wrote:
> > This series is the continuation and result of comments received for a fix
> > for the SGMII restart-an bit not actually being self-clearing, which was
> > reported by by Rasmus Villemoes.
> >
> > A closer investigation and testing the .remove and the .shutdown paths
> > of the mxl-gsw1xx.c and lantiq_gswip.c drivers has revealed a couple of
> > existing problems, which are also addressed in this series.
> >
> > Daniel Golle (4):
> > net: dsa: lantiq_gswip: fix order in .remove operation
> > net: dsa: mxl-gsw1xx: fix order in .remove operation
> > net: dsa: mxl-gsw1xx: fix .shutdown driver operation
> > net: dsa: mxl-gsw1xx: manually clear RANEG bit
> >
> > drivers/net/dsa/lantiq/lantiq_gswip.c | 3 --
> > drivers/net/dsa/lantiq/lantiq_gswip.h | 2 --
> > drivers/net/dsa/lantiq/lantiq_gswip_common.c | 19 +++++-----
> > drivers/net/dsa/lantiq/mxl-gsw1xx.c | 38 +++++++++++++++++---
> > 4 files changed, 44 insertions(+), 18 deletions(-)
> >
> > --
> > 2.52.0
>
> From a DSA API perspective this seems fine.
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
>
In case you are reluctant to accept patch 4/4 ("net: dsa: mxl-gsw1xx:
manually clear RANEG bit") it'd be nice to have at least patch 1, 2 and
3 merged as-is, and I'll resend 4/4 as a single patch being a simple
msleep(10) instead of the delayed_work approach, if that's the reason
for the series not being accepted.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes
2025-12-16 18:08 ` Daniel Golle
@ 2025-12-16 18:13 ` Vladimir Oltean
0 siblings, 0 replies; 11+ messages in thread
From: Vladimir Oltean @ 2025-12-16 18:13 UTC (permalink / raw)
To: Daniel Golle
Cc: Hauke Mehrtens, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Russell King, netdev, linux-kernel,
Rasmus Villemoes, Benny (Ying-Tsan) Weng, John Crispin
On Tue, Dec 16, 2025 at 06:08:06PM +0000, Daniel Golle wrote:
> On Wed, Dec 10, 2025 at 06:16:33PM +0200, Vladimir Oltean wrote:
> > On Tue, Dec 09, 2025 at 01:27:42AM +0000, Daniel Golle wrote:
> > > This series is the continuation and result of comments received for a fix
> > > for the SGMII restart-an bit not actually being self-clearing, which was
> > > reported by by Rasmus Villemoes.
> > >
> > > A closer investigation and testing the .remove and the .shutdown paths
> > > of the mxl-gsw1xx.c and lantiq_gswip.c drivers has revealed a couple of
> > > existing problems, which are also addressed in this series.
> > >
> > > Daniel Golle (4):
> > > net: dsa: lantiq_gswip: fix order in .remove operation
> > > net: dsa: mxl-gsw1xx: fix order in .remove operation
> > > net: dsa: mxl-gsw1xx: fix .shutdown driver operation
> > > net: dsa: mxl-gsw1xx: manually clear RANEG bit
> > >
> > > drivers/net/dsa/lantiq/lantiq_gswip.c | 3 --
> > > drivers/net/dsa/lantiq/lantiq_gswip.h | 2 --
> > > drivers/net/dsa/lantiq/lantiq_gswip_common.c | 19 +++++-----
> > > drivers/net/dsa/lantiq/mxl-gsw1xx.c | 38 +++++++++++++++++---
> > > 4 files changed, 44 insertions(+), 18 deletions(-)
> > >
> > > --
> > > 2.52.0
> >
> > From a DSA API perspective this seems fine.
> > Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
> >
>
> In case you are reluctant to accept patch 4/4 ("net: dsa: mxl-gsw1xx:
> manually clear RANEG bit") it'd be nice to have at least patch 1, 2 and
> 3 merged as-is, and I'll resend 4/4 as a single patch being a simple
> msleep(10) instead of the delayed_work approach, if that's the reason
> for the series not being accepted.
I think it has more to do with the fact that network maintainers are
taking a well deserved end of year break.
https://lore.kernel.org/netdev/15b104e5-7e8d-4a7c-a500-5632a4f3f9a8@redhat.com/
There are older patches than yours in patchwork.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes
2025-12-09 1:27 [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Daniel Golle
` (4 preceding siblings ...)
2025-12-10 16:16 ` [PATCH net v4 0/4] net: dsa: lantiq: a bunch of fixes Vladimir Oltean
@ 2025-12-18 12:00 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-12-18 12:00 UTC (permalink / raw)
To: Daniel Golle
Cc: hauke, andrew, olteanv, davem, edumazet, kuba, pabeni, linux,
netdev, linux-kernel, ravi, yweng, john
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 9 Dec 2025 01:27:42 +0000 you wrote:
> This series is the continuation and result of comments received for a fix
> for the SGMII restart-an bit not actually being self-clearing, which was
> reported by by Rasmus Villemoes.
>
> A closer investigation and testing the .remove and the .shutdown paths
> of the mxl-gsw1xx.c and lantiq_gswip.c drivers has revealed a couple of
> existing problems, which are also addressed in this series.
>
> [...]
Here is the summary with links:
- [net,v4,1/4] net: dsa: lantiq_gswip: fix order in .remove operation
https://git.kernel.org/netdev/net/c/377d66fa8665
- [net,v4,2/4] net: dsa: mxl-gsw1xx: fix order in .remove operation
https://git.kernel.org/netdev/net/c/8e4c0f08f6be
- [net,v4,3/4] net: dsa: mxl-gsw1xx: fix .shutdown driver operation
https://git.kernel.org/netdev/net/c/651b253b8037
- [net,v4,4/4] net: dsa: mxl-gsw1xx: manually clear RANEG bit
https://git.kernel.org/netdev/net/c/7b103aaf0d56
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 11+ messages in thread