diff options
-rw-r--r-- | drivers/net/ethernet/amazon/ena/ena_phc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/net/ethernet/amazon/ena/ena_phc.c b/drivers/net/ethernet/amazon/ena/ena_phc.c index 612cf45e3a9b..5ce9a32d210a 100644 --- a/drivers/net/ethernet/amazon/ena/ena_phc.c +++ b/drivers/net/ethernet/amazon/ena/ena_phc.c @@ -108,6 +108,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); @@ -134,7 +138,11 @@ 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; } |