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.
---
v4 -> v5: Based on Miroslav's tests and advises.
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 +
phc2sys.c | 129 ++++++++++++++++++++++++++++++++++++------------
pmc_common.c | 5 +-
port.c | 85 ++++++++++++++++++++++++++------
raw.c | 5 +-
rtnl.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++------
rtnl.h | 28 +++++++----
transport.c | 4 +-
transport.h | 3 +-
transport_private.h | 4 +-
udp.c | 7 +--
udp6.c | 7 +--
uds.c | 3 +-
16 files changed, 386 insertions(+), 105 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel