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>
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>
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>
[ 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Add a batch mode, where the commands are taken from the command line
instead of the standard input.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
The printing facility is used by different programs, allow to set the
program name which prefixes the messages written to stdout.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>