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>] [day] [month] [year] [list]
Message-ID: <986457BC66A4884EBFFDEFEBEB20F84C15F27D90@satlexdag03.amd.com>
Date:	Tue, 8 Apr 2014 21:20:33 +0000
From:	"Lendacky, Thomas" <Thomas.Lendacky@....com>
To:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: PHY driver loading for clause 45 PHY

I've encountered an issue trying to get a phy driver to load when the
phy supports clause 45.  I  call get_phy_device passing in an mii_bus
structure, an MMD address and true for is_c45.  The get_phy_device
function calls the get_phy_id function which calls the appropriate c45
routines to obtain the device ids for each available MMD device.
However, phy_id is set to zero upon return (by get_phy_c45_ids).  This
zero phy_id is used by phy_device_create to build a module name in an
attempt to load a phy driver that is associated with the phy_id. Since
the module name used doesn't match any of the ids associated with my
phy driver, my phy driver does not load.

I've worked around this for now by patching phy_device_create just
before calling request_module:

diff -rup linux-3.14/drivers/net/phy/phy_device.c linux-3.14-build/drivers/net/phy/phy_device.c
--- linux-3.14/drivers/net/phy/phy_device.c	2014-03-30 22:40:15.000000000 -0500
+++ linux-3.14-build/drivers/net/phy/phy_device.c	2014-04-08 15:51:24.000000000 -0500
@@ -195,6 +195,9 @@ struct phy_device *phy_device_create(str
 	 * driver will get bored and give up as soon as it finds that
 	 * there's no driver _already_ loaded.
 	 */
+	if (is_c45 && (addr < ARRAY_SIZE(c45_ids->device_ids)))
+		phy_id = c45_ids->device_ids[addr];
+
 	request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT, MDIO_ID_ARGS(phy_id));
 
 	device_initialize(&dev->dev);

This builds the proper module name, but I'm not sure this is the proper
thing to do.  Should the code loop through all the device_ids and issue
a request_module for each non-zero id?  Or is there a better way to get
a phy driver that supports clause 45 loaded?

Thanks,
Tom

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ