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: <20210614035148.w742cyk52m3w56zh@pengutronix.de>
Date:   Mon, 14 Jun 2021 05:51:48 +0200
From:   Oleksij Rempel <o.rempel@...gutronix.de>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     Woojung Huh <woojung.huh@...rochip.com>,
        UNGLinuxDriver@...rochip.com,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, kernel@...gutronix.de,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Russell King <linux@...linux.org.uk>,
        Michael Grzeschik <m.grzeschik@...gutronix.de>
Subject: Re: [PATCH net-next v4 9/9] net: phy: micrel: ksz886x/ksz8081: add
 cabletest support

On Sat, Jun 12, 2021 at 08:23:53PM +0200, Andrew Lunn wrote:
> > +static int ksz886x_cable_test_get_status(struct phy_device *phydev,
> > +					 bool *finished)
> > +{
> > +	unsigned long pair_mask = 0x3;
> > +	int retries = 20;
> > +	int pair, ret;
> > +
> > +	*finished = false;
> > +
> > +	/* Try harder if link partner is active */
> > +	while (pair_mask && retries--) {
> > +		for_each_set_bit(pair, &pair_mask, 4) {
> > +			ret = ksz886x_cable_test_one_pair(phydev, pair);
> > +			if (ret == -EAGAIN)
> > +				continue;
> > +			if (ret < 0)
> > +				return ret;
> > +			clear_bit(pair, &pair_mask);
> > +		}
> > +		/* If link partner is in autonegotiation mode it will send 2ms
> > +		 * of FLPs with at least 6ms of silence.
> > +		 * Add 2ms sleep to have better chances to hit this silence.
> > +		 */
> > +		if (pair_mask)
> > +			msleep(2);
> > +	}
> > +
> > +	*finished = true;
> > +
> > +	return 0;
> 
> If ksz886x_cable_test_one_pair() returns -EAGAIN 20x and it gives up,
> you end up returning 0. Maybe it would be better to return ret?

Good point. Fixed.

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ