Commit Graph

15 Commits (a8d0eb92c67ca87b94b2ea9c693de7dfb469af16)

Author SHA1 Message Date
Richard Cochran 992e292055 Make the LIST_FOREACH_SAFE publicly visible.
We will want to use this macro in more than one source file.  This patch
moves the macro into the common header for possibly undefined code.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-31 11:05:57 -07:00
Richard Cochran 4842d2c7ec Introduce peer to peer one step.
The 1588 standard defines one step operation for both Sync and
PDelay_Resp messages.  Up until now, hardware with P2P one step has
been rare, and kernel support was lacking.  This patch adds support of
the mode in anticipation of new kernel and hardware developments.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-27 22:26:32 -07:00
Richard Cochran a412982300 Correct macro to avoid undefined C language behavior.
I stumbled across a kernel commit that fixes the macro that convert
between file descriptors and clock ID types (see below).  This patch
corrects the FD-to-clockid macro by casting to unsigned before
shifting.

commit 29f1b2b0fecfae69e31833836f1da3136696eee5
Author: Nick Desaulniers <nick.desaulniers@gmail.com>
Date:   Thu Dec 28 22:11:36 2017 -0500

    posix-timers: Prevent UB from shifting negative signed value

    Shifting a negative signed number is undefined behavior. Looking at the
    macros MAKE_PROCESS_CPUCLOCK and FD_TO_CLOCKID, it seems that the
    subexpression:

    (~(clockid_t) (pid) << 3)

    where clockid_t resolves to a signed int, which once negated, is
    undefined behavior to shift the value of if the results thus far are
    negative.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-27 18:30:09 -07:00
Hangbin Liu 80bc4d4c2f rtnl: update function rtnl_link_status to get bond slave info
Update function rtnl_link_status to get bond slave info. Pass the slave index
to call back functions. i.e. port_link_status.

Also check the interface index of rtnl message in function rtnl_link_status.
Then we don't need to check it in port_link_status.

Add ifndef IFLA_BOND_MAX in case we build linuxptp on kernel before v3.13-rc1.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2017-10-14 05:34:18 -07:00
Richard Cochran 97c351cafd Fix build when using uClinux.
Unfortunately uClinux is rather inconsistent with respect to
clock_nanosleep().  Older versions of uclibc lack that function, while
newer versions may include the declaration but still lack the
definition, depending on whether pthreads are selected in the
configuration.

This patch works around uClinux shortcomings by using the library call
when available at compile time, otherwise falling back to syscall().

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2017-05-30 08:42:27 +02:00
Richard Cochran a5911e69c7 Use SO_SELECT_ERR_QUEUE when available.
The current implementation fetches a transmit time stamp by polling on the
socket with pollfd.events set to zero, and then checking if POLLERR has
been returned by the kernel in pollfd.revents. This has the unfortunate
side effect of sleeping in poll() for the entire time out duration,
regardless of when the error queue becomes readable.

Linux kernel version 3.10 introduced a new socket option that allows
polling for transmit time stamps explicitly, waking the process as soon as
a time stamp becomes available. This patch enables the socket option,
falling back to the old behavior if necessary.

Suggested-by: Joe Schaack <jschaack@xes-inc.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2014-11-07 19:47:36 +01:00
Richard Cochran 07edab48dc Add a macro for ADJ_TAI used when missing from the tool chain headers.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2014-06-22 09:23:54 +02:00
Jacob Keller 5e8a34f0b4 missing: add SIOCGHWTSTAMP to missing.h
In order to allow hwtstamp_ctl to use the non-destructive SIOCGHWTSTAMP
ioctl, we need to add it to missing.h, in order to prevent build failure
on older kernels which don't have this support.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2014-06-04 15:09:28 +02:00
Richard Cochran ad3793aaf7 Add missing semicolon to enumeration.
This patch adds a semicolon forgotten in commit
5bf265e "missing: add onestep sync to missing.h"

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-09-04 20:55:11 +02:00
Jacob Keller 5bf265e860 missing: add onestep sync to missing.h
this patch uses grep to test whether the net_tstamp.h header has
HWTSTAMP_TX_ONESTEP_SYNC flag defined. If it doesn't then we can simply define
it with the correct value. This works because proper drivers should just report
that the value is not allowed if they don't support onestep mode. This is the
cleanest way to ensure that linuxptp will still work on kernels which have not
defined the one step flag, and also works for any distributions which backport
the feature.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2013-09-04 18:05:43 +02:00
Richard Cochran f394e1796d uClinux: Add another missing system call wrapper.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-06-14 12:58:57 +02:00
Miroslav Lichvar 9edd319f11 Use clock_adjtime from glibc if available.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-09-06 08:23:21 +02:00
Richard Cochran d6ce3fbb3d Fix compilation for uclinux toolchain lacking <sys/timerfd.h>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-02-19 18:26:54 +01:00
Richard Cochran ba6cf8b767 uClinux: provide missing system calls.
The timerfd calls are missing from Sourcery CodeBench Lite 2011.09-23.
We can remove this code once these calls are properly integrated into a
current tool chain.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:56 +01:00
Richard Cochran af380e8617 Add the license, a readme, and some header files.
This commit gets the project off to a good start. The header files provide
some basic data types and definitions.

The README file will most probably grow over time.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2011-11-01 17:39:14 +01:00