RE: [PATCH net v2] igb: initialize PTP state before registering PHC
From: Singh, Ayush1X
Date: Mon Nov 23 2026 - 02:04:11 EST
> -----Original Message-----
> From: Runyu Xiao <runyu.xiao@xxxxxxxxxx>
> Sent: 17 September 2026 20:33
> To: Nguyen, Anthony L <anthony.l.nguyen@xxxxxxxxx>
> Cc: alessio.bogani@xxxxxxxxxx; Kitszel, Przemyslaw <przemyslaw.kitszel@xxxxxxxxx>; andrew+netdev@xxxxxxx; davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx; richardcochran@xxxxxxxxx; horms@xxxxxxxxxx; intel-wired-lan@xxxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; stable@xxxxxxxxxxxxxxx; runyu.xiao@xxxxxxxxxx; jianhao.xu@xxxxxxxxxx
> Subject: [PATCH net v2] igb: initialize PTP state before registering PHC
>
> igb_ptp_init() currently initializes the PTP lock, work items, timestamp configuration, and timecounter after ptp_clock_register().
> The PHC is published by that call, so PTP callbacks and timestamp interrupts can run before those objects are ready.
>
> Initialize the complete PTP state before registering the PHC. Skip the setup when CONFIG_PTP_1588_CLOCK is disabled, since the PTP registration helper is then a no-op. If PHC registration fails, cancel the work items queued by igb_ptp_reset() or a timestamp interrupt before returning.
>
> Fixes: b888c510f7b3 ("igb: Avoid starting unnecessary workqueues")
> Cc: stable@xxxxxxxxxxxxxxx
> Link: https://lore.kernel.org/netdev/20260830154912.2712900-1-runyu.xiao@xxxxxxxxxx/
> Assisted-by: LLM
> Signed-off-by: Runyu Xiao <runyu.xiao@xxxxxxxxxx>
>
> ---
> v2:
> - Restore all PTP state initialization before PHC registration.
> - Skip PTP setup when CONFIG_PTP_1588_CLOCK is disabled.
> - Cancel both PTP work items when PHC registration fails.
> ---
> drivers/net/ethernet/intel/igb/igb_ptp.c | 31 +++++++++++++++---------
> 1 file changed, 19 insertions(+), 12 deletions(-)
Tested-by: Singh, Ayush1X < ayush1x.singh@xxxxxxxxx > (A Contingent worker at Intel)