mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] sfc: create PPS workqueue before registering phc
@ 2026-11-20  8:44 Alex Austin
  2026-11-20  8:47 ` netdev-bot+sinfo
  2026-11-20 11:50 ` Andy Moreton
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Austin @ 2026-11-20  8:44 UTC (permalink / raw)
  To: Andy Moreton, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran
  Cc: netdev, linux-net-drivers, linux-kernel, Alex Austin

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@amd.com>
---
 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@amd.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-20 11:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20  8:44 [PATCH net] sfc: create PPS workqueue before registering phc Alex Austin
2026-11-20  8:47 ` netdev-bot+sinfo
2026-11-20  9:04   ` Austin, Alex (DCCG)
2026-11-20 11:50 ` Andy Moreton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®