Skip to contentSkip to conversation

net: mdio_bus: make check in mdiobus_prevent_c45_scan more granular

PATCH In review Heiner Kallweit 2 participants 3 messages Jan 2, 2024 – Jan 3, 2024

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH 1/1 net: mdio_bus: make check in mdiobus_prevent_c45_scan more granular

Matching on OUI level is a quite big hammer. So let's make matching more granular.

---
 drivers/net/phy/mdio_bus.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/net/phy/mdio_bus.c +11 -5
index 6cf73c156..fe4136649 100644
@@ -621,19 +621,25 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus)
  */
 static bool mdiobus_prevent_c45_scan(struct mii_bus *bus)
 {
-	int i;
+	static const struct mdio_device_id id_list[] = {
+		{ MICREL_OUI << 10, GENMASK(31, 10) },
+	};
+	int i, j;
 
 	for (i = 0; i < PHY_MAX_ADDR; i++) {
 		struct phy_device *phydev;
-		u32 oui;
 
 		phydev = mdiobus_get_phy(bus, i);
 		if (!phydev)
 			continue;
-		oui = phydev->phy_id >> 10;
 
-		if (oui == MICREL_OUI)
-			return true;
+		for (j = 0; j < ARRAY_SIZE(id_list); j++) {
+			const struct mdio_device_id *id = id_list + j;
+
+			if (phy_id_compare(phydev->phy_id, id->phy_id,
+					   id->phy_id_mask))
+				return true;
+		}
 	}
 	return false;
 }
Signature · 1 line
2.43.0
author maintainer
#1 lore raw
Quoted 8 lines · Heiner Kallweit

Matching on OUI level is a quite big hammer. So let's make matching more granular.

---
 drivers/net/phy/mdio_bus.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Shall we put this on hold until we better understand the root cause of the original issue?

maintainer
#2 lore raw
Quoted 4 lines · Heiner Kallweit
Quoted 3 lines · Heiner Kallweit

Matching on OUI level is a quite big hammer. So let's make matching more granular.

Quoted 8 lines
Quoted 5 lines
---
 drivers/net/phy/mdio_bus.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Shall we put this on hold until we better understand the root cause of the original issue?

Yes, lets wait for a while.

Andrew