When an interface doesn't support HW time stamping, before falling back to SW time stamping, check if it's actually supported and exit with an error message if not.
Signed-off-by: Miroslav Lichvar <mlich...@redhat.com> --- timemaster.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/timemaster.c b/timemaster.c index 9d6cc32..d5b20d4 100644 --- a/timemaster.c +++ b/timemaster.c @@ -674,13 +674,15 @@ static int add_ptp_source(struct ptp_domain *source, { struct config_file *config_file; char **command, *uds_path, **interfaces, *log_prefix; - int i, j, num_interfaces, *phc, *phcs, hw_ts; + int i, j, num_interfaces, *phc, *phcs, hw_ts, sw_ts; struct sk_ts_info ts_info; pr_debug("adding PTP domain %d", source->domain); hw_ts = SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE; + sw_ts = SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE | + SOF_TIMESTAMPING_SOFTWARE; for (num_interfaces = 0; source->interfaces[num_interfaces]; num_interfaces++) @@ -702,9 +704,14 @@ static int add_ptp_source(struct ptp_domain *source, return 1; } - if (!ts_info.valid || - ((ts_info.so_timestamping & hw_ts) != hw_ts)) { + if (((ts_info.so_timestamping & hw_ts) != hw_ts)) { pr_debug("interface %s: no PHC", source->interfaces[i]); + if ((ts_info.so_timestamping & sw_ts) != sw_ts) { + pr_err("time stamping not supported on %s", + source->interfaces[i]); + free(phcs); + return 1; + } continue; } -- 2.9.3 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel