[PATCH v1] net: phy: Add support for PHY-specific link polling interval and randomization

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jun 12 07:23:41 PDT 2024


Hello Oleksij,

On 12.06.24 16:09, Oleksij Rempel wrote:
>  static int eth_carrier_check(struct eth_device *edev, bool may_wait)
>  {
> +	uint64_t timeout;
> +
>  	if (!IS_ENABLED(CONFIG_PHYLIB))
>  		return 0;
>  
>  	if (!edev->phydev)
>  		return 0;
>  
> +	if (edev->phydev->polling_interval)
> +		timeout = edev->phydev->polling_interval;
> +	else
> +		timeout = 5 * SECOND;

IMO, you should initialize edev->phydev->polling_interval in phy_device_create(),
so phydev->polling_interval always has a valid value.

Cheers,
Ahmad


> +
>  	if (!edev->last_link_check ||
> -	    is_timeout(edev->last_link_check, 5 * SECOND))
> +	    is_timeout(edev->last_link_check, timeout))
>  		eth_carrier_poll_once(edev);
>  
>  	if (may_wait && !edev->phydev->link) {

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




More information about the barebox mailing list