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]
Date: Thu, 17 Aug 2023 18:06:42 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-phy@...ts.infradead.org
Cc: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Andrew Lunn <andrew@...n.ch>,
	Florian Fainelli <f.fainelli@...il.com>,
	Madalin Bucur <madalin.bucur@....com>,
	Ioana Ciornei <ioana.ciornei@....com>,
	Camelia Groza <camelia.groza@....com>,
	Li Yang <leoyang.li@....com>,
	Rob Herring <robh+dt@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor@...nel.org>,
	Sean Anderson <sean.anderson@...o.com>,
	Maxime Chevallier <maxime.chevallier@...tlin.com>,
	Vinod Koul <vkoul@...nel.org>,
	Kishon Vijay Abraham I <kishon@...nel.org>
Subject: [RFC PATCH net-next 6/8] net: phy: initialize phydev->master_slave_set to MASTER_SLAVE_CFG_UNKNOWN

It doesn't really make sense for phydev->master_slave_set (the user
requested AN master/slave configuration) to take the value
MASTER_SLAVE_CFG_UNSUPPORTED. That only exists, AFAICS, to detect
implementations which don't report phydev->master_slave_get and
phydev->master_slave_state.

Permit the most trivial of drivers to exist, that where .config_aneg()
accepts any user request, and is implemented as:

	/* We support anything */
	phydev->master_slave_get = phydev->master_slave_set;

This is currently rejected by ethnl_update_linkmodes() with the message
"master/slave configuration not supported by device", precisely because
lsettings->master_slave_cfg (which came from phydev->master_slave_get
through phy_ethtool_ksettings_get()) is MASTER_SLAVE_CFG_UNSUPPORTED
(coming from phydev->master_slave_get, see implementation above).

By making phydev->master_slave_set never hold UNSUPPORTED, we avoid the
above confusion (driver does implement master/slave but still gets
detected as unsupported by core) without special casing in the driver.

Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
 drivers/net/phy/phy_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 9cb5aa04b2b5..e374d1a57030 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3276,6 +3276,7 @@ static int phy_probe(struct device *dev)
 		phydev->is_internal = true;
 
 	phydev->suspended = true;
+	phydev->master_slave_set = MASTER_SLAVE_CFG_UNKNOWN;
 
 	/* Deassert the reset signal */
 	phy_device_reset(phydev, 0);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ