|
|
63489c |
commit 117ed5c2d0f865894dd930d877f0ec28bc23d951
|
|
|
63489c |
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
|
|
63489c |
Date: Tue Jan 17 14:17:41 2017 +0100
|
|
|
63489c |
|
|
|
63489c |
timemaster: check support for SW time stamping.
|
|
|
63489c |
|
|
|
63489c |
When an interface doesn't support HW time stamping, before falling back
|
|
|
63489c |
to SW time stamping, check if it's actually supported and exit with an
|
|
|
63489c |
error message if not.
|
|
|
63489c |
|
|
|
63489c |
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
|
|
63489c |
|
|
|
63489c |
diff --git a/timemaster.c b/timemaster.c
|
|
|
63489c |
index 880b2ab..cda2d90 100644
|
|
|
63489c |
--- a/timemaster.c
|
|
|
63489c |
+++ b/timemaster.c
|
|
|
63489c |
@@ -674,13 +674,15 @@ static int add_ptp_source(struct ptp_domain *source,
|
|
|
63489c |
{
|
|
|
63489c |
struct config_file *config_file;
|
|
|
63489c |
char **command, *uds_path, **interfaces, *message_tag;
|
|
|
63489c |
- int i, j, num_interfaces, *phc, *phcs, hw_ts;
|
|
|
63489c |
+ int i, j, num_interfaces, *phc, *phcs, hw_ts, sw_ts;
|
|
|
63489c |
struct sk_ts_info ts_info;
|
|
|
63489c |
|
|
|
63489c |
pr_debug("adding PTP domain %d", source->domain);
|
|
|
63489c |
|
|
|
63489c |
hw_ts = SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE |
|
|
|
63489c |
SOF_TIMESTAMPING_RAW_HARDWARE;
|
|
|
63489c |
+ sw_ts = SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE |
|
|
|
63489c |
+ SOF_TIMESTAMPING_SOFTWARE;
|
|
|
63489c |
|
|
|
63489c |
for (num_interfaces = 0;
|
|
|
63489c |
source->interfaces[num_interfaces]; num_interfaces++)
|
|
|
63489c |
@@ -702,9 +704,14 @@ static int add_ptp_source(struct ptp_domain *source,
|
|
|
63489c |
return 1;
|
|
|
63489c |
}
|
|
|
63489c |
|
|
|
63489c |
- if (!ts_info.valid ||
|
|
|
63489c |
- ((ts_info.so_timestamping & hw_ts) != hw_ts)) {
|
|
|
63489c |
+ if (((ts_info.so_timestamping & hw_ts) != hw_ts)) {
|
|
|
63489c |
pr_debug("interface %s: no PHC", source->interfaces[i]);
|
|
|
63489c |
+ if ((ts_info.so_timestamping & sw_ts) != sw_ts) {
|
|
|
63489c |
+ pr_err("time stamping not supported on %s",
|
|
|
63489c |
+ source->interfaces[i]);
|
|
|
63489c |
+ free(phcs);
|
|
|
63489c |
+ return 1;
|
|
|
63489c |
+ }
|
|
|
63489c |
continue;
|
|
|
63489c |
}
|
|
|
63489c |
|