Thread (27 messages) 27 messages, 3 authors, 2h ago

RE: [PATCH net-next 05/17] net: dsa: mv88e6xxx: Add conduit state change handler

From: Jagielski, Jedrzej <hidden>
Date: 2026-07-03 13:18:06
Also in: lkml

From: Luke Howard <redacted> 
Sent: Friday, July 3, 2026 9:47 AM
From: Andrew Lunn <andrew@lunn.ch>

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 [off-list ref]
Signed-off-by: Mattias Forsblad <redacted>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
...
quoted hunk ↗ jump to hunk
+++ 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@gmail.com>
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?
quoted hunk ↗ jump to hunk
+			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@gmail.com>
+ *
+ */
+
+#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
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help