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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67a3a8f3-5bee-4379-890a-6c8e8be391a8@lunn.ch>
Date:   Tue, 14 Mar 2023 14:50:57 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Xu Liang <lxu@...linear.com>
Cc:     hkallweit1@...il.com, netdev@...r.kernel.org, davem@...emloft.net,
        kuba@...nel.org, linux@...linux.org.uk, hmehrtens@...linear.com,
        tmohren@...linear.com, rtanwar@...linear.com,
        mohammad.athari.ismail@...el.com, edumazet@...gle.com,
        michael@...le.cc, pabeni@...hat.com
Subject: Re: [PATCH net-next v4] net: phy: mxl-gpy: enhance delay time
 required by loopback disable function

> +	/* It takes 3 seconds to fully switch out of loopback mode before
> +	 * it can safely re-enter loopback mode. Record the time when
> +	 * loopback is disabled. Check and wait if necessary before loopback
> +	 * is enabled.
> +	 */

Is there are restriction about entering loopback mode within the first
3 seconds after power on? 

> +	bool lb_dis_chk;
> +	u64 lb_dis_to;
>  };
>  
>  static const struct {
> @@ -769,18 +777,34 @@ static void gpy_get_wol(struct phy_device *phydev,
>  
>  static int gpy_loopback(struct phy_device *phydev, bool enable)
>  {
> +	struct gpy_priv *priv = phydev->priv;
> +	u16 set = 0;
>  	int ret;
>  
> -	ret = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
> -			 enable ? BMCR_LOOPBACK : 0);
> -	if (!ret) {
> -		/* It takes some time for PHY device to switch
> -		 * into/out-of loopback mode.
> +	if (enable) {
> +		/* wait until 3 seconds from last disable */
> +		if (priv->lb_dis_chk && time_is_after_jiffies64(priv->lb_dis_to))
> +			msleep(jiffies64_to_msecs(priv->lb_dis_to - get_jiffies_64()));
> +
> +		priv->lb_dis_chk = false;
> +		set = BMCR_LOOPBACK;

Maybe this can be simplified by setting priv->lb_dis_to =
get_jiffies_64() + HZ * 3 in _probe(). Then you don't need
priv->lb_dis_chk.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ