From 5bf265e8607ead166955a15d8f8a7a9b496828db Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Tue, 3 Sep 2013 17:19:30 -0700 Subject: [PATCH] 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 --- makefile | 3 +++ missing.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/makefile b/makefile index 71dcf0c..d79a1df 100644 --- a/makefile +++ b/makefile @@ -21,6 +21,9 @@ FEAT_CFLAGS := ifneq ($(shell grep --no-messages clock_adjtime /usr/include/bits/time.h),) FEAT_CFLAGS += -D_GNU_SOURCE -DHAVE_CLOCK_ADJTIME endif +ifneq ($(shell grep --no-messages HWTSTAMP_TX_ONESTEP_SYNC $(KBUILD_OUTPUT)/usr/include/linux/net_tstamp.h),) +FEAT_CFLAGS += -DHAVE_ONESTEP_SYNC +endif DEBUG = CC = $(CROSS_COMPILE)gcc diff --git a/missing.h b/missing.h index 3c2b9d8..99a8d83 100644 --- a/missing.h +++ b/missing.h @@ -44,6 +44,12 @@ #define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD) #define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3)) +#ifndef HAVE_ONESTEP_SYNC +enum _missing_hwtstamp_tx_types { + HWTSTAMP_TX_ONESTEP_SYNC = 2, +} +#endif + #ifndef HAVE_CLOCK_ADJTIME static inline int clock_adjtime(clockid_t id, struct timex *tx) {