Re: [Linuxptp-devel] linuxptp on ubuntu 14.04
My configuration right now is like this: two nodes plugged into a switch, representing a small private Network. There is no firewall (so no ip tables to turn off) the two nodes are: 10.20.20.1(master) and 10.20.20.2(slave)...an the wireshark capture looks like this: 559114.50748800010.20.20.2224.0.1.129PTPv286 Delay_Req Message 560114.89367700010.20.20.1224.0.1.129PTPv286 Follow_Up Message 561114.89369800010.20.20.1224.0.1.129PTPv296 Delay_Resp Message 562114.89370300010.20.20.1224.0.1.129PTPv286Sync Message 563115.89474900010.20.20.1224.0.1.129PTPv286 Follow_Up Message 564115.89476800010.20.20.1224.0.1.129PTPv2106 Announce Message 565115.89477200010.20.20.1224.0.1.129PTPv286Sync Message 566116.4273010.20.20.2224.0.1.129PTPv286 Delay_Req Message 567116.89486700010.20.20.1224.0.1.129PTPv286 Follow_Up Message so messages seem to get through, but still something seems to be wrong since I don't see much output on the console. Are these all the messages I should see in wireshark or are some missing? Thanks, Andrei On Wed, Jun 18, 2014 at 4:35 AM, Richard Cochran richardcoch...@gmail.com wrote: On Tue, Jun 17, 2014 at 08:05:59PM +, Keller, Jacob E wrote: The l7 output displays a bunch of much less useful output, which can clutter the display. I only suggested to run with debug logging because Andrei was complaining that nothing was happening. Now we see that both master and slave believe that they are sending protocol messages. Thanks, Richard -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel -- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you receive this in error please contact the sender and delete the material from any computer immediately. It is the policy of Klas Limited to disavow the sending of offensive material and should you consider that the material contained in the message is offensive you should contact the sender immediately and also your I.T. Manager. Klas Telecom Inc., a Virginia Corporation with offices at 1101 30th St. NW, Washington, DC 20007. Klas Limited (Company Number 163303) trading as Klas Telecom, an Irish Limited Liability Company, with its registered office at Fourth Floor, One Kilmainham Square, Inchicore Road, Kilmainham, Dublin 8, Ireland. -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Re: [Linuxptp-devel] linuxptp on ubuntu 14.04
correct me if I'm wrong but isn't the master supposed to send the Announce message only once, at initialization time, and after that just send sync and follow-up messages? I can see a lot of Announce Messages sent by the master: 4811.00617800010.20.20.1224.0.1.129PTPv2106Announce Message 4911.00620200010.20.20.1224.0.1.129PTPv286Sync Message 5011.82320400010.20.20.2224.0.1.129PTPv286Delay_Req Message 5112.00725500010.20.20.1224.0.1.129PTPv286Follow_Up Message 5212.00727800010.20.20.1224.0.1.129PTPv296 Delay_Resp Message 5312.00728500010.20.20.1224.0.1.129PTPv286Sync Message 5412.84942700010.20.20.2224.0.1.129PTPv286Delay_Req Message 5513.00737500010.20.20.1224.0.1.129PTPv286Follow_Up Message 5613.00740300010.20.20.1224.0.1.129PTPv296 Delay_Resp Message 5713.00741200010.20.20.1224.0.1.129PTPv2106Announce Message Announce Messages are send every 7-8 messages. Is this right? Thanks, Andrei On Wed, Jun 18, 2014 at 10:52 AM, Andrei Perietanu andrei.periet...@klastelecom.com wrote: My configuration right now is like this: two nodes plugged into a switch, representing a small private Network. There is no firewall (so no ip tables to turn off) the two nodes are: 10.20.20.1(master) and 10.20.20.2(slave)...an the wireshark capture looks like this: 559114.50748800010.20.20.2224.0.1.129PTPv286 Delay_Req Message 560114.89367700010.20.20.1224.0.1.129PTPv286 Follow_Up Message 561114.89369800010.20.20.1224.0.1.129PTPv296 Delay_Resp Message 562114.89370300010.20.20.1224.0.1.129PTPv286Sync Message 563115.89474900010.20.20.1224.0.1.129PTPv286 Follow_Up Message 564115.89476800010.20.20.1224.0.1.129PTPv2106 Announce Message 565115.89477200010.20.20.1224.0.1.129PTPv286Sync Message 566116.4273010.20.20.2224.0.1.129PTPv286 Delay_Req Message 567116.89486700010.20.20.1224.0.1.129PTPv286 Follow_Up Message so messages seem to get through, but still something seems to be wrong since I don't see much output on the console. Are these all the messages I should see in wireshark or are some missing? Thanks, Andrei On Wed, Jun 18, 2014 at 4:35 AM, Richard Cochran richardcoch...@gmail.com wrote: On Tue, Jun 17, 2014 at 08:05:59PM +, Keller, Jacob E wrote: The l7 output displays a bunch of much less useful output, which can clutter the display. I only suggested to run with debug logging because Andrei was complaining that nothing was happening. Now we see that both master and slave believe that they are sending protocol messages. Thanks, Richard -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel -- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you receive this in error please contact the sender and delete the material from any computer immediately. It is the policy of Klas Limited to disavow the sending of offensive material and should you consider that the material contained in the message is offensive you should contact the sender immediately and also your I.T. Manager. Klas Telecom Inc., a Virginia Corporation with offices at 1101 30th St. NW, Washington, DC 20007. Klas Limited (Company Number 163303) trading as Klas Telecom, an Irish Limited Liability Company, with its registered office at Fourth Floor, One Kilmainham Square, Inchicore Road, Kilmainham, Dublin 8, Ireland. -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems___ Linuxptp-devel mailing list
Re: [Linuxptp-devel] linuxptp on ubuntu 14.04
On Wed, Jun 18, 2014 at 12:37:46PM +0100, Andrei Perietanu wrote: I'm running wireshark on the master Please try it on the slave, to see if the Sync messages are arriving. Thanks, Richard -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Re: [Linuxptp-devel] linuxptp on ubuntu 14.04
I tried running wireshark on both nodes and I see the exact same wireshark output on both of them, so sync messages are being received by the slave. On Wed, Jun 18, 2014 at 12:51 PM, Richard Cochran richardcoch...@gmail.com wrote: On Wed, Jun 18, 2014 at 12:37:46PM +0100, Andrei Perietanu wrote: I'm running wireshark on the master Please try it on the slave, to see if the Sync messages are arriving. Thanks, Richard -- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you receive this in error please contact the sender and delete the material from any computer immediately. It is the policy of Klas Limited to disavow the sending of offensive material and should you consider that the material contained in the message is offensive you should contact the sender immediately and also your I.T. Manager. Klas Telecom Inc., a Virginia Corporation with offices at 1101 30th St. NW, Washington, DC 20007. Klas Limited (Company Number 163303) trading as Klas Telecom, an Irish Limited Liability Company, with its registered office at Fourth Floor, One Kilmainham Square, Inchicore Road, Kilmainham, Dublin 8, Ireland. -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
[Linuxptp-devel] [PATCH 3/3] makefile: remove programs on clean.
Signed-off-by: Miroslav Lichvar mlich...@redhat.com --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index e36835b..9ab3db1 100644 --- a/makefile +++ b/makefile @@ -69,7 +69,7 @@ install: $(PRG) install -p -m 644 -t $(man8dir) $(PRG:%=%.8) clean: - rm -f $(OBJECTS) $(DEPEND) + rm -f $(OBJECTS) $(DEPEND) $(PRG) distclean: clean rm -f $(PRG) -- 1.9.3 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
[Linuxptp-devel] [PATCH 1/3] phc2sys: track sync offset and leap second status in each clock.
This simplifies passing of pending leap seconds to the clocks and it will also allow to apply leap second to other clocks than system clock if needed in future. Signed-off-by: Miroslav Lichvar mlich...@redhat.com --- phc2sys.c | 54 +++--- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/phc2sys.c b/phc2sys.c index 26317dc..62a51bd 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -76,6 +76,8 @@ struct clock { int dest_only; int state; int new_state; + int sync_offset; + int leap_set; struct servo *servo; enum servo_state servo_state; char *device; @@ -102,7 +104,6 @@ struct node { int sync_offset; int forced_sync_offset; int leap; - int leap_set; int kernel_leap; struct pmc *pmc; int pmc_ds_requested; @@ -117,7 +118,7 @@ struct node { static int update_pmc(struct node *node, int subscribe); static int clock_handle_leap(struct node *node, struct clock *clock, -int64_t offset, uint64_t ts, int do_leap); +int64_t offset, uint64_t ts); static int run_pmc_get_utc_offset(struct node *node, int timeout); static void run_pmc_events(struct node *node); @@ -389,7 +390,7 @@ static int64_t get_sync_offset(struct node *node, struct clock *dst) if (!direction) direction = dst-is_utc - node-master-is_utc; - return (int64_t)node-sync_offset * NS_PER_SEC * direction; + return (int64_t)dst-sync_offset * NS_PER_SEC * direction; } static void update_clock_stats(struct clock *clock, unsigned int max_count, @@ -428,13 +429,12 @@ static void update_clock_stats(struct clock *clock, unsigned int max_count, } static void update_clock(struct node *node, struct clock *clock, -int64_t offset, uint64_t ts, int64_t delay, -int do_leap) +int64_t offset, uint64_t ts, int64_t delay) { enum servo_state state; double ppb; - if (clock_handle_leap(node, clock, offset, ts, do_leap)) + if (clock_handle_leap(node, clock, offset, ts)) return; offset += get_sync_offset(node, clock); @@ -513,7 +513,6 @@ static int do_pps_loop(struct node *node, struct clock *clock, int fd) int64_t pps_offset, phc_offset, phc_delay; uint64_t pps_ts, phc_ts; clockid_t src = node-master-clkid; - int do_leap; node-master-source_label = pps; @@ -550,10 +549,9 @@ static int do_pps_loop(struct node *node, struct clock *clock, int fd) pps_offset = pps_ts - phc_ts; } - do_leap = update_pmc(node, 0); - if (do_leap 0) + if (update_pmc(node, 0) 0) continue; - update_clock(node, clock, pps_offset, pps_ts, -1, do_leap); + update_clock(node, clock, pps_offset, pps_ts, -1); } close(fd); return 0; @@ -565,15 +563,13 @@ static int do_loop(struct node *node, int subscriptions) struct clock *clock; uint64_t ts; int64_t offset, delay; - int do_leap; interval.tv_sec = node-phc_interval; interval.tv_nsec = (node-phc_interval - interval.tv_sec) * 1e9; while (1) { clock_nanosleep(CLOCK_MONOTONIC, 0, interval, NULL); - do_leap = update_pmc(node, subscriptions); - if (do_leap 0) + if (update_pmc(node, subscriptions) 0) continue; if (subscriptions) { @@ -609,7 +605,7 @@ static int do_loop(struct node *node, int subscriptions) offset, ts, delay)) continue; } - update_clock(node, clock, offset, ts, delay, do_leap); + update_clock(node, clock, offset, ts, delay); } } return 0; /* unreachable */ @@ -1048,12 +1044,11 @@ static int auto_init_ports(struct node *node, int add_rt) return 0; } -/* Returns: -1 in case of error, 0 for normal sync, 1 to leap clock */ +/* Returns: -1 in case of error, 0 otherwise */ static int update_pmc(struct node *node, int subscribe) { struct timespec tp; uint64_t ts; - int clock_leap; if (clock_gettime(CLOCK_REALTIME, tp)) { pr_err(failed to read clock: %m); @@ -1070,25 +1065,18 @@ static int update_pmc(struct node *node, int subscribe) node-pmc_last_update = ts; } - /* Handle leap seconds. */ - - if (!node-leap !node-leap_set) - return 0; - - clock_leap = leap_second_status(ts, node-leap_set, - node-leap, node-sync_offset); - if (node-leap_set !=
[Linuxptp-devel] [PATCH 0/3] Set TAI offset of system clock
Setting the TAI offset is useful to have correct information in the adjtimex field and also to get correct time from CLOCK_TAI, which is implemented by the kernel as CLOCK_REALTIME + TAI offset. The first patch simplifies the phc2sys code a bit to make it easier for the second patch. The third patch fixes make clean; make on system where leap seconds are tested and the time is jumping backwards :). Miroslav Lichvar (3): phc2sys: track sync offset and leap second status in each clock. Set TAI offset of system clock. makefile: remove programs on clean. clock.c| 9 + clockadj.c | 11 +++ clockadj.h | 6 makefile | 2 +- phc2sys.c | 109 +++-- 5 files changed, 83 insertions(+), 54 deletions(-) -- 1.9.3 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
[Linuxptp-devel] [PATCH 2/3] Set TAI offset of system clock.
When synchronizing the system clock and the PTP UTC offset is valid and traceable, set the TAI offset of the clock to have correct CLOCK_TAI (which is implemented in the kernel as CLOCK_REALTIME + TAI offset). Signed-off-by: Miroslav Lichvar mlich...@redhat.com --- clock.c| 9 clockadj.c | 11 ++ clockadj.h | 6 ++ phc2sys.c | 69 -- 4 files changed, 66 insertions(+), 29 deletions(-) diff --git a/clock.c b/clock.c index 4378dec..14e20ad 100644 --- a/clock.c +++ b/clock.c @@ -88,6 +88,7 @@ struct clock { int freq_est_interval; int grand_master_capable; /* for 802.1AS only */ int utc_timescale; + int utc_offset_set; int leap_set; int kernel_leap; int utc_offset; /* grand master role */ @@ -700,6 +701,13 @@ static int clock_utc_correct(struct clock *c, tmv_t ingress) } } + /* Update TAI-UTC offset of the system clock if valid and traceable. */ + if (c-tds.flags UTC_OFF_VALID c-tds.flags TIME_TRACEABLE + c-utc_offset_set != utc_offset c-clkid == CLOCK_REALTIME) { + sysclk_set_tai_offset(utc_offset); + c-utc_offset_set = utc_offset; + } + if (!(c-tds.flags PTP_TIMESCALE)) return 0; @@ -789,6 +797,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count, max_adj = sysclk_max_freq(); sysclk_set_leap(0); } + c-utc_offset_set = 0; c-leap_set = 0; c-time_flags = c-utc_timescale ? 0 : PTP_TIMESCALE; diff --git a/clockadj.c b/clockadj.c index fbf9423..5eb7cce 100644 --- a/clockadj.c +++ b/clockadj.c @@ -129,6 +129,17 @@ void sysclk_set_leap(int leap) realtime_leap_bit = tx.status; } +void sysclk_set_tai_offset(int offset) +{ + clockid_t clkid = CLOCK_REALTIME; + struct timex tx; + memset(tx, 0, sizeof(tx)); + tx.modes = ADJ_TAI; + tx.constant = offset; + if (clock_adjtime(clkid, tx) 0) + pr_err(failed to set TAI offset: %m); +} + int sysclk_max_freq(void) { clockid_t clkid = CLOCK_REALTIME; diff --git a/clockadj.h b/clockadj.h index 7578e84..492418e 100644 --- a/clockadj.h +++ b/clockadj.h @@ -58,6 +58,12 @@ void clockadj_step(clockid_t clkid, int64_t step); void sysclk_set_leap(int leap); /** + * Set the TAI offset of the system clock to have correct CLOCK_TAI. + * @param offset The TAI-UTC offset in seconds. + */ +void sysclk_set_tai_offset(int offset); + +/** * Read maximum frequency adjustment of the system clock (CLOCK_REALTIME). * @return The maximum frequency adjustment in parts per billion (ppb). */ diff --git a/phc2sys.c b/phc2sys.c index 62a51bd..e063372 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -78,6 +78,7 @@ struct clock { int new_state; int sync_offset; int leap_set; + int utc_offset_set; struct servo *servo; enum servo_state servo_state; char *device; @@ -103,6 +104,7 @@ struct node { double phc_interval; int sync_offset; int forced_sync_offset; + int utc_offset_traceable; int leap; int kernel_leap; struct pmc *pmc; @@ -864,9 +866,12 @@ static int run_pmc_get_utc_offset(struct node *node, int timeout) node-leap = -1; else node-leap = 0; + node-utc_offset_traceable = tds-flags UTC_OFF_VALID +tds-flags TIME_TRACEABLE; } else { node-sync_offset = 0; node-leap = 0; + node-utc_offset_traceable = 0; } msg_put(msg); return 1; @@ -1076,42 +1081,48 @@ static int clock_handle_leap(struct node *node, struct clock *clock, clock-sync_offset = node-sync_offset; - if (!node_leap !clock-leap_set) - return 0; + if ((node_leap || clock-leap_set) + clock-is_utc != node-master-is_utc) { + /* If the master clock is in UTC, get a time stamp from it, as + it is the clock which will include the leap second. */ + if (node-master-is_utc) { + struct timespec tp; + if (clock_gettime(node-master-clkid, tp)) { + pr_err(failed to read clock: %m); + return -1; + } + ts = tp.tv_sec * NS_PER_SEC + tp.tv_nsec; + } - if (clock-is_utc == node-master-is_utc) - return 0; + /* If the clock will be stepped, the time stamp has to be the + new time. Ignore possible 1 second error in UTC offset. */ + if (clock-is_utc clock-servo_state == SERVO_UNLOCKED) + ts -= offset +
Re: [Linuxptp-devel] [PATCH 3/3] makefile: remove programs on clean.
On Wed, Jun 18, 2014 at 03:44:50PM +0200, Miroslav Lichvar wrote: clean: - rm -f $(OBJECTS) $(DEPEND) + rm -f $(OBJECTS) $(DEPEND) $(PRG) distclean: clean rm -f $(PRG) The clean target removes all the build products except for the executables. The distclean target goes one step further and removes the programs, too. This patch would make the distclean superfluous. Thanks, Richard -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Re: [Linuxptp-devel] linuxptp on ubuntu 14.04
On Wed, Jun 18, 2014 at 01:13:27PM +0100, Andrei Perietanu wrote: I tried running wireshark on both nodes and I see the exact same wireshark output on both of them, so sync messages are being received by the slave. Okay, then something very strange is happening, and I can't imagine what is going on. The one difference between wireshark and ptp4l is that wireshark uses promiscuous mode, while ptp4l joins the multicast group. Here are two things to try. 1. Easy: run ptp4l with the '-2' (L2 transport) flag 2. Harder: try a vanilla kernel Sorry, Richard -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel