diff mbox series

[net-next,2/3] dpll: extend lock_status_get() op by status error and expose to user

Message ID 20240129145916.244193-3-jiri@resnulli.us (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series dpll: expose lock status error value to user | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 1050 this patch: 1051
netdev/build_tools success Errors and warnings before: 1 this patch: 0
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang fail Errors and warnings before: 1066 this patch: 1067
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 1067 this patch: 1068
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 66 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc fail Errors and warnings before: 0 this patch: 1
netdev/source_inline success Was 0 now: 0

Commit Message

Jiri Pirko Jan. 29, 2024, 2:59 p.m. UTC
From: Jiri Pirko <jiri@nvidia.com>

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>
---
 drivers/dpll/dpll_netlink.c                    | 9 ++++++++-
 drivers/net/ethernet/intel/ice/ice_dpll.c      | 1 +
 drivers/net/ethernet/mellanox/mlx5/core/dpll.c | 9 +++++----
 drivers/ptp/ptp_ocp.c                          | 9 +++++----
 include/linux/dpll.h                           | 1 +
 5 files changed, 20 insertions(+), 9 deletions(-)

Comments

kernel test robot Jan. 30, 2024, 10:46 a.m. UTC | #1
Hi Jiri,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jiri-Pirko/dpll-extend-uapi-by-lock-status-error-attribute/20240129-230433
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240129145916.244193-3-jiri%40resnulli.us
patch subject: [patch net-next 2/3] dpll: extend lock_status_get() op by status error and expose to user
config: openrisc-allyesconfig (https://download.01.org/0day-ci/archive/20240130/202401301831.QfsB6gZg-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240130/202401301831.QfsB6gZg-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401301831.QfsB6gZg-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/intel/ice/ice_dpll.c:505: warning: Function parameter or struct member 'status_error' not described in 'ice_dpll_lock_status_get'


vim +505 drivers/net/ethernet/intel/ice/ice_dpll.c

d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  485  
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  486  /**
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  487   * ice_dpll_lock_status_get - get dpll lock status callback
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  488   * @dpll: registered dpll pointer
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  489   * @dpll_priv: private data pointer passed on dpll registration
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  490   * @status: on success holds dpll's lock status
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  491   * @extack: error reporting
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  492   *
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  493   * Dpll subsystem callback, provides dpll's lock status.
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  494   *
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  495   * Context: Acquires pf->dplls.lock
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  496   * Return:
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  497   * * 0 - success
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  498   * * negative - failure
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  499   */
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  500  static int
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  501  ice_dpll_lock_status_get(const struct dpll_device *dpll, void *dpll_priv,
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  502  			 enum dpll_lock_status *status,
0bbc9a9d0d8c32 Jiri Pirko           2024-01-29  503  			 enum dpll_lock_status_error *status_error,
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  504  			 struct netlink_ext_ack *extack)
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13 @505  {
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  506  	struct ice_dpll *d = dpll_priv;
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  507  	struct ice_pf *pf = d->pf;
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  508  
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  509  	mutex_lock(&pf->dplls.lock);
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  510  	*status = d->dpll_state;
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  511  	mutex_unlock(&pf->dplls.lock);
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  512  
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  513  	return 0;
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  514  }
d7999f5ea64bb1 Arkadiusz Kubalewski 2023-09-13  515
diff mbox series

Patch

diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c
index 314bb3775465..cf3313517ae1 100644
--- a/drivers/dpll/dpll_netlink.c
+++ b/drivers/dpll/dpll_netlink.c
@@ -121,14 +121,21 @@  dpll_msg_add_lock_status(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_lock_status_error status_error = 0;
 	enum dpll_lock_status status;
 	int ret;
 
-	ret = ops->lock_status_get(dpll, dpll_priv(dpll), &status, extack);
+	ret = ops->lock_status_get(dpll, dpll_priv(dpll), &status,
+				   &status_error, extack);
 	if (ret)
 		return ret;
 	if (nla_put_u32(msg, DPLL_A_LOCK_STATUS, status))
 		return -EMSGSIZE;
+	if (status_error &&
+	    (status == DPLL_LOCK_STATUS_UNLOCKED ||
+	     status == DPLL_LOCK_STATUS_HOLDOVER) &&
+	    nla_put_u32(msg, DPLL_A_LOCK_STATUS_ERROR, status_error))
+		return -EMSGSIZE;
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c b/drivers/net/ethernet/intel/ice/ice_dpll.c
index b9c5eced6326..04cafa896e9d 100644
--- a/drivers/net/ethernet/intel/ice/ice_dpll.c
+++ b/drivers/net/ethernet/intel/ice/ice_dpll.c
@@ -500,6 +500,7 @@  ice_dpll_hw_input_prio_set(struct ice_pf *pf, struct ice_dpll *dpll,
 static int
 ice_dpll_lock_status_get(const struct dpll_device *dpll, void *dpll_priv,
 			 enum dpll_lock_status *status,
+			 enum dpll_lock_status_error *status_error,
 			 struct netlink_ext_ack *extack)
 {
 	struct ice_dpll *d = dpll_priv;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dpll.c b/drivers/net/ethernet/mellanox/mlx5/core/dpll.c
index 18fed2b34fb1..07f43d5c90c6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/dpll.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/dpll.c
@@ -118,10 +118,11 @@  mlx5_dpll_pin_ffo_get(struct mlx5_dpll_synce_status *synce_status,
 	return 0;
 }
 
-static int mlx5_dpll_device_lock_status_get(const struct dpll_device *dpll,
-					    void *priv,
-					    enum dpll_lock_status *status,
-					    struct netlink_ext_ack *extack)
+static int
+mlx5_dpll_device_lock_status_get(const struct dpll_device *dpll, void *priv,
+				 enum dpll_lock_status *status,
+				 enum dpll_lock_status_error *status_error,
+				 struct netlink_ext_ack *extack)
 {
 	struct mlx5_dpll_synce_status synce_status;
 	struct mlx5_dpll *mdpll = priv;
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 5f858e426bbd..9507681e0d12 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -4209,10 +4209,11 @@  ptp_ocp_detach(struct ptp_ocp *bp)
 	device_unregister(&bp->dev);
 }
 
-static int ptp_ocp_dpll_lock_status_get(const struct dpll_device *dpll,
-					void *priv,
-					enum dpll_lock_status *status,
-					struct netlink_ext_ack *extack)
+static int
+ptp_ocp_dpll_lock_status_get(const struct dpll_device *dpll, void *priv,
+			     enum dpll_lock_status *status,
+			     enum dpll_lock_status_error *status_error,
+			     struct netlink_ext_ack *extack)
 {
 	struct ptp_ocp *bp = priv;
 
diff --git a/include/linux/dpll.h b/include/linux/dpll.h
index 9cf896ea1d41..9cb02ad73d51 100644
--- a/include/linux/dpll.h
+++ b/include/linux/dpll.h
@@ -19,6 +19,7 @@  struct dpll_device_ops {
 			enum dpll_mode *mode, struct netlink_ext_ack *extack);
 	int (*lock_status_get)(const struct dpll_device *dpll, void *dpll_priv,
 			       enum dpll_lock_status *status,
+			       enum dpll_lock_status_error *status_error,
 			       struct netlink_ext_ack *extack);
 	int (*temp_get)(const struct dpll_device *dpll, void *dpll_priv,
 			s32 *temp, struct netlink_ext_ack *extack);