lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR11MB4657C83479354B07E7E32FC89B4C2@DM6PR11MB4657.namprd11.prod.outlook.com>
Date: Tue, 22 Oct 2024 14:51:12 +0000
From: "Kubalewski, Arkadiusz" <arkadiusz.kubalewski@...el.com>
To: "Keller, Jacob E" <jacob.e.keller@...el.com>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "intel-wired-lan@...ts.osuosl.org"
	<intel-wired-lan@...ts.osuosl.org>
CC: "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>, "Kitszel, Przemyslaw"
	<przemyslaw.kitszel@...el.com>, "davem@...emloft.net" <davem@...emloft.net>,
	"edumazet@...gle.com" <edumazet@...gle.com>, "kuba@...nel.org"
	<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
	"richardcochran@...il.com" <richardcochran@...il.com>, "Loktionov, Aleksandr"
	<aleksandr.loktionov@...el.com>
Subject: RE: [Intel-wired-lan] [PATCH net-next 1/2] ptp: add control over HW
 timestamp latch point

>From: Keller, Jacob E <jacob.e.keller@...el.com>
>Sent: Tuesday, October 22, 2024 12:31 AM
>
>
>On 10/21/2024 7:19 AM, Arkadiusz Kubalewski wrote:
>> Currently HW support of PTP/timesync solutions in network PHY chips can
>> be
>> implemented with two different approaches, the timestamp maybe latched
>> either at the beginning or after the Start of Frame Delimiter (SFD) [1].
>>
>> Allow ptp device drivers to provide user with control over the HW
>> timestamp latch point with ptp sysfs ABI.
>>
>> [1] https://www.ieee802.org/3/cx/public/april20/tse_3cx_01_0420.pdf
>>
>> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@...el.com>
>> Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
>> ---
>>  Documentation/ABI/testing/sysfs-ptp | 12 ++++++++
>>  drivers/ptp/ptp_sysfs.c             | 44 +++++++++++++++++++++++++++++
>>  include/linux/ptp_clock_kernel.h    | 29 +++++++++++++++++++
>>  3 files changed, 85 insertions(+)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-ptp
>> b/Documentation/ABI/testing/sysfs-ptp
>> index 9c317ac7c47a..a0d89e0fd72e 100644
>> --- a/Documentation/ABI/testing/sysfs-ptp
>> +++ b/Documentation/ABI/testing/sysfs-ptp
>> @@ -140,3 +140,15 @@ Description:
>>  		PPS events to the Linux PPS subsystem. To enable PPS
>>  		events, write a "1" into the file. To disable events,
>>  		write a "0" into the file.
>> +
>> +What:		/sys/class/ptp/ptp<N>/ts_point
>> +Date:		October 2024
>> +Contact:	Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
>> +Description:
>> +		This file provides control over the point in time in
>> +		which the HW timestamp is latched. As specified in IEEE
>> +		802.3cx, the latch point can be either at the beginning
>> +		or after the end of Start of Frame Delimiter (SFD).
>> +		Value "0" means the timestamp is latched at the
>> +		beginning of the SFD. Value "1" means that timestamp is
>> +		latched after the end of SFD.
>> diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
>> index 6b1b8f57cd95..7e9f6ef368b6 100644
>> --- a/drivers/ptp/ptp_sysfs.c
>> +++ b/drivers/ptp/ptp_sysfs.c
>> @@ -28,6 +28,46 @@ static ssize_t max_phase_adjustment_show(struct device
>> *dev,
>>  }
>>  static DEVICE_ATTR_RO(max_phase_adjustment);
>>
>> +static ssize_t ts_point_show(struct device *dev, struct device_attribute
>> *attr,
>> +			     char *page)
>> +{
>> +	struct ptp_clock *ptp = dev_get_drvdata(dev);
>> +	enum ptp_ts_point point;
>> +	int err;
>> +
>> +	if (!ptp->info->get_ts_point)
>> +		return -EOPNOTSUPP;
>> +	err = ptp->info->get_ts_point(ptp->info, &point);
>> +	if (err)
>> +		return err;
>> +
>> +	return sysfs_emit(page, "%d\n", point);
>> +}
>> +
>
>Ok, so if the driver doesn't support this API, we just return EOPNOTSUPP
>and don't support the API then.
>
>Presumably hardware which doesn't timestamp according to this standard
>would then simply not support the API?

This is tricky, I did it this way, since the driver can implement only
get_ts_point for any given HW - just to give user idea what it shall expect
(the timestamp is always latched at some point).
Setting this, on the other hand depends on the PHY, which needs to allow
control over it.
If none of the callbacks are implemented then sysfs doesn't appear, if one of
the callbacks is implemented then the sysfs will appear, but the check if
callback is present is still required.

Thank you!
Arkadiusz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ