diff mbox series

[net-next] net: mdio_bus: make check in mdiobus_prevent_c45_scan more granular

Message ID 42e0d1c5-fdd2-4347-874d-2dab736abbdc@gmail.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: mdio_bus: make check in mdiobus_prevent_c45_scan more granular | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1113 this patch: 1113
netdev/cc_maintainers warning 3 maintainers not CCed: edumazet@google.com kuba@kernel.org pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 1140 this patch: 1140
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1140 this patch: 1140
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Heiner Kallweit Jan. 2, 2024, 3:54 p.m. UTC
Matching on OUI level is a quite big hammer. So let's make matching
more granular.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/mdio_bus.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Comments

Heiner Kallweit Jan. 2, 2024, 7:53 p.m. UTC | #1
On 02.01.2024 16:54, Heiner Kallweit wrote:
> Matching on OUI level is a quite big hammer. So let's make matching
> more granular.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  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?
Andrew Lunn Jan. 3, 2024, 1:32 p.m. UTC | #2
On Tue, Jan 02, 2024 at 08:53:12PM +0100, Heiner Kallweit wrote:
> On 02.01.2024 16:54, Heiner Kallweit wrote:
> > Matching on OUI level is a quite big hammer. So let's make matching
> > more granular.
> > 
> > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> > ---
> >  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
diff mbox series

Patch

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 6cf73c156..fe4136649 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -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;
 }