Skip to content

Commit

Permalink
tc: Add experimental TC command
Browse files Browse the repository at this point in the history
Measure the one-way inaccuracy through a TC. Runs on two synchronized
ports with onestep timestamping. The inaccuracies will be the cable
delay + any uncompensated rx/tx latencies.

The host should set --ingressLatency and --egressLatency. If the rx/tx
latencies aren't exactly known they can be set to the same value as
they will cancel each other out.

The value can be found by measuring the inaccuracy (minus the cable
delay) and dividing by 2, with a looped cable. This is the same
process as measuring the peer delay.

ingressLatency = egressLatency = peer_delay - cable_delay

Signed-off-by: Casper Andersson <[email protected]>
  • Loading branch information
cappe987 committed Dec 30, 2024
1 parent 74c05de commit 188cf25
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ project(tstest VERSION 1.0)

# ---- BUILD ----
add_executable(tstest)
target_sources(tstest PRIVATE src/liblink.c src/timestamping.c src/ptp_message.c src/extts.c src/pkt.c src/tstest.c src/delay.c src/check.c)
target_sources(tstest PRIVATE src/liblink.c src/timestamping.c src/ptp_message.c src/extts.c src/pkt.c src/tstest.c src/delay.c src/check.c src/tc.c)

target_include_directories(tstest PUBLIC ${PROJECT_INCLUDES})
target_link_libraries(tstest PUBLIC)
Expand Down
3 changes: 3 additions & 0 deletions include/pkt.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ struct pkt_cfg {
//int so_timestamping_flags;
int transportSpecific;
int twoStepFlag_set;
int ingressLatency;
int egressLatency;
int nonstop_flag;
int twoStepFlag;
int tstamp_all;
int auto_fup;
int interval;
int rx_only;
int version;
int listen;
Expand Down
3 changes: 3 additions & 0 deletions include/tstest.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ int run_delay_mode(int argc, char **argv);
/* check.c */
int run_check_mode(int argc, char **argv);

/* tc.c */
int run_tc_mode(int argc, char **argv);

/* ptp_message.c */
int str2ptp_type(const char *str);
char *ptp_type2str(int type);
Expand Down
Loading

0 comments on commit 188cf25

Please sign in to comment.