Black-box switches with PTP support commonly provide per-port statistics of
number of messages sent and received, split by the message type. Like other
statistics (ip link, ethtool, etc. etc.), network operators use the PTP
message stats to monitor the (PTP) network and debug issues.

When ptp4l is used to turn a Linux machine (be it a switch or a host) into
a PTP clock, there is no easy way to get at these stats. It would certainly
be possible to parse ingressing and egressing traffic using e.g. a u32
classifier, or create an ad-hoc eBPF-based tool, or something similar. But
all these approaches have to work hard to extract the knowledge that ptp4l
already has. ptp4l needs to parse the traffic anyway, and for transmitted
packets obviously knows what it is sending. It is thus the natural place
to place the stats.

To that end, patch #1 introduces the message stats into linuxptp. A logical
way to obtain these stats is then through pmc, which is implemented in
patch #2, by way of a new TLV type.

v2:
- Patch #1:
    - Add MAX_MESSAGE_TYPES with comment instead of using a bare constant.

Petr Machata (2):
  port: Introduce per-port stats for received and transmitted messages
  pmc: Add a new TLV to obtain per-port statistics

 ddt.h          |  7 +++++++
 pmc.c          | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 pmc_common.c   |  1 +
 port.c         | 32 ++++++++++++++++++++++++++++++--
 port_private.h |  1 +
 tlv.c          | 15 +++++++++++++++
 tlv.h          |  6 ++++++
 7 files changed, 107 insertions(+), 2 deletions(-)

-- 
2.20.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to