Hi Richard, As we know, more and more customers are asking for linuxptp fail over support.
And here is the bond failover patch set. The first two patches add netlink support to get bond slave info. Then we start track interface info in port so we can update interface after fail over. And also we start get ts info from true ts interface. After we get true ts interface, we use this interface in sk_timestamping_init() in transport_open(). Also we need update clock device and phc_index in phc2sys. Since it's a large patch set. I may miss some part. Please let me know if you have any questions, comments, or concerns. Thanks Hangbin --- Testing: I tested bond active-backup with L2 SW/HW and L4 SW/HW. All looks good so far. 1. set up bond # ip link add bond0 type bond # ip link set bond0 type bond mode active-backup # ip link set bond0 type bond miimon 100 # ip link set p4p1 master bond0 # ip link set p4p2 master bond0 # ip link set bond0 up # ip addr add 192.168.1.1/24 dev bond0 2. start ptp4l with L2 SW/HW and L4 SW/HW # ./ptp4l -S -2 -i bond0 -m # ./ptp4l -2 -i bond0 -m # ./ptp4l -S -i bond0 -m # ./ptp4l -i bond0 -m 3. When test HW tampstamping, also start phc2sys # ./phc2sys -a -r -m 4. trigger fail over # ip addr show bond0 10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000 link/ether f4:e9:d4:94:62:f0 brd ff:ff:ff:ff:ff:ff inet 192.168.1.1/24 scope global bond0 valid_lft forever preferred_lft forever inet6 fe80::f6e9:d4ff:fe94:62f0/64 scope link valid_lft forever preferred_lft forever # ip -d link show bond0 10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000 link/ether f4:e9:d4:94:62:f0 brd ff:ff:ff:ff:ff:ff promiscuity 0 bond mode active-backup active_slave p4p1 miimon 100 updelay 0 downdelay 0 use_carrier 1 arp_interval 0 arp_validate none arp_all_targets any primary_reselect always fail_over_mac none xmit_hash_policy layer2 resend_igmp 1 num_grat_arp 1 all_slaves_active 0 min_links 0 lp_interval 1 packets_per_slave 1 lacp_rate slow ad_select stable tlb_dynamic_lb 0 addrgenmode eui64 # ip link set p4p1 down # ip -d link show bond0 10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000 link/ether f4:e9:d4:94:62:f0 brd ff:ff:ff:ff:ff:ff promiscuity 0 bond mode active-backup active_slave p4p2 miimon 100 updelay 0 downdelay 0 use_carrier 1 arp_interval 0 arp_validate none arp_all_targets any primary_reselect always fail_over_mac none xmit_hash_policy layer2 resend_igmp 1 num_grat_arp 1 all_slaves_active 0 min_links 0 lp_interval 1 packets_per_slave 1 lacp_rate slow ad_select stable tlb_dynamic_lb 0 addrgenmode eui64 # ip link set p4p1 up # ip link set p4p2 down # ip link set p4p2 up 5. See the logs from ptp4l and phc2sys # ./ptp4l -i bond0 -m ptp4l[43749.389]: selected /dev/ptp0 as PTP clock ptp4l[43749.408]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[43749.408]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[43755.760]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[43755.760]: selected best master clock f4e9d4.fffe.9462f0 ptp4l[43755.760]: assuming the grand master role ptp4l[43767.206]: port 1: link up ptp4l[43767.225]: port 1: MASTER to LISTENING on INIT_COMPLETE ptp4l[43767.225]: port 1: link up ptp4l[43767.225]: port 1: link up ptp4l[43774.206]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[43774.206]: selected best master clock f4e9d4.fffe.9462f0 ptp4l[43774.206]: assuming the grand master role ptp4l[43784.208]: timed out while polling for tx timestamp ptp4l[43784.208]: increasing tx_timestamp_timeout may correct this issue, but it is likely caused by a driver bug ptp4l[43784.208]: port 1: send sync failed ptp4l[43784.208]: port 1: MASTER to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED) ptp4l[43784.567]: port 1: link up ptp4l[43784.587]: port 1: FAULTY to LISTENING on INIT_COMPLETE ptp4l[43784.587]: port 1: link up ptp4l[43784.587]: port 1: link up ptp4l[43790.675]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[43790.675]: selected best master clock f4e9d4.fffe.9462f0 ptp4l[43790.675]: assuming the grand master role # ./phc2sys -a -r -m phc2sys[43761.356]: reconfiguring after port state change phc2sys[43761.356]: selecting p4p1 for synchronization phc2sys[43761.356]: nothing to synchronize phc2sys[43767.357]: port f4e9d4.fffe.9462f0-1 changed state phc2sys[43767.357]: reconfiguring after port state change phc2sys[43767.357]: selecting p4p1 for synchronization phc2sys[43767.357]: nothing to synchronize phc2sys[43774.358]: port f4e9d4.fffe.9462f0-1 changed state phc2sys[43774.358]: reconfiguring after port state change phc2sys[43774.358]: selecting p4p2 for synchronization phc2sys[43774.358]: nothing to synchronize phc2sys[43785.360]: port f4e9d4.fffe.9462f0-1 changed state phc2sys[43785.360]: reconfiguring after port state change phc2sys[43785.360]: selecting p4p2 for synchronization phc2sys[43785.360]: nothing to synchronize phc2sys[43791.361]: port f4e9d4.fffe.9462f0-1 changed state phc2sys[43791.361]: reconfiguring after port state change phc2sys[43791.361]: selecting p4p1 for synchronization phc2sys[43791.361]: nothing to synchronize Hangbin Liu (8): rtnl: use ifinfomsg instead of rtgenmsg to request link info rtnl: extend struct interface and add new function rtnl_link_info port: track interface info in port port: add new function port_set_phc clock: use ts interface to get ts info clock: need check required_modes before use new ts info transport: pass struct interface instread of name to transport_open phc2sys: update clock clkid and phc_index if device changed clock.c | 79 +++++++++++++++++++++++---------- config.c | 1 - config.h | 1 + phc2sys.c | 50 +++++++++++++++++++-- pmc_common.c | 5 ++- port.c | 18 ++++++-- port.h | 14 ++++++ raw.c | 5 ++- rtnl.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++---- rtnl.h | 40 +++++++++++++++-- transport.c | 4 +- transport.h | 3 +- transport_private.h | 4 +- udp.c | 7 +-- udp6.c | 7 +-- uds.c | 3 +- 16 files changed, 308 insertions(+), 56 deletions(-) -- 2.5.5 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel