Skip to content

Commit 137303f

Browse files
committed
Merge: CNB96: dpll: expose lock status error value to user
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5282 JIRA: https://issues.redhat.com/browse/RHEL-59895 Patches expose dpll lock status error value to user. Signed-off-by: Petr Oros <poros@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2 parents a864659 + 9d10bec commit 137303f

File tree

6 files changed

+85
-5
lines changed

6 files changed

+85
-5
lines changed

Documentation/netlink/specs/dpll.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,40 @@ definitions:
5151
if dpll lock-state was not DPLL_LOCK_STATUS_LOCKED_HO_ACQ, the
5252
dpll's lock-state shall remain DPLL_LOCK_STATUS_UNLOCKED)
5353
render-max: true
54+
-
55+
type: enum
56+
name: lock-status-error
57+
doc: |
58+
if previous status change was done due to a failure, this provides
59+
information of dpll device lock status error.
60+
Valid values for DPLL_A_LOCK_STATUS_ERROR attribute
61+
entries:
62+
-
63+
name: none
64+
doc: |
65+
dpll device lock status was changed without any error
66+
value: 1
67+
-
68+
name: undefined
69+
doc: |
70+
dpll device lock status was changed due to undefined error.
71+
Driver fills this value up in case it is not able
72+
to obtain suitable exact error type.
73+
-
74+
name: media-down
75+
doc: |
76+
dpll device lock status was changed because of associated
77+
media got down.
78+
This may happen for example if dpll device was previously
79+
locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT.
80+
-
81+
name: fractional-frequency-offset-too-high
82+
doc: |
83+
the FFO (Fractional Frequency Offset) between the RX and TX
84+
symbol rate on the media got too high.
85+
This may happen for example if dpll device was previously
86+
locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT.
87+
render-max: true
5488
-
5589
type: const
5690
name: temp-divider
@@ -214,6 +248,10 @@ attribute-sets:
214248
name: type
215249
type: u32
216250
enum: type
251+
-
252+
name: lock-status-error
253+
type: u32
254+
enum: lock-status-error
217255
-
218256
name: pin
219257
enum-name: dpll_a_pin
@@ -380,6 +418,7 @@ operations:
380418
- mode
381419
- mode-supported
382420
- lock-status
421+
- lock-status-error
383422
- temp
384423
- clock-id
385424
- type

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);

include/uapi/linux/dpll.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,35 @@ enum dpll_lock_status {
5050
DPLL_LOCK_STATUS_MAX = (__DPLL_LOCK_STATUS_MAX - 1)
5151
};
5252

53+
/**
54+
* enum dpll_lock_status_error - if previous status change was done due to a
55+
* failure, this provides information of dpll device lock status error. Valid
56+
* values for DPLL_A_LOCK_STATUS_ERROR attribute
57+
* @DPLL_LOCK_STATUS_ERROR_NONE: dpll device lock status was changed without
58+
* any error
59+
* @DPLL_LOCK_STATUS_ERROR_UNDEFINED: dpll device lock status was changed due
60+
* to undefined error. Driver fills this value up in case it is not able to
61+
* obtain suitable exact error type.
62+
* @DPLL_LOCK_STATUS_ERROR_MEDIA_DOWN: dpll device lock status was changed
63+
* because of associated media got down. This may happen for example if dpll
64+
* device was previously locked on an input pin of type
65+
* PIN_TYPE_SYNCE_ETH_PORT.
66+
* @DPLL_LOCK_STATUS_ERROR_FRACTIONAL_FREQUENCY_OFFSET_TOO_HIGH: the FFO
67+
* (Fractional Frequency Offset) between the RX and TX symbol rate on the
68+
* media got too high. This may happen for example if dpll device was
69+
* previously locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT.
70+
*/
71+
enum dpll_lock_status_error {
72+
DPLL_LOCK_STATUS_ERROR_NONE = 1,
73+
DPLL_LOCK_STATUS_ERROR_UNDEFINED,
74+
DPLL_LOCK_STATUS_ERROR_MEDIA_DOWN,
75+
DPLL_LOCK_STATUS_ERROR_FRACTIONAL_FREQUENCY_OFFSET_TOO_HIGH,
76+
77+
/* private: */
78+
__DPLL_LOCK_STATUS_ERROR_MAX,
79+
DPLL_LOCK_STATUS_ERROR_MAX = (__DPLL_LOCK_STATUS_ERROR_MAX - 1)
80+
};
81+
5382
#define DPLL_TEMP_DIVIDER 1000
5483

5584
/**
@@ -150,6 +179,7 @@ enum dpll_a {
150179
DPLL_A_LOCK_STATUS,
151180
DPLL_A_TEMP,
152181
DPLL_A_TYPE,
182+
DPLL_A_LOCK_STATUS_ERROR,
153183

154184
__DPLL_A_MAX,
155185
DPLL_A_MAX = (__DPLL_A_MAX - 1)

0 commit comments

Comments
 (0)