Thread: [Linuxptp-users] Error accessing /dev/ptp0
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Ronex D. <ron...@ya...> - 2014-08-06 09:57:44
|
Hello, I have few queries related to linuxptp, as mentioned below: 1) I tried to run ptp4l application using command: /home/ptp4l -i eth0 -p eth0 -m -P (ptp master) But it fails with the following error message: ptp4l[3505.127]: selected /dev/ptp0 as PTP clock ptp4l[3505.166]: Failed to open /dev/ptp0: No such file or directory failed to create a clock I am trying to run it for arm architecture, and for this I have cross compiled kernel and linuxptp source. This ('/dev/ptp0') device node is not present inside '/dev' directory. Please help me to understand who creates this node, I have ptp supported driver for the ethernet device. If this device is supposed to be created by user then what is the MAJOR/MINOR number for /dev/ptp0 ? And which driver manages/handles access to this node ? 2) I am also not able to understand the basic higher level abstract flow of how this application works ? I think linux kernel has its own ptp driver implementation, So From the application does it use the linux user space API/system calls which further calls linux ptp driver functions (<linux_x.x>/drivers/ptp/), from which hardware ptp supported driver's functions are invoked ? ptp4l(linuxptp app) ---> drivers/ptp ---> ethernet_driver_with_ptp_support Regards, Ronex |
From: Richard C. <ric...@gm...> - 2014-08-06 16:24:03
|
On Wed, Aug 06, 2014 at 05:45:04PM +0800, Ronex Dicapriyo wrote: > Hello, > > I have few queries related to linuxptp, as mentioned below: > > > 1) I tried to run ptp4l application using command: > /home/ptp4l -i eth0 -p eth0 -m -P (ptp master) You don't need '-p' unless your kernel is older than v3.5. > If this device is supposed to be created by user then what is the MAJOR/MINOR number for /dev/ptp0 ? > And which driver manages/handles access to this node ? Look for 'ptp' in /proc/devices to get the major number. The minor number is then zero. Normally udev creates the node automatically. If you are using busybox, then mdev should also make the node for you. Otherwise, just create the node by hand using the 'mknod' command. > 2) I am also not able to understand the basic higher level abstract flow of how this application works ? > I think linux kernel has its own ptp driver implementation, So From the application does it use the linux user space API/system calls which further calls linux ptp driver functions (<linux_x.x>/drivers/ptp/), from which hardware ptp supported driver's functions are invoked ? > ptp4l(linuxptp app) ---> drivers/ptp ---> ethernet_driver_with_ptp_support Yes, more or less. There are actually three different kernel interfaces that ptp4l uses: 1. so_timestamping socket option (user -> network core -> driver) 2. ptp clock character device (user -> chardev -> ptp subsystem -> driver) 3. dynamic posix clock (user -> time core -> ptp subsystem -> driver) The second interface is only used to get a handle to a dynamic posix clock. In addition, the phc2sys program uses the ioctls from the ptp clock character device. See include/uapi/linux/ptp_clock.h in the Linux kernel source. HTH, Richard |
From: Ronex D. <ron...@ya...> - 2014-08-06 18:07:43
|
Hi Richard, Thanks for the detailed response, Kindly help on the few more queries for the same: 1) > 1. so_timestamping socket option (user -> network core -> driver) > 2. ptp clock character device (user -> chardev -> ptp subsystem -> driver) > 3. dynamic posix clock (user -> time core -> ptp subsystem -> driver) > The second interface is only used to get a handle to a dynamic posix clock. Here by using `driver` I believe you referred the network interface driver rather then driver/ptp implementation. And by `ptp subsystem`, Do you refer "<kernel_source>/drivers/ptp" ? 2) To run ptp4l I have used following command as you have suggested before: On the master host: ptp4l -m -q -i eth0 Does it sends ptp messages (like sync, delay etc..) to all the system in local LAN, and all the local IP's(Private and Public ethernet interface present on same host) ? On the slave host: ptp4l -m -q -i eth0 -s Now How am I supposed to check output, I believe log messages along with wireshark might can help here. Does it stops after syncing the time between slave and master device ? 3) Is it possible to establish ptp communication on one to one basis, means master sends ptp messages to slave IP,where ptp4l slave application is listening for master IP address ? Regards, Ronex On Wednesday, 6 August 2014 9:53 PM, Richard Cochran <ric...@gm...> wrote: On Wed, Aug 06, 2014 at 05:45:04PM +0800, Ronex Dicapriyo wrote: > Hello, > > I have few queries related to linuxptp, as mentioned below: > > > 1) I tried to run ptp4l application using command: > /home/ptp4l -i eth0 -p eth0 -m -P (ptp master) You don't need '-p' unless your kernel is older than v3.5. > If this device is supposed to be created by user then what is the MAJOR/MINOR number for /dev/ptp0 ? > And which driver manages/handles access to this node ? Look for 'ptp' in /proc/devices to get the major number. The minor number is then zero. Normally udev creates the node automatically. If you are using busybox, then mdev should also make the node for you. Otherwise, just create the node by hand using the 'mknod' command. > 2) I am also not able to understand the basic higher level abstract flow of how this application works ? > I think linux kernel has its own ptp driver implementation, So From the application does it use the linux user space API/system calls which further calls linux ptp driver functions (<linux_x.x>/drivers/ptp/), from which hardware ptp supported driver's functions are invoked ? > ptp4l(linuxptp app) ---> drivers/ptp ---> ethernet_driver_with_ptp_support Yes, more or less. There are actually three different kernel interfaces that ptp4l uses: 1. so_timestamping socket option (user -> network core -> driver) 2. ptp clock character device (user -> chardev -> ptp subsystem -> driver) 3. dynamic posix clock (user -> time core -> ptp subsystem -> driver) The second interface is only used to get a handle to a dynamic posix clock. In addition, the phc2sys program uses the ioctls from the ptp clock character device. See include/uapi/linux/ptp_clock.h in the Linux kernel source. HTH, Richard |
From: Richard C. <ric...@gm...> - 2014-08-06 19:08:39
|
On Thu, Aug 07, 2014 at 01:51:18AM +0800, Ronex Dicapriyo wrote: > And by `ptp subsystem`, Do you refer "<kernel_source>/drivers/ptp" ? Yes, some important files for the ptp subsystem are in drivers/ptp, but there are also drivers there. Overall it is not as simple you try to make it. When we say "driver" this can mean an Ethernet MAC driver, a PHY driver, or a PTP Hardware Clock driver. Also, the core ptp code is mostly in drivers/ptp, but there are some bits in the core networking code as well. You have the source. Now go and read it! > Does it sends ptp messages (like sync, delay etc..) to all the system in local LAN, and all the local IP's(Private and Public ethernet interface present on same host) ? It sends multicast messages on the given interface. > Now How am I supposed to check output, I believe log messages along with wireshark might can help here. You can use wireshark, sure. But the slave ptp4l program should print out the current time offset, once per second. > Does it stops after syncing the time between slave and master device ? No. > 3) Is it possible to establish ptp communication on one to one basis, means master sends ptp messages to slave IP,where ptp4l slave application is listening for master IP address ? Unicast messaging is possible with the protocol, but it is not implemented in linuxptp. Thanks, Richard |
From: Ronex D. <ron...@ya...> - 2014-08-07 13:41:24
|
Hello, 1) PTP master/slave is not working while I tried to run it over same host. Following messages are displayed repeatedly: ptp4l[269.788]: sendto failed: No message of desired type ptp4l[269.789]: port 1: send sync failed ptp4l[269.789]: port 1: MASTER to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED) ptp4l[269.861]: driver changed our HWTSTAMP options ptp4l[269.863]: tx_type 1 not 1 ptp4l[269.863]: rx_filter 1 not 12 ptp4l[269.864]: selected best master clock 169acc.fffe.7d54bd ptp4l[277.043]: driver changed our HWTSTAMP options ptp4l[277.046]: tx_type 1 not 1 ptp4l[277.046]: rx_filter 1 not 12 ptp4l[277.047]: selected best master clock 169acc.fffe.7d54bd ptp4l[284.513]: driver changed our HWTSTAMP options ptp4l[284.514]: tx_type 1 not 1 ptp4l[284.515]: rx_filter 1 not 12 ptp4l[284.516]: selected best master clock 169acc.fffe.7d54bd ptp4l[285.796]: driver changed our HWTSTAMP options ptp4l[285.798]: tx_type 1 not 1 ptp4l[285.798]: rx_filter 1 not 12 ptp4l[285.799]: port 1: FAULTY to LISTENING on FAULT_CLEARED ptp4l[290.943]: driver changed our HWTSTAMP options ptp4l[290.944]: tx_type 1 not 1 ptp4l[290.945]: rx_filter 1 not 12 ptp4l[290.946]: selected best master clock 169acc.fffe.7d54bd 2) And Can you please suggest How I could run it on two different linux host, Do I need to use some kind of multicast forwarding for that ? I tried to run PTP master behind, 10.0.0.1/24 and slave behind 10.0.1.1/24 +----------------------+ +----------------------+ | Linux Guest Host-1 | | Linux Guest Host-2 | | __________ | | __________ | | | | | | | | | | | eth0 | | | | eth0 | | | | 10.2.0.2 | | | | 10.1.0.2 | | | |__________| | | |__________| | | | | | +---------+------------+ +----------+-----------+ ____|____ ___|_____ | | | | |piface_1 | | piface_2| |10.2.0.2 | |10.2.0.1 | |_________| |_________| piface_1 and piface_2 exist on the host, where I am running two linux guest host. Now, I tried to run ptp master on linux guest host-1 ./ptp4l -i eth0 -m -q And ptp slave on linux guest host-2, ./ptp4l -i eth0 -m -s -q But On wireshark I could see sync, Follow_up messages from master(captured for piface_1) and on slave(captured over piface_2) I could just see IGMP massages, I think multicast frames from master doesn't reach to the slave. Am I missing here some configuration ? Regards, Ronex On Thursday, 7 August 2014 12:38 AM, Richard Cochran <ric...@gm...> wrote: On Thu, Aug 07, 2014 at 01:51:18AM +0800, Ronex Dicapriyo wrote: > And by `ptp subsystem`, Do you refer "<kernel_source>/drivers/ptp" ? Yes, some important files for the ptp subsystem are in drivers/ptp, but there are also drivers there. Overall it is not as simple you try to make it. When we say "driver" this can mean an Ethernet MAC driver, a PHY driver, or a PTP Hardware Clock driver. Also, the core ptp code is mostly in drivers/ptp, but there are some bits in the core networking code as well. You have the source. Now go and read it! > Does it sends ptp messages (like sync, delay etc..) to all the system in local LAN, and all the local IP's(Private and Public ethernet interface present on same host) ? It sends multicast messages on the given interface. > Now How am I supposed to check output, I believe log messages along with wireshark might can help here. You can use wireshark, sure. But the slave ptp4l program should print out the current time offset, once per second. > Does it stops after syncing the time between slave and master device ? No. > 3) Is it possible to establish ptp communication on one to one basis, means master sends ptp messages to slave IP,where ptp4l slave application is listening for master IP address ? Unicast messaging is possible with the protocol, but it is not implemented in linuxptp. Thanks, Richard |
From: Richard C. <ric...@gm...> - 2014-08-07 17:20:14
|
On Thu, Aug 07, 2014 at 09:41:14PM +0800, Ronex Dicapriyo wrote: > PTP master/slave is not working while I tried to run it over same host. ^^^^^^^^^^^^^^ What? That doesn't make any sense. > And Can you please suggest How I could run it on two different linux host, Do I need to use some kind of multicast forwarding for that ? I already told you how to do that. ptp4l -i eth0 -m -q # master ptp4l -i eth0 -m -q -s # slave > I tried to run PTP master behind, 10.0.0.1/24 and slave behind 10.0.1.1/24 ... > piface_1 and piface_2 exist on the host, where I am running two linux guest host. PTP probably won't work in a virtual machine. Try a real machine instead. Thanks, Richard |