From: Jacob Keller <jacob.e.keller@intel•com>
To: Saeed Mahameed <saeed@kernel•org>,
"David S. Miller" <davem@davemloft•net>,
Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
Eric Dumazet <edumazet@google•com>
Cc: Saeed Mahameed <saeedm@nvidia•com>, <netdev@vger•kernel.org>,
Tariq Toukan <tariqt@nvidia•com>,
Rahul Rameshbabu <rrameshbabu@nvidia•com>,
Gal Pressman <gal@nvidia•com>
Subject: Re: [net-next 04/15] net/mlx5: Add hardware extended range support for PTP adjtime and adjphase
Date: Wed, 18 Jan 2023 13:35:30 -0800 [thread overview]
Message-ID: <725bf5eb-ce75-413f-fe41-3ba9c9872e20@intel.com> (raw)
In-Reply-To: <20230118183602.124323-5-saeed@kernel.org>
On 1/18/2023 10:35 AM, Saeed Mahameed wrote:
> From: Rahul Rameshbabu <rrameshbabu@nvidia•com>
>
> Capable hardware can use an extended range for offsetting the clock. An
> extended range of [-200000,200000] is used instead of [-32768,32767] for
> the delta/phase parameter of the adjtime/adjphase ptp_clock_info callbacks.
>
> Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia•com>
> Reviewed-by: Gal Pressman <gal@nvidia•com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia•com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia•com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel•com>
> ---
> .../ethernet/mellanox/mlx5/core/lib/clock.c | 34 +++++++++++++++++--
> include/linux/mlx5/mlx5_ifc.h | 4 ++-
> 2 files changed, 34 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> index ecdff26a22b0..75510a12ab02 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> @@ -69,6 +69,13 @@ enum {
> MLX5_MTPPS_FS_OUT_PULSE_DURATION_NS = BIT(0xa),
> };
>
> +enum {
> + MLX5_MTUTC_OPERATION_ADJUST_TIME_MIN = S16_MIN,
> + MLX5_MTUTC_OPERATION_ADJUST_TIME_MAX = S16_MAX,
> + MLX5_MTUTC_OPERATION_ADJUST_TIME_EXTENDED_MIN = -200000,
> + MLX5_MTUTC_OPERATION_ADJUST_TIME_EXTENDED_MAX = 200000,
> +};
> +
> static bool mlx5_real_time_mode(struct mlx5_core_dev *mdev)
> {
> return (mlx5_is_real_time_rq(mdev) || mlx5_is_real_time_sq(mdev));
> @@ -86,6 +93,22 @@ static bool mlx5_modify_mtutc_allowed(struct mlx5_core_dev *mdev)
> return MLX5_CAP_MCAM_FEATURE(mdev, ptpcyc2realtime_modify);
> }
>
> +static bool mlx5_is_mtutc_time_adj_cap(struct mlx5_core_dev *mdev, s64 delta)
> +{
> + s64 min = MLX5_MTUTC_OPERATION_ADJUST_TIME_MIN;
> + s64 max = MLX5_MTUTC_OPERATION_ADJUST_TIME_MAX;
> +
> + if (MLX5_CAP_MCAM_FEATURE(mdev, mtutc_time_adjustment_extended_range)) {
> + min = MLX5_MTUTC_OPERATION_ADJUST_TIME_EXTENDED_MIN;
> + max = MLX5_MTUTC_OPERATION_ADJUST_TIME_EXTENDED_MAX;
> + }
> +
> + if (delta < min || delta > max)
> + return false;
> +
> + return true;
> +}
> +
> static int mlx5_set_mtutc(struct mlx5_core_dev *dev, u32 *mtutc, u32 size)
> {
> u32 out[MLX5_ST_SZ_DW(mtutc_reg)] = {};
> @@ -288,8 +311,8 @@ static int mlx5_ptp_adjtime_real_time(struct mlx5_core_dev *mdev, s64 delta)
> if (!mlx5_modify_mtutc_allowed(mdev))
> return 0;
>
> - /* HW time adjustment range is s16. If out of range, settime instead */
> - if (delta < S16_MIN || delta > S16_MAX) {
> + /* HW time adjustment range is checked. If out of range, settime instead */
> + if (!mlx5_is_mtutc_time_adj_cap(mdev, delta)) {
> struct timespec64 ts;
> s64 ns;
>
> @@ -328,7 +351,12 @@ static int mlx5_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
>
> static int mlx5_ptp_adjphase(struct ptp_clock_info *ptp, s32 delta)
> {
> - if (delta < S16_MIN || delta > S16_MAX)
> + struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock, ptp_info);
> + struct mlx5_core_dev *mdev;
> +
> + mdev = container_of(clock, struct mlx5_core_dev, clock);
> +
> + if (!mlx5_is_mtutc_time_adj_cap(mdev, delta))
> return -ERANGE;
>
> return mlx5_ptp_adjtime(ptp, delta);
> diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
> index a84bdeeed2c6..0b102c651fe2 100644
> --- a/include/linux/mlx5/mlx5_ifc.h
> +++ b/include/linux/mlx5/mlx5_ifc.h
> @@ -9941,7 +9941,9 @@ struct mlx5_ifc_pcam_reg_bits {
> };
>
> struct mlx5_ifc_mcam_enhanced_features_bits {
> - u8 reserved_at_0[0x5d];
> + u8 reserved_at_0[0x51];
> + u8 mtutc_time_adjustment_extended_range[0x1];
> + u8 reserved_at_52[0xb];
> u8 mcia_32dwords[0x1];
> u8 out_pulse_duration_ns[0x1];
> u8 npps_period[0x1];
next prev parent reply other threads:[~2023-01-18 21:35 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 18:35 [pull request][net-next 00/15] mlx5 updates 2023-01-18 Saeed Mahameed
2023-01-18 18:35 ` [net-next 01/15] net/mlx5e: Suppress Send WQEBB room warning for PAGE_SIZE >= 16KB Saeed Mahameed
2023-01-18 21:31 ` Jacob Keller
2023-01-20 4:00 ` patchwork-bot+netdevbpf
2023-01-18 18:35 ` [net-next 02/15] net/mlx5: Suppress error logging on UCTX creation Saeed Mahameed
2023-01-18 21:32 ` Jacob Keller
2023-01-18 18:35 ` [net-next 03/15] net/mlx5: Add adjphase function to support hardware-only offset control Saeed Mahameed
2023-01-18 21:33 ` Jacob Keller
2023-01-20 3:46 ` Jakub Kicinski
2023-01-20 3:56 ` Rahul Rameshbabu
2023-01-20 4:03 ` Jakub Kicinski
2023-01-20 4:26 ` Rahul Rameshbabu
2023-01-20 5:08 ` Jakub Kicinski
2023-01-20 5:22 ` Rahul Rameshbabu
2023-01-20 5:45 ` Jakub Kicinski
2023-01-20 6:02 ` Rahul Rameshbabu
2023-01-20 17:21 ` Jacob Keller
2023-01-20 18:00 ` Rahul Rameshbabu
2023-01-20 23:58 ` Jacob Keller
2023-01-21 0:06 ` Jakub Kicinski
2023-01-22 21:11 ` Rahul Rameshbabu
2023-01-23 2:22 ` Richard Cochran
2023-01-23 2:48 ` Rahul Rameshbabu
2023-01-23 2:58 ` Richard Cochran
2023-01-23 18:44 ` Rahul Rameshbabu
2023-01-23 19:13 ` Jacob Keller
2023-01-23 22:39 ` Richard Cochran
2023-01-23 22:36 ` Richard Cochran
2023-01-24 10:33 ` Bar Shapira
2023-01-24 19:15 ` Richard Cochran
2023-01-25 0:48 ` Jakub Kicinski
2023-01-25 2:26 ` Rahul Rameshbabu
2023-01-25 8:28 ` Gal Pressman
2023-01-23 2:15 ` Richard Cochran
2023-01-23 18:14 ` Jacob Keller
2023-01-18 18:35 ` [net-next 04/15] net/mlx5: Add hardware extended range support for PTP adjtime and adjphase Saeed Mahameed
2023-01-18 21:35 ` Jacob Keller [this message]
2023-01-18 18:35 ` [net-next 05/15] net/mlx5: E-switch, Remove redundant comment about meta rules Saeed Mahameed
2023-01-18 21:40 ` Jacob Keller
2023-01-18 18:35 ` [net-next 06/15] net/mlx5e: Fail with messages when params are not valid for XSK Saeed Mahameed
2023-01-18 21:41 ` Jacob Keller
2023-01-18 18:35 ` [net-next 07/15] net/mlx5e: Add warning when log WQE size is smaller than log stride size Saeed Mahameed
2023-01-18 21:42 ` Jacob Keller
2023-01-18 18:35 ` [net-next 08/15] net/mlx5e: TC, Pass flow attr to attach/detach mod hdr functions Saeed Mahameed
2023-01-18 21:42 ` Jacob Keller
2023-01-18 18:35 ` [net-next 09/15] net/mlx5e: TC, Add tc prefix to attach/detach " Saeed Mahameed
2023-01-18 21:44 ` Jacob Keller
2023-01-18 18:35 ` [net-next 10/15] net/mlx5e: TC, Use common function allocating flow mod hdr or encap mod hdr Saeed Mahameed
2023-01-18 21:45 ` Jacob Keller
2023-01-18 18:35 ` [net-next 11/15] net/mlx5e: Warn when destroying mod hdr hash table that is not empty Saeed Mahameed
2023-01-18 21:45 ` Jacob Keller
2023-01-18 18:35 ` [net-next 12/15] net/mlx5: E-Switch, Fix typo for egress Saeed Mahameed
2023-01-18 21:46 ` Jacob Keller
2023-01-18 18:36 ` [net-next 13/15] net/mlx5e: Support Geneve and GRE with VF tunnel offload Saeed Mahameed
2023-01-18 21:48 ` Jacob Keller
2023-01-18 18:36 ` [net-next 14/15] net/mlx5e: Remove redundant allocation of spec in create indirect fwd group Saeed Mahameed
2023-01-18 21:50 ` Jacob Keller
2023-01-18 18:36 ` [net-next 15/15] net/mlx5e: Use read lock for eswitch get callbacks Saeed Mahameed
2023-01-18 21:51 ` Jacob Keller
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=725bf5eb-ce75-413f-fe41-3ba9c9872e20@intel.com \
--to=jacob.e.keller@intel$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=gal@nvidia$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=rrameshbabu@nvidia$(echo .)com \
--cc=saeed@kernel$(echo .)org \
--cc=saeedm@nvidia$(echo .)com \
--cc=tariqt@nvidia$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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