[Linuxptp-devel] [PATCHv6 00/12] Add linuxptp bond failover support
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Hangbin L. <liu...@gm...> - 2017-10-09 14:33:01
|
This patch set is to add linuxptp bond fail over support. The main idea is get bond's active slave interface via rtnl socket and store it in struct interface. When active interface changed, we update the port phc index and switch to new phc on clock. After we get true ts interface, we need to use this interface in sk_timestamping_init() in transport_open(). Also we need update clock and phc_index in phc2sys. --- v5 -> v6: Based on Richard's advices. 1. For [PATCHv5 04/12] rtnl: update function rtnl_link_status to get bond... - Add ifndef IFLA_BOND_MAX in case we build linuxptp before kernel v3.13-rc1. - Fix rtnl_link_status() return value documentation. 2. For [PATCHv5 05/12] rtnl: add function rtnl_get_ts_label to get interface... - Reorder function rtnl_get_ts_label() with alphabet. 3. In [PATCHv5 08/12] ptp4l: use ts label to get ts info - Init variable ts_label[] before use it. v4 -> v5: Based on Miroslav's tests and advices. 1. For [PATCHv4 08/10] ptp4l: use ts label to get ts info - In function port_link_status() we should only switch phc with HW time stamping mode. 2. For [PATCHv4 10/10] phc2sys: update clock clkid and phc_index if device changed - Split this patch into three small patches to make the logic more clear. So now we have two parts for this patchset. Patches 1-9 are to add ptp4l bond failover support. And patches 10-12 are to add phc2sys failover support. - Split servo_add from function clock_add for later use. - In reconfigure() we only do clock_reinit() when new state is PS_MASTER or PS_SLAVE. But when get failover the state changed to PS_FAULTY first, during this time we still choose the old phc device instead of new phc. Fix this by call clock_reinit() whenever we have a new state. - In clock_reinit(), the new phc device may have different maximum adjustment, then it will try to make a larger adjustment than the HW can handle and breaks the synchronization. So we need to destroy the old servo and create a new one. v3 -> v4: 1. In [PATCHv3 04/10] rtnl: update function rtnl_link_status to get bond slave info - Make function rtnl_nested_rtattr_parse() static inline - Check type < max in function rtnl_rtattr_parse() 2. In [PATCHv3 08/10] ptp4l: use ts label to get ts info - In previous patch we only updated phc index when ts_label changed. But actually link down and up may also change the phc index. So in this new version we will check both states and update phc index when it changed. - Call clock_sync_interval() after clock_switch_phc() 3. In [PATCHv3 10/10] phc2sys: update clock clkid and phc_index if device changed - In clock_reinit(), we need to check phc index even clock->device not changed because device down and up will also cause phc index change. - In reconfigure(), we also need to reinit clock when new_state is PS_SLAVE because there may have bond failover on slave. v2 -> v3: 1. Change the ts_iface to ts_label 2. Separate the original fourth patch "rtnl: add function rtnl_link_info" into two parts. The first part is update function rtnl_link_status to get bond slave info. And the second part add the new function rtnl_get_ts_label() to get interface ts_label info. 3. update port link_status to enum 4. Some small fixes. v1 -> v2: 1. After the rtnl per port update, now we update ts_iface info in port_link_status(). 2. Fix port_dispatch event flood when change ts_iface info. This issue only happen with bond interface when fail over. Normal ethernet interface do not have this problem. Hangbin Liu (12): config: add new element ts_label in struct interface port: track interface info in port rtnl: update rtgenmsg to ifinfomsg when request link info rtnl: update function rtnl_link_status to get bond slave info rtnl: add function rtnl_get_ts_label to get interface ts_label info port: update port link_status to enum clock: add clock_required_modes to obtain the required time stamping mode ptp4l: use ts label to get ts info transport: pass struct interface to transport_open phc2sys: split servo_add from function clock_add phc2sys: re-create clock clkid and servo when phc index changed port: return timestamping iface in port properties clock.c | 63 +++++++++++++++++------- clock.h | 8 +++ config.c | 1 - config.h | 1 + missing.h | 36 ++++++++++++++ phc2sys.c | 129 ++++++++++++++++++++++++++++++++++++------------ pmc_common.c | 5 +- port.c | 85 ++++++++++++++++++++++++++------ raw.c | 5 +- rtnl.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++------ rtnl.h | 29 +++++++---- transport.c | 4 +- transport.h | 3 +- transport_private.h | 4 +- udp.c | 7 +-- udp6.c | 7 +-- uds.c | 3 +- 17 files changed, 424 insertions(+), 105 deletions(-) -- 2.5.5 |