Skip to contentSkip to conversation

Testing selectable timestamping - where are the tools for this feature?

DISCUSSION Russell King (Oracle) 2 participants 9 messages Nov 13, 2024 – Nov 15, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Kory,

I've finally found some cycles (and time when I'm next to the platform) to test the selectable timestamping feature. However, I'm struggling to get it to work.

In your email
https://lore.kernel.org/[email protected]/
you state that "You can test it with the ethtool source on branch feature_ptp of: https://github.com/kmaincent/ethtool". I cloned this repository, checked out the feature_ptp branch, and while building I get the following warnings:

netlink/desc-ethtool.c:241:37: warning: ‘__ts_desc’ defined but not used [-Wunus ed-const-variable=]
241 | static const struct pretty_nla_desc __ts_desc[] = {
| ^~~~~~~~~
netlink/ts.c: In function ‘ts_get_reply_cb’:
netlink/ts.c:23:14: warning: unused variable ‘str’ [-Wunused-variable]
23 | char str[10] = {'\0'};
| ^~~
ethtool.c:4865:12: warning: ‘do_set_ptp’ defined but not used [-Wunused-functio ]
4865 | static int do_set_ptp(struct cmd_context *ctx)

      |            ^~~~~~~~~~
ethtool.c:4839:12: warning: ‘do_get_ptp’ defined but not used [-Wunused-functio ]
 4839 | static int do_get_ptp(struct cmd_context *ctx)
      |            ^~~~~~~~~~
ethtool.c:4817:12: warning: ‘do_list_ptp’ defined but not used [-Wunused-function]
 4817 | static int do_list_ptp(struct cmd_context *ctx)
      |            ^~~~~~~~~~~

My conclusion is... your ethtool sources for testing this feature are broken, or this is no longer the place to test this feature.

Presumably there _is_ something somewhere that allows one to exercise this new code that Jakub merged on July 15th (commit 30b356005048)? Please could you point me in the appropriate direction ASAP - time is very short if I'm going to give this a test on the setup where both the MAC and PHY support PTP. Essentially, this afternoon - or its going to be at least a month before the next opportunity.

Thanks.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#1 lore raw

Hello Russell,

Quoted 13 lines · On Wed, 13 Nov 2024 14:46:25 +0000 "Russell King (Oracle)"…

Hi Kory,

I've finally found some cycles (and time when I'm next to the platform) to test the selectable timestamping feature. However, I'm struggling to get it to work.

In your email
https://lore.kernel.org/[email protected]/
you state that "You can test it with the ethtool source on branch feature_ptp of: https://github.com/kmaincent/ethtool". I cloned this repository, checked out the feature_ptp branch, and while building I get the following warnings:

Quoted 2 lines

My conclusion is... your ethtool sources for testing this feature are broken, or this is no longer the place to test this feature.

Yeah, it was for v3 of the patch series. It didn't follow up to v19, I am using ynl tool which is the easiest way to test it.
As there were a lot of changes along the way, updating ethtool every time was not a good idea.

Use ynl tool. Commands are described in the last patch of the series:
https://lore.kernel.org/all/[email protected]/

You simply need to install python python-yaml and maybe others python subpackages.
Copy the tool "tools/net/ynl" and the specs "Documentation/netlink/" on the board.

Then run the ynl commands.

Quoted 2 lines

Presumably there _is_ something somewhere that allows one to exercise this new code that Jakub merged on July 15th (commit 30b356005048)?

You can indeed test this merge with mainline ethtool.
Specially the commit 2dd356005901 which changes the default hwtstamp to MAC for newly supported PHY PTP as you requested.
With your marvell PTP support patch it should still report and use ts info from the MAC.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#2 lore raw
Quoted 29 lines · Kory Maincent

Hello Russell,

Quoted 13 lines · On Wed, 13 Nov 2024 14:46:25 +0000 "Russell King (Oracle)"…

Hi Kory,

I've finally found some cycles (and time when I'm next to the platform) to test the selectable timestamping feature. However, I'm struggling to get it to work.

In your email
https://lore.kernel.org/[email protected]/
you state that "You can test it with the ethtool source on branch feature_ptp of: https://github.com/kmaincent/ethtool". I cloned this repository, checked out the feature_ptp branch, and while building I get the following warnings:

Quoted 2 lines

My conclusion is... your ethtool sources for testing this feature are broken, or this is no longer the place to test this feature.

Yeah, it was for v3 of the patch series. It didn't follow up to v19, I am using ynl tool which is the easiest way to test it.
As there were a lot of changes along the way, updating ethtool every time was not a good idea.

Use ynl tool. Commands are described in the last patch of the series:
https://lore.kernel.org/all/[email protected]/

Quoted 6 lines

You simply need to install python python-yaml and maybe others python subpackages.
Copy the tool "tools/net/ynl" and the specs "Documentation/netlink/" on the board.

Then run the ynl commands.

Thanks... fairly unweildly but at least it's functional. However, running the first, I immediately find a problem:

# ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --dump tsinfo-get --json '{"header":{"dev-name":"eth0"}}'

One would expect this to only return results for eth0 ? I get:

[{'header': {'dev-index': 1, 'dev-name': 'lo'},
'timestamping': {'bits': {'bit': [{'index': 1, 'name': 'software-transmit'},

                                    {'index': 3, 'name': 'software-receive'},
                                    {'index': 4,
                                     'name': 'software-system-clock'}]},
                   'nomask': True,
                   'size': 17}},

... one entry per network device ...

Also, I don't see more than one timestamper on any interface - there should be two on eth2, one for the MAC and one for the PHY. I see the timestamper for the mvpp2 MAC, but nothing for the PHY. The PTP clock on the PHY is definitely registered (/dev/ptp0), which means phydev->mii_ts should be pointing to the MII timestamper for the PHY.

I've also tried with --json '{"header":{"dev-name":"eth2"}}' but no difference - it still reports all interfaces and only one timestamper for eth2.

I'm waiting for a kernel to build with nlmon modular to investigate further.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#3 lore raw
Quoted 37 lines · On Wed, 13 Nov 2024 15:57:56 +0000 "Russell King (Oracle)"…
Quoted 29 lines · Kory Maincent

Hello Russell,

Quoted 13 lines · On Wed, 13 Nov 2024 14:46:25 +0000 "Russell King (Oracle)"…

Hi Kory,

I've finally found some cycles (and time when I'm next to the platform) to test the selectable timestamping feature. However, I'm struggling to get it to work.

In your email
https://lore.kernel.org/[email protected]/
you state that "You can test it with the ethtool source on branch feature_ptp of: https://github.com/kmaincent/ethtool". I cloned this repository, checked out the feature_ptp branch, and while building I get the following warnings:

Quoted 2 lines

My conclusion is... your ethtool sources for testing this feature are broken, or this is no longer the place to test this feature.

Yeah, it was for v3 of the patch series. It didn't follow up to v19, I am using ynl tool which is the easiest way to test it.
As there were a lot of changes along the way, updating ethtool every time was not a good idea.

Use ynl tool. Commands are described in the last patch of the series:
https://lore.kernel.org/all/[email protected]/

Quoted 6 lines

You simply need to install python python-yaml and maybe others python subpackages.
Copy the tool "tools/net/ynl" and the specs "Documentation/netlink/" on the board.

Then run the ynl commands.

Quoted 7 lines

Thanks... fairly unweildly but at least it's functional. However, running the first, I immediately find a problem:

# ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --dump
tsinfo-get --json '{"header":{"dev-name":"eth0"}}'

One would expect this to only return results for eth0 ?

Indeed it should! That's weird, I will investigate.

Quoted 9 lines

Also, I don't see more than one timestamper on any interface - there should be two on eth2, one for the MAC and one for the PHY. I see the timestamper for the mvpp2 MAC, but nothing for the PHY. The PTP clock on the PHY is definitely registered (/dev/ptp0), which means phydev->mii_ts should be pointing to the MII timestamper for the PHY.

I've also tried with --json '{"header":{"dev-name":"eth2"}}' but no difference - it still reports all interfaces and only one timestamper for eth2.

Sorry forgot to explain that you need to register PTP clock with the function phydev_ptp_clock_register() in the PHY driver.

It will be changed in v20 as request by Jakub. I will save the hwtstamp source and phydev pointer in the netdev core instead.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#4 lore raw
Quoted 42 lines · On Wed, 13 Nov 2024 17:14:43 +0100 Kory Maincent <[email protected]>…
Quoted 6 lines · On Wed, 13 Nov 2024 15:57:56 +0000 "Russell King (Oracle)"…
Quoted 5 lines · Kory Maincent

Hello Russell,

On Wed, 13 Nov 2024 14:46:25 +0000
"Russell King (Oracle)" <[email protected]> wrote:

[...]

Quoted 16 lines
Quoted 9 lines

Yeah, it was for v3 of the patch series. It didn't follow up to v19, I am using ynl tool which is the easiest way to test it.
As there were a lot of changes along the way, updating ethtool every time was not a good idea.

Use ynl tool. Commands are described in the last patch of the series:
https://lore.kernel.org/all/[email protected]/

Quoted 6 lines

You simply need to install python python-yaml and maybe others python subpackages.
Copy the tool "tools/net/ynl" and the specs "Documentation/netlink/" on the board.

Then run the ynl commands.

Quoted 7 lines

Thanks... fairly unweildly but at least it's functional. However, running the first, I immediately find a problem:

# ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --dump
tsinfo-get --json '{"header":{"dev-name":"eth0"}}'

One would expect this to only return results for eth0 ?

Indeed it should! That's weird, I will investigate.

Quoted 6 lines

Also, I don't see more than one timestamper on any interface - there should be two on eth2, one for the MAC and one for the PHY. I see the timestamper for the mvpp2 MAC, but nothing for the PHY. The PTP clock on the PHY is definitely registered (/dev/ptp0), which means phydev->mii_ts should be pointing to the MII timestamper for the PHY.

Quoted 6 lines
Quoted 3 lines

I've also tried with --json '{"header":{"dev-name":"eth2"}}' but no difference - it still reports all interfaces and only one timestamper for eth2.

Sorry forgot to explain that you need to register PTP clock with the function phydev_ptp_clock_register() in the PHY driver.

And netdev_ptp_clock_register() in the MAC driver.

Quoted 5 lines

It will be changed in v20 as request by Jakub. I will save the hwtstamp source and phydev pointer in the netdev core instead.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#5 lore raw
In reply to Kory Maincent
Quoted 56 lines · Kory Maincent
Quoted 37 lines · On Wed, 13 Nov 2024 15:57:56 +0000 "Russell King (Oracle)"…
Quoted 29 lines · Kory Maincent

Hello Russell,

Quoted 13 lines · On Wed, 13 Nov 2024 14:46:25 +0000 "Russell King (Oracle)"…

Hi Kory,

I've finally found some cycles (and time when I'm next to the platform) to test the selectable timestamping feature. However, I'm struggling to get it to work.

In your email
https://lore.kernel.org/[email protected]/
you state that "You can test it with the ethtool source on branch feature_ptp of: https://github.com/kmaincent/ethtool". I cloned this repository, checked out the feature_ptp branch, and while building I get the following warnings:

Quoted 2 lines

My conclusion is... your ethtool sources for testing this feature are broken, or this is no longer the place to test this feature.

Yeah, it was for v3 of the patch series. It didn't follow up to v19, I am using ynl tool which is the easiest way to test it.
As there were a lot of changes along the way, updating ethtool every time was not a good idea.

Use ynl tool. Commands are described in the last patch of the series:
https://lore.kernel.org/all/[email protected]/

Quoted 6 lines

You simply need to install python python-yaml and maybe others python subpackages.
Copy the tool "tools/net/ynl" and the specs "Documentation/netlink/" on the board.

Then run the ynl commands.

Quoted 7 lines

Thanks... fairly unweildly but at least it's functional. However, running the first, I immediately find a problem:

# ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --dump
tsinfo-get --json '{"header":{"dev-name":"eth0"}}'

One would expect this to only return results for eth0 ?

Indeed it should! That's weird, I will investigate.

Quoted 6 lines

Also, I don't see more than one timestamper on any interface - there should be two on eth2, one for the MAC and one for the PHY. I see the timestamper for the mvpp2 MAC, but nothing for the PHY. The PTP clock on the PHY is definitely registered (/dev/ptp0), which means phydev->mii_ts should be pointing to the MII timestamper for the PHY.

Quoted 6 lines
Quoted 3 lines

I've also tried with --json '{"header":{"dev-name":"eth2"}}' but no difference - it still reports all interfaces and only one timestamper for eth2.

Sorry forgot to explain that you need to register PTP clock with the function phydev_ptp_clock_register() in the PHY driver.

That is certainly inconvenient. Marvell's PHY PTP/TAI implementation is used elsewhere, so the TAI driver is not specific to it being on a PHY. The drivers/ptp/marvell*.c that you find in my patches is meant to eventually replace drivers/net/dsa/mv88e6xxx/ptp.c - the same hardware block is in Marvell's DSA switches.

Quoted 2 lines

It will be changed in v20 as request by Jakub. I will save the hwtstamp source and phydev pointer in the netdev core instead.

I think I'll shelve this until that happens, hopefully that will mean my existing code will work and remain a re-usable library.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#6 lore raw
Quoted 38 lines · On Wed, 13 Nov 2024 16:52:20 +0000 "Russell King (Oracle)"…
Quoted 4 lines · Kory Maincent
Quoted 1 line · On Wed, 13 Nov 2024 15:57:56 +0000 "Russell King (Oracle)"…

On Wed, Nov 13, 2024 at 04:16:02PM +0100, Kory Maincent wrote:

[...]
[...]
[...]

Quoted 17 lines
Quoted 8 lines

Thanks... fairly unweildly but at least it's functional. However, running the first, I immediately find a problem:

# ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --dump
tsinfo-get --json '{"header":{"dev-name":"eth0"}}'

One would expect this to only return results for eth0 ?

Indeed it should! That's weird, I will investigate.

Quoted 6 lines

Also, I don't see more than one timestamper on any interface - there should be two on eth2, one for the MAC and one for the PHY. I see the timestamper for the mvpp2 MAC, but nothing for the PHY. The PTP clock on the PHY is definitely registered (/dev/ptp0), which means phydev->mii_ts should be pointing to the MII timestamper for the PHY.

Quoted 6 lines
Quoted 3 lines

I've also tried with --json '{"header":{"dev-name":"eth2"}}' but no difference - it still reports all interfaces and only one timestamper for eth2.

Sorry forgot to explain that you need to register PTP clock with the function phydev_ptp_clock_register() in the PHY driver.

That is certainly inconvenient. Marvell's PHY PTP/TAI implementation is used elsewhere, so the TAI driver is not specific to it being on a PHY. The drivers/ptp/marvell*.c that you find in my patches is meant to eventually replace drivers/net/dsa/mv88e6xxx/ptp.c - the same hardware block is in Marvell's DSA switches.

Quoted 5 lines
Quoted 2 lines

It will be changed in v20 as request by Jakub. I will save the hwtstamp source and phydev pointer in the netdev core instead.

I think I'll shelve this until that happens, hopefully that will mean my existing code will work and remain a re-usable library.

Ack, Thanks anyway.

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#7 lore raw
In reply to Russell King (Oracle)
Quoted 6 lines · Russell King (Oracle)
Quoted 5 lines · Kory Maincent

You simply need to install python python-yaml and maybe others python subpackages.
Copy the tool "tools/net/ynl" and the specs "Documentation/netlink/" on the board.

Quoted 8 lines
Quoted 1 line

Then run the ynl commands.

Thanks... fairly unweildly but at least it's functional. However, running the first, I immediately find a problem:

# ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --dump tsinfo-get --json '{"header":{"dev-name":"eth0"}}'

One would expect this to only return results for eth0 ? I get:

Here's the nlmon packet capture for the ynl request:

        0x0000:  0004 0338 0000 0000 0000 0000 0000 0010  ...8............
        0x0010:  2400 0000 1500 0503 f9d3 0000 0000 0000  $...............
        0x0020:  1901 0000 1000 0180 0900 0200 6574 6832  ............eth2
        0x0030:  0000 0000                                ....

Length: 0x00000024
Family ID: 0x0015 (ethtool)
Flags: 0x0305 (Return all matching, Specify tree root, ack, request)
Sequence: 0x0000d3f9
Port ID: 0x00000000
Command: 0x19
Family Version: 0x01

Then 16 bytes of data that does contain the interface name given to YNL. I haven't parsed that, it seems to require manual effort to do so as wireshark is unable to do so.

I'd be guessing to draw any conclusions from this without deeper analysis.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#8 lore raw
Quoted 32 lines · On Thu, 14 Nov 2024 20:20:58 +0000 "Russell King (Oracle)"…
Quoted 8 lines · Russell King (Oracle)
Quoted 6 lines · Kory Maincent

You simply need to install python python-yaml and maybe others python subpackages.
Copy the tool "tools/net/ynl" and the specs "Documentation/netlink/" on the board.

Then run the ynl commands.

Quoted 7 lines

Thanks... fairly unweildly but at least it's functional. However, running the first, I immediately find a problem:

# ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --dump
tsinfo-get --json '{"header":{"dev-name":"eth0"}}'

One would expect this to only return results for eth0 ? I get:

Here's the nlmon packet capture for the ynl request:

        0x0000:  0004 0338 0000 0000 0000 0000 0000 0010  ...8............
        0x0010:  2400 0000 1500 0503 f9d3 0000 0000 0000  $...............
        0x0020:  1901 0000 1000 0180 0900 0200 6574 6832  ............eth2
        0x0030:  0000 0000                                ....

Length: 0x00000024
Family ID: 0x0015 (ethtool)
Flags: 0x0305 (Return all matching, Specify tree root, ack, request)
Sequence: 0x0000d3f9
Port ID: 0x00000000
Command: 0x19
Family Version: 0x01

Quoted 6 lines

Then 16 bytes of data that does contain the interface name given to YNL. I haven't parsed that, it seems to require manual effort to do so as wireshark is unable to do so.

I'd be guessing to draw any conclusions from this without deeper analysis.

Ok thanks, I will take a look at it

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com