Subject: Re: [PATCH net-next v2 03/10] amd-xgbe-phy: Provide support for auto-negotiation timeout

From: Tom Lendacky <[email-masked]>
Date: Thu, 19 Mar 2015 15:39:33 -0500

On 03/19/2015 03:16 PM, David Miller wrote:
> From: Tom Lendacky <[email-masked]>
> Date: Thu, 19 Mar 2015 15:08:26 -0500
>
>> @@ -902,8 +906,23 @@ static enum amd_xgbe_phy_an amd_xgbe_an_page_received(struct phy_device *phydev)
>>   {
>>   	struct amd_xgbe_phy_priv *priv = phydev->priv;
>>   	enum amd_xgbe_phy_rx *state;
>> +	struct timespec64 rcv_time, diff_time;
>>   	int ret;
>>
>> +	getnstimeofday64(&rcv_time);
>> +	if (!timespec64_to_ns(&priv->an_start)) {
>> +		priv->an_start = rcv_time;
>> +	} else {
>> +		diff_time = timespec64_sub(rcv_time, priv->an_start);
>> +		if (timespec64_to_ns(&diff_time) > XGBE_AN_NS_TIMEOUT) {
>> +			/* Auto-negotiation timed out, reset state */
>> +			priv->kr_state = AMD_XGBE_RX_BPA;
>> +			priv->kx_state = AMD_XGBE_RX_BPA;
>> +
>> +			priv->an_start = rcv_time;
>> +		}
>> +	}
>> +
>
> timespec is a little bit heavyweight for something like this, you just
> want to snapshot a point in time then later check if a certain number
> of ms have passed or not.
>
> For that, plain 'jiffies' is sufficient.
>

Sounds good, I'll rework it to use jiffies.

Thanks,
Tom