* [PATCH net-next] testptp: add option to enable external timestamping edges
@ 2025-06-19 13:53 Miroslav Lichvar
2025-06-19 14:17 ` Vadim Fedorenko
2025-06-23 12:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Miroslav Lichvar @ 2025-06-19 13:53 UTC (permalink / raw)
To: netdev; +Cc: Miroslav Lichvar, Richard Cochran, Jacob Keller
Some drivers (e.g. ice) don't enable any edges by default when external
timestamping is requested by the PTP_EXTTS_REQUEST ioctl, which makes
testptp -e unusable for testing hardware supported by these drivers.
Add -E option to specify if the rising, falling, or both edges should
be enabled by the ioctl.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>
---
tools/testing/selftests/ptp/testptp.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c
index edc08a4433fd..ed1e2886ba3c 100644
--- a/tools/testing/selftests/ptp/testptp.c
+++ b/tools/testing/selftests/ptp/testptp.c
@@ -120,6 +120,7 @@ static void usage(char *progname)
" -c query the ptp clock's capabilities\n"
" -d name device to open\n"
" -e val read 'val' external time stamp events\n"
+ " -E val enable rising (1), falling (2), or both (3) edges\n"
" -f val adjust the ptp clock frequency by 'val' ppb\n"
" -F chan Enable single channel mask and keep device open for debugfs verification.\n"
" -g get the ptp clock time\n"
@@ -178,6 +179,7 @@ int main(int argc, char *argv[])
int adjphase = 0;
int capabilities = 0;
int extts = 0;
+ int edge = 0;
int flagtest = 0;
int gettime = 0;
int index = 0;
@@ -202,7 +204,7 @@ int main(int argc, char *argv[])
progname = strrchr(argv[0], '/');
progname = progname ? 1+progname : argv[0];
- while (EOF != (c = getopt(argc, argv, "cd:e:f:F:ghH:i:k:lL:n:o:p:P:rsSt:T:w:x:Xy:z"))) {
+ while (EOF != (c = getopt(argc, argv, "cd:e:E:f:F:ghH:i:k:lL:n:o:p:P:rsSt:T:w:x:Xy:z"))) {
switch (c) {
case 'c':
capabilities = 1;
@@ -213,6 +215,11 @@ int main(int argc, char *argv[])
case 'e':
extts = atoi(optarg);
break;
+ case 'E':
+ edge = atoi(optarg);
+ edge = (edge & 1 ? PTP_RISING_EDGE : 0) |
+ (edge & 2 ? PTP_FALLING_EDGE : 0);
+ break;
case 'f':
adjfreq = atoi(optarg);
break;
@@ -444,7 +451,7 @@ int main(int argc, char *argv[])
if (!readonly) {
memset(&extts_request, 0, sizeof(extts_request));
extts_request.index = index;
- extts_request.flags = PTP_ENABLE_FEATURE;
+ extts_request.flags = PTP_ENABLE_FEATURE | edge;
if (ioctl(fd, PTP_EXTTS_REQUEST, &extts_request)) {
perror("PTP_EXTTS_REQUEST");
extts = 0;
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] testptp: add option to enable external timestamping edges
2025-06-19 13:53 [PATCH net-next] testptp: add option to enable external timestamping edges Miroslav Lichvar
@ 2025-06-19 14:17 ` Vadim Fedorenko
2025-06-23 12:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Vadim Fedorenko @ 2025-06-19 14:17 UTC (permalink / raw)
To: Miroslav Lichvar, netdev; +Cc: Richard Cochran, Jacob Keller
On 19/06/2025 14:53, Miroslav Lichvar wrote:
> Some drivers (e.g. ice) don't enable any edges by default when external
> timestamping is requested by the PTP_EXTTS_REQUEST ioctl, which makes
> testptp -e unusable for testing hardware supported by these drivers.
>
> Add -E option to specify if the rising, falling, or both edges should
> be enabled by the ioctl.
>
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Jacob Keller <jacob.e.keller@intel.com>
> ---
> tools/testing/selftests/ptp/testptp.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c
> index edc08a4433fd..ed1e2886ba3c 100644
> --- a/tools/testing/selftests/ptp/testptp.c
> +++ b/tools/testing/selftests/ptp/testptp.c
> @@ -120,6 +120,7 @@ static void usage(char *progname)
> " -c query the ptp clock's capabilities\n"
> " -d name device to open\n"
> " -e val read 'val' external time stamp events\n"
> + " -E val enable rising (1), falling (2), or both (3) edges\n"
> " -f val adjust the ptp clock frequency by 'val' ppb\n"
> " -F chan Enable single channel mask and keep device open for debugfs verification.\n"
> " -g get the ptp clock time\n"
> @@ -178,6 +179,7 @@ int main(int argc, char *argv[])
> int adjphase = 0;
> int capabilities = 0;
> int extts = 0;
> + int edge = 0;
> int flagtest = 0;
> int gettime = 0;
> int index = 0;
> @@ -202,7 +204,7 @@ int main(int argc, char *argv[])
>
> progname = strrchr(argv[0], '/');
> progname = progname ? 1+progname : argv[0];
> - while (EOF != (c = getopt(argc, argv, "cd:e:f:F:ghH:i:k:lL:n:o:p:P:rsSt:T:w:x:Xy:z"))) {
> + while (EOF != (c = getopt(argc, argv, "cd:e:E:f:F:ghH:i:k:lL:n:o:p:P:rsSt:T:w:x:Xy:z"))) {
> switch (c) {
> case 'c':
> capabilities = 1;
> @@ -213,6 +215,11 @@ int main(int argc, char *argv[])
> case 'e':
> extts = atoi(optarg);
> break;
> + case 'E':
> + edge = atoi(optarg);
> + edge = (edge & 1 ? PTP_RISING_EDGE : 0) |
> + (edge & 2 ? PTP_FALLING_EDGE : 0);
> + break;
> case 'f':
> adjfreq = atoi(optarg);
> break;
> @@ -444,7 +451,7 @@ int main(int argc, char *argv[])
> if (!readonly) {
> memset(&extts_request, 0, sizeof(extts_request));
> extts_request.index = index;
> - extts_request.flags = PTP_ENABLE_FEATURE;
> + extts_request.flags = PTP_ENABLE_FEATURE | edge;
> if (ioctl(fd, PTP_EXTTS_REQUEST, &extts_request)) {
> perror("PTP_EXTTS_REQUEST");
> extts = 0;
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] testptp: add option to enable external timestamping edges
2025-06-19 13:53 [PATCH net-next] testptp: add option to enable external timestamping edges Miroslav Lichvar
2025-06-19 14:17 ` Vadim Fedorenko
@ 2025-06-23 12:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-23 12:40 UTC (permalink / raw)
To: Miroslav Lichvar; +Cc: netdev, richardcochran, jacob.e.keller
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Thu, 19 Jun 2025 15:53:42 +0200 you wrote:
> Some drivers (e.g. ice) don't enable any edges by default when external
> timestamping is requested by the PTP_EXTTS_REQUEST ioctl, which makes
> testptp -e unusable for testing hardware supported by these drivers.
>
> Add -E option to specify if the rising, falling, or both edges should
> be enabled by the ioctl.
>
> [...]
Here is the summary with links:
- [net-next] testptp: add option to enable external timestamping edges
https://git.kernel.org/netdev/net-next/c/27390db9592d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-23 12:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 13:53 [PATCH net-next] testptp: add option to enable external timestamping edges Miroslav Lichvar
2025-06-19 14:17 ` Vadim Fedorenko
2025-06-23 12:40 ` patchwork-bot+netdevbpf
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).