From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Michael Chan <michael.chan@broadcom.com>,
davem@davemloft.net, Pavan Chebbi <pavan.chebbi@broadcom.com>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, edumazet@google.com,
andrew.gospodarek@broadcom.com, jiri@resnulli.us,
richardcochran@gmail.com
Subject: Re: [PATCH net-next 1/2] bnxt_en: Introduce devlink runtime driver param to set ptp tx timeout
Date: Thu, 29 Feb 2024 09:27:24 +0000 [thread overview]
Message-ID: <66cb6a54-8735-4f67-9aff-0048156e0902@linux.dev> (raw)
In-Reply-To: <20240229070202.107488-2-michael.chan@broadcom.com>
On 29/02/2024 07:02, Michael Chan wrote:
> From: Pavan Chebbi <pavan.chebbi@broadcom.com>
>
> Sometimes, the current 1ms value that driver waits for firmware
> to obtain a tx timestamp for a PTP packet may not be sufficient.
> User may want the driver to wait for a longer custom period before
> timing out.
>
> Introduce a new runtime driver param for devlink "ptp_tx_timeout".
> Using this parameter the driver can wait for up to the specified
> time, when it is querying for a TX timestamp from firmware. By
> default the value is set to 1s.
>
> Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
> Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> ---
> .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 42 +++++++++++++++++++
> drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 1 +
> drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 3 ++
> 3 files changed, 46 insertions(+)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> index ae4529c043f0..0df0baa9d18c 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> @@ -652,6 +652,7 @@ static const struct devlink_ops bnxt_vf_dl_ops;
> enum bnxt_dl_param_id {
> BNXT_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
> BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK,
> + BNXT_DEVLINK_PARAM_ID_PTP_TXTS_TMO,
> };
>
> static const struct bnxt_dl_nvm_param nvm_params[] = {
> @@ -1077,6 +1078,42 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
> return rc;
> }
>
> +static int bnxt_dl_ptp_param_get(struct devlink *dl, u32 id,
> + struct devlink_param_gset_ctx *ctx)
> +{
> + struct bnxt *bp = bnxt_get_bp_from_dl(dl);
> +
> + if (!bp->ptp_cfg)
> + return -EOPNOTSUPP;
> +
> + ctx->val.vu32 = bp->ptp_cfg->txts_tmo;
> + return 0;
> +}
> +
> +static int bnxt_dl_ptp_param_set(struct devlink *dl, u32 id,
> + struct devlink_param_gset_ctx *ctx)
> +{
> + struct bnxt *bp = bnxt_get_bp_from_dl(dl);
> +
> + if (!bp->ptp_cfg)
> + return -EOPNOTSUPP;
> +
> + bp->ptp_cfg->txts_tmo = ctx->val.vu32;
> + return 0;
> +}
> +
> +static int bnxt_dl_ptp_param_validate(struct devlink *dl, u32 id,
> + union devlink_param_value val,
> + struct netlink_ext_ack *extack)
> +{
> + if (val.vu32 > BNXT_PTP_MAX_TX_TMO) {
> + NL_SET_ERR_MSG_FMT_MOD(extack, "TX timeout value exceeds the maximum (%d ms)",
> + BNXT_PTP_MAX_TX_TMO);
> + return -EINVAL;
> + }
> + return 0;
> +}
> +
> static int bnxt_dl_nvm_param_get(struct devlink *dl, u32 id,
> struct devlink_param_gset_ctx *ctx)
> {
> @@ -1180,6 +1217,11 @@ static const struct devlink_param bnxt_dl_params[] = {
> BIT(DEVLINK_PARAM_CMODE_PERMANENT),
> bnxt_dl_nvm_param_get, bnxt_dl_nvm_param_set,
> NULL),
> + DEVLINK_PARAM_DRIVER(BNXT_DEVLINK_PARAM_ID_PTP_TXTS_TMO,
> + "ptp_tx_timeout", DEVLINK_PARAM_TYPE_U32,
> + BIT(DEVLINK_PARAM_CMODE_RUNTIME),
> + bnxt_dl_ptp_param_get, bnxt_dl_ptp_param_set,
> + bnxt_dl_ptp_param_validate),
> /* keep REMOTE_DEV_RESET last, it is excluded based on caps */
> DEVLINK_PARAM_GENERIC(ENABLE_REMOTE_DEV_RESET,
> BIT(DEVLINK_PARAM_CMODE_RUNTIME),
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
> index cc07660330f5..4b50b07b9771 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
> @@ -965,6 +965,7 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg)
> spin_unlock_bh(&ptp->ptp_lock);
> ptp_schedule_worker(ptp->ptp_clock, 0);
> }
> + ptp->txts_tmo = BNXT_PTP_DFLT_TX_TMO;
> return 0;
>
> out:
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h
> index fce8dc39a7d0..ee977620d33e 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h
> @@ -22,6 +22,8 @@
> #define BNXT_LO_TIMER_MASK 0x0000ffffffffUL
> #define BNXT_HI_TIMER_MASK 0xffff00000000UL
>
> +#define BNXT_PTP_DFLT_TX_TMO 1000 /* ms */
I'm not happy with such huge timeout, but looks like other vendors do
expect the same timeouts, I'm ok.
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
> +#define BNXT_PTP_MAX_TX_TMO 5000 /* ms */
> #define BNXT_PTP_QTS_TIMEOUT 1000
> #define BNXT_PTP_QTS_TX_ENABLES (PORT_TS_QUERY_REQ_ENABLES_PTP_SEQ_ID | \
> PORT_TS_QUERY_REQ_ENABLES_TS_REQ_TIMEOUT | \
> @@ -120,6 +122,7 @@ struct bnxt_ptp_cfg {
>
> u32 refclk_regs[2];
> u32 refclk_mapped_regs[2];
> + u32 txts_tmo;
> };
>
> #if BITS_PER_LONG == 32
next prev parent reply other threads:[~2024-02-29 9:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 7:02 [PATCH net-next 0/2] bnxt_en: Support configurable PTP TX timeout Michael Chan
2024-02-29 7:02 ` [PATCH net-next 1/2] bnxt_en: Introduce devlink runtime driver param to set ptp tx timeout Michael Chan
2024-02-29 9:27 ` Vadim Fedorenko [this message]
2024-02-29 17:11 ` Jiri Pirko
2024-02-29 17:30 ` Jakub Kicinski
2024-02-29 21:22 ` Vadim Fedorenko
2024-03-01 1:49 ` Jakub Kicinski
2024-03-01 7:39 ` Pavan Chebbi
2024-03-01 17:18 ` Jakub Kicinski
2024-03-07 3:50 ` Pavan Chebbi
2024-03-07 4:19 ` Jakub Kicinski
2024-03-01 11:34 ` Jiri Pirko
2024-02-29 7:02 ` [PATCH net-next 2/2] bnxt_en: Retry for TX timestamp from FW until timeout specified Michael Chan
2024-02-29 9:23 ` Vadim Fedorenko
2024-02-29 16:43 ` Michael Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=66cb6a54-8735-4f67-9aff-0048156e0902@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pavan.chebbi@broadcom.com \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).