Skip to contentSkip to conversation

dpll: add all inputs phase offset monitor

PATCH Superseded Arkadiusz Kubalewski 2 participants 12 messages May 8, 2025 – May 23, 2025

Subsystems (7)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Arkadiusz Kubalewski

author maintainer
#0 lore raw

v3 cover dpll: add all inputs phase offset monitor

Add dpll device level feature: phase offset monitor.

Phase offset measurement is typically performed against the current active source. However, some DPLL (Digital Phase-Locked Loop) devices may offer the capability to monitor phase offsets across all available inputs. The attribute and current feature state shall be included in the response message of the ``DPLL_CMD_DEVICE_GET`` command for supported DPLL devices. In such cases, users can also control the feature using the ``DPLL_CMD_DEVICE_SET`` command by setting the ``enum dpll_feature_state`` values for the attribute.

Implement feature support in ice driver for dpll-enabled devices.

Verify capability:

$ ./tools/net/ynl/pyynl/cli.py \
 --spec Documentation/netlink/specs/dpll.yaml \
 --dump device-get
[{'clock-id': 4658613174691613800,
  'id': 0,
  'lock-status': 'locked-ho-acq',
  'mode': 'automatic',
  'mode-supported': ['automatic'],
  'module-name': 'ice',
  'type': 'eec'},
 {'clock-id': 4658613174691613800,
  'id': 1,
  'lock-status': 'locked-ho-acq',
  'mode': 'automatic',
  'mode-supported': ['automatic'],
  'module-name': 'ice',
  'phase-offset-monitor': 'disable',
  'type': 'pps'}]

Enable the feature:

$ ./tools/net/ynl/pyynl/cli.py \
 --spec Documentation/netlink/specs/dpll.yaml \
 --do device-set --json '{"id":1, "phase-offset-monitor":"enable"}'

Verify feature is enabled:

$ ./tools/net/ynl/pyynl/cli.py \
 --spec Documentation/netlink/specs/dpll.yaml \
 --dump device-get
[
 [...]
 {'capabilities': {'all-inputs-phase-offset-monitor'},
  'clock-id': 4658613174691613800,
  'id': 1,
 [...]
  'phase-offset-monitor': 'enable',
 [...]]

v3:
- removed patch 1/4:
"dpll: use struct dpll_device_info for dpll registration"

Arkadiusz Kubalewski (3):
dpll: add phase-offset-monitor feature to netlink spec
dpll: add phase_offset_monitor_get/set callbacks
ice: add phase offset monitor for all PPS dpll inputs

 Documentation/driver-api/dpll.rst             |  16 ++
 Documentation/netlink/specs/dpll.yaml         |  24 +++
 drivers/dpll/dpll_netlink.c                   |  76 ++++++-
 drivers/dpll/dpll_nl.c                        |   5 +-
 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |  20 ++
 drivers/net/ethernet/intel/ice/ice_common.c   |  26 +++
 drivers/net/ethernet/intel/ice/ice_common.h   |   3 +
 drivers/net/ethernet/intel/ice/ice_dpll.c     | 191 +++++++++++++++++-
 drivers/net/ethernet/intel/ice/ice_dpll.h     |   6 +
 drivers/net/ethernet/intel/ice/ice_main.c     |   4 +
 include/linux/dpll.h                          |   8 +
 include/uapi/linux/dpll.h                     |  12 ++
 12 files changed, 386 insertions(+), 5 deletions(-)

base-commit: 46431fd5224f7f3bab2823992ae1cf6f2700f1ce

Signature · 1 line
2.38.1
author maintainer
#1 lore raw

PATCH v3 1/3 dpll: add phase-offset-monitor feature to netlink spec

Add enum dpll_feature_state for control over features.

Add dpll device level attribute:
DPLL_A_PHASE_OFFSET_MONITOR - to allow control over a phase offset monitor feature. Attribute is present and shall return current state of a feature (enum dpll_feature_state), if the device driver provides such capability, otherwie attribute shall not be present.

---
v3:
- replace feature flags and capabilities with per feature attribute approach,
- add dpll documentation for phase-offset-monitor feature.

---
 Documentation/driver-api/dpll.rst     | 16 ++++++++++++++++
 Documentation/netlink/specs/dpll.yaml | 24 ++++++++++++++++++++++++
 drivers/dpll/dpll_nl.c                |  5 +++--
 include/uapi/linux/dpll.h             | 12 ++++++++++++
 4 files changed, 55 insertions(+), 2 deletions(-)
Documentation/driver-api/dpll.rst +16 -0
index e6855cd37e85..04efb425b411 100644
@@ -214,6 +214,22 @@ offset values are fractional with 3-digit decimal places and shell be
 divided with ``DPLL_PIN_PHASE_OFFSET_DIVIDER`` to get integer part and
 modulo divided to get fractional part.
 
+Phase offset monitor
+====================
+
+Phase offset measurement is typically performed against the current active
+source. However, some DPLL (Digital Phase-Locked Loop) devices may offer
+the capability to monitor phase offsets across all available inputs.
+The attribute and current feature state shall be included in the response
+message of the ``DPLL_CMD_DEVICE_GET`` command for supported DPLL devices.
+In such cases, users can also control the feature using the
+``DPLL_CMD_DEVICE_SET`` command by setting the ``enum dpll_feature_state``
+values for the attribute.
+
+  =============================== ========================
+  ``DPLL_A_PHASE_OFFSET_MONITOR`` attr state of a feature
+  =============================== ========================
+
 Embedded SYNC
 =============
 
Documentation/netlink/specs/dpll.yaml +24 -0
index 8feefeae5376..e9774678b3f3 100644
@@ -240,6 +240,20 @@ definitions:
       integer part of a measured phase offset value.
       Value of (DPLL_A_PHASE_OFFSET % DPLL_PHASE_OFFSET_DIVIDER) is a
       fractional part of a measured phase offset value.
+  -
+    type: enum
+    name: feature-state
+    doc: |
+      Allow control (enable/disable) and status checking over features.
+    entries:
+      -
+        name: disable
+        doc: |
+          feature shall be disabled
+      -
+        name: enable
+        doc: |
+          feature shall be enabled
 
 attribute-sets:
   -
@@ -293,6 +307,14 @@ attribute-sets:
           be put to message multiple times to indicate possible parallel
           quality levels (e.g. one specified by ITU option 1 and another
           one specified by option 2).
+      -
+        name: phase-offset-monitor
+        type: u32
+        enum: feature-state
+        doc: Receive or request state of phase offset monitor feature.
+          If enabled, dpll device shall monitor and notify all currently
+          available inputs for changes of their phase offset against the
+          dpll device.
   -
     name: pin
     enum-name: dpll_a_pin
@@ -483,6 +505,7 @@ operations:
             - temp
             - clock-id
             - type
+            - phase-offset-monitor
 
       dump:
         reply: *dev-attrs
@@ -499,6 +522,7 @@ operations:
         request:
           attributes:
             - id
+            - phase-offset-monitor
     -
       name: device-create-ntf
       doc: Notification about device appearing
drivers/dpll/dpll_nl.c +3 -2
index fe9b6893d261..8de90310c3be 100644
@@ -37,8 +37,9 @@ static const struct nla_policy dpll_device_get_nl_policy[DPLL_A_ID + 1] = {
 };
 
 /* DPLL_CMD_DEVICE_SET - do */
-static const struct nla_policy dpll_device_set_nl_policy[DPLL_A_ID + 1] = {
+static const struct nla_policy dpll_device_set_nl_policy[DPLL_A_PHASE_OFFSET_MONITOR + 1] = {
 	[DPLL_A_ID] = { .type = NLA_U32, },
+	[DPLL_A_PHASE_OFFSET_MONITOR] = NLA_POLICY_MAX(NLA_U32, 1),
 };
 
 /* DPLL_CMD_PIN_ID_GET - do */
@@ -105,7 +106,7 @@ static const struct genl_split_ops dpll_nl_ops[] = {
 		.doit		= dpll_nl_device_set_doit,
 		.post_doit	= dpll_post_doit,
 		.policy		= dpll_device_set_nl_policy,
-		.maxattr	= DPLL_A_ID,
+		.maxattr	= DPLL_A_PHASE_OFFSET_MONITOR,
 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
 	},
 	{
include/uapi/linux/dpll.h +12 -0
index bf97d4b6d51f..349e1b3ca1ae 100644
@@ -192,6 +192,17 @@ enum dpll_pin_capabilities {
 
 #define DPLL_PHASE_OFFSET_DIVIDER	1000
 
+/**
+ * enum dpll_feature_state - Allow control (enable/disable) and status checking
+ *   over features.
+ * @DPLL_FEATURE_STATE_DISABLE: feature shall be disabled
+ * @DPLL_FEATURE_STATE_ENABLE: feature shall be enabled
+ */
+enum dpll_feature_state {
+	DPLL_FEATURE_STATE_DISABLE,
+	DPLL_FEATURE_STATE_ENABLE,
+};
+
 enum dpll_a {
 	DPLL_A_ID = 1,
 	DPLL_A_MODULE_NAME,
@@ -204,6 +215,7 @@ enum dpll_a {
 	DPLL_A_TYPE,
 	DPLL_A_LOCK_STATUS_ERROR,
 	DPLL_A_CLOCK_QUALITY_LEVEL,
+	DPLL_A_PHASE_OFFSET_MONITOR,
 
 	__DPLL_A_MAX,
 	DPLL_A_MAX = (__DPLL_A_MAX - 1)
Signature · 1 line
2.38.1
maintainer
#2 lore raw

Re: [PATCH net-next v3 1/3] dpll: add phase-offset-monitor feature to netlink spec

Quoted 62 lines · Thu, May 08, 2025 at 02:21:26PM +0200, [email protected] wrote:

Add enum dpll_feature_state for control over features.

Add dpll device level attribute:
DPLL_A_PHASE_OFFSET_MONITOR - to allow control over a phase offset monitor feature. Attribute is present and shall return current state of a feature (enum dpll_feature_state), if the device driver provides such capability, otherwie attribute shall not be present.

---
v3:
- replace feature flags and capabilities with per feature attribute approach,
- add dpll documentation for phase-offset-monitor feature.
---

Documentation/driver-api/dpll.rst     | 16 ++++++++++++++++
Documentation/netlink/specs/dpll.yaml | 24 ++++++++++++++++++++++++
drivers/dpll/dpll_nl.c                |  5 +++--
include/uapi/linux/dpll.h             | 12 ++++++++++++
4 files changed, 55 insertions(+), 2 deletions(-)
Documentation/driver-api/dpll.rst +0 -0
index e6855cd37e85..04efb425b411 100644
@@ -214,6 +214,22 @@ offset values are fractional with 3-digit decimal places and shell be

divided with ``DPLL_PIN_PHASE_OFFSET_DIVIDER`` to get integer part and modulo divided to get fractional part.

Documentation/driver-api/dpll.rst +16 -0
+Phase offset monitor
+====================
+
+Phase offset measurement is typically performed against the current active
+source. However, some DPLL (Digital Phase-Locked Loop) devices may offer
+the capability to monitor phase offsets across all available inputs.
+The attribute and current feature state shall be included in the response
+message of the ``DPLL_CMD_DEVICE_GET`` command for supported DPLL devices.
+In such cases, users can also control the feature using the
+``DPLL_CMD_DEVICE_SET`` command by setting the ``enum dpll_feature_state``
+values for the attribute.
+
+  =============================== ========================
+  ``DPLL_A_PHASE_OFFSET_MONITOR`` attr state of a feature
+  =============================== ========================
+

Embedded SYNC
=============

Documentation/netlink/specs/dpll.yaml +4 -0
index 8feefeae5376..e9774678b3f3 100644
@@ -240,6 +240,20 @@ definitions:
      integer part of a measured phase offset value.
      Value of (DPLL_A_PHASE_OFFSET % DPLL_PHASE_OFFSET_DIVIDER) is a
      fractional part of a measured phase offset value.
+  -
+    type: enum
+    name: feature-state
+    doc: |

Documentation/netlink/specs/dpll.yaml definitions: · line 256

Quoted 10 lines
Documentation/netlink/specs/dpll.yaml +10 -0
+      Allow control (enable/disable) and status checking over features.
+    entries:
+      -
+        name: disable
+        doc: |
+          feature shall be disabled
+      -
+        name: enable
+        doc: |
+          feature shall be enabled

Is it necessary to introduce an enum for simple bool?
I mean, we used to handle this by U8 attr with 0/1 value. Idk what's the usual way carry boolean values to do this these days, but enum looks like overkill.

Quoted 91 lines

attribute-sets:
-

Documentation/netlink/specs/dpll.yaml +10 -0
@@ -293,6 +307,14 @@ attribute-sets:
          be put to message multiple times to indicate possible parallel
          quality levels (e.g. one specified by ITU option 1 and another
          one specified by option 2).
+      -
+        name: phase-offset-monitor
+        type: u32
+        enum: feature-state
+        doc: Receive or request state of phase offset monitor feature.
+          If enabled, dpll device shall monitor and notify all currently
+          available inputs for changes of their phase offset against the
+          dpll device.
  -
    name: pin
    enum-name: dpll_a_pin
@@ -483,6 +505,7 @@ operations:
            - temp
            - clock-id
            - type
+            - phase-offset-monitor
 
      dump:
        reply: *dev-attrs
@@ -499,6 +522,7 @@ operations:
        request:
          attributes:
            - id
+            - phase-offset-monitor
    -
      name: device-create-ntf
      doc: Notification about device appearing
drivers/dpll/dpll_nl.c +3 -2
index fe9b6893d261..8de90310c3be 100644
@@ -37,8 +37,9 @@ static const struct nla_policy dpll_device_get_nl_policy[DPLL_A_ID + 1] = {
 };
 
 /* DPLL_CMD_DEVICE_SET - do */
-static const struct nla_policy dpll_device_set_nl_policy[DPLL_A_ID + 1] = {
+static const struct nla_policy dpll_device_set_nl_policy[DPLL_A_PHASE_OFFSET_MONITOR + 1] = {
 	[DPLL_A_ID] = { .type = NLA_U32, },
+	[DPLL_A_PHASE_OFFSET_MONITOR] = NLA_POLICY_MAX(NLA_U32, 1),
 };
 
 /* DPLL_CMD_PIN_ID_GET - do */
@@ -105,7 +106,7 @@ static const struct genl_split_ops dpll_nl_ops[] = {
 		.doit		= dpll_nl_device_set_doit,
 		.post_doit	= dpll_post_doit,
 		.policy		= dpll_device_set_nl_policy,
-		.maxattr	= DPLL_A_ID,
+		.maxattr	= DPLL_A_PHASE_OFFSET_MONITOR,
 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
 	},
 	{
include/uapi/linux/dpll.h +12 -0
index bf97d4b6d51f..349e1b3ca1ae 100644
@@ -192,6 +192,17 @@ enum dpll_pin_capabilities {
 
 #define DPLL_PHASE_OFFSET_DIVIDER	1000
 
+/**
+ * enum dpll_feature_state - Allow control (enable/disable) and status checking
+ *   over features.
+ * @DPLL_FEATURE_STATE_DISABLE: feature shall be disabled
+ * @DPLL_FEATURE_STATE_ENABLE: feature shall be enabled
+ */
+enum dpll_feature_state {
+	DPLL_FEATURE_STATE_DISABLE,
+	DPLL_FEATURE_STATE_ENABLE,
+};
+
 enum dpll_a {
 	DPLL_A_ID = 1,
 	DPLL_A_MODULE_NAME,
@@ -204,6 +215,7 @@ enum dpll_a {
 	DPLL_A_TYPE,
 	DPLL_A_LOCK_STATUS_ERROR,
 	DPLL_A_CLOCK_QUALITY_LEVEL,
+	DPLL_A_PHASE_OFFSET_MONITOR,
 
 	__DPLL_A_MAX,
 	DPLL_A_MAX = (__DPLL_A_MAX - 1)
Signature · 1 line
2.38.1
author maintainer
#3 lore raw

RE: [PATCH net-next v3 1/3] dpll: add phase-offset-monitor feature to netlink spec

Quoted 80 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, May 8, 2025 4:26 PM

Thu, May 08, 2025 at 02:21:26PM +0200, [email protected]

Quoted 38 lines · wrote:

Add enum dpll_feature_state for control over features.

Add dpll device level attribute:
DPLL_A_PHASE_OFFSET_MONITOR - to allow control over a phase offset monitor feature. Attribute is present and shall return current state of a feature (enum dpll_feature_state), if the device driver provides such capability, otherwie attribute shall not be present.

---
v3:
- replace feature flags and capabilities with per feature attribute approach,
- add dpll documentation for phase-offset-monitor feature.
---

Documentation/driver-api/dpll.rst     | 16 ++++++++++++++++
Documentation/netlink/specs/dpll.yaml | 24 ++++++++++++++++++++++++
drivers/dpll/dpll_nl.c                |  5 +++--
include/uapi/linux/dpll.h             | 12 ++++++++++++
4 files changed, 55 insertions(+), 2 deletions(-)
Documentation/driver- renamed from Documentation/driver-api/dpll.rst +0 -0

api/dpll.rst
index e6855cd37e85..04efb425b411 100644

Documentation/driver-api/dpll.rst +0 -0
@@ -214,6 +214,22 @@ offset values are fractional with 3-digit decimal

places and shell be
divided with ``DPLL_PIN_PHASE_OFFSET_DIVIDER`` to get integer part and modulo divided to get fractional part.

Documentation/driver-api/dpll.rst +4 -0
+Phase offset monitor
+====================
+
+Phase offset measurement is typically performed against the current

active

Documentation/driver-api/dpll.rst offset values are fractional with 3-digit decimal places and shell be

Quoted 4 lines
Documentation/driver-api/dpll.rst +4 -0
+source. However, some DPLL (Digital Phase-Locked Loop) devices may offer
+the capability to monitor phase offsets across all available inputs.
+The attribute and current feature state shall be included in the response
+message of the ``DPLL_CMD_DEVICE_GET`` command for supported DPLL

devices.

Quoted 32 lines

+In such cases, users can also control the feature using the +``DPLL_CMD_DEVICE_SET`` command by setting the ``enum dpll_feature_state``

Documentation/driver-api/dpll.rst +6 -0
+values for the attribute.
+
+  =============================== ========================
+  ``DPLL_A_PHASE_OFFSET_MONITOR`` attr state of a feature
+  =============================== ========================
+

Embedded SYNC
=============

Documentation/netlink/specs/dpll.yaml +11 -0
index 8feefeae5376..e9774678b3f3 100644
@@ -240,6 +240,20 @@ definitions:
      integer part of a measured phase offset value.
      Value of (DPLL_A_PHASE_OFFSET % DPLL_PHASE_OFFSET_DIVIDER) is a
      fractional part of a measured phase offset value.
+  -
+    type: enum
+    name: feature-state
+    doc: |
+      Allow control (enable/disable) and status checking over features.
+    entries:
+      -
+        name: disable
+        doc: |
+          feature shall be disabled
+      -
Quoted 9 lines

Documentation/netlink/specs/dpll.yaml definitions: · line 256

Quoted 3 lines
Documentation/netlink/specs/dpll.yaml +3 -0
+        name: enable
+        doc: |
+          feature shall be enabled

Is it necessary to introduce an enum for simple bool?
I mean, we used to handle this by U8 attr with 0/1 value. Idk what's the usual way carry boolean values to do this these days, but enum looks like overkill.

Well, yeah.. tricky.. There is no bool type in the attribute types? Input/output pin direction or eec/pps dpll types are also 2-value-enums we use same way..

Had to use something as it is better then plain 0/1, also those values could be reused for any other feature.

Thank you!
Arkadiusz

[...]

maintainer
#4 lore raw

Re: [PATCH net-next v3 1/3] dpll: add phase-offset-monitor feature to netlink spec

Quoted 90 lines · Thu, May 08, 2025 at 05:29:07PM +0200, [email protected] wrote:
Quoted 80 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, May 8, 2025 4:26 PM

Thu, May 08, 2025 at 02:21:26PM +0200, [email protected]

Quoted 38 lines · wrote:

Add enum dpll_feature_state for control over features.

Add dpll device level attribute:
DPLL_A_PHASE_OFFSET_MONITOR - to allow control over a phase offset monitor feature. Attribute is present and shall return current state of a feature (enum dpll_feature_state), if the device driver provides such capability, otherwie attribute shall not be present.

---
v3:
- replace feature flags and capabilities with per feature attribute approach,
- add dpll documentation for phase-offset-monitor feature.
---

Documentation/driver-api/dpll.rst     | 16 ++++++++++++++++
Documentation/netlink/specs/dpll.yaml | 24 ++++++++++++++++++++++++
drivers/dpll/dpll_nl.c                |  5 +++--
include/uapi/linux/dpll.h             | 12 ++++++++++++
4 files changed, 55 insertions(+), 2 deletions(-)
Documentation/driver- renamed from Documentation/driver-api/dpll.rst +0 -0

api/dpll.rst
index e6855cd37e85..04efb425b411 100644

Documentation/driver-api/dpll.rst +0 -0
@@ -214,6 +214,22 @@ offset values are fractional with 3-digit decimal

places and shell be
divided with ``DPLL_PIN_PHASE_OFFSET_DIVIDER`` to get integer part and modulo divided to get fractional part.

Documentation/driver-api/dpll.rst +4 -0
+Phase offset monitor
+====================
+
+Phase offset measurement is typically performed against the current

active

Documentation/driver-api/dpll.rst offset values are fractional with 3-digit decimal places and shell be

Quoted 4 lines
Documentation/driver-api/dpll.rst +4 -0
+source. However, some DPLL (Digital Phase-Locked Loop) devices may offer
+the capability to monitor phase offsets across all available inputs.
+The attribute and current feature state shall be included in the response
+message of the ``DPLL_CMD_DEVICE_GET`` command for supported DPLL

devices.

Quoted 32 lines

+In such cases, users can also control the feature using the +``DPLL_CMD_DEVICE_SET`` command by setting the ``enum dpll_feature_state``

Documentation/driver-api/dpll.rst +6 -0
+values for the attribute.
+
+  =============================== ========================
+  ``DPLL_A_PHASE_OFFSET_MONITOR`` attr state of a feature
+  =============================== ========================
+

Embedded SYNC
=============

Documentation/netlink/specs/dpll.yaml +11 -0
index 8feefeae5376..e9774678b3f3 100644
@@ -240,6 +240,20 @@ definitions:
      integer part of a measured phase offset value.
      Value of (DPLL_A_PHASE_OFFSET % DPLL_PHASE_OFFSET_DIVIDER) is a
      fractional part of a measured phase offset value.
+  -
+    type: enum
+    name: feature-state
+    doc: |
+      Allow control (enable/disable) and status checking over features.
+    entries:
+      -
+        name: disable
+        doc: |
+          feature shall be disabled
+      -
Quoted 9 lines

Documentation/netlink/specs/dpll.yaml definitions: · line 256

Quoted 3 lines
Documentation/netlink/specs/dpll.yaml +3 -0
+        name: enable
+        doc: |
+          feature shall be enabled

Is it necessary to introduce an enum for simple bool?
I mean, we used to handle this by U8 attr with 0/1 value. Idk what's the usual way carry boolean values to do this these days, but enum looks like overkill.

Quoted 6 lines

Well, yeah.. tricky.. There is no bool type in the attribute types? Input/output pin direction or eec/pps dpll types are also 2-value-enums we use same way..

Had to use something as it is better then plain 0/1, also those values could be reused for any other feature.

Okay, I don't mind.

Quoted 5 lines

Thank you!
Arkadiusz

[...]

author maintainer
#5 lore raw

PATCH v3 2/3 dpll: add phase_offset_monitor_get/set callback ops

In reply to Arkadiusz Kubalewski

Add new callback operations for a dpll device:
- phase_offset_monitor_get(..) - to obtain current state of phase offset monitor feature from dpll device,
- phase_offset_monitor_set(..) - to allow feature configuration.

Obtain the feature state value using the get callback and provide it to the user if the device driver implements callbacks.

Execute the set callback upon user requests.

---
v3:
- remove feature flags and capabilities,
- add separated (per feature) callback ops,
- use callback ops to determine feature availability.

---
 drivers/dpll/dpll_netlink.c | 76 ++++++++++++++++++++++++++++++++++++-
 include/linux/dpll.h        |  8 ++++
 2 files changed, 82 insertions(+), 2 deletions(-)
drivers/dpll/dpll_netlink.c +74 -2
index c130f87147fa..6d2980455a46 100644
@@ -126,6 +126,26 @@ dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll,
 	return 0;
 }
 
+static int
+dpll_msg_add_phase_offset_monitor(struct sk_buff *msg, struct dpll_device *dpll,
+				  struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state;
+	int ret;
+
+	if (ops->phase_offset_monitor_set && ops->phase_offset_monitor_get) {
+		ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
+						    &state, extack);
+		if (ret)
+			return -EINVAL;
+		if (nla_put_u32(msg, DPLL_A_PHASE_OFFSET_MONITOR, state))
+			return -EMSGSIZE;
+	}
+
+	return 0;
+}
+
 static int
 dpll_msg_add_lock_status(struct sk_buff *msg, struct dpll_device *dpll,
 			 struct netlink_ext_ack *extack)
@@ -591,6 +611,9 @@ dpll_device_get_one(struct dpll_device *dpll, struct sk_buff *msg,
 		return ret;
 	if (nla_put_u32(msg, DPLL_A_TYPE, dpll->type))
 		return -EMSGSIZE;
+	ret = dpll_msg_add_phase_offset_monitor(msg, dpll, extack);
+	if (ret)
+		return ret;
 
 	return 0;
 }
@@ -746,6 +769,31 @@ int dpll_pin_change_ntf(struct dpll_pin *pin)
 }
 EXPORT_SYMBOL_GPL(dpll_pin_change_ntf);
 
+static int
+dpll_phase_offset_monitor_set(struct dpll_device *dpll, struct nlattr *a,
+			      struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state = nla_get_u32(a), old_state;
+	int ret;
+
+	if (!(ops->phase_offset_monitor_set && ops->phase_offset_monitor_get)) {
+		NL_SET_ERR_MSG_ATTR(extack, a, "dpll device not capable of phase offset monitor");
+		return -EOPNOTSUPP;
+	}
+	ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll), &old_state,
+					    extack);
+	if (ret) {
+		NL_SET_ERR_MSG(extack, "unable to get current state of phase offset monitor");
+		return -EINVAL;
+	}
+	if (state == old_state)
+		return 0;
+
+	return ops->phase_offset_monitor_set(dpll, dpll_priv(dpll), state,
+					     extack);
+}
+
 static int
 dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a,
 		  struct netlink_ext_ack *extack)
@@ -1533,10 +1581,34 @@ int dpll_nl_device_get_doit(struct sk_buff *skb, struct genl_info *info)
 	return genlmsg_reply(msg, info);
 }
 
+static int
+dpll_set_from_nlattr(struct dpll_device *dpll, struct genl_info *info)
+{
+	struct nlattr *a;
+	int rem, ret;
+
+	nla_for_each_attr(a, genlmsg_data(info->genlhdr),
+			  genlmsg_len(info->genlhdr), rem) {
+		switch (nla_type(a)) {
+		case DPLL_A_PHASE_OFFSET_MONITOR:
+			ret = dpll_phase_offset_monitor_set(dpll, a,
+							    info->extack);
+			if (ret)
+				return ret;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return 0;
+}
+
 int dpll_nl_device_set_doit(struct sk_buff *skb, struct genl_info *info)
 {
-	/* placeholder for set command */
-	return 0;
+	struct dpll_device *dpll = info->user_ptr[0];
+
+	return dpll_set_from_nlattr(dpll, info);
 }
 
 int dpll_nl_device_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
include/linux/dpll.h +8 -0
index 5e4f9ab1cf75..6ad6c2968a28 100644
@@ -30,6 +30,14 @@ struct dpll_device_ops {
 				       void *dpll_priv,
 				       unsigned long *qls,
 				       struct netlink_ext_ack *extack);
+	int (*phase_offset_monitor_set)(const struct dpll_device *dpll,
+					void *dpll_priv,
+					enum dpll_feature_state state,
+					struct netlink_ext_ack *extack);
+	int (*phase_offset_monitor_get)(const struct dpll_device *dpll,
+					void *dpll_priv,
+					enum dpll_feature_state *state,
+					struct netlink_ext_ack *extack);
 };
 
 struct dpll_pin_ops {
Signature · 1 line
2.38.1
maintainer
#6 lore raw

Re: [PATCH net-next v3 2/3] dpll: add phase_offset_monitor_get/set callback ops

Quoted 33 lines · Thu, May 08, 2025 at 02:21:27PM +0200, [email protected] wrote:

Add new callback operations for a dpll device:
- phase_offset_monitor_get(..) - to obtain current state of phase offset monitor feature from dpll device,
- phase_offset_monitor_set(..) - to allow feature configuration.

Obtain the feature state value using the get callback and provide it to the user if the device driver implements callbacks.

Execute the set callback upon user requests.

---
v3:
- remove feature flags and capabilities,
- add separated (per feature) callback ops,
- use callback ops to determine feature availability.
---
drivers/dpll/dpll_netlink.c | 76 ++++++++++++++++++++++++++++++++++++-
include/linux/dpll.h | 8 ++++

2 files changed, 82 insertions(+), 2 deletions(-)
drivers/dpll/dpll_netlink.c +3 -0
index c130f87147fa..6d2980455a46 100644
@@ -126,6 +126,26 @@ dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll,
 	return 0;
 }
 
+static int
+dpll_msg_add_phase_offset_monitor(struct sk_buff *msg, struct dpll_device *dpll,
+				  struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll, · line 141

Quoted 10 lines
drivers/dpll/dpll_netlink.c +10 -0
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state;
+	int ret;
+
+	if (ops->phase_offset_monitor_set && ops->phase_offset_monitor_get) {
+		ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
+						    &state, extack);
+		if (ret)
+			return -EINVAL;

Why you don't propagate "ret"?

Quoted 37 lines
drivers/dpll/dpll_netlink.c +7 -0
+		if (nla_put_u32(msg, DPLL_A_PHASE_OFFSET_MONITOR, state))
+			return -EMSGSIZE;
+	}
+
+	return 0;
+}
+

static int
dpll_msg_add_lock_status(struct sk_buff *msg, struct dpll_device *dpll,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +16 -0
@@ -591,6 +611,9 @@ dpll_device_get_one(struct dpll_device *dpll, struct sk_buff *msg,
 		return ret;
 	if (nla_put_u32(msg, DPLL_A_TYPE, dpll->type))
 		return -EMSGSIZE;
+	ret = dpll_msg_add_phase_offset_monitor(msg, dpll, extack);
+	if (ret)
+		return ret;
 
 	return 0;
 }
@@ -746,6 +769,31 @@ int dpll_pin_change_ntf(struct dpll_pin *pin)
 }
 EXPORT_SYMBOL_GPL(dpll_pin_change_ntf);
 
+static int
+dpll_phase_offset_monitor_set(struct dpll_device *dpll, struct nlattr *a,
+			      struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state = nla_get_u32(a), old_state;
+	int ret;
+
+	if (!(ops->phase_offset_monitor_set && ops->phase_offset_monitor_get)) {
+		NL_SET_ERR_MSG_ATTR(extack, a, "dpll device not capable of phase offset monitor");
+		return -EOPNOTSUPP;
+	}
+	ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll), &old_state,

drivers/dpll/dpll_netlink.c int dpll_pin_change_ntf(struct dpll_pin *pin) · line 794

Quoted 10 lines
drivers/dpll/dpll_netlink.c +10 -0
+					    extack);
+	if (ret) {
+		NL_SET_ERR_MSG(extack, "unable to get current state of phase offset monitor");
+		return -EINVAL;
+	}
+	if (state == old_state)
+		return 0;
+
+	return ops->phase_offset_monitor_set(dpll, dpll_priv(dpll), state,
+					     extack);

Why you need to do this get/set dance? I mean, just call the driver set() op and let it do what is needed there, no?

Quoted 7 lines
drivers/dpll/dpll_netlink.c +2 -0
+}
+

static int
dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +0 -0
@@ -1533,10 +1581,34 @@ int dpll_nl_device_get_doit(struct sk_buff *skb, struct genl_info *info)
 	return genlmsg_reply(msg, info);

drivers/dpll/dpll_netlink.c int dpll_nl_device_get_doit(struct sk_buff *skb, struct genl_info *info) · line 1591

Quoted 10 lines
drivers/dpll/dpll_netlink.c +8 -0
 }
 
+static int
+dpll_set_from_nlattr(struct dpll_device *dpll, struct genl_info *info)
+{
+	struct nlattr *a;
+	int rem, ret;
+
+	nla_for_each_attr(a, genlmsg_data(info->genlhdr),
+			  genlmsg_len(info->genlhdr), rem) {

Hmm, why you iterate? Why you just don't parse to attr array, as it is usually done?

Quoted 47 lines
drivers/dpll/dpll_netlink.c +18 -2
+		switch (nla_type(a)) {
+		case DPLL_A_PHASE_OFFSET_MONITOR:
+			ret = dpll_phase_offset_monitor_set(dpll, a,
+							    info->extack);
+			if (ret)
+				return ret;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return 0;
+}
+
 int dpll_nl_device_set_doit(struct sk_buff *skb, struct genl_info *info)
 {
-	/* placeholder for set command */
-	return 0;
+	struct dpll_device *dpll = info->user_ptr[0];
+
+	return dpll_set_from_nlattr(dpll, info);
 }
 
 int dpll_nl_device_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
include/linux/dpll.h +8 -0
index 5e4f9ab1cf75..6ad6c2968a28 100644
@@ -30,6 +30,14 @@ struct dpll_device_ops {
 				       void *dpll_priv,
 				       unsigned long *qls,
 				       struct netlink_ext_ack *extack);
+	int (*phase_offset_monitor_set)(const struct dpll_device *dpll,
+					void *dpll_priv,
+					enum dpll_feature_state state,
+					struct netlink_ext_ack *extack);
+	int (*phase_offset_monitor_get)(const struct dpll_device *dpll,
+					void *dpll_priv,
+					enum dpll_feature_state *state,
+					struct netlink_ext_ack *extack);
 };
 
 struct dpll_pin_ops {
Signature · 1 line
2.38.1
author maintainer
#7 lore raw

RE: [PATCH net-next v3 2/3] dpll: add phase_offset_monitor_get/set callback ops

Quoted 36 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, May 8, 2025 4:31 PM

Thu, May 08, 2025 at 02:21:27PM +0200, [email protected]

Quoted 31 lines · wrote:

Add new callback operations for a dpll device:
- phase_offset_monitor_get(..) - to obtain current state of phase offset monitor feature from dpll device,
- phase_offset_monitor_set(..) - to allow feature configuration.

Obtain the feature state value using the get callback and provide it to the user if the device driver implements callbacks.

Execute the set callback upon user requests.

---
v3:
- remove feature flags and capabilities,
- add separated (per feature) callback ops,
- use callback ops to determine feature availability.
---
drivers/dpll/dpll_netlink.c | 76 ++++++++++++++++++++++++++++++++++++-
include/linux/dpll.h | 8 ++++

2 files changed, 82 insertions(+), 2 deletions(-)
drivers/dpll/dpll_netlink.c +0 -0
index c130f87147fa..6d2980455a46 100644
@@ -126,6 +126,26 @@ dpll_msg_add_mode_supported(struct sk_buff *msg,
 struct dpll_device *dpll,
 	return 0;
 }
 
Quoted 17 lines
Quoted 4 lines
drivers/dpll/dpll_netlink.c +3 -0
+static int
+dpll_msg_add_phase_offset_monitor(struct sk_buff *msg, struct dpll_device
 *dpll,
+				  struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll, · line 141

Quoted 10 lines
drivers/dpll/dpll_netlink.c +10 -0
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state;
+	int ret;
+
+	if (ops->phase_offset_monitor_set && ops->phase_offset_monitor_get) {
+		ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
+						    &state, extack);
+		if (ret)
+			return -EINVAL;

Why you don't propagate "ret"?

My bad, will fix that.

Quoted 48 lines
Quoted 48 lines
drivers/dpll/dpll_netlink.c +7 -0
+		if (nla_put_u32(msg, DPLL_A_PHASE_OFFSET_MONITOR, state))
+			return -EMSGSIZE;
+	}
+
+	return 0;
+}
+

static int
dpll_msg_add_lock_status(struct sk_buff *msg, struct dpll_device *dpll,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +3 -0
@@ -591,6 +611,9 @@ dpll_device_get_one(struct dpll_device *dpll, struct
 sk_buff *msg,
 		return ret;
 	if (nla_put_u32(msg, DPLL_A_TYPE, dpll->type))
 		return -EMSGSIZE;
+	ret = dpll_msg_add_phase_offset_monitor(msg, dpll, extack);
+	if (ret)
+		return ret;
 
 	return 0;

}

drivers/dpll/dpll_netlink.c +16 -0
@@ -746,6 +769,31 @@ int dpll_pin_change_ntf(struct dpll_pin *pin)
 }
 EXPORT_SYMBOL_GPL(dpll_pin_change_ntf);
 
+static int
+dpll_phase_offset_monitor_set(struct dpll_device *dpll, struct nlattr *a,
+			      struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state = nla_get_u32(a), old_state;
+	int ret;
+
+	if (!(ops->phase_offset_monitor_set && ops-
 phase_offset_monitor_get)) {
+		NL_SET_ERR_MSG_ATTR(extack, a, "dpll device not capable of
 phase offset monitor");
+		return -EOPNOTSUPP;
+	}
+	ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
 &old_state,
+					    extack);
+	if (ret) {
+		NL_SET_ERR_MSG(extack, "unable to get current state of phase

offset monitor");

drivers/dpll/dpll_netlink.c +2 -0
+		return -EINVAL;
+	}
Quoted 9 lines

drivers/dpll/dpll_netlink.c int dpll_pin_change_ntf(struct dpll_pin *pin) · line 794

Quoted 5 lines
drivers/dpll/dpll_netlink.c +5 -0
+	if (state == old_state)
+		return 0;
+
+	return ops->phase_offset_monitor_set(dpll, dpll_priv(dpll), state,
+					     extack);

Why you need to do this get/set dance? I mean, just call the driver set() op and let it do what is needed there, no?

We did it this way from the beginning (during various pin-set related flows).

Quoted 11 lines
Quoted 11 lines
drivers/dpll/dpll_netlink.c +2 -0
+}
+

static int
dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +0 -0
@@ -1533,10 +1581,34 @@ int dpll_nl_device_get_doit(struct sk_buff *skb,
 struct genl_info *info)
 	return genlmsg_reply(msg, info);
 }
 
Quoted 12 lines

drivers/dpll/dpll_netlink.c int dpll_nl_device_get_doit(struct sk_buff *skb, struct genl_info *info) · line 1591

Quoted 8 lines
drivers/dpll/dpll_netlink.c +8 -0
+static int
+dpll_set_from_nlattr(struct dpll_device *dpll, struct genl_info *info)
+{
+	struct nlattr *a;
+	int rem, ret;
+
+	nla_for_each_attr(a, genlmsg_data(info->genlhdr),
+			  genlmsg_len(info->genlhdr), rem) {

Hmm, why you iterate? Why you just don't parse to attr array, as it is usually done?

Hmm, AFAIR there are issues when you parse nested stuff with the array approach, here nothing is nested, but we already have the same approach on parsing pin related stuff (dpll_pin_set_from_nlattr(..)), just did the same here.

Thank you!
Arkadiusz

Quoted 49 lines
Quoted 49 lines
drivers/dpll/dpll_netlink.c +18 -2
+		switch (nla_type(a)) {
+		case DPLL_A_PHASE_OFFSET_MONITOR:
+			ret = dpll_phase_offset_monitor_set(dpll, a,
+							    info->extack);
+			if (ret)
+				return ret;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return 0;
+}
+
 int dpll_nl_device_set_doit(struct sk_buff *skb, struct genl_info *info)
 {
-	/* placeholder for set command */
-	return 0;
+	struct dpll_device *dpll = info->user_ptr[0];
+
+	return dpll_set_from_nlattr(dpll, info);
 }
 

int dpll_nl_device_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)

include/linux/dpll.h +8 -1
index 5e4f9ab1cf75..6ad6c2968a28 100644
@@ -30,6 +30,14 @@ struct dpll_device_ops {
 				       void *dpll_priv,
 				       unsigned long *qls,
 				       struct netlink_ext_ack *extack);
+	int (*phase_offset_monitor_set)(const struct dpll_device *dpll,
+					void *dpll_priv,
+					enum dpll_feature_state state,
+					struct netlink_ext_ack *extack);
+	int (*phase_offset_monitor_get)(const struct dpll_device *dpll,
+					void *dpll_priv,
+					enum dpll_feature_state *state,
+					struct netlink_ext_ack *extack);
 };
 
 struct dpll_pin_ops {
--

2.38.1

maintainer
#8 lore raw

Re: [PATCH net-next v3 2/3] dpll: add phase_offset_monitor_get/set callback ops

Quoted 95 lines · Thu, May 08, 2025 at 05:20:24PM +0200, [email protected] wrote:
Quoted 36 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, May 8, 2025 4:31 PM

Thu, May 08, 2025 at 02:21:27PM +0200, [email protected]

Quoted 31 lines · wrote:

Add new callback operations for a dpll device:
- phase_offset_monitor_get(..) - to obtain current state of phase offset monitor feature from dpll device,
- phase_offset_monitor_set(..) - to allow feature configuration.

Obtain the feature state value using the get callback and provide it to the user if the device driver implements callbacks.

Execute the set callback upon user requests.

---
v3:
- remove feature flags and capabilities,
- add separated (per feature) callback ops,
- use callback ops to determine feature availability.
---
drivers/dpll/dpll_netlink.c | 76 ++++++++++++++++++++++++++++++++++++-
include/linux/dpll.h | 8 ++++

2 files changed, 82 insertions(+), 2 deletions(-)
drivers/dpll/dpll_netlink.c +0 -0
index c130f87147fa..6d2980455a46 100644
@@ -126,6 +126,26 @@ dpll_msg_add_mode_supported(struct sk_buff *msg,
 struct dpll_device *dpll,
 	return 0;
 }
 
Quoted 17 lines
Quoted 4 lines
drivers/dpll/dpll_netlink.c +3 -0
+static int
+dpll_msg_add_phase_offset_monitor(struct sk_buff *msg, struct dpll_device
 *dpll,
+				  struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll, · line 141

Quoted 10 lines
drivers/dpll/dpll_netlink.c +10 -0
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state;
+	int ret;
+
+	if (ops->phase_offset_monitor_set && ops->phase_offset_monitor_get) {
+		ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
+						    &state, extack);
+		if (ret)
+			return -EINVAL;

Why you don't propagate "ret"?

My bad, will fix that.

Quoted 39 lines
Quoted 39 lines
drivers/dpll/dpll_netlink.c +7 -0
+		if (nla_put_u32(msg, DPLL_A_PHASE_OFFSET_MONITOR, state))
+			return -EMSGSIZE;
+	}
+
+	return 0;
+}
+

static int
dpll_msg_add_lock_status(struct sk_buff *msg, struct dpll_device *dpll,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +3 -0
@@ -591,6 +611,9 @@ dpll_device_get_one(struct dpll_device *dpll, struct
 sk_buff *msg,
 		return ret;
 	if (nla_put_u32(msg, DPLL_A_TYPE, dpll->type))
 		return -EMSGSIZE;
+	ret = dpll_msg_add_phase_offset_monitor(msg, dpll, extack);
+	if (ret)
+		return ret;
 
 	return 0;

}

drivers/dpll/dpll_netlink.c +11 -0
@@ -746,6 +769,31 @@ int dpll_pin_change_ntf(struct dpll_pin *pin)
 }
 EXPORT_SYMBOL_GPL(dpll_pin_change_ntf);
 
+static int
+dpll_phase_offset_monitor_set(struct dpll_device *dpll, struct nlattr *a,
+			      struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state = nla_get_u32(a), old_state;
+	int ret;
+
+	if (!(ops->phase_offset_monitor_set && ops-
 phase_offset_monitor_get)) {
+		NL_SET_ERR_MSG_ATTR(extack, a, "dpll device not capable of
 phase offset monitor");
+		return -EOPNOTSUPP;
Quoted 8 lines
Quoted 8 lines

drivers/dpll/dpll_netlink.c

Quoted 8 lines
drivers/dpll/dpll_netlink.c +5 -0
+	}
+	ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
 &old_state,
+					    extack);
+	if (ret) {
+		NL_SET_ERR_MSG(extack, "unable to get current state of phase

offset monitor");

drivers/dpll/dpll_netlink.c +1 -0
+		return -EINVAL;

Propagate ret.

Quoted 11 lines
Quoted 10 lines

drivers/dpll/dpll_netlink.c int dpll_pin_change_ntf(struct dpll_pin *pin) · line 794

Quoted 6 lines
drivers/dpll/dpll_netlink.c +6 -0
+	}
+	if (state == old_state)
+		return 0;
+
+	return ops->phase_offset_monitor_set(dpll, dpll_priv(dpll), state,
+					     extack);

Why you need to do this get/set dance? I mean, just call the driver set() op and let it do what is needed there, no?

Quoted 1 line

We did it this way from the beginning (during various pin-set related flows).

Hmm, idk if it is absolutelly necessary to stick with this pattern all the time. I mean, what's the benefit here? I don't see any.

Quoted 25 lines
Quoted 12 lines
Quoted 12 lines
drivers/dpll/dpll_netlink.c +2 -0
+}
+

static int
dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +0 -0
@@ -1533,10 +1581,34 @@ int dpll_nl_device_get_doit(struct sk_buff *skb,
 struct genl_info *info)
 	return genlmsg_reply(msg, info);
 }
 
Quoted 12 lines

drivers/dpll/dpll_netlink.c int dpll_nl_device_get_doit(struct sk_buff *skb, struct genl_info *info) · line 1591

Quoted 8 lines
drivers/dpll/dpll_netlink.c +8 -0
+static int
+dpll_set_from_nlattr(struct dpll_device *dpll, struct genl_info *info)
+{
+	struct nlattr *a;
+	int rem, ret;
+
+	nla_for_each_attr(a, genlmsg_data(info->genlhdr),
+			  genlmsg_len(info->genlhdr), rem) {

Hmm, why you iterate? Why you just don't parse to attr array, as it is usually done?

Quoted 4 lines

Hmm, AFAIR there are issues when you parse nested stuff with the array approach, here nothing is nested, but we already have the same approach on parsing pin related stuff (dpll_pin_set_from_nlattr(..)), just did the same here.

The only reason to iterate over attrs is then you have multiattr. Is ever attr is there only once, no need for iteration.

Quoted 54 lines

Thank you!
Arkadiusz

Quoted 49 lines
Quoted 49 lines
drivers/dpll/dpll_netlink.c +18 -2
+		switch (nla_type(a)) {
+		case DPLL_A_PHASE_OFFSET_MONITOR:
+			ret = dpll_phase_offset_monitor_set(dpll, a,
+							    info->extack);
+			if (ret)
+				return ret;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return 0;
+}
+
 int dpll_nl_device_set_doit(struct sk_buff *skb, struct genl_info *info)
 {
-	/* placeholder for set command */
-	return 0;
+	struct dpll_device *dpll = info->user_ptr[0];
+
+	return dpll_set_from_nlattr(dpll, info);
 }
 

int dpll_nl_device_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)

include/linux/dpll.h +8 -1
index 5e4f9ab1cf75..6ad6c2968a28 100644
@@ -30,6 +30,14 @@ struct dpll_device_ops {
 				       void *dpll_priv,
 				       unsigned long *qls,
 				       struct netlink_ext_ack *extack);
+	int (*phase_offset_monitor_set)(const struct dpll_device *dpll,
+					void *dpll_priv,
+					enum dpll_feature_state state,
+					struct netlink_ext_ack *extack);
+	int (*phase_offset_monitor_get)(const struct dpll_device *dpll,
+					void *dpll_priv,
+					enum dpll_feature_state *state,
+					struct netlink_ext_ack *extack);
 };
 
 struct dpll_pin_ops {
--

2.38.1

author maintainer
#9 lore raw

RE: [PATCH net-next v3 2/3] dpll: add phase_offset_monitor_get/set callback ops

Quoted 104 lines

From: Jiri Pirko <[email protected]>
Sent: Friday, May 9, 2025 8:15 AM

Thu, May 08, 2025 at 05:20:24PM +0200, [email protected]

Quoted 99 lines · wrote:
Quoted 45 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, May 8, 2025 4:31 PM

Thu, May 08, 2025 at 02:21:27PM +0200, [email protected]

Quoted 40 lines · wrote:

Add new callback operations for a dpll device:
- phase_offset_monitor_get(..) - to obtain current state of phase offset monitor feature from dpll device,
- phase_offset_monitor_set(..) - to allow feature configuration.

Obtain the feature state value using the get callback and provide it to the user if the device driver implements callbacks.

Execute the set callback upon user requests.

---
v3:
- remove feature flags and capabilities,
- add separated (per feature) callback ops,
- use callback ops to determine feature availability.
---
drivers/dpll/dpll_netlink.c | 76 ++++++++++++++++++++++++++++++++++++-
include/linux/dpll.h | 8 ++++

2 files changed, 82 insertions(+), 2 deletions(-)
drivers/dpll/dpll_netlink.c +2 -0
index c130f87147fa..6d2980455a46 100644
@@ -126,6 +126,26 @@ dpll_msg_add_mode_supported(struct sk_buff *msg,
 struct dpll_device *dpll,
 	return 0;
 }
 
+static int
+dpll_msg_add_phase_offset_monitor(struct sk_buff *msg, struct

dpll_device
*dpll,

drivers/dpll/dpll_netlink.c +5 -0
+				  struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state;
+	int ret;
Quoted 9 lines

drivers/dpll/dpll_netlink.c dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll, · line 141

Quoted 6 lines
drivers/dpll/dpll_netlink.c +6 -0
+
+	if (ops->phase_offset_monitor_set && ops->phase_offset_monitor_get) {
+		ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
+						    &state, extack);
+		if (ret)
+			return -EINVAL;

Why you don't propagate "ret"?

My bad, will fix that.

Quoted 42 lines
Quoted 42 lines
drivers/dpll/dpll_netlink.c +7 -0
+		if (nla_put_u32(msg, DPLL_A_PHASE_OFFSET_MONITOR, state))
+			return -EMSGSIZE;
+	}
+
+	return 0;
+}
+

static int
dpll_msg_add_lock_status(struct sk_buff *msg, struct dpll_device *dpll,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +3 -0
@@ -591,6 +611,9 @@ dpll_device_get_one(struct dpll_device *dpll, struct
 sk_buff *msg,
 		return ret;
 	if (nla_put_u32(msg, DPLL_A_TYPE, dpll->type))
 		return -EMSGSIZE;
+	ret = dpll_msg_add_phase_offset_monitor(msg, dpll, extack);
+	if (ret)
+		return ret;
 
 	return 0;

}

drivers/dpll/dpll_netlink.c +13 -0
@@ -746,6 +769,31 @@ int dpll_pin_change_ntf(struct dpll_pin *pin)
 }
 EXPORT_SYMBOL_GPL(dpll_pin_change_ntf);
 
+static int
+dpll_phase_offset_monitor_set(struct dpll_device *dpll, struct nlattr
 *a,
+			      struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state = nla_get_u32(a), old_state;
+	int ret;
+
+	if (!(ops->phase_offset_monitor_set && ops-
 phase_offset_monitor_get)) {
+		NL_SET_ERR_MSG_ATTR(extack, a, "dpll device not capable of
 phase offset monitor");
+		return -EOPNOTSUPP;
+	}
+	ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

drivers/dpll/dpll_netlink.c

Quoted 6 lines

&old_state,

drivers/dpll/dpll_netlink.c +3 -0
+					    extack);
+	if (ret) {
+		NL_SET_ERR_MSG(extack, "unable to get current state of phase

offset monitor");

drivers/dpll/dpll_netlink.c +1 -0
+		return -EINVAL;

Propagate ret.

Sure, will do.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

drivers/dpll/dpll_netlink.c int dpll_pin_change_ntf(struct dpll_pin *pin) · line 794

Quoted 7 lines
drivers/dpll/dpll_netlink.c +6 -0
+	}
+	if (state == old_state)
+		return 0;
+
+	return ops->phase_offset_monitor_set(dpll, dpll_priv(dpll), state,
+					     extack);

Why you need to do this get/set dance? I mean, just call the driver set() op and let it do what is needed there, no?

Quoted 6 lines
Quoted 2 lines

We did it this way from the beginning (during various pin-set related flows).

Hmm, idk if it is absolutelly necessary to stick with this pattern all the time. I mean, what's the benefit here? I don't see any.

Driver implementing callback could do that, or can be done here. Here is earlier/better, right?

Why would we remove this pattern for one flow, and use different for other flows? Doesn't make much sense to me, we could change for all to make it consistent.

Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 11 lines
drivers/dpll/dpll_netlink.c +2 -0
+}
+

static int
dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +0 -0
@@ -1533,10 +1581,34 @@ int dpll_nl_device_get_doit(struct sk_buff *skb,
 struct genl_info *info)
 	return genlmsg_reply(msg, info);

drivers/dpll/dpll_netlink.c int dpll_nl_device_get_doit(struct sk_buff *skb, · line 1592

Quoted 10 lines
drivers/dpll/dpll_netlink.c +8 -0
 }
 
+static int
+dpll_set_from_nlattr(struct dpll_device *dpll, struct genl_info *info)
+{
+	struct nlattr *a;
+	int rem, ret;
+
+	nla_for_each_attr(a, genlmsg_data(info->genlhdr),
+			  genlmsg_len(info->genlhdr), rem) {

Hmm, why you iterate? Why you just don't parse to attr array, as it is usually done?

Quoted 9 lines
Quoted 5 lines

Hmm, AFAIR there are issues when you parse nested stuff with the array approach, here nothing is nested, but we already have the same approach on parsing pin related stuff (dpll_pin_set_from_nlattr(..)), just did the same
here.

The only reason to iterate over attrs is then you have multiattr. Is ever attr is there only once, no need for iteration.

Ok, will do.

Thank you!
Arkadiusz

[...]

maintainer
#10 lore raw

Re: [PATCH net-next v3 2/3] dpll: add phase_offset_monitor_get/set callback ops

Quoted 135 lines · Fri, May 23, 2025 at 09:45:29AM +0200, [email protected] wrote:
Quoted 104 lines

From: Jiri Pirko <[email protected]>
Sent: Friday, May 9, 2025 8:15 AM

Thu, May 08, 2025 at 05:20:24PM +0200, [email protected]

Quoted 99 lines · wrote:
Quoted 45 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, May 8, 2025 4:31 PM

Thu, May 08, 2025 at 02:21:27PM +0200, [email protected]

Quoted 40 lines · wrote:

Add new callback operations for a dpll device:
- phase_offset_monitor_get(..) - to obtain current state of phase offset monitor feature from dpll device,
- phase_offset_monitor_set(..) - to allow feature configuration.

Obtain the feature state value using the get callback and provide it to the user if the device driver implements callbacks.

Execute the set callback upon user requests.

---
v3:
- remove feature flags and capabilities,
- add separated (per feature) callback ops,
- use callback ops to determine feature availability.
---
drivers/dpll/dpll_netlink.c | 76 ++++++++++++++++++++++++++++++++++++-
include/linux/dpll.h | 8 ++++

2 files changed, 82 insertions(+), 2 deletions(-)
drivers/dpll/dpll_netlink.c +2 -0
index c130f87147fa..6d2980455a46 100644
@@ -126,6 +126,26 @@ dpll_msg_add_mode_supported(struct sk_buff *msg,
 struct dpll_device *dpll,
 	return 0;
 }
 
+static int
+dpll_msg_add_phase_offset_monitor(struct sk_buff *msg, struct

dpll_device
*dpll,

drivers/dpll/dpll_netlink.c +5 -0
+				  struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state;
+	int ret;
Quoted 9 lines

drivers/dpll/dpll_netlink.c dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll, · line 141

Quoted 6 lines
drivers/dpll/dpll_netlink.c +6 -0
+
+	if (ops->phase_offset_monitor_set && ops->phase_offset_monitor_get) {
+		ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
+						    &state, extack);
+		if (ret)
+			return -EINVAL;

Why you don't propagate "ret"?

My bad, will fix that.

Quoted 42 lines
Quoted 42 lines
drivers/dpll/dpll_netlink.c +7 -0
+		if (nla_put_u32(msg, DPLL_A_PHASE_OFFSET_MONITOR, state))
+			return -EMSGSIZE;
+	}
+
+	return 0;
+}
+

static int
dpll_msg_add_lock_status(struct sk_buff *msg, struct dpll_device *dpll,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +3 -0
@@ -591,6 +611,9 @@ dpll_device_get_one(struct dpll_device *dpll, struct
 sk_buff *msg,
 		return ret;
 	if (nla_put_u32(msg, DPLL_A_TYPE, dpll->type))
 		return -EMSGSIZE;
+	ret = dpll_msg_add_phase_offset_monitor(msg, dpll, extack);
+	if (ret)
+		return ret;
 
 	return 0;

}

drivers/dpll/dpll_netlink.c +13 -0
@@ -746,6 +769,31 @@ int dpll_pin_change_ntf(struct dpll_pin *pin)
 }
 EXPORT_SYMBOL_GPL(dpll_pin_change_ntf);
 
+static int
+dpll_phase_offset_monitor_set(struct dpll_device *dpll, struct nlattr
 *a,
+			      struct netlink_ext_ack *extack)
+{
+	const struct dpll_device_ops *ops = dpll_device_ops(dpll);
+	enum dpll_feature_state state = nla_get_u32(a), old_state;
+	int ret;
+
+	if (!(ops->phase_offset_monitor_set && ops-
 phase_offset_monitor_get)) {
+		NL_SET_ERR_MSG_ATTR(extack, a, "dpll device not capable of
 phase offset monitor");
+		return -EOPNOTSUPP;
+	}
+	ret = ops->phase_offset_monitor_get(dpll, dpll_priv(dpll),
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

drivers/dpll/dpll_netlink.c

Quoted 6 lines

&old_state,

drivers/dpll/dpll_netlink.c +3 -0
+					    extack);
+	if (ret) {
+		NL_SET_ERR_MSG(extack, "unable to get current state of phase

offset monitor");

drivers/dpll/dpll_netlink.c +1 -0
+		return -EINVAL;

Propagate ret.

Sure, will do.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

drivers/dpll/dpll_netlink.c int dpll_pin_change_ntf(struct dpll_pin *pin) · line 794

Quoted 7 lines
drivers/dpll/dpll_netlink.c +6 -0
+	}
+	if (state == old_state)
+		return 0;
+
+	return ops->phase_offset_monitor_set(dpll, dpll_priv(dpll), state,
+					     extack);

Why you need to do this get/set dance? I mean, just call the driver set() op and let it do what is needed there, no?

Quoted 6 lines
Quoted 2 lines

We did it this way from the beginning (during various pin-set related flows).

Hmm, idk if it is absolutelly necessary to stick with this pattern all the time. I mean, what's the benefit here? I don't see any.

Quoted 6 lines

Driver implementing callback could do that, or can be done here. Here is earlier/better, right?

Why would we remove this pattern for one flow, and use different for other flows? Doesn't make much sense to me, we could change for all to make it consistent.

Fair.

Quoted 43 lines
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
Quoted 12 lines
drivers/dpll/dpll_netlink.c +2 -0
+}
+

static int
dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a,
struct netlink_ext_ack *extack)

drivers/dpll/dpll_netlink.c +0 -0
@@ -1533,10 +1581,34 @@ int dpll_nl_device_get_doit(struct sk_buff *skb,
 struct genl_info *info)
 	return genlmsg_reply(msg, info);

drivers/dpll/dpll_netlink.c int dpll_nl_device_get_doit(struct sk_buff *skb, · line 1592

Quoted 10 lines
drivers/dpll/dpll_netlink.c +8 -0
 }
 
+static int
+dpll_set_from_nlattr(struct dpll_device *dpll, struct genl_info *info)
+{
+	struct nlattr *a;
+	int rem, ret;
+
+	nla_for_each_attr(a, genlmsg_data(info->genlhdr),
+			  genlmsg_len(info->genlhdr), rem) {

Hmm, why you iterate? Why you just don't parse to attr array, as it is usually done?

Quoted 9 lines
Quoted 5 lines

Hmm, AFAIR there are issues when you parse nested stuff with the array approach, here nothing is nested, but we already have the same approach on parsing pin related stuff (dpll_pin_set_from_nlattr(..)), just did the same
here.

The only reason to iterate over attrs is then you have multiattr. Is ever attr is there only once, no need for iteration.

Ok, will do.

Thank you!
Arkadiusz

[...]

author maintainer
#11 lore raw

PATCH v3 3/3 ice: add phase offset monitor for all PPS dpll inputs

In reply to Arkadiusz Kubalewski

Implement a new admin command and helper function to handle and obtain CGU measurements for input pins.

Add new callback operations to control the dpll device-level feature "phase offset monitor," allowing it to be enabled or disabled. If the feature is enabled, provide users with measured phase offsets and notifications.

Initialize PPS DPLL with new callback operations if the feature is supported by the firmware.

---
v3:
- align implementation with v3 changes of the dpll subsystem patches

---
 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |  20 ++
 drivers/net/ethernet/intel/ice/ice_common.c   |  26 +++
 drivers/net/ethernet/intel/ice/ice_common.h   |   3 +
 drivers/net/ethernet/intel/ice/ice_dpll.c     | 191 +++++++++++++++++-
 drivers/net/ethernet/intel/ice/ice_dpll.h     |   6 +
 drivers/net/ethernet/intel/ice/ice_main.c     |   4 +
 6 files changed, 249 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +20 -0
index bdee499f991a..0ae7387e0599 100644
@@ -2272,6 +2272,22 @@ struct ice_aqc_get_pkg_info_resp {
 	struct ice_aqc_get_pkg_info pkg_info[];
 };
 
+#define ICE_CGU_INPUT_PHASE_OFFSET_BYTES	6
+
+struct ice_cgu_input_measure {
+	u8 phase_offset[ICE_CGU_INPUT_PHASE_OFFSET_BYTES];
+	__le32 freq;
+} __packed __aligned(sizeof(__le16));
+
+#define ICE_AQC_GET_CGU_IN_MEAS_DPLL_IDX_M	ICE_M(0xf, 0)
+
+/* Get CGU input measure command response data structure (indirect 0x0C59) */
+struct ice_aqc_get_cgu_input_measure {
+	u8 dpll_idx_opt;
+	u8 length;
+	u8 rsvd[6];
+};
+
 #define ICE_AQC_GET_CGU_MAX_PHASE_ADJ	GENMASK(30, 0)
 
 /* Get CGU abilities command response data structure (indirect 0x0C61) */
@@ -2721,6 +2737,7 @@ struct ice_aq_desc {
 		struct ice_aqc_add_get_update_free_vsi vsi_cmd;
 		struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;
 		struct ice_aqc_download_pkg download_pkg;
+		struct ice_aqc_get_cgu_input_measure get_cgu_input_measure;
 		struct ice_aqc_set_cgu_input_config set_cgu_input_config;
 		struct ice_aqc_get_cgu_input_config get_cgu_input_config;
 		struct ice_aqc_set_cgu_output_config set_cgu_output_config;
@@ -2772,6 +2789,8 @@ enum ice_aq_err {
 	ICE_AQ_RC_OK		= 0,  /* Success */
 	ICE_AQ_RC_EPERM		= 1,  /* Operation not permitted */
 	ICE_AQ_RC_ENOENT	= 2,  /* No such element */
+	ICE_AQ_RC_ESRCH		= 3,  /* Bad opcode */
+	ICE_AQ_RC_EAGAIN	= 8,  /* Try again */
 	ICE_AQ_RC_ENOMEM	= 9,  /* Out of memory */
 	ICE_AQ_RC_EBUSY		= 12, /* Device or resource busy */
 	ICE_AQ_RC_EEXIST	= 13, /* Object already exists */
@@ -2927,6 +2946,7 @@ enum ice_adminq_opc {
 	ice_aqc_opc_get_pkg_info_list			= 0x0C43,
 
 	/* 1588/SyncE commands/events */
+	ice_aqc_opc_get_cgu_input_measure		= 0x0C59,
 	ice_aqc_opc_get_cgu_abilities			= 0x0C61,
 	ice_aqc_opc_set_cgu_input_config		= 0x0C62,
 	ice_aqc_opc_get_cgu_input_config		= 0x0C63,
drivers/net/ethernet/intel/ice/ice_common.c +26 -0
index 4fedf0181c4e..48ff515d7c61 100644
@@ -4970,6 +4970,32 @@ ice_dis_vsi_rdma_qset(struct ice_port_info *pi, u16 count, u32 *qset_teid,
 	return status;
 }
 
+/**
+ * ice_aq_get_cgu_input_pin_measure - get input pin signal measurements
+ * @hw: pointer to the HW struct
+ * @dpll_idx: index of dpll to be measured
+ * @meas: array to be filled with results
+ * @meas_num: max number of results array can hold
+ *
+ * Get CGU measurements (0x0C59) of phase and frequency offsets for input
+ * pins on given dpll.
+ *
+ * Return: 0 on success or negative value on failure.
+ */
+int ice_aq_get_cgu_input_pin_measure(struct ice_hw *hw, u8 dpll_idx,
+				     struct ice_cgu_input_measure *meas,
+				     u16 meas_num)
+{
+	struct ice_aqc_get_cgu_input_measure *cmd;
+	struct ice_aq_desc desc;
+
+	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_cgu_input_measure);
+	cmd = &desc.params.get_cgu_input_measure;
+	cmd->dpll_idx_opt = dpll_idx & ICE_AQC_GET_CGU_IN_MEAS_DPLL_IDX_M;
+
+	return ice_aq_send_cmd(hw, &desc, meas, meas_num * sizeof(*meas), NULL);
+}
+
 /**
  * ice_aq_get_cgu_abilities - get cgu abilities
  * @hw: pointer to the HW struct
drivers/net/ethernet/intel/ice/ice_common.h +3 -0
index 64c530b39191..c70f56d897dc 100644
@@ -229,6 +229,9 @@ void ice_replay_post(struct ice_hw *hw);
 struct ice_q_ctx *
 ice_get_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 q_handle);
 int ice_sbq_rw_reg(struct ice_hw *hw, struct ice_sbq_msg_input *in, u16 flag);
+int ice_aq_get_cgu_input_pin_measure(struct ice_hw *hw, u8 dpll_idx,
+				     struct ice_cgu_input_measure *meas,
+				     u16 meas_num);
 int
 ice_aq_get_cgu_abilities(struct ice_hw *hw,
 			 struct ice_aqc_get_cgu_abilities *abilities);
drivers/net/ethernet/intel/ice/ice_dpll.c +190 -1

254 lines not on this page · raw message

drivers/net/ethernet/intel/ice/ice_dpll.h +6 -0
index c320f1bf7d6d..290babeef58f 100644
@@ -19,6 +19,7 @@
  * @prop: pin properties
  * @freq: current frequency of a pin
  * @phase_adjust: current phase adjust value
+ * @phase_offset: monitored phase offset value
  */
 struct ice_dpll_pin {
 	struct dpll_pin *pin;
@@ -31,6 +32,7 @@ struct ice_dpll_pin {
 	struct dpll_pin_properties prop;
 	u32 freq;
 	s32 phase_adjust;
+	s64 phase_offset;
 	u8 status;
 };
 
@@ -47,6 +49,7 @@ struct ice_dpll_pin {
  * @input_prio: priorities of each input
  * @dpll_state: current dpll sync state
  * @prev_dpll_state: last dpll sync state
+ * @phase_offset_monitor_period: period for phase offset monitor read frequency
  * @active_input: pointer to active input pin
  * @prev_input: pointer to previous active input pin
  */
@@ -64,6 +67,7 @@ struct ice_dpll {
 	enum dpll_lock_status dpll_state;
 	enum dpll_lock_status prev_dpll_state;
 	enum dpll_mode mode;
+	u32 phase_offset_monitor_period;
 	struct dpll_pin *active_input;
 	struct dpll_pin *prev_input;
 };
@@ -80,6 +84,7 @@ struct ice_dpll {
  * @num_inputs: number of input pins available on dpll
  * @num_outputs: number of output pins available on dpll
  * @cgu_state_acq_err_num: number of errors returned during periodic work
+ * @periodic_counter: counter of periodic work executions
  * @base_rclk_idx: idx of first pin used for clock revocery pins
  * @clock_id: clock_id of dplls
  * @input_phase_adj_max: max phase adjust value for an input pins
@@ -97,6 +102,7 @@ struct ice_dplls {
 	u8 num_inputs;
 	u8 num_outputs;
 	int cgu_state_acq_err_num;
+	u32 periodic_counter;
 	u8 base_rclk_idx;
 	u64 clock_id;
 	s32 input_phase_adj_max;
drivers/net/ethernet/intel/ice/ice_main.c +4 -0
index 1fbe13ee93a8..9abc179e1bd3 100644
@@ -7914,6 +7914,10 @@ const char *ice_aq_str(enum ice_aq_err aq_err)
 		return "ICE_AQ_RC_EPERM";
 	case ICE_AQ_RC_ENOENT:
 		return "ICE_AQ_RC_ENOENT";
+	case ICE_AQ_RC_ESRCH:
+		return "ICE_AQ_RC_ESRCH";
+	case ICE_AQ_RC_EAGAIN:
+		return "ICE_AQ_RC_EAGAIN";
 	case ICE_AQ_RC_ENOMEM:
 		return "ICE_AQ_RC_ENOMEM";
 	case ICE_AQ_RC_EBUSY:
Signature · 1 line
2.38.1