Hi all,
In the section 6.6.4 (page 35) of the IEEE Std 1588-2008 the following
is stated about the port 2 in the P2P mode.
Port-2 either:
1. returns the difference between the timestamps t2 and t3 in the
Pdelay_Resp message
2. returns the difference between the timestamps t2 and t3 in a
Pdelay_Resp_Follow_Up message
3. returns the timestamps t2 and t3 in the Pdelay_Resp and
Pdelay_Resp_Follow_Up messages,
respectively
I found that the IXIA master that I used was using option 2 and was not
sending the actual timestamp t2 but sending out 0 instead. At the same
time the Syncs were the actual timestamp as the originTimestamp. This
makes it impossible to use the two remote timestamp values together to
compute the delay using get_raw_delay() in tsproc_update_offset(). To
workaround this I am using the following patch. (BTW, t2 corresponds to
t4 in the tsproc structure). Instead of calling get_raw_delay() I am
using the previous value of it. There could be better solutions for this
but this is for the review of my initial solution.
Thanks,
Methlal
diff --git a/tsproc.c b/tsproc.c
index a871049..8f0376a 100644
--- a/tsproc.c
+++ b/tsproc.c
@@ -43,6 +43,9 @@ struct tsproc {
tmv_t filtered_delay;
int filtered_delay_valid;
+ /* Last raw delay */
+ tmv_t last_raw_delay;
+
/* Delay filter */
struct filter *delay_filter;
};
@@ -155,6 +158,7 @@ int tsproc_update_delay(struct tsproc *tsp, tmv_t
*delay)
raw_delay = get_raw_delay(tsp);
tsp->filtered_delay = filter_sample(tsp->delay_filter, raw_delay);
tsp->filtered_delay_valid = 1;
+ tsp->last_raw_delay = raw_delay;
pr_debug("delay filtered %10" PRId64 " raw %10" PRId64,
tmv_to_nanoseconds(tsp->filtered_delay),
@@ -197,14 +201,22 @@ int tsproc_update_offset(struct tsproc *tsp, tmv_t
*offset, double *weight)
if (tmv_is_zero(tsp->t3)) {
return -1;
}
- raw_delay = get_raw_delay(tsp);
+ if (tmv_is_zero(tsp->t4)) { /* Special p2p case */
+ raw_delay = tsp->last_raw_delay;
+ } else {
+ raw_delay = get_raw_delay(tsp);
+ }
delay = raw_delay;
break;
case TSPROC_FILTER_WEIGHT:
if (tmv_is_zero(tsp->t3) || !tsp->filtered_delay_valid) {
return -1;
}
- raw_delay = get_raw_delay(tsp);
+ if (tmv_is_zero(tsp->t4)) { /* Special p2p case */
+ raw_delay = tsp->last_raw_delay;
+ } else {
+ raw_delay = get_raw_delay(tsp);
+ }
delay = tsp->filtered_delay;
break;
}
@@ -233,6 +245,7 @@ void tsproc_reset(struct tsproc *tsp, int full)
tsp->t2 = tmv_zero();
tsp->t3 = tmv_zero();
tsp->t4 = tmv_zero();
+ tsp->last_raw_delay = tmv_zero();
if (full) {
tsp->clock_rate_ratio = 1.0;
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel