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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211006223603.18858-10-ansuelsmth@gmail.com>
Date:   Thu,  7 Oct 2021 00:35:59 +0200
From:   Ansuel Smith <ansuelsmth@...il.com>
To:     Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        Ansuel Smith <ansuelsmth@...il.com>, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [net-next PATCH 09/13] net: dsa: qca8k: check rgmii also on port 6 if exchanged

Port 0 can be exchanged with port6. Handle this special case by also
checking the port6 if present.

Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
---
 drivers/net/dsa/qca8k.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 3a040a3ed58e..4d4f23f7f948 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -906,7 +906,20 @@ qca8k_setup_of_rgmii_delay(struct qca8k_priv *priv)
 	if (mode != PHY_INTERFACE_MODE_RGMII_ID &&
 	    mode != PHY_INTERFACE_MODE_RGMII_RXID &&
 	    mode != PHY_INTERFACE_MODE_RGMII_TXID) {
-		return 0;
+		/* Port 0 can be exchanged with port 6 */
+		dp = dsa_to_port(priv->ds, 6);
+		if (!dp)
+			return 0;
+
+		port_dn = dp->dn;
+
+		/* Check if port 6 is set to the correct type */
+		of_get_phy_mode(port_dn, &mode);
+		if (mode != PHY_INTERFACE_MODE_RGMII_ID &&
+		    mode != PHY_INTERFACE_MODE_RGMII_RXID &&
+		    mode != PHY_INTERFACE_MODE_RGMII_TXID) {
+			return 0;
+		}
 	}
 
 	switch (mode) {
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ