Skip to content

Commit 9d10bec

Browse files
committed
dpll: extend lock_status_get() op by status error and expose to user
JIRA: https://issues.redhat.com/browse/RHEL-59895 Conflicts: - omitted chunk for drivers/ptp/ptp_ocp.c. The patch is not applicable due to missing 09eeb3a ("ptp_ocp: implement DPLL ops"). Upstream commit(s): commit e2ca9e7 Author: Jiri Pirko <jiri@nvidia.com> Date: Tue Jan 30 13:08:30 2024 +0100 dpll: extend lock_status_get() op by status error and expose to user Pass additional argunent status_error over lock_status_get() so drivers can fill it up. In case they do, expose the value over previously introduced attribute to user. Do it only in case the current lock_status is either "unlocked" or "holdover". Signed-off-by: Jiri Pirko <jiri@nvidia.com> Acked-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Petr Oros <poros@redhat.com>
1 parent 2e810d9 commit 9d10bec

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

drivers/dpll/dpll_netlink.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,21 @@ dpll_msg_add_lock_status(struct sk_buff *msg, struct dpll_device *dpll,
131131
struct netlink_ext_ack *extack)
132132
{
133133
const struct dpll_device_ops *ops = dpll_device_ops(dpll);
134+
enum dpll_lock_status_error status_error = 0;
134135
enum dpll_lock_status status;
135136
int ret;
136137

137-
ret = ops->lock_status_get(dpll, dpll_priv(dpll), &status, extack);
138+
ret = ops->lock_status_get(dpll, dpll_priv(dpll), &status,
139+
&status_error, extack);
138140
if (ret)
139141
return ret;
140142
if (nla_put_u32(msg, DPLL_A_LOCK_STATUS, status))
141143
return -EMSGSIZE;
144+
if (status_error &&
145+
(status == DPLL_LOCK_STATUS_UNLOCKED ||
146+
status == DPLL_LOCK_STATUS_HOLDOVER) &&
147+
nla_put_u32(msg, DPLL_A_LOCK_STATUS_ERROR, status_error))
148+
return -EMSGSIZE;
142149

143150
return 0;
144151
}

drivers/net/ethernet/intel/ice/ice_dpll.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ ice_dpll_hw_input_prio_set(struct ice_pf *pf, struct ice_dpll *dpll,
527527
* @dpll: registered dpll pointer
528528
* @dpll_priv: private data pointer passed on dpll registration
529529
* @status: on success holds dpll's lock status
530+
* @status_error: status error value
530531
* @extack: error reporting
531532
*
532533
* Dpll subsystem callback, provides dpll's lock status.
@@ -539,6 +540,7 @@ ice_dpll_hw_input_prio_set(struct ice_pf *pf, struct ice_dpll *dpll,
539540
static int
540541
ice_dpll_lock_status_get(const struct dpll_device *dpll, void *dpll_priv,
541542
enum dpll_lock_status *status,
543+
enum dpll_lock_status_error *status_error,
542544
struct netlink_ext_ack *extack)
543545
{
544546
struct ice_dpll *d = dpll_priv;

drivers/net/ethernet/mellanox/mlx5/core/dpll.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ mlx5_dpll_pin_ffo_get(struct mlx5_dpll_synce_status *synce_status,
118118
return 0;
119119
}
120120

121-
static int mlx5_dpll_device_lock_status_get(const struct dpll_device *dpll,
122-
void *priv,
123-
enum dpll_lock_status *status,
124-
struct netlink_ext_ack *extack)
121+
static int
122+
mlx5_dpll_device_lock_status_get(const struct dpll_device *dpll, void *priv,
123+
enum dpll_lock_status *status,
124+
enum dpll_lock_status_error *status_error,
125+
struct netlink_ext_ack *extack)
125126
{
126127
struct mlx5_dpll_synce_status synce_status;
127128
struct mlx5_dpll *mdpll = priv;

include/linux/dpll.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct dpll_device_ops {
2121
enum dpll_mode *mode, struct netlink_ext_ack *extack);
2222
int (*lock_status_get)(const struct dpll_device *dpll, void *dpll_priv,
2323
enum dpll_lock_status *status,
24+
enum dpll_lock_status_error *status_error,
2425
struct netlink_ext_ack *extack);
2526
int (*temp_get)(const struct dpll_device *dpll, void *dpll_priv,
2627
s32 *temp, struct netlink_ext_ack *extack);

0 commit comments

Comments
 (0)