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]
Message-ID: <e92b60fa-b3d0-4f45-b9a1-90bc9bb3ec7c@lunn.ch>
Date: Mon, 13 Jan 2025 22:55:04 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Gerhard Engleder <gerhard@...leder-embedded.com>
Cc: hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
	edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
	netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 3/5] net: phy: micrel: Add loopback support

> @@ -1030,6 +1030,33 @@ static int ksz9021_config_init(struct phy_device *phydev)
>  #define MII_KSZ9031RN_EDPD		0x23
>  #define MII_KSZ9031RN_EDPD_ENABLE	BIT(0)
>  
> +static int ksz9031_set_loopback(struct phy_device *phydev, bool enable,
> +				int speed)
> +{
> +	u16 ctl = BMCR_LOOPBACK;
> +	int ret, val;
> +
> +	if (!enable)
> +		return genphy_loopback(phydev, enable, 0);
> +
> +	if (speed == SPEED_10 || speed == SPEED_100 || speed == SPEED_1000)
> +		phydev->speed = speed;
> +	else if (speed)
> +		return -EINVAL;
> +	phydev->duplex = DUPLEX_FULL;
> +
> +	ctl |= mii_bmcr_encode_fixed(phydev->speed, phydev->duplex);
> +
> +	phy_modify(phydev, MII_BMCR, ~0, ctl);
> +
> +	ret = phy_read_poll_timeout(phydev, MII_BMSR, val, val & BMSR_LSTATUS,
> +				    5000, 500000, true);
> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}

As far as i can see, the marvell PHY is the only other one you can
specify the speed? I think it would be better if the marvell
set_loopback and this one looked similar. Either clearing the loopback
bit and configuring aneg should be here, or the marvell driver should
be modified to use genphy_loopback to disable loopback.

    Andrew

---
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ