From patchwork Mon Jan 29 14:59:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 13535845 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 496CA153BDA for ; Mon, 29 Jan 2024 14:59:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706540367; cv=none; b=sjLpei07p8bGg0qq+ZUpeH8gfOim849GnkLGvJFBqiQiAYb6boOA2zZVPNysLsZWqdK3NXDBTieqwfpgG1TKH44OhQ4WajMGxfRFWdq4pvJotaXLWK9ETDg7MdZoT+M7+hiGixiCR66oN6M8+EeUFW/SF52DYUBw5Ae/qeGOUcE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706540367; c=relaxed/simple; bh=hta23/G+8utfOrsbQEJr9zCWrMy/+Z5fD6oPYEfxupA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S4QfXsbVNcVHa4K53GxfCTMdymhAFvp15OdE1wIhTEFGXHzNlHzSEvdx2aVx4M3G0LDICO8SbhbosBc3JL2Exun/kL/B+CkyvjipxkrHPSOvlw7PmMakasvKozGQBy5EBkgUIypdmG/84NpjrOWN4/rXROyc7zPksialHN6iGXU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us; spf=none smtp.mailfrom=resnulli.us; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b=i5+a2Dkl; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=resnulli.us Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b="i5+a2Dkl" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a35e9161b8cso83268366b.3 for ; Mon, 29 Jan 2024 06:59:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20230601.gappssmtp.com; s=20230601; t=1706540363; x=1707145163; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tUEcATRoqgdSTmWPi/AnlbzHt1e8IP5T+d1tEQq1sqM=; b=i5+a2DklpwYRsOKlJY0hd2D8T6Qeq0psayh76PnkZhcWX6ljtcyg5FNUmaYQlw5aTF zUG4mNBP+T9CA2gmfkPF1IN9ji7Q4rIrnakHBN7c64MGEI2QPO12NRqD+tpvr6FkNNCb pHGtxBu4nNAG8oFzA8pkaG6lhuzC0JRC52wOD1RVDo8BBC36p4jAIHJ9WXjPf27rLMtB 3vwSJp+mTVEBB23lJHl+amEPw7Tf8ULDlpnuuVVr5xY5/gSFHu8efvtaPKblMGCb+mWr knV+yK/6c0TmWiE0blQ/APeJTWQc2w3p44e6dJiaR6mcXleJY1QausRP+onfA6Ll00de wlrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706540363; x=1707145163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tUEcATRoqgdSTmWPi/AnlbzHt1e8IP5T+d1tEQq1sqM=; b=q1KqUMes3EhoaFgwtdVZ+qTDAItLUk100YHrPDFNjOR2UYKS1U9OdCq6sWzt3SM/qJ pkZUN7S7IH1N++0chs8lJpaMmpctJKtbA/ufaWjI9req3K065GIJZunroRQ7tsymlHUc ZVYP2kcqYgF+7BBDycbRoEfyE6gJTVOBsb2q4sLDjIy/jCEXz37WCi2F9lPK4lxDsLDX 1FjkziNLAxKVxg4eDPrxu//V9UADtqpsbiXrzMKydFbfjtSueDyelEUuwKNM+LnVt9kC 9NLS5VlNDJHG/6BvThVRQwo9P/0Rn24fyKP9o6IHPv7OIe14PzockGTcfgPno9dIFTS5 SDEA== X-Gm-Message-State: AOJu0YwMCDK3BbQnCdGoSVaUSZonOLEo18e9bycR3KDu5Nxy+bwTiWCt rAiVADFDYw0x34+iAAgAB6xlI9ilM4mhrmzpSNxvd6oRotr+xvdLBNc5MSokNt2jOZ5hXy2k8j6 G8WRJcQ== X-Google-Smtp-Source: AGHT+IF6ikerbnIjhr/FPyswvBebDDLSRYTDkD5PrvJ8QkEFdMTtQ/c3f9ywXHrCsymI6MvCACFTWQ== X-Received: by 2002:a17:906:e53:b0:a31:7ce5:d44b with SMTP id q19-20020a1709060e5300b00a317ce5d44bmr4186891eji.71.1706540363242; Mon, 29 Jan 2024 06:59:23 -0800 (PST) Received: from localhost ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id wb5-20020a170907d50500b00a30d9c59771sm3995372ejc.32.2024.01.29.06.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:59:22 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com, saeedm@nvidia.com, leon@kernel.org, jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, rrameshbabu@nvidia.com Subject: [patch net-next 1/3] dpll: extend uapi by lock status error attribute Date: Mon, 29 Jan 2024 15:59:14 +0100 Message-ID: <20240129145916.244193-2-jiri@resnulli.us> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129145916.244193-1-jiri@resnulli.us> References: <20240129145916.244193-1-jiri@resnulli.us> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jiri Pirko If the dpll devices goes to state "unlocked" or "holdover", it may be caused by an error. In that case, allow user to see what the error was. Introduce a new attribute and values it can carry. Signed-off-by: Jiri Pirko --- Documentation/netlink/specs/dpll.yaml | 39 +++++++++++++++++++++++++++ include/uapi/linux/dpll.h | 30 +++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/Documentation/netlink/specs/dpll.yaml b/Documentation/netlink/specs/dpll.yaml index b14aed18065f..1755066d8308 100644 --- a/Documentation/netlink/specs/dpll.yaml +++ b/Documentation/netlink/specs/dpll.yaml @@ -51,6 +51,40 @@ definitions: if dpll lock-state was not DPLL_LOCK_STATUS_LOCKED_HO_ACQ, the dpll's lock-state shall remain DPLL_LOCK_STATUS_UNLOCKED) render-max: true + - + type: enum + name: lock-status-error + doc: | + if previous status change was done due to a failure, this provides + information of dpll device lock status error. + Valid values for DPLL_A_LOCK_STATUS_ERROR attribute + entries: + - + name: none + doc: | + dpll device lock status was changed without any error + value: 1 + - + name: undefined + doc: | + dpll device lock status was changed due to undefined error. + Driver fills this value up in case it is not able + to obtain suitable exact error type. + - + name: media-down + doc: | + dpll device lock status was changed because of associated + media got down. + This may happen for example if dpll device was previously + locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT. + - + name: fractional-frequency-offset-too-high + doc: | + the FFO (Fractional Frequency Offset) between the RX and TX + symbol rate on the media got too high. + This may happen for example if dpll device was previously + locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT. + render-max: true - type: const name: temp-divider @@ -214,6 +248,10 @@ attribute-sets: name: type type: u32 enum: type + - + name: lock-status-error + type: u32 + enum: lock-status-error - name: pin enum-name: dpll_a_pin @@ -379,6 +417,7 @@ operations: - mode - mode-supported - lock-status + - lock-status-error - temp - clock-id - type diff --git a/include/uapi/linux/dpll.h b/include/uapi/linux/dpll.h index b4e947f9bfbc..0c13d7f1a1bc 100644 --- a/include/uapi/linux/dpll.h +++ b/include/uapi/linux/dpll.h @@ -50,6 +50,35 @@ enum dpll_lock_status { DPLL_LOCK_STATUS_MAX = (__DPLL_LOCK_STATUS_MAX - 1) }; +/** + * enum dpll_lock_status_error - if previous status change was done due to a + * failure, this provides information of dpll device lock status error. Valid + * values for DPLL_A_LOCK_STATUS_ERROR attribute + * @DPLL_LOCK_STATUS_ERROR_NONE: dpll device lock status was changed without + * any error + * @DPLL_LOCK_STATUS_ERROR_UNDEFINED: dpll device lock status was changed due + * to undefined error. Driver fills this value up in case it is not able to + * obtain suitable exact error type. + * @DPLL_LOCK_STATUS_ERROR_MEDIA_DOWN: dpll device lock status was changed + * because of associated media got down. This may happen for example if dpll + * device was previously locked on an input pin of type + * PIN_TYPE_SYNCE_ETH_PORT. + * @DPLL_LOCK_STATUS_ERROR_FRACTIONAL_FREQUENCY_OFFSET_TOO_HIGH: the FFO + * (Fractional Frequency Offset) between the RX and TX symbol rate on the + * media got too high. This may happen for example if dpll device was + * previously locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT. + */ +enum dpll_lock_status_error { + DPLL_LOCK_STATUS_ERROR_NONE = 1, + DPLL_LOCK_STATUS_ERROR_UNDEFINED, + DPLL_LOCK_STATUS_ERROR_MEDIA_DOWN, + DPLL_LOCK_STATUS_ERROR_FRACTIONAL_FREQUENCY_OFFSET_TOO_HIGH, + + /* private: */ + __DPLL_LOCK_STATUS_ERROR_MAX, + DPLL_LOCK_STATUS_ERROR_MAX = (__DPLL_LOCK_STATUS_ERROR_MAX - 1) +}; + #define DPLL_TEMP_DIVIDER 1000 /** @@ -150,6 +179,7 @@ enum dpll_a { DPLL_A_LOCK_STATUS, DPLL_A_TEMP, DPLL_A_TYPE, + DPLL_A_LOCK_STATUS_ERROR, __DPLL_A_MAX, DPLL_A_MAX = (__DPLL_A_MAX - 1) From patchwork Mon Jan 29 14:59:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 13535846 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AACBC1534FE for ; Mon, 29 Jan 2024 14:59:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706540370; cv=none; b=mHnYrMu5SlsA70bnr1wszODzfheFo6RVpfFbEAyKcgYt79ERcelXX3+zV2UFh0XUspXGkwP0oQTCSgkYJu+Zh6l1sxwRHsFNBAfDU3nIh7nOnj7Nwnzs0pLcdcYMuglvzvFmzIlqh17rI2sZtdvHolx4YQbvqOmpYNwGYq4SDYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706540370; c=relaxed/simple; bh=uv+x1tnt+B2n61YzM57z/U/dWWIxIP1XO9FSSvvKCDg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UdRs7Fd1eq1g3zSa9Q/Pz27cdBOgVvt5GIf8OPRCzxbUrmFFdxJfSs18Ikoh7IoPzX8c5FnXd0zKkW1TYh2hgC6W3wcdTDqq0I1sMYx4kdLPFMGb7DDydhKZ13zoU/58zxAoyUev/nZ5DuyGZbIUcesUAyjB7W9IVIpZtSkTpTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us; spf=none smtp.mailfrom=resnulli.us; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b=dX0mu9EZ; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=resnulli.us Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b="dX0mu9EZ" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2cc9fa5e8e1so30855541fa.3 for ; Mon, 29 Jan 2024 06:59:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20230601.gappssmtp.com; s=20230601; t=1706540366; x=1707145166; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oRVeK3/iLpqWUEjl4hBDQ7S/p9rC6B4dKMLerlPoTrk=; b=dX0mu9EZ58RDcrOo+yOy9Yx4Weg3UbUdQCNeyxTTm391eQMZSjXPEyAvSa052+ONEm yzpXSSv5hf9UBsPnUK2pIZog9GCxhhzQaGlOhGt0GYWc+1DEqoRvtH36gM4rDtQ1IHCD HVx0mW2jTwJApG0+rQR2yI8bMexr5KjHK5lLIbc7Ep7tP/PNbQ4Mq8A9gtWAjUjkJoD4 q9K026IcoGp0tgXD2dSZq9SBdirRy7cT+ORc9wYG5jwj1PW9HtWsDS1+g3Hy97X4WWun ZXV9ScGKBY4JQb6c9R5GFra37QzNLNpaaJLxQMI4Im4pJjGKsISiZ/UaKqh6v+q4RVoM wFcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706540366; x=1707145166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oRVeK3/iLpqWUEjl4hBDQ7S/p9rC6B4dKMLerlPoTrk=; b=qhVE6Hpmk8CyWtE3u05m1pYaeme4kBaNbbUHLrOlasXhR1S+ZrCIbgiAoaPkOSYAS8 2gOTxnj4SbT72jAGnjY0OHMLA8UzuRiPRIzDeY5dSGFERCEnVJsayAmWwTxfX4HVZmFA SZX2+BBrxJdtZLB1rwMr4rYz5r6Ww4ttRlLkJPnaMWv3ygKO2QsZG+v5GT3JmK1c2jZT o+8XJzdhXiXEnbKlvyJc5sTCnVNZElkl2/Oc78XUfW8Q3PpyEElde0LCkRZ0BzOKvdrH PYkN43E4Sdgk4QRXcVWY609EiPiwY65vQ/YT3N7n0hPjyAMuMjs7OeoaaveVFAK2B0/U VItQ== X-Gm-Message-State: AOJu0YyVUvqrJI6mOV3EuKdaRMRwTjSFvWoqftonzV5tcitqRJR69kAo R4cvDt4VBhHfjj28mCOaK/5QTg++cxnT/WjreRIPmDpCMIEv/OncjYLDO2/zCrA5LhHP24tvTxs mB7Ztpg== X-Google-Smtp-Source: AGHT+IGsZ/9dx9FYI+oQpVx4JOXVwQvAUJum7qEbDxrnqhP+VM/BcuksSHWZ2fx9T8apy7IXXeZFvw== X-Received: by 2002:a2e:7407:0:b0:2cd:cd45:5cc0 with SMTP id p7-20020a2e7407000000b002cdcd455cc0mr3726003ljc.9.1706540366798; Mon, 29 Jan 2024 06:59:26 -0800 (PST) Received: from localhost ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id ds8-20020a0564021cc800b0055c9280dc51sm3832713edb.14.2024.01.29.06.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:59:26 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com, saeedm@nvidia.com, leon@kernel.org, jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, rrameshbabu@nvidia.com Subject: [patch net-next 2/3] dpll: extend lock_status_get() op by status error and expose to user Date: Mon, 29 Jan 2024 15:59:15 +0100 Message-ID: <20240129145916.244193-3-jiri@resnulli.us> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129145916.244193-1-jiri@resnulli.us> References: <20240129145916.244193-1-jiri@resnulli.us> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jiri Pirko 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 --- 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(-) 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); From patchwork Mon Jan 29 14:59:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 13535847 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 186A91534E6 for ; Mon, 29 Jan 2024 14:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706540374; cv=none; b=Q3rUq/au7bTh9ZnKNqTPhOt39avKuYMMMgAPiVaRWSmthAiXKgfJ7zvSI7DzpT+jDyYzog0lZMW8wBK6b9j980PumgR6A+xp800dLj1IFcgIEtdC11Iws90A8j5T9EbXeykIa9gd5kPfW/5NcNYmofNUJsX4FwM6cUdhg0cQ2ds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706540374; c=relaxed/simple; bh=w+vtkcaEg4HOJ6EQ6DECN4f/kbuYjM4UKBSJAedeigw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EE8+zOqBQJ5JkHL1xgqJTd8oO60o2o2RG9U1ipRxCRXN1q2sBsDNLJHBNopa+SvB4JjeXUntngQQV7Khn9gcRD9aPD/WVy4hTe4eEknXla5p2b7XzQN+OV7+Xwcepj2WrDYWierqPpVUeuc5B/53sMKwqQjiPkC9O0FsLDLgo7w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us; spf=none smtp.mailfrom=resnulli.us; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b=mWbvpQqZ; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=resnulli.us Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b="mWbvpQqZ" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a2f79e79f0cso331138866b.2 for ; Mon, 29 Jan 2024 06:59:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20230601.gappssmtp.com; s=20230601; t=1706540370; x=1707145170; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mT4POyZmbKK1kuk+bzu1xvYfdLsCluJ/1k8wEuWl7dw=; b=mWbvpQqZojj7HK76nUm3l9U+mElQpS8RyGmM+Og48/omqLZXYarme6e069SCz06+qT 5Q8r4RCDUC3jrXdwzzVojLO7U6xhvT/0OE3yH+BVtTWuGc0Jo3+GpkX6lQ7YsTYz6x/k SkBeTSS5TPn5/4H6SnzVUM2O5g2u0jYfVJlJJIhIPnYRj1lb0IlxQz1igQDlwV9quFS/ /5/fEq2eGP9CuwdwF1gmc8cuNYC+BnOtMPDip7X2zU3/nLBjfFT6N+L4u+4oGk3Ftj4K T+sGU6Q8PUCmDzN4AJWtflqxqgYBMOceGz5iXv2F3GnQ3LqbVp2/CPRYQEVeuDAkTu70 KR2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706540370; x=1707145170; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mT4POyZmbKK1kuk+bzu1xvYfdLsCluJ/1k8wEuWl7dw=; b=lmxD9sm280Ma0TQRCQEQsgcWcOURrR2plecnh32uJTz1tVxV43Ob87qOk9pZfyLeJp rro4R7p0Dowo++BXJDT8gEfuoa51gA2YNSVZRaoB0Th9HmmKcJfLXaaOigaOMI0nDtZG 8ZWj1urqqrfQnB7KfATkFfgljLINE6Y8s7RFsDbAGhbijbsxid3PclDOFQUjhBf4FbHM NofblSWY/MjIZOVxa40EaJ2DnMSxxKe6r06DUb8ITu7oHl34ef6LbEVhvrpkWlolnb+z uakER2VF5DiEqHawFoyZIfmmKh/Hcw6ckMPEhPv3Xmn6zL1+WmGkcUNcn2q/Z42qTUMa VeLw== X-Gm-Message-State: AOJu0Yz0glAD+qH+3yiqfzp43+Pp83bjk4SjcGflG62Ukekzv6GMel00 lHumRU8LVTfNhAXMH6Al8UaWXIyNtoEQDDAiNEGTgDYHW8478Wr9ROI5qGzzuVSKCkEA4IAA/zn xR8DNuA== X-Google-Smtp-Source: AGHT+IH+udtnqsEzAcr2Z3DrMjegwtLPHteljCAh6cwGi3jLoA1Wef0X++R+xe9KlXRiwsp1cNyTjA== X-Received: by 2002:a17:906:c343:b0:a31:818e:c98a with SMTP id ci3-20020a170906c34300b00a31818ec98amr5001432ejb.19.1706540370119; Mon, 29 Jan 2024 06:59:30 -0800 (PST) Received: from localhost ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id hw20-20020a170907a0d400b00a2b1a20e662sm4002299ejc.34.2024.01.29.06.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:59:29 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com, saeedm@nvidia.com, leon@kernel.org, jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, rrameshbabu@nvidia.com Subject: [patch net-next 3/3] net/mlx5: DPLL, Implement lock status error value Date: Mon, 29 Jan 2024 15:59:16 +0100 Message-ID: <20240129145916.244193-4-jiri@resnulli.us> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129145916.244193-1-jiri@resnulli.us> References: <20240129145916.244193-1-jiri@resnulli.us> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jiri Pirko Fill-up the lock status error value properly. Signed-off-by: Jiri Pirko --- .../net/ethernet/mellanox/mlx5/core/dpll.c | 23 +++++++++++++++++++ include/linux/mlx5/mlx5_ifc.h | 8 +++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dpll.c b/drivers/net/ethernet/mellanox/mlx5/core/dpll.c index 07f43d5c90c6..4ad3d2d3d4c8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/dpll.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/dpll.c @@ -41,6 +41,7 @@ struct mlx5_dpll_synce_status { enum mlx5_msees_oper_status oper_status; bool ho_acq; bool oper_freq_measure; + enum mlx5_msees_failure_reason failure_reason; s32 frequency_diff; }; @@ -60,6 +61,7 @@ mlx5_dpll_synce_status_get(struct mlx5_core_dev *mdev, synce_status->oper_status = MLX5_GET(msees_reg, out, oper_status); synce_status->ho_acq = MLX5_GET(msees_reg, out, ho_acq); synce_status->oper_freq_measure = MLX5_GET(msees_reg, out, oper_freq_measure); + synce_status->failure_reason = MLX5_GET(msees_reg, out, failure_reason); synce_status->frequency_diff = MLX5_GET(msees_reg, out, frequency_diff); return 0; } @@ -99,6 +101,26 @@ mlx5_dpll_lock_status_get(struct mlx5_dpll_synce_status *synce_status) } } +static enum dpll_lock_status_error +mlx5_dpll_lock_status_error_get(struct mlx5_dpll_synce_status *synce_status) +{ + switch (synce_status->oper_status) { + case MLX5_MSEES_OPER_STATUS_FAIL_HOLDOVER: + fallthrough; + case MLX5_MSEES_OPER_STATUS_FAIL_FREE_RUNNING: + switch (synce_status->failure_reason) { + case MLX5_MSEES_FAILURE_REASON_PORT_DOWN: + return DPLL_LOCK_STATUS_ERROR_MEDIA_DOWN; + case MLX5_MSEES_FAILURE_REASON_TOO_HIGH_FREQUENCY_DIFF: + return DPLL_LOCK_STATUS_ERROR_FRACTIONAL_FREQUENCY_OFFSET_TOO_HIGH; + default: + return DPLL_LOCK_STATUS_ERROR_UNDEFINED; + } + default: + return DPLL_LOCK_STATUS_ERROR_NONE; + } +} + static enum dpll_pin_state mlx5_dpll_pin_state_get(struct mlx5_dpll_synce_status *synce_status) { @@ -132,6 +154,7 @@ mlx5_dpll_device_lock_status_get(const struct dpll_device *dpll, void *priv, if (err) return err; *status = mlx5_dpll_lock_status_get(&synce_status); + *status_error = mlx5_dpll_lock_status_error_get(&synce_status); return 0; } diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index c726f90ab752..6c44f107b8ba 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -12705,6 +12705,14 @@ enum mlx5_msees_oper_status { MLX5_MSEES_OPER_STATUS_FAIL_FREE_RUNNING = 0x5, }; +enum mlx5_msees_failure_reason { + MLX5_MSEES_FAILURE_REASON_UNDEFINED_ERROR = 0x0, + MLX5_MSEES_FAILURE_REASON_PORT_DOWN = 0x1, + MLX5_MSEES_FAILURE_REASON_TOO_HIGH_FREQUENCY_DIFF = 0x2, + MLX5_MSEES_FAILURE_REASON_NET_SYNCHRONIZER_DEVICE_ERROR = 0x3, + MLX5_MSEES_FAILURE_REASON_LACK_OF_RESOURCES = 0x4, +}; + struct mlx5_ifc_msees_reg_bits { u8 reserved_at_0[0x8]; u8 local_port[0x8];