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]
Date:   Mon,  9 Nov 2020 20:43:47 +0800
From:   Wong Vee Khee <vee.khee.wong@...el.com>
To:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Ong Boon Leong <boon.leong.ong@...el.com>,
        Voon Wei Feng <weifeng.voon@...el.com>,
        Wong Vee Khee <vee.khee.wong@...el.com>
Subject: [PATCH net-next 1/1] net: phy: Allow mdio buses to probe C45 before falling back to C22

This patch makes mdiobus_scan() to try on C45 first as C45 can access
all devices. This allows the function available for the PHY that
supports for both C45 and C22.

Reviewed-by: Voon Weifeng <weifeng.voon@...el.com>
Reviewed-by: Ong Boon Leong <boon.leong.ong@...el.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@...el.com>
---
 drivers/net/phy/mdio_bus.c | 5 +++++
 include/linux/phy.h        | 1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 56094dd6bf26..372d0d088f7e 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -691,6 +691,11 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
 		if (IS_ERR(phydev))
 			phydev = get_phy_device(bus, addr, true);
 		break;
+	case MDIOBUS_C45_C22:
+		phydev = get_phy_device(bus, addr, true);
+		if (IS_ERR(phydev))
+			phydev = get_phy_device(bus, addr, false);
+		break;
 	}
 
 	if (IS_ERR(phydev))
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 189bc9881ea6..73d9be2c00f4 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -360,6 +360,7 @@ struct mii_bus {
 		MDIOBUS_C22,
 		MDIOBUS_C45,
 		MDIOBUS_C22_C45,
+		MDIOBUS_C45_C22,
 	} probe_capabilities;
 
 	/** @shared_lock: protect access to the shared element */
-- 
2.17.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ