Commit Graph

80 Commits (master)

Author SHA1 Message Date
Richard Cochran 6eb9898f61 pmc: Show slave delay timing data TLVs attached to signaling messages.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2020-05-24 19:46:31 -07:00
Richard Cochran 2d2637989c pmc: Show slave receive timing data TLVs attached to signaling messages.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2020-05-24 19:46:31 -07:00
Richard Cochran 6c5b61a64c pmc: Support getting and setting the local synchronization uncertain flag.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2020-05-24 12:02:49 -07:00
Richard Cochran e6d52c54e9 pmc: Allow printing of the SUBSCRIBE_EVENTS_NP tlv.
While we are at it, reformat the pmc_show() function into reverse
Christmas tree order.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2020-03-31 15:03:41 -07:00
Richard Cochran aed79c38d4 pmc: Move private macros back into their source files.
The header file, pmc_common.h, makes some private macros public.  The
intent was to use those macros in SNMP code, but that development never
materialized into production code.  This patch removes the private macros
from public view.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2020-03-31 15:03:41 -07:00
Petr Machata 7985634179 pmc: Support querying TLV_PORT_PROPERTIES_NP
TLV_PORT_PROPERTIES_NP messages serve for querying of port properties, such
as timestamp type and, prominently, netdevice name associated with the
port. pmc however does not support this query, which makes it difficult to
access this information e.g. from scripts. Add this support to pmc.

Signed-off-by: Mykola Zhuravel <mykola@mellanox.com>
Signed-off-by: Petr Machata <petrm@mellanox.com>
2019-10-12 19:42:42 -07:00
Petr Machata 2b5bec8d27 pmc: Add a new TLV to obtain per-port statistics
Add an ability of pmc to query per-port stats added in the previous patch.

Signed-off-by: Petr Machata <petrm@mellanox.com>
2019-09-10 20:56:30 -07:00
Michael Walle 8f484e8312 msg: Drop msg->tlv_count.
The field is redundant with the length tlv_list. Replace it with a
function msg_tlv_count() instead. This iterates over the tlv_list. The
computational overhead should be small, because the lists are very short
and the tlv_count is only used in management paths (yet).

Signed-off-by: Michael Walle <michael@walle.cc>
2018-07-21 16:28:07 -07:00
Anders Selhammer d85c592993 pmc: Move new common funtionality into pmc_common
Code from pmc.c will be reused by new snmpd.c in later commit.

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
2018-07-05 23:17:32 -07:00
Peter Schneider 0455489158 pmc: Fix LOG_SYNC_INTERVAL
In pmc, there is a little bug (only text, not functional):
When pmc is called with the management id 'LOG_SYNC_INTERVAL',
the response is '... seq 0 RESPONSE MANAGEMENT ANNOUNCE_RECEIPT_TIMEOUT' .
It should be '... seq 0 RESPONSE MANAGEMENT LOG_SYNC_INTERVAL'.
This patch fixes this.

[RC: Include explanation from 0/1 in commit message. ]

Signed-off-by: Peter Schneider <peter@psch.de>
2018-04-18 14:51:57 -07:00
Peter Schneider c96dea72f1 pmc: add long options and configuration file
[ RC: - Add new flag into usage message.
      - Fix up coding style of the automatic variables. ]

Signed-off-by: Peter Schneider <peter@psch.de>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-24 21:15:17 -07:00
Richard Cochran 0483bf4972 util: Relocate utility functions from pmc.c.
The file, pmc.c, contains utility functions for printing out a port address
structure.  We will want to call these functions from pmc_common.c, and so
this patch moves the utility functions where they belong.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-08 07:20:42 -08:00
Richard Cochran 7fe69e7ba0 msg: Populate the TLV list on receive.
This patch changes the receive message parsing code to place each TLV
into the list.  A method is introduced that allows attaching TLVs to
the end of the list.

In addition, msg.last_tlv is converted into a pointer to the last item
in the list.  Because of this change, the transmit code that uses this
field now allocates a TLV before using it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-07 19:28:25 -08:00
Richard Cochran 201abc9b95 pmc: Fix white space errors.
We indent with tabs, not spaces.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-06 06:37:54 -08:00
Hangbin Liu 95b5a13cb2 pmc: goto out when get unknown management tlv
If handle unknown management tlv. The management message id and format are
also unknown, thus we may crash due to access unknown area.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2017-05-25 13:44:07 +02:00
Petr Kulhavy a216b11ce5 pmc: optimize duplicated code in do_set_action()
TLV_PRIORITY1 and TLV_PRIORITY2 cases in do_set_action() use the same repeated
piece of generic code for setting one-value parameter. Remove the duplicated
code and let both cases use the same code.

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
2017-05-21 21:37:10 +02:00
Richard Cochran 7b438defe5 config: introduce a proper creation method.
Now that all of the legacy, open coded configuration fields are gone,
we can follow a normal create/destroy pattern for the configuration.
This patch add the new method and converts the programs to use it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:48:09 +02:00
Richard Cochran e27b036d09 config: convert 'uds_address' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran e7dbc068f6 config: introduce a new API for reading configuration settings.
This patch introduces generic code for adding and parsing new options.
The public 'get' methods return option values directly.  Although the
API is easy to use, it does not provide error checking in case the
option does not exist or if there is a type mismatch.

Therefore the code performs a BIST to ensure that the options are
properly populated.  In addition, the code terminates the program in
case of missing options or type mismatches.  This heavy handed
approach is meant to catch errors during development and should never
trigger during normal usage.

As a first element, we include an option for specifying the UDP TTL.

Users are required to call 'config_init', and so this patch add that into
all three programs, ptp4l, phc2sys and pmc.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:19 +02:00
Richard Cochran bbbc0cd451 pmc: require a configuration for creating a PMC instance.
In the near future, the transports will need to consult the configuration
database in order to obtain various options.  This patch also introduces
the idea of a configuration file into the phc2sys and pmc programs.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-16 11:20:23 +02:00
Richard Cochran 3e1e894d22 pmc: support setting the priority attributes.
This patch lets the pmc program change the priority1 and priority2
elements of the "default data set" at run time.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-07-24 21:59:43 +02:00
IOhannes m zmölnig 6415f56acb fixed spelling: "MANAGEMENT"
rather than "MANAGMENT"

Signed-off-by: IOhannes m zmölnig <zmoelnig@umlaeute.mur.at>
2015-06-08 14:46:37 +02:00
Miroslav Lichvar 1773d21f26 Append PID to client UDS paths.
This allows running multiple phc2sys and pmc instances at the same time.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-09-21 12:34:05 +02:00
Miroslav Lichvar 30841a6849 Close client UDS transport before exit.
In pmc and phc2sys handle terminating signals and close the UDS
transport before exit to remove the sockets in /var/run.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-09-21 12:34:05 +02:00
Miroslav Lichvar 70dd682349 Prefix TLV IDs.
To avoid conflicts in generic names add TLV_ prefix to all TLV IDs
defined in tlv.h.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-07-09 06:31:25 +02:00
Miroslav Lichvar c0fd772974 pmc: print cumulativeScaledRateOffset as offset.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-02-25 14:15:49 +01:00
Stephan Gatzka 110849d422 Make functions and structs dealing with string literals const correct.
This allows the compiler to check if someone writes into string
literals.

Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
2014-02-07 19:41:47 +01:00
Delio Brignoli 29063a8227 pmc: support retrieving neighborPropDelayThresh and asCapable using management interface
Define new PORT_DATA_SET_NP TLV
neighborPropDelayThresh can also be set using the same TLV

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2014-02-04 18:59:26 +01:00
Richard Cochran 4f6f1e1cba pmc: add a command line option to select the server's UDS address.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-10-08 20:11:20 +02:00
Richard Cochran b74e46724e pmc: release the message cache on exit.
This makes valgrind happier by freeing any cached message buffers.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-23 19:56:02 +02:00
Richard Cochran a3762c506e pmc: add a command to select the target port.
This patch adds a new pmc command called "target" that lets the user
address a particular clock and port. Previously all management requests
were sent to the wild card address.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-22 21:47:28 +02:00
Richard Cochran b0d789a73e pmc: optional legacy zero length TLV for GET actions.
This patch makes the original behavior of sending the
TLV values for GET actions with a length of zero.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-22 21:47:28 +02:00
Richard Cochran 617a905643 pmc: add our very first SET command.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-14 21:37:52 +02:00
Richard Cochran 661d7a7716 pmc: Support the grandmaster settings management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-14 21:36:18 +02:00
Richard Cochran 5be0770dfc pmc: fix coding style by using K&R style functions. 2013-07-07 18:55:44 +02:00
Ken ICHIKAWA 8c55817caf Enable LOG_MIN_PDELAY_REQ_INTERVAL management request
Why don't you enable LOG_MIN_PDELAY_REQ_INTERVAL management request?
2013-03-28 07:10:32 +01:00
Geoff Salmon 3a028edbc8 pmc: avoid printing invalid data from empty TLVs
Also adds additional null-check to bin2str to avoid crashing on empty
messages.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-03-12 20:26:44 +01:00
Richard Cochran 48aa6712a9 Add support for the log peer delay interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:27:12 +01:00
Richard Cochran 9b5e37bbf8 Add support for the delay mechanism management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:23:32 +01:00
Richard Cochran d30d397c2b Add support for the version number management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:18:19 +01:00
Richard Cochran 06a65003f4 Add support for the log sync interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:14:05 +01:00
Richard Cochran d2f8bc5e38 Add support for the announce receipt timeout management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:10:51 +01:00
Richard Cochran 555c42e3d0 Add support for the log announce interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:06:36 +01:00
Richard Cochran 2044d045b4 Add support for the timescale management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-03 20:26:00 +01:00
Richard Cochran 4dfcca733b Add support for the traceability management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-03 20:20:12 +01:00
Richard Cochran 32c8635aef Add support for the clock_accuracy management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-03 20:10:46 +01:00
Richard Cochran 78e37ebf0b Add support for the slave_only management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-03 20:06:17 +01:00
Richard Cochran bed1067d2b Add support for the domain management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-03 19:54:17 +01:00
Richard Cochran 8cc3a1f3b8 Add support for the priority2 management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-03 19:48:43 +01:00
Richard Cochran f0c0f7b121 Add support for the priority1 management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-03 19:41:06 +01:00