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: <YMT7uSNXBA8/2r8C@lunn.ch>
Date:   Sat, 12 Jun 2021 20:23:53 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Oleksij Rempel <o.rempel@...gutronix.de>
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

> +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?

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ