[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0becc009-68a8-452f-9115-a5df3ca998ed@redhat.com>
Date: Fri, 18 Jul 2025 11:09:28 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Carolina Jubran <cjubran@...dia.com>,
Richard Cochran <richardcochran@...il.com>
Cc: Saeed Mahameed <saeedm@...dia.com>, Leon Romanovsky <leon@...nel.org>,
Mark Bloch <mbloch@...dia.com>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
Tariq Toukan <tariqt@...dia.com>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next 3/3] net/mlx5: Support getcyclesx and
getcrosscycles
On 7/17/25 5:56 PM, Carolina Jubran wrote:
> On 17/07/2025 13:55, Paolo Abeni wrote:
>> On 7/15/25 7:15 AM, Tariq Toukan wrote:
>>> From: Carolina Jubran <cjubran@...dia.com>
>>>
>>> Implement the getcyclesx64 and getcrosscycles callbacks in ptp_info to
>>> expose the device’s raw free-running counter.
>>>
>>> Signed-off-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 | 74 ++++++++++++++++++-
>>> 1 file changed, 73 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
>>> index b1e2deeefc0c..2f75726674a9 100644
>>> --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
>>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
>>> @@ -306,6 +306,23 @@ static int mlx5_mtctr_syncdevicetime(ktime_t *device_time,
>>> return 0;
>>> }
>>>
>>> +static int
>>> +mlx5_mtctr_syncdevicecyclestime(ktime_t *device_time,
>>> + struct system_counterval_t *sys_counterval,
>>> + void *ctx)
>>> +{
>>> + struct mlx5_core_dev *mdev = ctx;
>>> + u64 device;
>>> + int err;
>>> +
>>> + err = mlx5_mtctr_read(mdev, false, sys_counterval, &device);
>>> + if (err)
>>> + return err;
>>> + *device_time = ns_to_ktime(device);
>>
>> If the goal is providing a raw cycle counter, why still using a timespec
>> to the user space? A plain u64 would possibly be less ambiguous.
>>
>> /P
>>
>
> getcycles64 and getcrosscycles already return the cycle counter in a
> timespec64/ktime format, so I kept the new ioctls consistent with them.
Ah, sorry I missed that context. Looks good to me than.
Thanks,
Paolo
Powered by blists - more mailing lists