[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63be4b0d-4cff-45d9-90b3-a318ac6e28c1@intel.com>
Date: Tue, 4 Feb 2025 09:43:32 +0100
From: Mateusz Polchlopek <mateusz.polchlopek@...el.com>
To: Tariq Toukan <tariqt@...dia.com>, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Eric
Dumazet" <edumazet@...gle.com>, Andrew Lunn <andrew+netdev@...n.ch>
CC: <netdev@...r.kernel.org>, Saeed Mahameed <saeedm@...dia.com>, Gal Pressman
<gal@...dia.com>, Jianbo Liu <jianbol@...dia.com>, Moshe Shemesh
<moshe@...dia.com>, Leon Romanovsky <leonro@...dia.com>, Mark Bloch
<mbloch@...dia.com>, Carolina Jubran <cjubran@...dia.com>, Dragos Tatulea
<dtatulea@...dia.com>
Subject: Re: [PATCH net-next 01/15] net/mlx5: Add helper functions for PTP
callbacks
On 2/3/2025 10:35 PM, Tariq Toukan wrote:
> From: Jianbo Liu <jianbol@...dia.com>
>
> The PTP callback functions should not be used directly by internal
> callers. Add helpers that can be used internally and externally.
>
> Signed-off-by: Jianbo Liu <jianbol@...dia.com>
> Reviewed-by: Carolina Jubran <cjubran@...dia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@...dia.com>
> Signed-off-by: Tariq Toukan <tariqt@...dia.com>
> ---
> .../ethernet/mellanox/mlx5/core/lib/clock.c | 32 +++++++++++++------
> 1 file changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> index d61a1a9297c9..eaf343756026 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> @@ -119,6 +119,13 @@ static u32 mlx5_ptp_shift_constant(u32 dev_freq_khz)
> ilog2((U32_MAX / NSEC_PER_MSEC) * dev_freq_khz));
> }
>
[...]
>
> +static int mlx5_ptp_settime(struct ptp_clock_info *ptp, const struct timespec64 *ts)
> +{
> + 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);
> +
Maybe just oneliner for mdev instead of dividing it into two lines? But
it's up to you
> + return mlx5_clock_settime(mdev, clock, ts);
> +}
> +
> static
> struct timespec64 mlx5_ptp_gettimex_real_time(struct mlx5_core_dev *mdev,
> struct ptp_system_timestamp *sts)
> @@ -1129,7 +1141,7 @@ static void mlx5_init_timer_clock(struct mlx5_core_dev *mdev)
> struct timespec64 ts;
>
> ktime_get_real_ts64(&ts);
> - mlx5_ptp_settime(&clock->ptp_info, &ts);
> + mlx5_clock_settime(mdev, clock, &ts);
> }
> }
>
Only one small nitpick, overall the code looks good, nice rework.
Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@...el.com>
Powered by blists - more mailing lists