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: <97827b19-a747-4f4d-99e7-8c2bec3d5f0a@lunn.ch>
Date: Wed, 17 Jul 2024 20:30:01 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Pawel Dembicki <paweldembicki@...il.com>
Cc: netdev@...r.kernel.org, Florian Fainelli <f.fainelli@...il.com>,
	Vladimir Oltean <olteanv@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Linus Walleij <linus.walleij@...aro.org>,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 1/2] net: dsa: vsc73xx: make RGMII delays
 configurable

On Tue, Jul 16, 2024 at 08:37:34PM +0200, Pawel Dembicki wrote:
> This patch switches hardcoded RGMII transmit/receive delay to
> a configurable value. Delay values are taken from the properties of
> the CPU port: 'tx-internal-delay-ps' and 'rx-internal-delay-ps'.
> 
> The default value is configured to 2.0 ns to maintain backward
> compatibility with existing code.
> 
> Signed-off-by: Pawel Dembicki <paweldembicki@...il.com>
> ---
>  drivers/net/dsa/vitesse-vsc73xx-core.c | 68 ++++++++++++++++++++++++--
>  1 file changed, 64 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c
> index d9d3e30fd47a..7d3c8176dff7 100644
> --- a/drivers/net/dsa/vitesse-vsc73xx-core.c
> +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c
> @@ -684,6 +684,67 @@ vsc73xx_update_vlan_table(struct vsc73xx *vsc, int port, u16 vid, bool set)
>  	return vsc73xx_write_vlan_table_entry(vsc, vid, portmap);
>  }
>  
> +static void vsc73xx_configure_rgmii_port_delay(struct dsa_switch *ds)
> +{
> +	/* Keep 2.0 ns delay for backward complatibility */
> +	u32 tx_delay = VSC73XX_GMIIDELAY_GMII0_GTXDELAY_2_0_NS;
> +	u32 rx_delay = VSC73XX_GMIIDELAY_GMII0_RXDELAY_2_0_NS;
> +	struct dsa_port *dp = dsa_to_port(ds, CPU_PORT);
> +	struct device_node *port_dn = dp->dn;
> +	struct vsc73xx *vsc = ds->priv;
> +	u32 delay;
> +
> +	if (!of_property_read_u32(port_dn, "tx-internal-delay-ps", &delay)) {
> +		switch (delay) {
> +		case 0:
> +			tx_delay = VSC73XX_GMIIDELAY_GMII0_GTXDELAY_NONE;
> +			break;
> +		case 1400:
> +			tx_delay = VSC73XX_GMIIDELAY_GMII0_GTXDELAY_1_4_NS;
> +			break;
> +		case 1700:
> +			tx_delay = VSC73XX_GMIIDELAY_GMII0_GTXDELAY_1_7_NS;
> +			break;
> +		case 2000:
> +			break;
> +		default:
> +			dev_warn(vsc->dev,
> +				 "Unsupported RGMII Transmit Clock Delay, set to 2.0 ns\n");

I would suggest you make this dev_err() and return -EINVAL. The DT has
a real error in it which should be fixed.

> +			break;
> +		}
> +	} else {
> +		dev_info(vsc->dev,
> +			 "RGMII Transmit Clock Delay isn't configured, set to 2.0 ns\n");

This is for backwards compatibility. Do we need to spam the log? I
would say dev_dbg().

Same for RX please.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ