RE: [PATCH net-next 05/17] net: dsa: mv88e6xxx: Add conduit state change handler
From: Jagielski, Jedrzej
Date: Fri Jul 03 2026 - 09:28:24 EST
From: Luke Howard <lukeh@xxxxxxxx>
Sent: Friday, July 3, 2026 9:47 AM
>From: Andrew Lunn <andrew@xxxxxxx>
>
>When the conduit interface comes up, try to enable the RMU. Failing to
>enable the remote management unit is not fatal, not all chips support
>it, and some boards have chips which do support RMU, but with wrong
>port is connected to the CPU.
>
>When the conduit interface goes down, disable the RMU.
>
>Keep track of the conduit interface, so that RMU frames can be sent to
>it.
>
>Co-developed: Mattias Forsblad <mattias.forsblad@xxxxxxxxx>
>Signed-off-by: Mattias Forsblad <mattias.forsblad@xxxxxxxxx>
>Signed-off-by: Andrew Lunn <andrew@xxxxxxx>
...
>+++ b/drivers/net/dsa/mv88e6xxx/rmu.c
>@@ -0,0 +1,50 @@
>+// SPDX-License-Identifier: GPL-2.0-or-later
>+/*
>+ * Marvell 88E6xxx Switch Remote Management Unit Support
>+ *
>+ * Copyright (c) 2022 Mattias Forsblad <mattias.forsblad@xxxxxxxxx>
shouldn't present year be put here?
>+ *
>+ */
>+
>+#include <net/dsa.h>
>+#include "chip.h"
>+#include "global1.h"
>+#include "rmu.h"
>+
>+void mv88e6xxx_rmu_conduit_state_change(struct dsa_switch *ds,
>+ const struct net_device *conduit,
>+ bool operational)
>+{
>+ struct dsa_port *cpu_dp = conduit->dsa_ptr;
>+ struct mv88e6xxx_chip *chip = ds->priv;
>+ int port;
>+ int ret;
could be squashed
>+
>+ port = dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index);
>+
>+ mv88e6xxx_reg_lock(chip);
>+
>+ if (operational && chip->info->ops->rmu_enable) {
>+ ret = chip->info->ops->rmu_enable(chip, port);
>+ if (ret == -EOPNOTSUPP) {
>+ dev_info(chip->dev, "RMU: not usable on this board");
do this case really needs to be treated different way if the general
case already prints error code?
>+ goto out;
>+ } else if (ret < 0) {
>+ dev_err(chip->dev, "RMU: unable to enable on port %d %pe",
>+ port, ERR_PTR(ret));
>+ goto out;
>+ }
>+
>+ WRITE_ONCE(chip->rmu_conduit, (struct net_device *)conduit);
>+
>+ dev_dbg(chip->dev, "RMU: Enabled on port %d", port);
>+ } else {
>+ if (chip->info->ops->rmu_disable)
>+ chip->info->ops->rmu_disable(chip);
>+
>+ WRITE_ONCE(chip->rmu_conduit, NULL);
>+ }
>+
>+out:
>+ mv88e6xxx_reg_unlock(chip);
>+}
>diff --git a/drivers/net/dsa/mv88e6xxx/rmu.h b/drivers/net/dsa/mv88e6xxx/rmu.h
>new file mode 100644
>index 0000000000000..71c4fc1d4113f
>--- /dev/null
>+++ b/drivers/net/dsa/mv88e6xxx/rmu.h
>@@ -0,0 +1,15 @@
>+/* SPDX-License-Identifier: GPL-2.0+ */
>+/*
>+ * Marvell 88E6xxx Switch Remote Management Unit Support
>+ *
>+ * Copyright (c) 2022 Mattias Forsblad <mattias.forsblad@xxxxxxxxx>
>+ *
>+ */
>+
>+#ifndef _MV88E6XXX_RMU_H_
>+#define _MV88E6XXX_RMU_H_
>+
>+void mv88e6xxx_rmu_conduit_state_change(struct dsa_switch *ds,
>+ const struct net_device *conduit,
>+ bool operational);
>+#endif /* _MV88E6XXX_RMU_H_ */
>
>--
>2.43.0