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:   Tue, 3 Mar 2020 19:06:01 +0000
From:   Russell King - ARM Linux admin <linux@...linux.org.uk>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     Florian Fainelli <f.fainelli@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Antoine Tenart <antoine.tenart@...tlin.com>,
        "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/3] net: phy: marvell10g: add mdix control

On Tue, Mar 03, 2020 at 06:03:16PM +0100, Andrew Lunn wrote:
> > +static int mv3310_reset(struct phy_device *phydev, u32 unit)
> > +{
> > +	int retries, val, err;
> > +
> > +	err = phy_modify_mmd(phydev, MDIO_MMD_PCS, unit + MDIO_CTRL1,
> > +			     MDIO_CTRL1_RESET, MDIO_CTRL1_RESET);
> > +	if (err < 0)
> > +		return err;
> > +
> > +	retries = 20;
> > +	do {
> > +		msleep(5);
> > +		val = phy_read_mmd(phydev, MDIO_MMD_PCS, unit + MDIO_CTRL1);
> > +		if (val < 0)
> > +			return val;
> > +	} while (val & MDIO_CTRL1_RESET && --retries);
> > +
> > +	return val & MDIO_CTRL1_RESET ? -ETIMEDOUT : 0;
> 
> Hi Russell
> 
> I've often seen people get this sort of polling loop wrong. So i
> generally point people towards include/linux/iopoll.h.

The above comes from phy_poll_reset().

> I wonder if it would be helpful to add phy_read_mmd_poll_timeout()
> and maybe phy_read_poll_timeout() to phy-core.c?

Maybe, if it becomes more prevalent.

We do have one version in aquantia_main.c which does the wrong
test-register, sleep, timeout sequence, which looks to be the only
case that is wrong.

So, if we want to do this, it should be a separate series, fixing
all locations at the same time.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ