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]
Date:	Thu, 19 Mar 2015 16:16:42 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	thomas.lendacky@....com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 03/10] amd-xgbe-phy: Provide support for
 auto-negotiation timeout

From: Tom Lendacky <thomas.lendacky@....com>
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ