[lkml]   [2020]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH 0/7] TC-ETF support PTP clocks series
Add support for using PTP clock with
Traffic control Earliest TxTime First (ETF) Qdisc.

Why do we need ETF to use PTP clock?
Current ETF requires to synchronization the system clock
to the PTP Hardware clock (PHC) we want to send through.
But there are cases that we can not synchronize the system clock with
the desire NIC PHC.
1. We use several NICs with several PTP domains that our device
is not allowed to be PTP master.
And we are not allowed to synchronize these PTP domains.
2. We are using another clock source which we need for our system.
Yet our device is not allowed to be PTP master.
Regardless of the exact topology, as the Linux tradition is to allow
the user the freedom to choose, we propose a patch that will allow
the user to configure the TC-ETF with a PTP clock as well as
using the system clock.
* NOTE: we do encourage the users to synchronize the system clock with
a PTP clock.
As the ETF watchdog uses the system clock.
Synchronizing the system clock with a PTP clock will probably
reduce the frequency different of the PHC and the system clock.
As sequence, the user might be able to reduce the ETF delta time
and the packets latency cross the network.

Follow the decision to derive a dynamic clock ID from the file description
of an opened PTP clock device file.
We propose a simple way to use the dynamic clock ID with the ETF Qdisc.
We will submit a patch to the "tc" tool from the iproute2 project
once this patch is accepted.

The patches contain:
1. Add function to verify that a dynamic clock ID is derived
from file description.
The function follows the clock ID convention for dynamic clock ID
for file description.
The function will be used in the second patch.

2. Function to get main system oscillator calibration state.

3. Functions to get and put POSIX clock reference of
a PTP Hardware Clock (PHC).
The get function uses a dynamic clock ID created by application space.
The purpose is that a module can hold a POSIX clock reference after the
configuration application closed the PTP clock device file,
and though the dynamic clock ID can not be used any further.
The POSIX clock refereces are used by the TC-ETF.

4. A fix of the range check in qdisc_watchdog_schedule_range_ns().

5. During testing of ETF, we notice issue with the high-resolution timer
the ETF Qdisc watchdog uses.
The timer was set for a sleep of 300 nanoseconds but
end up sleeping for 3 milliseconds.
The problem happens when the timer is already active and
the current expire is earlier then a new expire.
So, we add a new TC schedule function that do not reprogram the timer
under these conditions.
The use of the function make sense as the Qdisc watchdog does act as
The Qdisc watchdog can expire earlier.
However, if the watchdog is late, packets are dropped.

6. Add kernel configuration for TC-ETF watchdog range.
As the range is characteristic of Hardware,
that seems to be the proper way.

7. Add support for using PHC clock with TC-ETF.

Erez Geva (7):
POSIX clock ID check function
Function to retrieve main clock state
Functions to fetch POSIX dynamic clock object
Fix qdisc_watchdog_schedule_range_ns range check
Traffic control using high-resolution timer issue
TC-ETF code improvements
TC-ETF support PTP clocks

include/linux/posix-clock.h | 39 +++++++++
include/linux/posix-timers.h | 5 ++
include/linux/timex.h | 1 +
include/net/pkt_sched.h | 2 +
include/uapi/linux/net_tstamp.h | 5 ++
kernel/time/posix-clock.c | 76 ++++++++++++++++
kernel/time/posix-timers.c | 2 +-
kernel/time/timekeeping.c | 9 ++
net/sched/Kconfig | 8 ++
net/sched/sch_api.c | 36 +++++++-
net/sched/sch_etf.c | 148 +++++++++++++++++++++++++-------
11 files changed, 298 insertions(+), 33 deletions(-)

base-commit: a1b8638ba1320e6684aa98233c15255eb803fac7

 \ /
  Last update: 2020-10-01 23:04    [W:0.163 / U:2.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site