[PATCH net] sfc: create PPS workqueue before registering phc

From: Alex Austin

Date: Fri Nov 20 2026 - 03:49:17 EST


Registering the PHC before creating the PPS workqueue leaves a small
window for PTP_CLK_REQ_PPS to be requested and a NIC generated PPS event
to arrive before the workqueue exists. Create the PPS workqueue before
registering the PHC.

Fixes: 7c236c43b838 ("sfc: Add support for IEEE-1588 PTP")
Signed-off-by: Alex Austin <alex.austin@xxxxxxx>
---
drivers/net/ethernet/sfc/ptp.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 37511f234d76..ad6a4e7d990f 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -1633,26 +1633,26 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)

if (efx->mcdi->fn_flags &
(1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY)) {
+ INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker);
+ ptp->pps_workwq = create_singlethread_workqueue("sfc_pps");
+ if (!ptp->pps_workwq) {
+ rc = -ENOMEM;
+ goto fail3;
+ }
+
ptp->phc_clock_info = efx_phc_clock_info;
ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info,
&efx->pci_dev->dev);
if (IS_ERR(ptp->phc_clock)) {
rc = PTR_ERR(ptp->phc_clock);
- goto fail3;
- } else if (ptp->phc_clock) {
- INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker);
- ptp->pps_workwq = create_singlethread_workqueue("sfc_pps");
- if (!ptp->pps_workwq) {
- rc = -ENOMEM;
- goto fail4;
- }
+ goto fail4;
}
}
ptp->nic_ts_enabled = false;

return 0;
fail4:
- ptp_clock_unregister(efx->ptp_data->phc_clock);
+ destroy_workqueue(efx->ptp_data->pps_workwq);

fail3:
destroy_workqueue(efx->ptp_data->workwq);
@@ -1702,16 +1702,16 @@ void efx_ptp_remove(struct efx_nic *efx)

cancel_work_sync(&efx->ptp_data->work);
cancel_delayed_work_sync(&efx->ptp_data->cleanup_work);
- if (efx->ptp_data->pps_workwq)
+ if (efx->ptp_data->pps_workwq) {
cancel_work_sync(&efx->ptp_data->pps_work);
+ destroy_workqueue(efx->ptp_data->pps_workwq);
+ }

skb_queue_purge(&efx->ptp_data->rxq);
skb_queue_purge(&efx->ptp_data->txq);

- if (efx->ptp_data->phc_clock) {
- destroy_workqueue(efx->ptp_data->pps_workwq);
+ if (efx->ptp_data->phc_clock)
ptp_clock_unregister(efx->ptp_data->phc_clock);
- }

destroy_workqueue(efx->ptp_data->workwq);


---
base-commit: 9068e05d35f3b02a802f520e664032f802bcd2e9
change-id: 20261120-sfc_pps_wq_fix-2ed4ecc4c345

Best regards,
--
Alex Austin <alex.austin@xxxxxxx>