If you are interested in using ptp4l/phc2sys hardware timestamp on
vlan, the following instruction is working on my system.
Someone may ask why VLAN, why I can just have the interfaces on
different NIC cards. Sure you can. But if you want to reduce the
number of cables, NIC cards, and may be switches. VLAN is the
solution.
Many thanks to Shawn Bohrer for helping me to make this configuration work.
- These two NIC cards are working under this configuration
> ethtool -i eth0
driver: ixgbe
version: 4.0.1-k-rh7.1
firmware-version: 0x61c10001
bus-info: 0000:03:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no
> ethtool -i eth6
driver: mlx4_en
version: 3.1-1.0.4 (30 Sep 2015)
firmware-version: 2.35.5100
bus-info: 0000:81:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: yes
- Download linuxptp1.6.tgz
- On the slave servers, my system has eth6, eth6.2, eth6.8, eth6.172,
and I want the ptp traffic to be only on eth6.172
>ethtool eth6
Settings for eth6:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseKX/Full
10000baseKX4/Full
10000baseKR/Full
40000baseCR4/Full
40000baseSR4/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Advertised link modes: 1000baseKX/Full
10000baseKX4/Full
10000baseKR/Full
40000baseCR4/Full
40000baseSR4/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 40000Mb/s
Duplex: Full
Port: Direct Attach Copper
PHYAD: 0
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: d
Wake-on: d
Current message level: 0x00000014 (20)
link ifdown
Link detected: yes
> ethtool -T eth6
Time stamping parameters for eth6:
Capabilities:
hardware-transmit (SOF_TIMESTAMPING_TX_HARDWARE)
software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE)
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE)
PTP Hardware Clock: 2 <-- (note: the /dev/ptp2 will be used to run
ptp4l and phc2sys)
Hardware Transmit Timestamp Modes:
off (HWTSTAMP_TX_OFF)
on (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
none (HWTSTAMP_FILTER_NONE)
all (HWTSTAMP_FILTER_ALL)
- Configure hwstamp_ctl
>hwstamp_ctl -i eth6 -r 1 -t 1
current settings:
tx_type 0
rx_filter 0
new settings:
tx_type 1
rx_filter 1
- Modify the following files
port.c | 3 ++-
ptp4l.c | 3 ++-
sk.c | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/port.c b/port.c
index 3f32433..412fdd9 100644
--- a/port.c
+++ b/port.c
@@ -2562,7 +2562,8 @@ struct port *port_open(int phc_index,
pr_err("port %d: PHC device mismatch", number);
pr_err("port %d: /dev/ptp%d requested, ptp%d attached",
number, phc_index, interface->ts_info.phc_index);
- goto err_port;
+ // Mismatch caused by VLAN, just continue
+ //goto err_port;
}
}
diff --git a/ptp4l.c b/ptp4l.c
index 662e6e6..cefa2de 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -302,7 +302,8 @@ int main(int argc, char *argv[])
fprintf(stderr, "interface '%s' does not support "
"requested timestamping mode.\n",
iface->name);
- goto out;
+ // Vlan claims it doesn't support HW TS but
real interface does
+ //goto out;
}
}
diff --git a/sk.c b/sk.c
index e80f608..d67a7a6 100644
--- a/sk.c
+++ b/sk.c
@@ -58,6 +58,8 @@ static int hwts_init(int fd, const char *device, int
rx_filter, int one_step)
cfg.tx_type = one_step ? HWTSTAMP_TX_ONESTEP_SYNC : HWTSTAMP_TX_ON;
cfg.rx_filter = rx_filter;
req = cfg;
+ // Don't enable HW TS we'll have to do it manually
+ return 0;
err = ioctl(fd, SIOCSHWTSTAMP, &ifreq);
if (err < 0)
return err;
- Build the linuxptp source code and make install. The default
location should be under /usr/local/sbin/
- If you have a ptp4l.conf file then pass it in the command line,
otherwise you need to set each option here. I.e, for running as slave,
add -s. Ignore the line "does not support requested timestamping mode"
>/usr/local/sbin/ptp4l -f /etc/ptp4l.conf -i eth6.172 -p /dev/ptp2
>/usr/local/sbin/phc2sys -s /dev/ptp2 -w
Dec 2 08:57:36 dr-xeon ptp4l: interface 'eth6.172' does not support
requested timestamping mode.
Dec 2 08:57:36 dr-xeon ptp4l: [76304.287] selected /dev/ptp2 as PTP clock
Dec 2 08:57:36 dr-xeon ptp4l: [76304.287] port 1: PHC device mismatch
Dec 2 08:57:36 dr-xeon ptp4l: [76304.287] port 1: /dev/ptp2
requested, ptp-1 attached
Dec 2 08:57:36 dr-xeon ptp4l: [76304.287] port 1: INITIALIZING to
LISTENING on INITIALIZE
Dec 2 08:57:36 dr-xeon ptp4l: [76304.287] port 0: INITIALIZING to
LISTENING on INITIALIZE
Dec 2 08:57:36 dr-xeon phc2sys: [76304.355] phc offset -19 s2
freq -13165 delay 1128
Dec 2 08:57:37 dr-xeon ptp4l: [76304.497] port 1: new foreign master
000cec.fffe.0a103c-1
Dec 2 08:57:37 dr-xeon phc2sys: [76305.356] phc offset -3 s2
freq -13155 delay 1137
Dec 2 08:57:38 dr-xeon phc2sys: [76306.356] phc offset 29 s2
freq -13124 delay 1127
Dec 2 08:57:39 dr-xeon ptp4l: [76306.497] selected best master clock
000cec.fffe.0a103c
Dec 2 08:57:39 dr-xeon ptp4l: [76306.497] port 1: LISTENING to
UNCALIBRATED on RS_SLAVE
Dec 2 08:57:39 dr-xeon phc2sys: [76307.356] phc offset 24 s2
freq -13120 delay 1133
Dec 2 08:57:40 dr-xeon phc2sys: [76308.356] phc offset 27 s2
freq -13110 delay 1140
Dec 2 08:57:41 dr-xeon ptp4l: [76308.497] master offset 5066 s0
freq +205632 path delay 21301
Dec 2 08:57:41 dr-xeon phc2sys: [76309.356] phc offset -7 s2
freq -13136 delay 1174
Dec 2 08:57:42 dr-xeon ptp4l: [76309.497] master offset 6026 s2
freq +206592 path delay 21100
Dec 2 08:57:42 dr-xeon ptp4l: [76309.497] port 1: UNCALIBRATED to
SLAVE on MASTER_CLOCK_SELECTED
Dec 2 08:57:42 dr-xeon phc2sys: [76310.356] phc offset 838 s2
freq -12293 delay 1130
Dec 2 08:57:43 dr-xeon ptp4l: [76310.497] master offset 5195 s2
freq +211787 path delay 21196
Dec 2 08:57:43 dr-xeon phc2sys: [76311.356] phc offset 5386 s2
freq -7493 delay 1137
Dec 2 08:57:44 dr-xeon ptp4l: [76311.497] master offset 394 s2
freq +208544 path delay 21196
Dec 2 08:57:44 dr-xeon phc2sys: [76312.357] phc offset 3066 s2
freq -8197 delay 1127
Dec 2 08:57:45 dr-xeon ptp4l: [76312.497] master offset -2295 s2
freq +205974 path delay 21248
Dec 2 08:57:45 dr-xeon phc2sys: [76313.357] phc offset -1221 s2
freq -11565 delay 1140
Dec 2 08:57:46 dr-xeon ptp4l: [76313.497] master offset -2915 s2
freq +204665 path delay 21196
Dec 2 08:57:46 dr-xeon phc2sys: [76314.357] phc offset -3639 s2
freq -14349 delay 1130
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Linuxptp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-users