lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220209224538.9028-1-luizluca@gmail.com>
Date:   Wed,  9 Feb 2022 19:45:38 -0300
From:   Luiz Angelo Daros de Luca <luizluca@...il.com>
To:     netdev@...r.kernel.org
Cc:     linus.walleij@...aro.org, andrew@...n.ch, vivien.didelot@...il.com,
        f.fainelli@...il.com, olteanv@...il.com, davem@...emloft.net,
        kuba@...nel.org, alsi@...g-olufsen.dk, arinc.unal@...nc9.com,
        Luiz Angelo Daros de Luca <luizluca@...il.com>
Subject: [PATCH net-next] net: dsa: realtek: rtl8365mb: irq with realtek-mdio

realtek-smi creates a custom ds->slave_mii_bus and uses a mdio
device-tree subnode to associates the interrupt-controller to each port.
However, with realtek-mdio, ds->slave_mii_bus is created and configured
by the switch with no device-tree settings. With no interruptions, the
switch falls back to polling the port status.

This patch adds a new ds_ops->port_setup() to configure each phy_device
interruption. It is only used by realtek-mdio but it could probably be
used by realtek-smi as well, removing the need for a mdio subnode in the
realtek device-tree node.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@...il.com>
---
 drivers/net/dsa/realtek/rtl8365mb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c
index 2ed592147c20..45afe57a5d31 100644
--- a/drivers/net/dsa/realtek/rtl8365mb.c
+++ b/drivers/net/dsa/realtek/rtl8365mb.c
@@ -1053,6 +1053,23 @@ static void rtl8365mb_phylink_mac_link_up(struct dsa_switch *ds, int port,
 	}
 }
 
+static int rtl8365mb_port_setup(struct dsa_switch *ds, int port)
+{
+	struct realtek_priv *priv = ds->priv;
+	struct phy_device *phydev;
+
+	if (priv->irqdomain && ds->slave_mii_bus->irq[port] == PHY_POLL) {
+		phydev = mdiobus_get_phy(ds->slave_mii_bus, port);
+		if (!phydev)
+			return 0;
+
+		phydev->irq = irq_find_mapping(priv->irqdomain, port);
+		ds->slave_mii_bus->irq[port] = phydev->irq;
+	}
+
+	return 0;
+}
+
 static void rtl8365mb_port_stp_state_set(struct dsa_switch *ds, int port,
 					 u8 state)
 {
@@ -2022,6 +2039,7 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops_mdio = {
 	.phylink_mac_link_up = rtl8365mb_phylink_mac_link_up,
 	.phy_read = rtl8365mb_dsa_phy_read,
 	.phy_write = rtl8365mb_dsa_phy_write,
+	.port_setup = rtl8365mb_port_setup,
 	.port_stp_state_set = rtl8365mb_port_stp_state_set,
 	.get_strings = rtl8365mb_get_strings,
 	.get_ethtool_stats = rtl8365mb_get_ethtool_stats,
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ