Commit Graph

25 Commits (bdaff2ecd2c6c7c630f39cfa5c89b74b476a3c3b)

Author SHA1 Message Date
Richard Cochran 7a76c36b34 nsm, pmc: Check for missing HW time stamps.
As of 510777deca message layer no longer returns -ETIME.  Callers of
msg_post_recv() are expected to check for missing time stamps themselves.
This patch updates the two forgotten call sites.

Fixes: 510777deca ("msg: Move the check for missing HW time stamps into caller.")

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-04-18 18:44:28 -07:00
Richard Cochran a1c5e3f2ed transport: Fix callers to pass a proper enumeration value.
The majority of the callers of transport_send() use hard coded magic
numbers.  This patch fixes them to use the corresponding enumerated
values instead.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-04-13 22:29:05 -07:00
Richard Cochran d465406106 pmc: Initialize variable on the stack.
Valgrind is complaining that the pmc program is using uninitialized
data.  Actually the data are partially initialized, but it can't hurt
to zero the entire data structure.  Doing so silences the valgrind
warning, and after all it is good practice.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-30 10:29:30 -07:00
Peter Schneider ea9dda30e2 pmc_common: Preset uninitialized 'iface.ts_label' with 'iface.name'
pmc_create() calls transport_create(), which sets the open function
for the interface 'iface' to raw_open(), if Layer 2 is used. The
immediate following call of transport_open() calls raw_open(), which
uses the field .ts_label for opening, instead of the field .name
(which is used in the other transport layers). Therefore, the
field .name is copied here into the field .ts_label .

[ RC - Actually ts_label should always be initialized. Made the
       assignment of ts_label unconditional, regardless of the choice
       of transport layer. ]

Signed-off-by: Peter Schneider <peter@psch.de>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-24 21:14:35 -07:00
Richard Cochran e09d3a4aea pmc: Remove unused parameter.
The third parameter of the function, pmc_send(), is never used.  This patch
removes it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-07 19:28:25 -08:00
Richard Cochran b6fa8e20ee pmc: Convert to the API for appending TLVs on the transmit path.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-07 19:28:25 -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 8ecdedaa69 pmc: Add missing break in switch/case.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-06 06:37:54 -08:00
Hangbin Liu 8923bcdf64 transport: pass struct interface to transport_open
Pass struct interface so we can use ts_iface in HW filter.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2017-10-14 05:34:18 -07:00
Richard Cochran 3189a7bc0a transport: store the configuration in the transport data structure.
This will allow modules to read out various user options.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-16 11:20:23 +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
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
Jiri Benc 48f6a31cc3 pmc_common: easy way to set port and broadcast target
Implement pmc_target_port to set a port number, leaving clock identity
unchanged, and pmc_target_all to set clock identity and port number to all
1's.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2014-06-12 11:35:45 +02:00
Jiri Benc 14742ef566 uds: don't output "Connection refused"
When phc2sys is started before ptp4l or it is interrupted before ptp4l has
a chance to reply to its query, the "uds: sendto failed: Connection refused"
message is output. This is not an interesting message.

Also, don't output the "failed to send message" error from pmc_send, as
all transports output errors in their send routine.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2014-05-03 13:56:57 +02:00
Jiri Benc bbe634d790 Let transport_recv/send/peer use ptp_message
The callers of those functions are all using ptp_message. As we're going to
return more information (the address), let those functions just fill in the
ptp_message fields directly.

Some minor reshuffling needed to prevent circular header dependencies.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2014-04-17 06:49:38 +02: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 923ff5bbc1 pmc_common: introduce a variable for the target port identity.
This patch replaces the hard coded wild card target port identity with
a variable initially set to the wild card value. The intent is to allow
the caller to set specific targets.

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 0650b079f9 pmc: send GET management messages according to interpretation #29.
This commit makes the GET messages have data bodies, just like the erratum
says to. It really doesn't make sense, but have to do it anyhow. We also
introduce a variable that will enable the legacy behavior of sending
empty bodies.

   http://standards.ieee.org/findstds/interps/1588-2008.html

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-22 21:47:28 +02:00
Richard Cochran 4ae27d9179 pmc: make the TLV length a functional result.
This patch lets the TLV length field of GET messages come from a
function. For now, the function still results in a length of two,
but the intent is to allow different values later.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-22 21:47:27 +02:00
Richard Cochran 6a1a16ac66 pmc: add a utility function for sending a message with the SET action.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-07-14 21:37:52 +02:00
Libor Pechacek 0367bb5f1b Distinguish between ignored and malformed packets
When there is a peer speaking PTPv1 in the network we want to silently ignore
the packets instead of flooding system log with error messages.  At the same
time we still want to report malformed packets.  For that we reuse standard
error numbers and do more fine-grained error reporting in packet processing
routines.

Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
2013-03-28 18:48:52 +01:00
Geoff Salmon 5b8e169486 match pmc_send_get_action's definition and declaration
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-09 08:38:20 +01:00
Miroslav Lichvar cbc1a70c2c Move some pmc code to separate file.
Move some code which can be shared between PTP management clients to
a new file.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-02-03 19:08:34 +01:00