On 4/18/2024 9:28 PM, Rahul Rameshbabu wrote:
On Thu, 18 Apr, 2024 01:24:54 -0400 Mateusz Polchlopek
<[email protected]> wrote:
From: Jacob Keller <[email protected]>
Add the iavf_ptp.c file and fill it in with a skeleton framework to
allow registering the PTP clock device.
Add implementation of helper functions to check if a PTP capability
is supported and handle change in PTP capabilities.
Enabling virtual clock would be possible, though it would probably
perform poorly due to the lack of direct time access.
Reviewed-by: Sai Krishna <[email protected]>
Reviewed-by: Wojciech Drewek <[email protected]>
Signed-off-by: Jacob Keller <[email protected]>
Co-developed-by: Ahmed Zaki <[email protected]>
Signed-off-by: Ahmed Zaki <[email protected]>
Co-developed-by: Mateusz Polchlopek <[email protected]>
Signed-off-by: Mateusz Polchlopek <[email protected]>
---
diff --git a/drivers/net/ethernet/intel/iavf/iavf_ptp.c
b/drivers/net/ethernet/intel/iavf/iavf_ptp.c
<snip>
+/**
+ * iavf_ptp_release - Disable PTP support
+ * @adapter: private adapter structure
+ *
+ * Release all PTP resources that were previously initialized.
+ */
+void iavf_ptp_release(struct iavf_adapter *adapter)
+{
+ if (!IS_ERR_OR_NULL(adapter->ptp.clock)) {
+ dev_info(&adapter->pdev->dev, "removing PTP clock %s\n",
+ adapter->ptp.info.name);
+ ptp_clock_unregister(adapter->ptp.clock);
+ adapter->ptp.clock = NULL;
+ }
+
+ adapter->ptp.initialized = false;
I think teardown should be LIFO order to initialization. I would move
this line to the beginning of the function before any resources are
actually released.
Not really sure if this is applicable here. I understand Your point with
LIFO but in my opinion at the beginning we should unregister PTP clock
and when done - set the flag to false;
+}
<snip>
--
Thanks,
Rahul Rameshbabu