@@ -104,6 +104,10 @@ static int ena_phc_register(struct ena_adapter *adapter)
phc_info = adapter->phc_info;
clock_info = &phc_info->clock_info;
+ /* PHC may already be registered in case of a reset */
+ if (ena_phc_is_active(adapter))
+ return 0;
+
phc_info->adapter = adapter;
spin_lock_init(&phc_info->lock);
@@ -129,7 +133,8 @@ static void ena_phc_unregister(struct ena_adapter *adapter)
{
struct ena_phc_info *phc_info = adapter->phc_info;
- if (ena_phc_is_active(adapter)) {
+ /* During reset flow, PHC must stay registered to keep kernel's PHC index */
+ if (ena_phc_is_active(adapter) && !test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags)) {
ptp_clock_unregister(phc_info->clock);
phc_info->clock = NULL;
}