tools/testing/selftests/net/forwarding/tsn_lib.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/forwarding/tsn_lib.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/forwarding/tsn_lib.sh- Extension
.sh- Size
- 6215 bytes
- Lines
- 276
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function phc2sys_start
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright 2021-2022 NXP
tc_testing_scripts_dir=$(dirname $0)/../../tc-testing/scripts
REQUIRE_ISOCHRON=${REQUIRE_ISOCHRON:=yes}
REQUIRE_LINUXPTP=${REQUIRE_LINUXPTP:=yes}
# Tunables
UTC_TAI_OFFSET=37
ISOCHRON_CPU=1
if [[ "$REQUIRE_ISOCHRON" = "yes" ]]; then
# https://github.com/vladimiroltean/tsn-scripts
# WARNING: isochron versions pre-1.0 are unstable,
# always use the latest version
require_command isochron
fi
if [[ "$REQUIRE_LINUXPTP" = "yes" ]]; then
require_command phc2sys
require_command ptp4l
require_command phc_ctl
fi
phc2sys_start()
{
local uds_address=$1
local extra_args=""
if ! [ -z "${uds_address}" ]; then
extra_args="${extra_args} -z ${uds_address}"
fi
phc2sys_log="$(mktemp)"
chrt -f 10 phc2sys -m \
-a -rr \
--step_threshold 0.00002 \
--first_step_threshold 0.00002 \
${extra_args} \
> "${phc2sys_log}" 2>&1 &
phc2sys_pid=$!
echo "phc2sys logs to ${phc2sys_log} and has pid ${phc2sys_pid}"
sleep 1
}
phc2sys_stop()
{
{ kill ${phc2sys_pid} && wait ${phc2sys_pid}; } 2> /dev/null
rm "${phc2sys_log}" 2> /dev/null
}
# Replace space separators from interface list with underscores
if_names_to_label()
{
local if_name_list="$1"
echo "${if_name_list/ /_}"
}
ptp4l_start()
{
local if_names="$1"
local slave_only=$2
local uds_address=$3
local log="ptp4l_log_$(if_names_to_label ${if_names})"
local pid="ptp4l_pid_$(if_names_to_label ${if_names})"
Annotation
- Detected declarations: `function phc2sys_start`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.