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] [day] [month] [year] [list]
Message-ID: <IA3PR11MB8986EAF08887FE162C7F9DB7E5D8A@IA3PR11MB8986.namprd11.prod.outlook.com>
Date: Tue, 2 Dec 2025 08:44:36 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: Markus Blöchl <markus@...chl.de>, "Nguyen, Anthony L"
	<anthony.l.nguyen@...el.com>, "Kitszel, Przemyslaw"
	<przemyslaw.kitszel@...el.com>, "Keller, Jacob E" <jacob.e.keller@...el.com>,
	Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, "Paolo
 Abeni" <pabeni@...hat.com>
CC: Richard Cochran <richardcochran@...il.com>, "Bloechl, Markus"
	<markus.bloechl@...tronik.com>, "intel-wired-lan@...ts.osuosl.org"
	<intel-wired-lan@...ts.osuosl.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
Subject: RE: [Intel-wired-lan] [PATCH net v2] i40e: fix ptp time increment
 while link is down



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@...osl.org> On Behalf
> Of Markus Blöchl
> Sent: Sunday, November 30, 2025 4:24 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@...el.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@...el.com>; Keller, Jacob E
> <jacob.e.keller@...el.com>; Andrew Lunn <andrew+netdev@...n.ch>; David
> S. Miller <davem@...emloft.net>; Eric Dumazet <edumazet@...gle.com>;
> Jakub Kicinski <kuba@...nel.org>; Paolo Abeni <pabeni@...hat.com>
> Cc: Richard Cochran <richardcochran@...il.com>; Bloechl, Markus
> <markus.bloechl@...tronik.com>; intel-wired-lan@...ts.osuosl.org;
> netdev@...r.kernel.org; linux-kernel@...r.kernel.org; Markus Blöchl
> <markus@...chl.de>
> Subject: [Intel-wired-lan] [PATCH net v2] i40e: fix ptp time increment
> while link is down
> 
> When an X710 ethernet port with an active ptp daemon (like the ptp4l
> and phc2sys combo) suddenly loses its link and regains it after a
> while, the ptp daemon has a hard time to recover synchronization and
> sometimes entirely fails to do so.
> 
> The issue seems to be related to a wrongly configured increment while
> the link is down. This could not be observed with the Intel reference
> driver.
> We identified the fix to appear in Intels official ethernet-linux-i40e
> release version 2.17.4.
> 
> Include the relevant changes in the kernel version of this driver.
> 
> Fixes: beb0dff1251d ("i40e: enable PTP")
> Cc: stable@...r.kernel.org
> Signed-off-by: Markus Blöchl <markus@...chl.de>
> ---
> Tested with an X710 at 10G link speed and kernel version 6.12.42.
> ---
> Changes in v2:
> - Fix kdoc and code formatting
> - Rebase onto net tree
> - Link to v1: https://lore.kernel.org/r/20251119-i40e_ptp_link_down-
> v1-1-b351fed254b3@...chl.de
> ---
>  drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h |  9 +++
>  drivers/net/ethernet/intel/i40e/i40e_ptp.c        | 69
> +++++++++++++++++++++--
>  drivers/net/ethernet/intel/i40e/i40e_register.h   |  9 +++
>  drivers/net/ethernet/intel/i40e/i40e_type.h       |  8 +++
>  4 files changed, 90 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
> b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
> index cc02a85ad42b..ec176e9569ad 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
> @@ -1488,6 +1488,15 @@ enum i40e_aq_link_speed {
>  	I40E_LINK_SPEED_25GB	= BIT(I40E_LINK_SPEED_25GB_SHIFT),
>  };
> 
> +enum i40e_prt_mac_pcs_link_speed {
> +	I40E_PRT_MAC_PCS_LINK_SPEED_UNKNOWN = 0,
> +	I40E_PRT_MAC_PCS_LINK_SPEED_100MB,
> +	I40E_PRT_MAC_PCS_LINK_SPEED_1GB,
> +	I40E_PRT_MAC_PCS_LINK_SPEED_10GB,
> +	I40E_PRT_MAC_PCS_LINK_SPEED_40GB,
> +	I40E_PRT_MAC_PCS_LINK_SPEED_20GB
> +};
> +
>  struct i40e_aqc_module_desc {
>  	u8 oui[3];
>  	u8 reserved1;
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
> b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
> index 33535418178b..89abe2f22216 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
> @@ -847,6 +847,66 @@ void i40e_ptp_rx_hwtstamp(struct i40e_pf *pf,
> struct sk_buff *skb, u8 index)
>  	i40e_ptp_convert_to_hwtstamp(skb_hwtstamps(skb), ns);  }
> 
> +/**
> + * i40e_ptp_get_link_speed_hw - get the link speed
> + * @pf: Board private structure
> + *
> + * Calculate link speed depending on the link status.
> + *
> + * Return: current link speed.
> + **/
> +static enum i40e_aq_link_speed i40e_ptp_get_link_speed_hw(struct
> +i40e_pf *pf) {
> +	bool link_up = pf->hw.phy.link_info.link_info &
> I40E_AQ_LINK_UP;
> +	enum i40e_aq_link_speed link_speed = I40E_LINK_SPEED_UNKNOWN;
> +	struct i40e_hw *hw = &pf->hw;
> +
> +	if (link_up) {
> +		struct i40e_link_status *hw_link_info = &hw-
> >phy.link_info;
> +
> +		i40e_aq_get_link_info(hw, true, NULL, NULL);
> +		link_speed = hw_link_info->link_speed;
> +	} else {
> +		enum i40e_prt_mac_link_speed prtmac_linksta;
> +		u64 prtmac_pcs_linksta;
> +
> +		prtmac_linksta = (rd32(hw, I40E_PRTMAC_LINKSTA(0)) &
> +				  I40E_PRTMAC_LINKSTA_MAC_LINK_SPEED_MASK)
> >>
> +				  I40E_PRTMAC_LINKSTA_MAC_LINK_SPEED_SHIFT;
Can you consider to use standard macro?

prtmac_linksta = FIELD_GET(I40E_PRTMAC_LINKSTA_MAC_LINK_SPEED_MASK,
                            rd32(hw, I40E_PRTMAC_LINKSTA(0)))


> +		if (prtmac_linksta == I40E_PRT_MAC_LINK_SPEED_40GB) {
> +			link_speed = I40E_LINK_SPEED_40GB;
> +		} else {
> +			i40e_aq_debug_read_register(hw,

...
> 
> ---
> base-commit: e5235eb6cfe02a51256013a78f7b28779a7740d5
> change-id: 20251119-i40e_ptp_link_down-47934f9e155d
> 
> Best regards,
> --
> Markus Blöchl <markus@...chl.de>
> 
> 
> --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ