mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v2] linuxptp: Update package and configs
@ 2017-09-11 12:47 Michael Grzeschik
  2017-11-22 11:43 ` Michael Grzeschik
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Grzeschik @ 2017-09-11 12:47 UTC (permalink / raw)
  To: ptxdist

Usualy we can not ensure only to use transparent clock switches.
Therefor we setup the fix option -P to the commandline to enable
the P2P mechanism in ptp4l.

The following options are highly depending on the usecase
so we remove them for the defaults.

path_trace_enabled
follow_up_info
tx_timestamp_timeout

With all other options were simple defaults the whole
config can be removed.

We also add some service files to start the ptp4l service on
dev eth0. In case the ptp4l daemon is configured
we add the option to install the phc2sys daemon to adjust the
system time by ptp.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
v1 -> v2: - removed install stage for gPTP.conf from rules file
          - limited to run ptp4l only on eth0 for the default setup case

 projectroot/etc/gPTP.conf                          | 28 ----------------------
 projectroot/usr/lib/systemd/system/phc2sys.service | 10 ++++++++
 projectroot/usr/lib/systemd/system/ptp4l@.service  | 12 ++++++++++
 rules/linuxptp.in                                  | 12 ++++++++++
 rules/linuxptp.make                                | 20 +++++++++++++---
 5 files changed, 51 insertions(+), 31 deletions(-)
 delete mode 100644 projectroot/etc/gPTP.conf
 create mode 100644 projectroot/usr/lib/systemd/system/phc2sys.service
 create mode 100644 projectroot/usr/lib/systemd/system/ptp4l@.service

diff --git a/projectroot/etc/gPTP.conf b/projectroot/etc/gPTP.conf
deleted file mode 100644
index 5bbbaf288..000000000
--- a/projectroot/etc/gPTP.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-[global]
-#
-# Run time options
-#
-assume_two_step         1
-logging_level           6
-path_trace_enabled      1
-follow_up_info          1
-tx_timestamp_timeout    40
-use_syslog              1
-verbose                 0
-summary_interval        0
-#
-# Transport options
-#
-transportSpecific       0x1
-ptp_dst_mac             01:80:C2:00:00:0E
-p2p_dst_mac             01:80:C2:00:00:0E
-uds_address             /var/run/ptp4l
-#
-# Default interface options
-#
-network_transport       L2
-delay_mechanism         P2P
-time_stamping           hardware
-
-[eth0]
-
diff --git a/projectroot/usr/lib/systemd/system/phc2sys.service b/projectroot/usr/lib/systemd/system/phc2sys.service
new file mode 100644
index 000000000..eb8e57037
--- /dev/null
+++ b/projectroot/usr/lib/systemd/system/phc2sys.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Precision Time Protocol system clock synchronization
+Wants=ptp4l@.service
+
+[Service]
+ExecStart=/usr/sbin/phc2sys -a -r -r
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/projectroot/usr/lib/systemd/system/ptp4l@.service b/projectroot/usr/lib/systemd/system/ptp4l@.service
new file mode 100644
index 000000000..7cd00dc45
--- /dev/null
+++ b/projectroot/usr/lib/systemd/system/ptp4l@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Precision Time Protocol (PTP) service
+BindsTo = sys-subsystem-net-devices-%i.device
+After = sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/ptp4l -P -i %i
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/rules/linuxptp.in b/rules/linuxptp.in
index 641d844c7..5418d2ad0 100644
--- a/rules/linuxptp.in
+++ b/rules/linuxptp.in
@@ -7,3 +7,15 @@ config LINUXPTP
 	  The Linux PTP project implements the Precision Time protocol (PTP),
 	  standardized as IEEE1588.
 
+if LINUXPTP
+
+config LINUXPTP_SYSTEMD_SERVICE
+	bool "install ptp4l and phc2sys systemd service files"
+	default y
+
+config LINUXPTP_PHC2SYS_SYSTEMD_SERVICE
+	bool "Enable phc2sys systemd service file"
+	default y
+	depends on LINUXPTP_SYSTEMD_SERVICE
+
+endif
diff --git a/rules/linuxptp.make b/rules/linuxptp.make
index 59cbb5123..6cfc0823d 100644
--- a/rules/linuxptp.make
+++ b/rules/linuxptp.make
@@ -17,8 +17,8 @@ PACKAGES-$(PTXCONF_LINUXPTP) += linuxptp
 #
 # Paths and names
 #
-LINUXPTP_VERSION	:= 1.6
-LINUXPTP_MD5		:= 6aa15d83f5a35f1fd076ba9adc4e7285
+LINUXPTP_VERSION	:= 1.8
+LINUXPTP_MD5		:= 5688cdfe57932273e1dbf35b3b97b9a0
 LINUXPTP		:= linuxptp-$(LINUXPTP_VERSION)
 LINUXPTP_SUFFIX		:= tgz
 LINUXPTP_URL		:= $(call ptx/mirror, SF, linuxptp/$(LINUXPTP).$(LINUXPTP_SUFFIX))
@@ -64,7 +64,21 @@ $(STATEDIR)/linuxptp.targetinstall:
 	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/phc2sys)
 	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/pmc)
 	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/hwstamp_ctl)
-	@$(call install_alternative, linuxptp, 0, 0, 0644, /etc/gPTP.conf)
+	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/phc_ctl)
+	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/timemaster)
+
+ifdef PTXCONF_LINUXPTP_SYSTEMD_SERVICE
+	@$(call install_alternative, linuxptp, 0, 0, 0644, /usr/lib/systemd/system/ptp4l@.service)
+	@$(call install_alternative, linuxptp, 0, 0, 0644, /usr/lib/systemd/system/phc2sys.service)
+
+	$(call install_link, linuxptp, ../ptp4l@.service, \
+			/usr/lib/systemd/system/multi-user.target.wants/ptp4l@$eth0.service)
+
+ifdef PTXCONF_LINUXPTP_PHC2SYS_SYSTEMD_SERVICE
+	@$(call install_link, linuxptp, ../phc2sys.service, \
+		/usr/lib/systemd/system/multi-user.target.wants/phc2sys.service)
+endif
+endif
 
 	@$(call install_finish, linuxptp)
 
-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [PATCH v2] linuxptp: Update package and configs
  2017-09-11 12:47 [ptxdist] [PATCH v2] linuxptp: Update package and configs Michael Grzeschik
@ 2017-11-22 11:43 ` Michael Grzeschik
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Grzeschik @ 2017-11-22 11:43 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 6836 bytes --]

On Mon, Sep 11, 2017 at 02:47:11PM +0200, Michael Grzeschik wrote:
> Usualy we can not ensure only to use transparent clock switches.
> Therefor we setup the fix option -P to the commandline to enable
> the P2P mechanism in ptp4l.
> 
> The following options are highly depending on the usecase
> so we remove them for the defaults.
> 
> path_trace_enabled
> follow_up_info
> tx_timestamp_timeout
> 
> With all other options were simple defaults the whole
> config can be removed.
> 
> We also add some service files to start the ptp4l service on
> dev eth0. In case the ptp4l daemon is configured
> we add the option to install the phc2sys daemon to adjust the
> system time by ptp.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
> v1 -> v2: - removed install stage for gPTP.conf from rules file
>           - limited to run ptp4l only on eth0 for the default setup case
> 
>  projectroot/etc/gPTP.conf                          | 28 ----------------------
>  projectroot/usr/lib/systemd/system/phc2sys.service | 10 ++++++++
>  projectroot/usr/lib/systemd/system/ptp4l@.service  | 12 ++++++++++
>  rules/linuxptp.in                                  | 12 ++++++++++
>  rules/linuxptp.make                                | 20 +++++++++++++---
>  5 files changed, 51 insertions(+), 31 deletions(-)
>  delete mode 100644 projectroot/etc/gPTP.conf
>  create mode 100644 projectroot/usr/lib/systemd/system/phc2sys.service
>  create mode 100644 projectroot/usr/lib/systemd/system/ptp4l@.service
> 
> diff --git a/projectroot/etc/gPTP.conf b/projectroot/etc/gPTP.conf
> deleted file mode 100644
> index 5bbbaf288..000000000
> --- a/projectroot/etc/gPTP.conf
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -[global]
> -#
> -# Run time options
> -#
> -assume_two_step         1
> -logging_level           6
> -path_trace_enabled      1
> -follow_up_info          1
> -tx_timestamp_timeout    40
> -use_syslog              1
> -verbose                 0
> -summary_interval        0
> -#
> -# Transport options
> -#
> -transportSpecific       0x1
> -ptp_dst_mac             01:80:C2:00:00:0E
> -p2p_dst_mac             01:80:C2:00:00:0E
> -uds_address             /var/run/ptp4l
> -#
> -# Default interface options
> -#
> -network_transport       L2
> -delay_mechanism         P2P
> -time_stamping           hardware
> -
> -[eth0]
> -
> diff --git a/projectroot/usr/lib/systemd/system/phc2sys.service b/projectroot/usr/lib/systemd/system/phc2sys.service
> new file mode 100644
> index 000000000..eb8e57037
> --- /dev/null
> +++ b/projectroot/usr/lib/systemd/system/phc2sys.service
> @@ -0,0 +1,10 @@
> +[Unit]
> +Description=Precision Time Protocol system clock synchronization
> +Wants=ptp4l@.service
> +
> +[Service]
> +ExecStart=/usr/sbin/phc2sys -a -r -r

The second -r is wrong here. It only makes sense if we want to
synchronise the phc clock to the systemclock. And that only is
valid if we can ensure to have a valid systemclock i.e. by ntp.

The usual case should be to synchronise the systemclock by one
grandmaster clock in the network, which we are not serving.

> +Restart=always
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/projectroot/usr/lib/systemd/system/ptp4l@.service b/projectroot/usr/lib/systemd/system/ptp4l@.service
> new file mode 100644
> index 000000000..7cd00dc45
> --- /dev/null
> +++ b/projectroot/usr/lib/systemd/system/ptp4l@.service
> @@ -0,0 +1,12 @@
> +[Unit]
> +Description=Precision Time Protocol (PTP) service
> +BindsTo = sys-subsystem-net-devices-%i.device
> +After = sys-subsystem-net-devices-%i.device
> +
> +[Service]
> +Type=simple
> +ExecStart=/usr/sbin/ptp4l -P -i %i
> +Restart=always
> +

The usual case should be only to run this on eth0 for
the default rule. I will change it in v3 to -i eth0.

> +[Install]
> +WantedBy=multi-user.target
> diff --git a/rules/linuxptp.in b/rules/linuxptp.in
> index 641d844c7..5418d2ad0 100644
> --- a/rules/linuxptp.in
> +++ b/rules/linuxptp.in
> @@ -7,3 +7,15 @@ config LINUXPTP
>  	  The Linux PTP project implements the Precision Time protocol (PTP),
>  	  standardized as IEEE1588.
>  
> +if LINUXPTP
> +
> +config LINUXPTP_SYSTEMD_SERVICE
> +	bool "install ptp4l and phc2sys systemd service files"
> +	default y
> +
> +config LINUXPTP_PHC2SYS_SYSTEMD_SERVICE
> +	bool "Enable phc2sys systemd service file"
> +	default y
> +	depends on LINUXPTP_SYSTEMD_SERVICE
> +
> +endif
> diff --git a/rules/linuxptp.make b/rules/linuxptp.make
> index 59cbb5123..6cfc0823d 100644
> --- a/rules/linuxptp.make
> +++ b/rules/linuxptp.make
> @@ -17,8 +17,8 @@ PACKAGES-$(PTXCONF_LINUXPTP) += linuxptp
>  #
>  # Paths and names
>  #
> -LINUXPTP_VERSION	:= 1.6
> -LINUXPTP_MD5		:= 6aa15d83f5a35f1fd076ba9adc4e7285
> +LINUXPTP_VERSION	:= 1.8
> +LINUXPTP_MD5		:= 5688cdfe57932273e1dbf35b3b97b9a0
>  LINUXPTP		:= linuxptp-$(LINUXPTP_VERSION)
>  LINUXPTP_SUFFIX		:= tgz
>  LINUXPTP_URL		:= $(call ptx/mirror, SF, linuxptp/$(LINUXPTP).$(LINUXPTP_SUFFIX))
> @@ -64,7 +64,21 @@ $(STATEDIR)/linuxptp.targetinstall:
>  	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/phc2sys)
>  	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/pmc)
>  	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/hwstamp_ctl)
> -	@$(call install_alternative, linuxptp, 0, 0, 0644, /etc/gPTP.conf)
> +	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/phc_ctl)
> +	@$(call install_copy, linuxptp, 0, 0, 0755, -, /usr/sbin/timemaster)
> +
> +ifdef PTXCONF_LINUXPTP_SYSTEMD_SERVICE
> +	@$(call install_alternative, linuxptp, 0, 0, 0644, /usr/lib/systemd/system/ptp4l@.service)

This will be changed to:

	@$(call install_alternative, linuxptp, 0, 0, 0644, /usr/lib/systemd/system/ptp4l.service)

> +	@$(call install_alternative, linuxptp, 0, 0, 0644, /usr/lib/systemd/system/phc2sys.service)
> +
> +	$(call install_link, linuxptp, ../ptp4l@.service, \
> +			/usr/lib/systemd/system/multi-user.target.wants/ptp4l@$eth0.service)

This will be changed to:

	$(call install_link, linuxptp, ../ptp4l.service, \
			/usr/lib/systemd/system/multi-user.target.wants/ptp4l.service)

> +
> +ifdef PTXCONF_LINUXPTP_PHC2SYS_SYSTEMD_SERVICE
> +	@$(call install_link, linuxptp, ../phc2sys.service, \
> +		/usr/lib/systemd/system/multi-user.target.wants/phc2sys.service)
> +endif
> +endif
>  
>  	@$(call install_finish, linuxptp)
>  
> -- 
> 2.11.0

Thanks,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-22 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 12:47 [ptxdist] [PATCH v2] linuxptp: Update package and configs Michael Grzeschik
2017-11-22 11:43 ` Michael Grzeschik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox