]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
selftests: net: tsn_lib: run phc2sys in automatic mode
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 23 Sep 2022 21:00:15 +0000 (00:00 +0300)
committerJakub Kicinski <kuba@kernel.org>
Mon, 26 Sep 2022 20:22:01 +0000 (13:22 -0700)
commit162d52dfee445c21d1fa5c4b1f55765946df4d3e
tree63fa769ee13f081e913c051c86586f85776eb680
parenta7ce95ac837d9e74a66e5a2825595476722bb616
selftests: net: tsn_lib: run phc2sys in automatic mode

We can make the phc2sys helper not only synchronize a PHC to
CLOCK_REALTIME, which is what it currently does, but also CLOCK_REALTIME
to a PHC, which is going to be needed in distributed TSN tests.

Instead of making the complexity of the arguments passed to
phc2sys_start() explode, we can let it figure out the sync direction
automatically, based on ptp4l's port states.

Towards that goal, pass just the path to the desired ptp4l instance's
UNIX domain socket, and remove the $if_name argument (from which it
derives the PHC). Also adapt the one caller from the ocelot psfp.sh
test. In the case of psfp.sh, phc2sys_start is able to properly figure
out that CLOCK_REALTIME is the source clock and swp1's PHC is the
destination, because of the way in which ptp4l_start for the
UDS_ADDRESS_SWP1 was called: with slave_only=false, so it will always
win the BMCA and always become the sync master between itself and $h1.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/ocelot/psfp.sh
tools/testing/selftests/net/forwarding/tsn_lib.sh