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  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:   Wed, 27 May 2020 02:52:24 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Dan Murphy <dmurphy@...com>
Cc:     f.fainelli@...il.com, hkallweit1@...il.com, davem@...emloft.net,
        robh@...nel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH net-next v3 4/4] net: dp83869: Add RGMII internal delay
 configuration

> @@ -218,6 +224,7 @@ static int dp83869_of_init(struct phy_device *phydev)
>  		ret = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_STRAP_STS1);
>  		if (ret < 0)
>  			return ret;
> +
>  		if (ret & DP83869_STRAP_MIRROR_ENABLED)
>  			dp83869->port_mirroring = DP83869_PORT_MIRRORING_EN;
>  		else

This random white space change does not belong in this patch.

> @@ -232,6 +239,20 @@ static int dp83869_of_init(struct phy_device *phydev)
>  				 &dp83869->tx_fifo_depth))
>  		dp83869->tx_fifo_depth = DP83869_PHYCR_FIFO_DEPTH_4_B_NIB;
>  
> +	ret = of_property_read_u32(of_node, "rx-internal-delay-ps",
> +				   &dp83869->rx_id_delay);
> +	if (ret) {
> +		dp83869->rx_id_delay = ret;
> +		ret = 0;
> +	}

This looks odd.

If this optional property is not found, -EINVAL will be returned. It
could also return -ENODATA. You then assign this error value to
dp83869->rx_id_delay? I would of expected you to assign 2000, the
default value?

> +
> +	ret = of_property_read_u32(of_node, "tx-internal-delay-ps",
> +				   &dp83869->tx_id_delay);
> +	if (ret) {
> +		dp83869->tx_id_delay = ret;
> +		ret = 0;
> +	}
> +
>  	return ret;
>  }
>  #else
> @@ -367,10 +388,45 @@ static int dp83869_configure_mode(struct phy_device *phydev,
>  	return ret;
>  }
>  
> +static int dp83869_get_delay(struct phy_device *phydev)
> +{
> +	struct dp83869_private *dp83869 = phydev->priv;
> +	int delay_size = ARRAY_SIZE(dp83869_internal_delay);
> +	int tx_delay = 0;
> +	int rx_delay = 0;
> +
> +	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
> +	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
> +		tx_delay = phy_get_delay_index(phydev,
> +					       &dp83869_internal_delay[0],
> +					       delay_size, dp83869->tx_id_delay,
> +					       false);
> +		if (tx_delay < 0) {
> +			phydev_err(phydev, "Tx internal delay is invalid\n");
> +			return tx_delay;
> +		}
> +	}
> +
> +	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
> +	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
> +		rx_delay = phy_get_delay_index(phydev,
> +					       &dp83869_internal_delay[0],
> +					       delay_size, dp83869->rx_id_delay,
> +					       false);
> +		if (rx_delay < 0) {
> +			phydev_err(phydev, "Rx internal delay is invalid\n");
> +			return rx_delay;
> +		}
> +	}

So any PHY using these properties is going to pretty much reproduce
this code. Meaning is should all be in a helper.

     Andrew

Powered by blists - more mailing lists