Create common DPLL configuration API
Subsystems (11)
Kubalewski, Arkadiusz
maintainerRE: [PATCH 09/11] ice: implement dpll interface to control cgu
In reply to Vadim FedorenkoQuoted 7 lines
From: Vadim Fedorenko <[email protected]>
Sent: Monday, July 24, 2023 7:59 PMQuoted 2 lines · Simon Horman
On Thu, Jul 20, 2023 at 10:19:01AM +0100, Vadim Fedorenko wrote:
Quoted 9 lines
Quoted 4 lines
...
Hi Vadim,
Hi Simon!
Thanks for the review. I believe Arkadiusz as the author of the patch will adjust the code accordingly
Yes, will fix all the findings, thank you Simon for pointing them out! Arkadiusz
Quoted 1,038 lines
Quoted 986 lines
Quoted 24 lines
+/**
+ *ice_dpll_cb_unlock- unlock dplls mutex in callback context
+ * @pf: private board structure
+ *
+ * Unlock the mutex from the callback operations invoked by dpll subsystem.
+ */drivers/net/ethernet/intel/ice/ice_dpll.c new file +17
-0+static void ice_dpll_cb_unlock (struct ice_pf *pf) +{ +mutex_unlock (&pf->dplls.lock); +} + +/** +* ice_dpll_pin_freq_set - set pin's frequency +* @pf: private board structure +* @pin: pointer to a pin +* @pin_type: type of pin being configured +* @freq: frequency to be set +* @extack: error reporting +* +* Set requested frequency on a pin. +* +* Context: Called under pf->dplls.lock +* Return: drivers/net/ethernet/intel/ice/ice_dpll.c line 100
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +10
-0+* * 0 - success +* * negative - error on AQ or wrong pin type given +*/ +static int +ice_dpll_pin_freq_set (struct ice_pf *pf,struct ice_dpll_pin *pin, +enum ice_dpll_pin_type pin_type,const u32 freq, +struct netlink_ext_ack *extack) +{ +int ret; +u8 flags;Please arrange local variable declarations for new Networking code in reverse xmas tree order - longest line to shortest.
Quoted 28 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +18
-0+ +switch (pin_type) { +case ICE_DPLL_PIN_TYPE_INPUT : + flags =ICE_AQC_SET_CGU_IN_CFG_FLG1_UPDATE_FREQ ; + ret =ice_aq_set_input_pin_cfg (&pf->hw, pin->idx, flags, + pin->flags[0 ], freq,0 ); +break ; +case ICE_DPLL_PIN_TYPE_OUTPUT : + flags =ICE_AQC_SET_CGU_OUT_CFG_UPDATE_FREQ ; + ret =ice_aq_set_output_pin_cfg (&pf->hw, pin->idx, flags, +0 , freq,0 ); +break ; +default : +return -EINVAL ; + } +if (ret) { + NL_SET_ERR_MSG_FMT(extack, + "err:%d %s failed to set pin freq:%u onpin:%u\n",
drivers/net/ethernet/intel/ice/ice_dpll.c new file +9
-0+ ret, +ice_aq_str (pf->hw.adminq.sq_last_status), + freq, pin->idx); +return ret; + } + pin->freq = freq; + +return 0 ; +}...
Quoted 564 lines
(quoted diff) +76
-0+/** + * ice_dpll_pin_state_update - update pin's state + * @pf: private board struct + * @pin: structure with pin attributes to be updated + * @pin_type: type of pin being updated + * @extack: error reporting + * + * Determine pin current state and frequency, then update struct + * holding the pin info. For input pin states are separated for each + * dpll, for rclk pins states are separated for each parent. + * + * Context: Called under pf->dplls.lock + * Return: + * * 0 - OK + * * negative - error + */ +int +ice_dpll_pin_state_update(struct ice_pf *pf, struct ice_dpll_pin *pin, + enum ice_dpll_pin_type pin_type, + struct netlink_ext_ack *extack) +/** + * ice_dpll_frequency_set - wrapper for pin callback for set frequency + * @pin: pointer to a pin + * @pin_priv: private data pointer passed on pin registration + * @dpll: pointer to dpll + * @dpll_priv: private data pointer passed on dpll registration + * @frequency: frequency to be set + * @extack: error reporting + * @pin_type: type of pin being configured + * + * Wraps internal set frequency command on a pin. + * + * Context: Acquires pf->dplls.lock + * Return: + * * 0 - success + * * negative - error pin not found or couldn't set in hw + */ +static int +ice_dpll_frequency_set(const struct dpll_pin *pin, void *pin_priv, + const struct dpll_device *dpll, void *dpll_priv, + const u32 frequency, + struct netlink_ext_ack *extack, + enum ice_dpll_pin_type pin_type) +{ + struct ice_dpll_pin *p = pin_priv; + struct ice_dpll *d = dpll_priv; + struct ice_pf *pf = d->pf; + int ret; + + ret = ice_dpll_cb_lock(pf, extack); + if (ret) + return ret; + ret = ice_dpll_pin_freq_set(pf, p, pin_type, frequency, extack); + ice_dpll_cb_unlock(pf); + + return ret; +} + +/** + * ice_dpll_input_frequency_set - input pin callback for set frequency + * @pin: pointer to a pin + * @pin_priv: private data pointer passed on pin registration + * @dpll: pointer to dpll + * @dpll_priv: private data pointer passed on dpll registration + * @frequency: frequency to be set + * @extack: error reporting + * + * Wraps internal set frequency command on a pin. + * + * Context: Called under pf->dplls.lock + * Return: + * * 0 - success + * * negative - error pin not found or couldn't set in hw + */ +static int +ice_dpll_input_frequency_set(const struct dpll_pin *pin, void
*pin_priv,drivers/net/ethernet/intel/ice/ice_dpll.c new file +4
-0+ const struct dpll_device *dpll, void *dpll_priv, + u64 frequency, struct netlink_ext_ack *extack) +{ + return ice_dpll_frequency_set(pin, pin_priv, dpll, dpll_priv,frequency,
drivers/net/ethernet/intel/ice/ice_dpll.c new file +5
-0+ extack, ICE_DPLL_PIN_TYPE_INPUT); +} + +/** +* ice_dpll_output_frequency_set - output pin callback for set frequency
+ * @pin: pointer to a pin
+ * @pin_priv: private data pointer passed on pin registration
+ * @dpll: pointer to dpll
+ * @dpll_priv: private data pointer passed on dpll registration
+ * @frequency: frequency to be set
+ * @extack: error reporting
+ *
+ * Wraps internal set frequency command on a pin.
+ *
+ * Context: Called underpf->dplls.lock
+ * Return:
+ * * 0 - success
+ * * negative - error pin not found or couldn't set in hw
+ */(quoted diff) +2
-0+static int +ice_dpll_output_frequency_set(const struct dpll_pin *pin, void
*pin_priv,drivers/net/ethernet/intel/ice/ice_dpll.c new file +4
-0+ const struct dpll_device *dpll, void *dpll_priv, + u64 frequency, struct netlink_ext_ack *extack) +{ + return ice_dpll_frequency_set(pin, pin_priv, dpll, dpll_priv,frequency,
drivers/net/ethernet/intel/ice/ice_dpll.c new file +58
-0+ extack, ICE_DPLL_PIN_TYPE_OUTPUT); +} + +/** +* ice_dpll_frequency_get - wrapper for pin callback for get frequency +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: pointer to dpll +* @dpll_priv: private data pointer passed on dpll registration +* @frequency: on success holds pin's frequency +* @extack: error reporting +* @pin_type: type of pin being configured +* +* Wraps internal get frequency command of a pin. +* +* Context: Acquires pf->dplls.lock +* Return: +* * 0 - success +* * negative - error pin not found or couldn't get from hw +*/ +static int +ice_dpll_frequency_get (const struct dpll_pin *pin,void *pin_priv, +const struct dpll_device *dpll,void *dpll_priv, +u64 *frequency,struct netlink_ext_ack *extack, +enum ice_dpll_pin_type pin_type) +{ +struct ice_dpll_pin *p = pin_priv; +struct ice_dpll *d = dpll_priv; +struct ice_pf *pf = d->pf; +int ret; + + ret =ice_dpll_cb_lock (pf, extack); +if (ret) +return ret; + *frequency = p->freq; +ice_dpll_cb_unlock (pf); + +return 0 ; +} + +/** +* ice_dpll_input_frequency_get - input pin callback for get frequency +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: pointer to dpll +* @dpll_priv: private data pointer passed on dpll registration +* @frequency: on success holds pin's frequency +* @extack: error reporting +* +* Wraps internal get frequency command of a input pin. +* +* Context: Called under pf->dplls.lock +* Return: +* * 0 - success +* * negative - error pin not found or couldn't get from hw +*/ +static int +ice_dpll_input_frequency_get(const struct dpll_pin *pin, void
*pin_priv,drivers/net/ethernet/intel/ice/ice_dpll.c new file +4
-0+ const struct dpll_device *dpll, void *dpll_priv, + u64 *frequency, struct netlink_ext_ack *extack) +{ + return ice_dpll_frequency_get(pin, pin_priv, dpll, dpll_priv,frequency,
drivers/net/ethernet/intel/ice/ice_dpll.c new file +5
-0+ extack, ICE_DPLL_PIN_TYPE_INPUT); +} + +/** +* ice_dpll_output_frequency_get - output pin callback for get frequency
+ * @pin: pointer to a pin
+ * @pin_priv: private data pointer passed on pin registration
+ * @dpll: pointer to dpll
+ * @dpll_priv: private data pointer passed on dpll registration
+ * @frequency: on success holds pin's frequency
+ * @extack: error reporting
+ *
+ * Wraps internal get frequency command of a pin.
+ *
+ * Context: Called underpf->dplls.lock
+ * Return:
+ * * 0 - success
+ * * negative - error pin not found or couldn't get from hw
+ */(quoted diff) +2
-0+static int +ice_dpll_output_frequency_get(const struct dpll_pin *pin, void
*pin_priv,drivers/net/ethernet/intel/ice/ice_dpll.c new file +4
-0+ const struct dpll_device *dpll, void *dpll_priv, + u64 *frequency, struct netlink_ext_ack *extack) +{ + return ice_dpll_frequency_get(pin, pin_priv, dpll, dpll_priv,frequency,
drivers/net/ethernet/intel/ice/ice_dpll.c new file +150
-0+ extack, ICE_DPLL_PIN_TYPE_OUTPUT); +} + +/** +* ice_dpll_pin_enable - enable a pin on dplls +* @hw: board private hw structure +* @pin: pointer to a pin +* @pin_type: type of pin being enabled +* @extack: error reporting +* +* Enable a pin on both dplls. Store current state in pin->flags. +* +* Context: Called under pf->dplls.lock +* Return: +* * 0 - OK +* * negative - error +*/ +static int +ice_dpll_pin_enable (struct ice_hw *hw,struct ice_dpll_pin *pin, +enum ice_dpll_pin_type pin_type, +struct netlink_ext_ack *extack) +{ +u8 flags =0 ; +int ret; + +switch (pin_type) { +case ICE_DPLL_PIN_TYPE_INPUT : +if (pin->flags[0 ] &ICE_AQC_GET_CGU_IN_CFG_FLG2_ESYNC_EN ) + flags |=ICE_AQC_SET_CGU_IN_CFG_FLG2_ESYNC_EN ; + flags |=ICE_AQC_SET_CGU_IN_CFG_FLG2_INPUT_EN ; + ret =ice_aq_set_input_pin_cfg (hw, pin->idx,0 , flags,0 ,0 ); +break ; +case ICE_DPLL_PIN_TYPE_OUTPUT : +if (pin->flags[0 ] &ICE_AQC_GET_CGU_OUT_CFG_ESYNC_EN ) + flags |=ICE_AQC_SET_CGU_OUT_CFG_ESYNC_EN ; + flags |=ICE_AQC_SET_CGU_OUT_CFG_OUT_EN ; + ret =ice_aq_set_output_pin_cfg (hw, pin->idx, flags,0 ,0 ,0 ); +break ; +default : +return -EINVAL ; + } +if (ret) +NL_SET_ERR_MSG_FMT (extack, +"err:%d %s failed to enable %s pin:%u\n" , + ret,ice_aq_str (hw->adminq.sq_last_status), + pin_type_name[pin_type], pin->idx); + +return ret; +} + +/** +* ice_dpll_pin_disable - disable a pin on dplls +* @hw: board private hw structure +* @pin: pointer to a pin +* @pin_type: type of pin being disabled +* @extack: error reporting +* +* Disable a pin on both dplls. Store current state in pin->flags. +* +* Context: Called under pf->dplls.lock +* Return: +* * 0 - OK +* * negative - error +*/ +static int +ice_dpll_pin_disable (struct ice_hw *hw,struct ice_dpll_pin *pin, +enum ice_dpll_pin_type pin_type, +struct netlink_ext_ack *extack) +{ +u8 flags =0 ; +int ret; + +switch (pin_type) { +case ICE_DPLL_PIN_TYPE_INPUT : +if (pin->flags[0 ] &ICE_AQC_GET_CGU_IN_CFG_FLG2_ESYNC_EN ) + flags |=ICE_AQC_SET_CGU_IN_CFG_FLG2_ESYNC_EN ; + ret =ice_aq_set_input_pin_cfg (hw, pin->idx,0 , flags,0 ,0 ); +break ; +case ICE_DPLL_PIN_TYPE_OUTPUT : +if (pin->flags[0 ] &ICE_AQC_GET_CGU_OUT_CFG_ESYNC_EN ) + flags |=ICE_AQC_SET_CGU_OUT_CFG_ESYNC_EN ; + ret =ice_aq_set_output_pin_cfg (hw, pin->idx, flags,0 ,0 ,0 ); +break ; +default : +return -EINVAL ; + } +if (ret) +NL_SET_ERR_MSG_FMT (extack, +"err:%d %s failed to disable %s pin:%u\n" , + ret,ice_aq_str (hw->adminq.sq_last_status), + pin_type_name[pin_type], pin->idx); + +return ret; +} +/** +* ice_dpll_frequency_set - wrapper for pin callback for set frequency +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: pointer to dpll +* @dpll_priv: private data pointer passed on dpll registration +* @frequency: frequency to be set +* @extack: error reporting +* @pin_type: type of pin being configured +* +* Wraps internal set frequency command on a pin. +* +* Context: Acquires pf->dplls.lock +* Return: +* * 0 - success +* * negative - error pin not found or couldn't set in hw +*/ +static int +ice_dpll_frequency_set (const struct dpll_pin *pin,void *pin_priv, +const struct dpll_device *dpll,void *dpll_priv, +const u32 frequency, +struct netlink_ext_ack *extack, +enum ice_dpll_pin_type pin_type) +{ +struct ice_dpll_pin *p = pin_priv; +struct ice_dpll *d = dpll_priv; +struct ice_pf *pf = d->pf; +int ret; + + ret =ice_dpll_cb_lock (pf, extack); +if (ret) +return ret; + ret =ice_dpll_pin_freq_set (pf, p, pin_type, frequency, extack); +ice_dpll_cb_unlock (pf); + +return ret; +} + +/** +* ice_dpll_input_frequency_set - input pin callback for set frequency +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: pointer to dpll +* @dpll_priv: private data pointer passed on dpll registration +* @frequency: frequency to be set +* @extack: error reporting +* +* Wraps internal set frequency command on a pin. +* +* Context: Called under pf->dplls.lock +* Return: +* * 0 - success +* * negative - error pin not found or couldn't set in hw +*/ +static int +ice_dpll_input_frequency_set(const struct dpll_pin *pin, void
*pin_priv,drivers/net/ethernet/intel/ice/ice_dpll.c new file +4
-0+ const struct dpll_device *dpll, void *dpll_priv, + u64 frequency, struct netlink_ext_ack *extack) +{ + return ice_dpll_frequency_set(pin, pin_priv, dpll, dpll_priv,frequency,
drivers/net/ethernet/intel/ice/ice_dpll.c new file +5
-0+ extack, ICE_DPLL_PIN_TYPE_INPUT); +} + +/** +* ice_dpll_output_frequency_set - output pin callback for set frequency
+ * @pin: pointer to a pin
+ * @pin_priv: private data pointer passed on pin registration
+ * @dpll: pointer to dpll
+ * @dpll_priv: private data pointer passed on dpll registration
+ * @frequency: frequency to be set
+ * @extack: error reporting
+ *
+ * Wraps internal set frequency command on a pin.
+ *
+ * Context: Called underpf->dplls.lock
+ * Return:
+ * * 0 - success
+ * * negative - error pin not found or couldn't set in hw
+ */(quoted diff) +2
-0+static int +ice_dpll_output_frequency_set(const struct dpll_pin *pin, void
*pin_priv,drivers/net/ethernet/intel/ice/ice_dpll.c new file +4
-0+ const struct dpll_device *dpll, void *dpll_priv, + u64 frequency, struct netlink_ext_ack *extack) +{ + return ice_dpll_frequency_set(pin, pin_priv, dpll, dpll_priv,frequency,
drivers/net/ethernet/intel/ice/ice_dpll.c new file +58
-0+ extack, ICE_DPLL_PIN_TYPE_OUTPUT); +} + +/** +* ice_dpll_frequency_get - wrapper for pin callback for get frequency +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: pointer to dpll +* @dpll_priv: private data pointer passed on dpll registration +* @frequency: on success holds pin's frequency +* @extack: error reporting +* @pin_type: type of pin being configured +* +* Wraps internal get frequency command of a pin. +* +* Context: Acquires pf->dplls.lock +* Return: +* * 0 - success +* * negative - error pin not found or couldn't get from hw +*/ +static int +ice_dpll_frequency_get (const struct dpll_pin *pin,void *pin_priv, +const struct dpll_device *dpll,void *dpll_priv, +u64 *frequency,struct netlink_ext_ack *extack, +enum ice_dpll_pin_type pin_type) +{ +struct ice_dpll_pin *p = pin_priv; +struct ice_dpll *d = dpll_priv; +struct ice_pf *pf = d->pf; +int ret; + + ret =ice_dpll_cb_lock (pf, extack); +if (ret) +return ret; + *frequency = p->freq; +ice_dpll_cb_unlock (pf); + +return 0 ; +} + +/** +* ice_dpll_input_frequency_get - input pin callback for get frequency +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: pointer to dpll +* @dpll_priv: private data pointer passed on dpll registration +* @frequency: on success holds pin's frequency +* @extack: error reporting +* +* Wraps internal get frequency command of a input pin. +* +* Context: Called under pf->dplls.lock +* Return: +* * 0 - success +* * negative - error pin not found or couldn't get from hw +*/ +static int +ice_dpll_input_frequency_get(const struct dpll_pin *pin, void
*pin_priv,drivers/net/ethernet/intel/ice/ice_dpll.c new file +4
-0+ const struct dpll_device *dpll, void *dpll_priv, + u64 *frequency, struct netlink_ext_ack *extack) +{ + return ice_dpll_frequency_get(pin, pin_priv, dpll, dpll_priv,frequency,
drivers/net/ethernet/intel/ice/ice_dpll.c new file +5
-0+ extack, ICE_DPLL_PIN_TYPE_INPUT); +} + +/** +* ice_dpll_output_frequency_get - output pin callback for get frequency
+ * @pin: pointer to a pin
+ * @pin_priv: private data pointer passed on pin registration
+ * @dpll: pointer to dpll
+ * @dpll_priv: private data pointer passed on dpll registration
+ * @frequency: on success holds pin's frequency
+ * @extack: error reporting
+ *
+ * Wraps internal get frequency command of a pin.
+ *
+ * Context: Called underpf->dplls.lock
+ * Return:
+ * * 0 - success
+ * * negative - error pin not found or couldn't get from hw
+ */(quoted diff) +2
-0+static int +ice_dpll_output_frequency_get(const struct dpll_pin *pin, void
*pin_priv,drivers/net/ethernet/intel/ice/ice_dpll.c new file +4
-0+ const struct dpll_device *dpll, void *dpll_priv, + u64 *frequency, struct netlink_ext_ack *extack) +{ + return ice_dpll_frequency_get(pin, pin_priv, dpll, dpll_priv,frequency,
drivers/net/ethernet/intel/ice/ice_dpll.c new file +84
-0+ extack, ICE_DPLL_PIN_TYPE_OUTPUT); +} + +/** +* ice_dpll_pin_enable - enable a pin on dplls +* @hw: board private hw structure +* @pin: pointer to a pin +* @pin_type: type of pin being enabled +* @extack: error reporting +* +* Enable a pin on both dplls. Store current state in pin->flags. +* +* Context: Called under pf->dplls.lock +* Return: +* * 0 - OK +* * negative - error +*/ +static int +ice_dpll_pin_enable (struct ice_hw *hw,struct ice_dpll_pin *pin, +enum ice_dpll_pin_type pin_type, +struct netlink_ext_ack *extack) +{ +u8 flags =0 ; +int ret; + +switch (pin_type) { +case ICE_DPLL_PIN_TYPE_INPUT : +if (pin->flags[0 ] &ICE_AQC_GET_CGU_IN_CFG_FLG2_ESYNC_EN ) + flags |=ICE_AQC_SET_CGU_IN_CFG_FLG2_ESYNC_EN ; + flags |=ICE_AQC_SET_CGU_IN_CFG_FLG2_INPUT_EN ; + ret =ice_aq_set_input_pin_cfg (hw, pin->idx,0 , flags,0 ,0 ); +break ; +case ICE_DPLL_PIN_TYPE_OUTPUT : +if (pin->flags[0 ] &ICE_AQC_GET_CGU_OUT_CFG_ESYNC_EN ) + flags |=ICE_AQC_SET_CGU_OUT_CFG_ESYNC_EN ; + flags |=ICE_AQC_SET_CGU_OUT_CFG_OUT_EN ; + ret =ice_aq_set_output_pin_cfg (hw, pin->idx, flags,0 ,0 ,0 ); +break ; +default : +return -EINVAL ; + } +if (ret) +NL_SET_ERR_MSG_FMT (extack, +"err:%d %s failed to enable %s pin:%u\n" , + ret,ice_aq_str (hw->adminq.sq_last_status), + pin_type_name[pin_type], pin->idx); + +return ret; +} + +/** +* ice_dpll_pin_disable - disable a pin on dplls +* @hw: board private hw structure +* @pin: pointer to a pin +* @pin_type: type of pin being disabled +* @extack: error reporting +* +* Disable a pin on both dplls. Store current state in pin->flags. +* +* Context: Called under pf->dplls.lock +* Return: +* * 0 - OK +* * negative - error +*/ +static int +ice_dpll_pin_disable (struct ice_hw *hw,struct ice_dpll_pin *pin, +enum ice_dpll_pin_type pin_type, +struct netlink_ext_ack *extack) +{ +u8 flags =0 ; +int ret; + +switch (pin_type) { +case ICE_DPLL_PIN_TYPE_INPUT : +if (pin->flags[0 ] &ICE_AQC_GET_CGU_IN_CFG_FLG2_ESYNC_EN ) + flags |=ICE_AQC_SET_CGU_IN_CFG_FLG2_ESYNC_EN ; + ret =ice_aq_set_input_pin_cfg (hw, pin->idx,0 , flags,0 ,0 ); +break ; +case ICE_DPLL_PIN_TYPE_OUTPUT : +if (pin->flags[0 ] &ICE_AQC_GET_CGU_OUT_CFG_ESYNC_EN ) + flags |=ICE_AQC_SET_CGU_OUT_CFG_ESYNC_EN ; + ret =ice_aq_set_output_pin_cfg (hw, pin->idx, flags,0 ,0 ,0 ); +break ; +default :drivers/net/ethernet/intel/ice/ice_dpll.c line 394
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +10
-0+return -EINVAL ; + } +if (ret) +NL_SET_ERR_MSG_FMT (extack, +"err:%d %s failed to disable %s pin:%u\n" , + ret,ice_aq_str (hw->adminq.sq_last_status), + pin_type_name[pin_type], pin->idx); + +return ret; +}Should this function be static?
Quoted 35 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +35
-0+{ +int ret; + +switch (pin_type) { +case ICE_DPLL_PIN_TYPE_INPUT : + ret =ice_aq_get_input_pin_cfg (&pf->hw, pin->idx,NULL ,NULL , +NULL , &pin->flags[0 ], + &pin->freq,NULL ); +if (ret) + goto err; +if (ICE_AQC_GET_CGU_IN_CFG_FLG2_INPUT_EN & pin->flags[0 ]) { +if (pin->pin) { + pin->state[pf->dplls.eec.dpll_idx] = + pin->pin == pf->dplls.eec.active_input ? +DPLL_PIN_STATE_CONNECTED : +DPLL_PIN_STATE_SELECTABLE ; + pin->state[pf->dplls.pps.dpll_idx] = + pin->pin == pf->dplls.pps.active_input ? +DPLL_PIN_STATE_CONNECTED : +DPLL_PIN_STATE_SELECTABLE ; + }else { + pin->state[pf->dplls.eec.dpll_idx] = +DPLL_PIN_STATE_SELECTABLE ; + pin->state[pf->dplls.pps.dpll_idx] = +DPLL_PIN_STATE_SELECTABLE ; + } + }else { + pin->state[pf->dplls.eec.dpll_idx] = +DPLL_PIN_STATE_DISCONNECTED ; + pin->state[pf->dplls.pps.dpll_idx] = +DPLL_PIN_STATE_DISCONNECTED ; + } +break ; +case ICE_DPLL_PIN_TYPE_OUTPUT : + ret = ice_aq_get_output_pin_cfg(&pf->hw, pin->idx,drivers/net/ethernet/intel/ice/ice_dpll.c line 460
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +10
-0+ &pin->flags[0 ],NULL , + &pin->freq, NULL); +if (ret) + goto err; +if (ICE_AQC_SET_CGU_OUT_CFG_OUT_EN & pin->flags[0 ]) + pin->state[0 ] =DPLL_PIN_STATE_CONNECTED ; +else + pin->state[0 ] =DPLL_PIN_STATE_DISCONNECTED ; +break ; +case ICE_DPLL_PIN_TYPE_RCLK_INPUT :clang-16 complains that:
drivers/net/ethernet/intel/ice/ice_dpll.c:461:3: error: expected
expression
u8 parent,port_num=ICE_AQC_SET_PHY_REC_CLK_OUT_CURR_PORT;Which, I think means, it wants this case to be enclosed in { }
Quoted 40 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +40
-0+u8 parent, port_num =ICE_AQC_SET_PHY_REC_CLK_OUT_CURR_PORT ; + +for (parent =0 ; parent < pf->dplls.rclk.num_parents; + parent++) { +u8 p = parent; + + ret =ice_aq_get_phy_rec_clk_out (&pf->hw, &p, + &port_num, + &pin->flags[parent], +NULL ); +if (ret) + goto err; +if (ICE_AQC_GET_PHY_REC_CLK_OUT_OUT_EN & + pin->flags[parent]) + pin->state[parent] =DPLL_PIN_STATE_CONNECTED ; +else + pin->state[parent] = +DPLL_PIN_STATE_DISCONNECTED ; + } +break ; +default : +return -EINVAL ; + } + +return 0 ; +err: +if (extack) +NL_SET_ERR_MSG_FMT (extack, +"err:%d %s failed to update %s pin:%u\n" , + ret, +ice_aq_str (pf->hw.adminq.sq_last_status), + pin_type_name[pin_type], pin->idx); +else +dev_err_ratelimited (ice_pf_to_dev (pf), +"err:%d %s failed to update %s pin:%u\n" , + ret, +ice_aq_str (pf->hw.adminq.sq_last_status), + pin_type_name[pin_type], pin->idx); +return ret; +}...
Quoted 28 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +25
-0+/** +* ice_dpll_update_state - update dpll state +* @pf: pf private structure +* @d: pointer to queried dpll device +* @init: if function called on initialization of ice dpll +* +* Poll current state of dpll from hw and update ice_dpll struct. +* +* Context: Called under pf->dplls.lock +* Return: +* * 0 - success +* * negative - AQ failure +*/ +static int +ice_dpll_update_state (struct ice_pf *pf,struct ice_dpll *d,bool init) +{ +struct ice_dpll_pin *p =NULL ; +int ret; + + ret =ice_get_cgu_state (&pf->hw, d->dpll_idx, d->prev_dpll_state, + &d->input_idx, &d->ref_state, &d->eec_mode, + &d->phase_shift, &d->dpll_state, &d->mode); + + dev_dbg(ice_pf_to_dev(pf), + "update dpll=%d, prev_src_idx:%u, src_idx:%u, state:%d, prev:%dmode:%d\n",
drivers/net/ethernet/intel/ice/ice_dpll.c new file +2
-0+ d->dpll_idx, d->prev_input_idx, d->input_idx, + d->dpll_state, d->prev_dpll_state, d->mode);drivers/net/ethernet/intel/ice/ice_dpll.c line 1206
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +10
-0+if (ret) { +dev_err (ice_pf_to_dev (pf), +"update dpll=%d state failed, ret=%d %s\n" , + d->dpll_idx, ret, +ice_aq_str (pf->hw.adminq.sq_last_status)); +return ret; + } +if (init) { +if (d->dpll_state ==DPLL_LOCK_STATUS_LOCKED && + d->dpll_state ==DPLL_LOCK_STATUS_LOCKED_HO_ACQ )Should this be '||' rather than '&&' ?
Flagged by a clang-16 W=1 build, Sparse and Smatch.
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +5
-0+ d->active_input = pf->dplls.inputs[d->input_idx].pin; + p = &pf->dplls.inputs[d->input_idx]; +return ice_dpll_pin_state_update (pf, p, +ICE_DPLL_PIN_TYPE_INPUT ,NULL ); + }...
Quoted 56 lines
+/**
+ *ice_dpll_init_info_direct_pins- initializes direct pins info
+ * @pf: board private structure
+ * @pin_type: type of pins being initialized
+ *
+ * Init information for directly connected pins, cache them in pf's pins
+ * structures.
+ *
+ * Context: Called underpf->dplls.lock.
+ * Return:
+ * * 0 - success
+ * * negative - init failure reason
+ */drivers/net/ethernet/intel/ice/ice_dpll.c new file +42
-0+static int +ice_dpll_init_info_direct_pins (struct ice_pf *pf, +enum ice_dpll_pin_type pin_type) +{ +struct ice_dpll *de = &pf->dplls.eec, *dp = &pf->dplls.pps; +struct ice_hw *hw = &pf->hw; +struct ice_dpll_pin *pins; +int num_pins, i, ret; +u8 freq_supp_num; +bool input; + +switch (pin_type) { +case ICE_DPLL_PIN_TYPE_INPUT : + pins = pf->dplls.inputs; + num_pins = pf->dplls.num_inputs; + input = true; +break ; +case ICE_DPLL_PIN_TYPE_OUTPUT : + pins = pf->dplls.outputs; + num_pins = pf->dplls.num_outputs; + input = false; +break ; +default : +return -EINVAL ; + } + +for (i =0 ; i < num_pins; i++) { + pins[i].idx = i; + pins[i].prop.board_label =ice_cgu_get_pin_name (hw, i, input); + pins[i].prop.type =ice_cgu_get_pin_type (hw, i, input); +if (input) { + ret =ice_aq_get_cgu_ref_prio (hw, de->dpll_idx, i, + &de->input_prio[i]); +if (ret) +return ret; + ret =ice_aq_get_cgu_ref_prio (hw, dp->dpll_idx, i, + &dp->input_prio[i]); +if (ret) +return ret; + pins[i].prop.capabilities |= +DPLL_PIN_CAPS_PRIORITY_CAN_CHANGE ; + }drivers/net/ethernet/intel/ice/ice_dpll.c line 1816
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +10
-0+ pins[i].prop.capabilities |=DPLL_PIN_CAPS_STATE_CAN_CHANGE ; + ret =ice_dpll_pin_state_update (pf, &pins[i], pin_type,NULL ); +if (ret) +return ret; + pins[i].prop.freq_supported = +ice_cgu_get_pin_freq_supp (hw, i, input, &freq_supp_num); + pins[i].prop.freq_supported_num = freq_supp_num; + pins[i].pf = pf; + } +I'm unsure if this can happen,
but if the for loop above iterates zero times
then ret will be null here.Use of uninitialised variable flagged by Smatch.
Quoted 2 lines
(quoted diff) +2
-0+ return ret; +}...
Quoted 50 lines
+/**
+ *ice_dpll_init_info- prepare pf's dpll information structure
+ * @pf: board private structure
+ * @cgu: if cgu is present and controlled by this NIC
+ *
+ * Acquire (from HW) and set basic dpll information (onpf->dpllsstruct).
+ *
+ * Context: Called underpf->dplls.lock
+ * Return:
+ * * 0 - success
+ * * negative - init failure reason
+ */drivers/net/ethernet/intel/ice/ice_dpll.c new file +37
-0+static int ice_dpll_init_info (struct ice_pf *pf,bool cgu) +{ +struct ice_aqc_get_cgu_abilities abilities; +struct ice_dpll *de = &pf->dplls.eec; +struct ice_dpll *dp = &pf->dplls.pps; +struct ice_dplls *d = &pf->dplls; +struct ice_hw *hw = &pf->hw; +int ret, alloc_size, i; + + d->clock_id =ice_generate_clock_id (pf); + ret =ice_aq_get_cgu_abilities (hw, &abilities); +if (ret) { +dev_err (ice_pf_to_dev (pf), +"err:%d %s failed to read cgu abilities\n" , + ret,ice_aq_str (hw->adminq.sq_last_status)); +return ret; + } + + de->dpll_idx = abilities.eec_dpll_idx; + dp->dpll_idx = abilities.pps_dpll_idx; + d->num_inputs = abilities.num_inputs; + d->num_outputs = abilities.num_outputs; + d->input_phase_adj_max =le32_to_cpu (abilities.max_in_phase_adj); + d->output_phase_adj_max =le32_to_cpu (abilities.max_out_phase_adj); + + alloc_size =sizeof (*d->inputs) * d->num_inputs; + d->inputs =kzalloc (alloc_size,GFP_KERNEL ); +if (!d->inputs) +return -ENOMEM ; + + alloc_size =sizeof (*de->input_prio) * d->num_inputs; + de->input_prio =kzalloc (alloc_size,GFP_KERNEL ); +if (!de->input_prio) +return -ENOMEM ; + + dp->input_prio =kzalloc (alloc_size,GFP_KERNEL ); +if (!dp->input_prio)drivers/net/ethernet/intel/ice/ice_dpll.c line 1941
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +10
-0+return -ENOMEM ; + + ret =ice_dpll_init_pins_info (pf,ICE_DPLL_PIN_TYPE_INPUT ); +if (ret) + goto deinit_info; + +if (cgu) { + alloc_size =sizeof (*d->outputs) * d->num_outputs; + d->outputs =kzalloc (alloc_size,GFP_KERNEL ); +if (!d->outputs)Should ret be set to
-ENOMEMhere?Flagged by Smatch.
Quoted 34 lines
drivers/net/ethernet/intel/ice/ice_dpll.c new file +28
-0+ goto deinit_info; + + ret =ice_dpll_init_pins_info (pf,ICE_DPLL_PIN_TYPE_OUTPUT ); +if (ret) + goto deinit_info; + } + + ret =ice_get_cgu_rclk_pin_info (&pf->hw, &d->base_rclk_idx, + &pf->dplls.rclk.num_parents); +if (ret) +return ret; +for (i =0 ; i < pf->dplls.rclk.num_parents; i++) + pf->dplls.rclk.parent_idx[i] = d->base_rclk_idx + i; + ret =ice_dpll_init_pins_info (pf,ICE_DPLL_PIN_TYPE_RCLK_INPUT ); +if (ret) +return ret; + de->mode =DPLL_MODE_AUTOMATIC ; + dp->mode =DPLL_MODE_AUTOMATIC ; + +dev_dbg (ice_pf_to_dev (pf), +"%s - success, inputs:%u, outputs:%u rclk-parents:%u\n" , + __func__, d->num_inputs, d->num_outputs, d->rclk.num_parents); + +return 0 ; + +deinit_info: + dev_err(ice_pf_to_dev(pf), + "%s - fail: d->inputs:%p, de->input_prio:%p, dp->input_prio:%p,d->outputs:%p\n",
drivers/net/ethernet/intel/ice/ice_dpll.c new file +5
-0+ __func__, d->inputs, de->input_prio, + dp->input_prio, d->outputs); +ice_dpll_deinit_info (pf); +return ret; +}...
Quoted 8 lines
+/**
+ *ice_dpll_init- initialize support for dpll subsystem
+ * @pf: board private structure
+ *
+ * Set up the device dplls, register them and pins connected within Linux dpll
+ * subsystem. Allow userpsace to obtain state of DPLL and handling of DPLLnit: userpsace -> userspace
Quoted 8 lines
Quoted 4 lines
+ * configuration requests.
+ *
+ * Context: Function initializes and holdspf->dplls.lockmutex.
+ */...
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/net/ethernet/intel/ice/ice_dpll.hQuoted 43 lines
Quoted 15 lines
new file mode 100644
index 000000000000..975066b71c5edrivers/net/ethernet/intel/ice/ice_dpll.h new file +10
-0@@ -0,0 +1,104 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2022, Intel Corporation. */ + +#ifndef _ICE_DPLL_H_ +#define _ICE_DPLL_H_ + +#include "ice.h" + +#define ICE_DPLL_PRIO_MAX 0xF +#define ICE_DPLL_RCLK_NUM_MAX 4drivers/net/ethernet/intel/ice/ice_dpll.h line 20
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_dpll.h new file +10
-0+ +/** ice_dpll_pin - store info about pins +* @pin: dpll pin structure +* @pf: pointer to pf, which has registered the dpll_pin +* @idx: ice pin private idx +* @num_parents: hols number of parent pins +* @parent_idx: hold indexes of parent pins +* @flags: pin flags returned from HW +* @state: state of a pin +* @prop: pin properities nit: properities -> properties
Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_dpll.h new file +13
-0+* @freq: current frequency of a pin +*/ +struct ice_dpll_pin { +struct dpll_pin *pin; +struct ice_pf *pf; +u8 idx; +u8 num_parents; +u8 parent_idx[ICE_DPLL_RCLK_NUM_MAX ]; +u8 flags[ICE_DPLL_RCLK_NUM_MAX ]; +u8 state[ICE_DPLL_RCLK_NUM_MAX ]; +struct dpll_pin_properties prop; +u32 freq; +};...
Vadim Fedorenko
maintainerPATCH 10/11 ptp_ocp: implement DPLL ops
In reply to Vadim FedorenkoImplement basic DPLL operations in ptp_ocp driver as the simplest example of using new subsystem.
---
RFC v9->v0:
- implement monitoring thread and netlink notification
- implement state on dpll callback
drivers/ptp/Kconfig | 1 + drivers/ptp/ptp_ocp.c | 366 +++++++++++++++++++++++++++++++++++------- 2 files changed, 307 insertions(+), 60 deletions(-)
drivers/ptp/Kconfig +1 -0
@@ -177,6 +177,7 @@ config PTP_1588_CLOCK_OCP depends on COMMON_CLK select NET_DEVLINK select CRC16 + select DPLL help This driver adds support for an OpenCompute time card.
drivers/ptp/ptp_ocp.c +307 -60
584 lines not on this page · raw message
Signature · 1 line
2.27.0
Jiri Pirko
maintainerRe: [PATCH 10/11] ptp_ocp: implement DPLL ops
Quoted 5 lines · Thu, Jul 20, 2023 at 11:19:02AM CEST, [email protected] wrote:
Implement basic DPLL operations in
ptp_ocpdriver as the simplest example of using new subsystem.Signed-off-by Vadim Fedorenko <[email protected]>Signed-off-by Arkadiusz Kubalewski <[email protected]>
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Vadim Fedorenko
maintainerPATCH 11/11 mlx5: Implement SyncE support using DPLL infrastructure
In reply to Vadim FedorenkoFrom: Jiri Pirko <[email protected]>
Implement SyncE support using newly introduced DPLL support. Make sure that each PFs/VFs/SFs probed with appropriate capability will spawn a dpll auxiliary device and register appropriate dpll device and pin instances.
--- .../net/ethernet/mellanox/mlx5/core/Kconfig | 8 + .../net/ethernet/mellanox/mlx5/core/Makefile | 3 + drivers/net/ethernet/mellanox/mlx5/core/dev.c | 17 + .../net/ethernet/mellanox/mlx5/core/dpll.c | 432 ++++++++++++++++++ include/linux/mlx5/driver.h | 2 + include/linux/mlx5/mlx5_ifc.h | 59 ++- 6 files changed, 520 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/dpll.c
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +8 -0
@@ -188,3 +188,11 @@ config MLX5_SF_MANAGER port is managed through devlink. A subfunction supports RDMA, netdevice and vdpa device. It is similar to a SRIOV VF but it doesn't require SRIOV support. + +config MLX5_DPLL + tristate "Mellanox 5th generation network adapters (ConnectX series) DPLL support" + depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE + select DPLL + help + DPLL support in Mellanox Technologies ConnectX NICs. +
drivers/net/ethernet/mellanox/mlx5/core/Makefile +3 -0
@@ -124,3 +124,6 @@ mlx5_core-$(CONFIG_MLX5_SF) += sf/vhca_event.o sf/dev/dev.o sf/dev/driver.o irq_ # SF manager # mlx5_core-$(CONFIG_MLX5_SF_MANAGER) += sf/cmd.o sf/hw_table.o sf/devlink.o + +obj-$(CONFIG_MLX5_DPLL) += mlx5_dpll.o +mlx5_dpll-y := dpll.o
drivers/net/ethernet/mellanox/mlx5/core/dev.c +17 -0
@@ -205,6 +205,19 @@ static bool is_ib_enabled(struct mlx5_core_dev *dev)return err ? false : val.vbool; } +static bool is_dpll_supported (struct mlx5_core_dev *dev) +{ +if (!IS_ENABLED (CONFIG_MLX5_DPLL )) +return false; + +if (!MLX5_CAP_MCAM_REG2 (dev, synce_registers)) { +mlx5_core_warn (dev,"Missing SyncE capability\n" ); +return false; + } + +return true; +} +enum {MLX5_INTERFACE_PROTOCOL_ETH ,MLX5_INTERFACE_PROTOCOL_ETH_REP ,
@@ -214,6 +227,8 @@ enum {MLX5_INTERFACE_PROTOCOL_MPIB ,MLX5_INTERFACE_PROTOCOL_VNET , + + MLX5_INTERFACE_PROTOCOL_DPLL, }; static const struct mlx5_adev_device {
@@ -236,6 +251,8 @@ static const struct mlx5_adev_device { .is_supported = &is_ib_rep_supported }, [MLX5_INTERFACE_PROTOCOL_MPIB] = { .suffix = "multiport", .is_supported = &is_mp_supported }, + [MLX5_INTERFACE_PROTOCOL_DPLL] = { .suffix = "dpll", + .is_supported = &is_dpll_supported }, };int mlx5_adev_idx_alloc (void )
drivers/net/ethernet/mellanox/mlx5/core/dpll.c new file +432 -0
432 lines not on this page · raw message
include/linux/mlx5/driver.h +2 -0
@@ -154,6 +154,8 @@ enum {MLX5_REG_MCC =0x9062 ,MLX5_REG_MCDA =0x9063 ,MLX5_REG_MCAM =0x907f , +MLX5_REG_MSECQ =0x9155 , +MLX5_REG_MSEES =0x9156 ,MLX5_REG_MIRC =0x9162 ,MLX5_REG_SBCAM =0xB01F , MLX5_REG_RESOURCE_DUMP = 0xC000,
include/linux/mlx5/mlx5_ifc.h +58 -1
69 lines not on this page · raw message
Signature · 1 line
2.27.0
Jiri Pirko
maintainerQuoted 1 line · Thu, Jul 20, 2023 at 11:18:52AM CEST, [email protected] wrote:
v8 RFC -> v0:
Just to avoid future confusion: In netdev, the count goes from 1. So this is v1. Next submission will be v2.
Jiri Pirko
maintainerThere are couple of issues that came up during our internal ci run:
10:16:04 error: drivers/dpll/dpll_netlink.c:452:5: error: no previous prototype for '__dpll_device_change_ntf' [-Werror=missing-prototypes] 10:16:04 error: drivers/dpll/dpll_netlink.c:1283:13: error: no previous prototype for 'dpll_netlink_fini' [-Werror=missing-prototypes] 10:16:04 error: drivers/dpll/dpll_core.c:221:1: error: no previous prototype for 'dpll_xa_ref_dpll_find' [-Werror=missing-prototypes]
10:27:31 error: drivers/dpll/dpll_core.c:220:21: warning: symbol 'dpll_xa_ref_dpll_find' was not declared. Should it be static? 10:27:31 error: drivers/dpll/dpll_netlink.c:452:5: warning: symbol '__dpll_device_change_ntf' was not declared. Should it be static? 10:27:31 error: drivers/dpll/dpll_netlink.c:1283:13: warning: symbol 'dpll_netlink_fini' was not declared. Should it be static? 10:27:41 error: drivers/net/ethernet/intel/ice/ice_dpll.c:461:3: error: a label can only be part of a statement and a declaration is not a statement
I believe that you didn't run make with C=2, otherwise you would hit these.
Checkpatch issue:
10:29:30 CHECK: struct mutex definition without comment 10:29:30 #6581: FILE: drivers/net/ethernet/intel/ice/ice_dpll.h:85: 10:29:30 + struct mutex lock;
Spelling errors:
10:45:08 error: Documentation/netlink/specs/dpll.yaml:165: prority ==> priority 10:45:08 error: include/uapi/linux/dpll.h:128: prority ==> priority 10:45:08 error: drivers/net/ethernet/intel/ice/ice_dpll.c:2008: userpsace ==> userspace 10:45:08 error: drivers/net/ethernet/intel/ice/ice_dpll.h:20: properities ==> properties
Quoted 3 lines · Thu, Jul 20, 2023 at 11:18:52AM CEST, [email protected] wrote:
Implement common API for clock/DPLL configuration and status reporting. The API utilises netlink interface as transport for commands and event notifications. This API aim to extend current pin configuration and
s/API aim/API aims/
Quoted 1 line
make it flexible and easy to cover special configurations.
I don't follow. How this could "aim to extend current pin configuration" ? This is a new thing. Could you re-phrase?
What's "special configuration"? Sounds odd.
Quoted 8 lines
Netlink interface is based on ynl spec, it allows use of in-kernel
tools/net/ynl/cli.pyapplication to control the interface with properly formated command and json attribute strings. Here are few command examples of how it works withicedriver on supported NIC:- dump dpll devices
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
"$#" looks a bit odd. Just "$" with "sudo" when you want to emphasize root is needed to perform the command.
Quoted 14 lines
--dump device-get
[{'clock-id': 282574471561216,
'id': 0,
'lock-status': 'unlocked',
'mode': 'automatic',
'module-name': 'ice',
'type': 'eec'},
{'clock-id': 282574471561216,
'id': 1,
'lock-status': 'unlocked',
'mode': 'automatic',
'module-name': 'ice',
'type': 'pps'}]
Quoted 10 lines
- get single pin info:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-get --json '{"pin-id":2}'
{'clock-id': 282574471561216,
'module-name': 'ice',
'pin-board-label': 'C827_0-RCLKA',
'pin-dpll-caps': 6,
'pin-frequency': 1953125,
'pin-id': 2,
'pin-parenti-device': [{'id': 0,
This looks like manual edit went wrong :)
s/parenti/parent/
Quoted 22 lines
'pin-direction': 'input', 'pin-prio': 11, 'pin-state': 'selectable'}, {'id': 1, 'pin-direction': 'input', 'pin-prio': 9, 'pin-state': 'selectable'}],'pin-type': 'mux'}
- set pin's state on dpll:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-set --json '{"pin-id":2, "pin-parent-device":{"id":1, "pin-state":2}}'- set pin's prio on dpll:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-set --json '{"pin-id":2, "pin-parent-device":{"id":1, "pin-prio":4}}'- set pin's state on parent pin:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\--do pin-set --json '{"pin-id":13, \ "pin-parent-pin":{"pin-id":2, "pin-state":1}}'
[...]
Vadim Fedorenko
maintainerQuoted 6 lines · Jiri Pirko
There are couple of issues that came up during our internal ci run:
10:16:04 error: drivers/dpll/dpll_netlink.c:452:5: error: no previous prototype for '__dpll_device_change_ntf' [-Werror=missing-prototypes] 10:16:04 error: drivers/dpll/dpll_netlink.c:1283:13: error: no previous prototype for 'dpll_netlink_fini' [-Werror=missing-prototypes] 10:16:04 error: drivers/dpll/dpll_core.c:221:1: error: no previous prototype for 'dpll_xa_ref_dpll_find' [-Werror=missing-prototypes]
Quoted 7 lines
10:27:31 error: drivers/dpll/dpll_core.c:220:21: warning: symbol 'dpll_xa_ref_dpll_find' was not declared. Should it be static? 10:27:31 error: drivers/dpll/dpll_netlink.c:452:5: warning: symbol '__dpll_device_change_ntf' was not declared. Should it be static? 10:27:31 error: drivers/dpll/dpll_netlink.c:1283:13: warning: symbol 'dpll_netlink_fini' was not declared. Should it be static? 10:27:41 error: drivers/net/ethernet/intel/ice/ice_dpll.c:461:3: error: a label can only be part of a statement and a declaration is not a statementI believe that you didn't run make with C=2, otherwise you would hit these.
Yeah, I'll re-run the set patch-by-patch with C=2 next time.
Quoted 5 lines
Checkpatch issue:
10:29:30 CHECK: struct mutex definition without comment 10:29:30 #6581: FILE: drivers/net/ethernet/intel/ice/ice_dpll.h:85: 10:29:30 + struct mutex lock;
Arkadiusz will take care of "ice" part.
Quoted 6 lines
Spelling errors:
10:45:08 error: Documentation/netlink/specs/dpll.yaml:165: prority ==> priority 10:45:08 error: include/uapi/linux/dpll.h:128: prority ==> priority 10:45:08 error: drivers/net/ethernet/intel/ice/ice_dpll.c:2008: userpsace ==> userspace 10:45:08 error: drivers/net/ethernet/intel/ice/ice_dpll.h:20: properities ==> properties
Will fix it.
Quoted 6 lines
Quoted 3 lines · Thu, Jul 20, 2023 at 11:18:52AM CEST, [email protected] wrote:
Implement common API for clock/DPLL configuration and status reporting. The API utilises netlink interface as transport for commands and event notifications. This API aim to extend current pin configuration and
Quoted 7 lines
s/API aim/API aims/
Quoted 1 line
make it flexible and easy to cover special configurations.
I don't follow. How this could "aim to extend current pin configuration" ? This is a new thing. Could you re-phrase?
Not really new. PTP devices have already simple pin configurations, mlx5 is using it for some cards with external pins. The problem is that PTP subsystem covers only simple configuration of the pin and doesn't cover DPLL part at all.
Quoted 3 lines
What's "special configuration"? Sounds odd.
Yeah, "complex configurations" sounds better, will change it.
Quoted 39 lines
Quoted 9 lines
Netlink interface is based on ynl spec, it allows use of in-kernel
tools/net/ynl/cli.pyapplication to control the interface with properly formated command and json attribute strings. Here are few command examples of how it works withicedriver on supported NIC:- dump dpll devices
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\"$#" looks a bit odd. Just "$" with "sudo" when you want to emphasize root is needed to perform the command.
Quoted 14 lines
--dump device-get
[{'clock-id': 282574471561216,
'id': 0,
'lock-status': 'unlocked',
'mode': 'automatic',
'module-name': 'ice',
'type': 'eec'},
{'clock-id': 282574471561216,
'id': 1,
'lock-status': 'unlocked',
'mode': 'automatic',
'module-name': 'ice',
'type': 'pps'}]Quoted 10 lines
- get single pin info:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-get --json '{"pin-id":2}'
{'clock-id': 282574471561216,
'module-name': 'ice',
'pin-board-label': 'C827_0-RCLKA',
'pin-dpll-caps': 6,
'pin-frequency': 1953125,
'pin-id': 2,
'pin-parenti-device': [{'id': 0,
Quoted 3 lines
This looks like manual edit went wrong :)
s/parenti/parent/
Ahhh... yeah :)
Quoted 25 lines
Quoted 23 lines
'pin-direction': 'input', 'pin-prio': 11, 'pin-state': 'selectable'}, {'id': 1, 'pin-direction': 'input', 'pin-prio': 9, 'pin-state': 'selectable'}],'pin-type': 'mux'}
- set pin's state on dpll:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-set --json '{"pin-id":2, "pin-parent-device":{"id":1, "pin-state":2}}'- set pin's prio on dpll:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-set --json '{"pin-id":2, "pin-parent-device":{"id":1, "pin-prio":4}}'- set pin's state on parent pin:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\--do pin-set --json '{"pin-id":13, \ "pin-parent-pin":{"pin-id":2, "pin-state":1}}'[...]
Jiri Pirko
maintainerQuoted 44 lines · Fri, Jul 21, 2023 at 04:42:46PM CEST, [email protected] wrote:
Quoted 6 lines · Jiri Pirko
There are couple of issues that came up during our internal ci run:
10:16:04 error: drivers/dpll/dpll_netlink.c:452:5: error: no previous prototype for '__dpll_device_change_ntf' [-Werror=missing-prototypes] 10:16:04 error: drivers/dpll/dpll_netlink.c:1283:13: error: no previous prototype for 'dpll_netlink_fini' [-Werror=missing-prototypes] 10:16:04 error: drivers/dpll/dpll_core.c:221:1: error: no previous prototype for 'dpll_xa_ref_dpll_find' [-Werror=missing-prototypes]Quoted 7 lines
10:27:31 error: drivers/dpll/dpll_core.c:220:21: warning: symbol 'dpll_xa_ref_dpll_find' was not declared. Should it be static? 10:27:31 error: drivers/dpll/dpll_netlink.c:452:5: warning: symbol '__dpll_device_change_ntf' was not declared. Should it be static? 10:27:31 error: drivers/dpll/dpll_netlink.c:1283:13: warning: symbol 'dpll_netlink_fini' was not declared. Should it be static? 10:27:41 error: drivers/net/ethernet/intel/ice/ice_dpll.c:461:3: error: a label can only be part of a statement and a declaration is not a statementI believe that you didn't run make with C=2, otherwise you would hit these.
Yeah, I'll re-run the set patch-by-patch with C=2 next time.
Quoted 5 lines
Checkpatch issue:
10:29:30 CHECK: struct mutex definition without comment 10:29:30 #6581: FILE: drivers/net/ethernet/intel/ice/ice_dpll.h:85: 10:29:30 + struct mutex lock;Arkadiusz will take care of "ice" part.
Quoted 6 lines
Spelling errors:
10:45:08 error: Documentation/netlink/specs/dpll.yaml:165: prority ==> priority 10:45:08 error: include/uapi/linux/dpll.h:128: prority ==> priority 10:45:08 error: drivers/net/ethernet/intel/ice/ice_dpll.c:2008: userpsace ==> userspace 10:45:08 error: drivers/net/ethernet/intel/ice/ice_dpll.h:20: properities ==> propertiesWill fix it.
Quoted 9 lines
Quoted 3 lines · Thu, Jul 20, 2023 at 11:18:52AM CEST, [email protected] wrote:
Implement common API for clock/DPLL configuration and status reporting. The API utilises netlink interface as transport for commands and event notifications. This API aim to extend current pin configuration and
s/API aim/API aims/
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
make it flexible and easy to cover special configurations.
I don't follow. How this could "aim to extend current pin configuration" ? This is a new thing. Could you re-phrase?
Not really new. PTP devices have already simple pin configurations, mlx5 is using it for some cards with external pins. The problem is that PTP subsystem covers only simple configuration of the pin and doesn't cover DPLL part at all.
Okay, please put the info in.
Quoted 78 lines
Quoted 4 lines
What's "special configuration"? Sounds odd.
Yeah, "complex configurations" sounds better, will change it.
Quoted 39 lines
Quoted 9 lines
Netlink interface is based on ynl spec, it allows use of in-kernel
tools/net/ynl/cli.pyapplication to control the interface with properly formated command and json attribute strings. Here are few command examples of how it works withicedriver on supported NIC:- dump dpll devices
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\"$#" looks a bit odd. Just "$" with "sudo" when you want to emphasize root is needed to perform the command.
Quoted 14 lines
--dump device-get
[{'clock-id': 282574471561216,
'id': 0,
'lock-status': 'unlocked',
'mode': 'automatic',
'module-name': 'ice',
'type': 'eec'},
{'clock-id': 282574471561216,
'id': 1,
'lock-status': 'unlocked',
'mode': 'automatic',
'module-name': 'ice',
'type': 'pps'}]Quoted 10 lines
- get single pin info:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-get --json '{"pin-id":2}'
{'clock-id': 282574471561216,
'module-name': 'ice',
'pin-board-label': 'C827_0-RCLKA',
'pin-dpll-caps': 6,
'pin-frequency': 1953125,
'pin-id': 2,
'pin-parenti-device': [{'id': 0,Quoted 3 lines
This looks like manual edit went wrong :)
s/parenti/parent/Ahhh... yeah :)
Quoted 25 lines
Quoted 23 lines
'pin-direction': 'input', 'pin-prio': 11, 'pin-state': 'selectable'}, {'id': 1, 'pin-direction': 'input', 'pin-prio': 9, 'pin-state': 'selectable'}],'pin-type': 'mux'}
- set pin's state on dpll:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-set --json '{"pin-id":2, "pin-parent-device":{"id":1, "pin-state":2}}'- set pin's prio on dpll:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\
--do pin-set --json '{"pin-id":2, "pin-parent-device":{"id":1, "pin-prio":4}}'- set pin's state on parent pin:
$#./tools/net/ynl/cli.py--specDocumentation/netlink/specs/dpll.yaml\--do pin-set --json '{"pin-id":13, \ "pin-parent-pin":{"pin-id":2, "pin-state":1}}'[...]