This commit allows a user to specify a flag value for configuring
timestamping through hwtsamp_config structure.

New flags introduced:

HWTSTAMP_FLAGS_NONE = 0
        No flag specified: as it is of value 0, this will selects the
        default behavior for all the existing drivers and should not
        break existing userland programs.

HWTSTAMP_FLAGS_ADJ_FINE = 1
        Use the fine adjustment mode.
        Fine adjustment mode is usually used for precise frequency adjustments.

HWTSTAMP_FLAGS_ADJ_COARSE = 2
        Use the coarse adjustment mode
        Coarse adjustment mode is usually used for direct phase correction.

Signed-off-by: Olivier Dautricourt <olivier.dautrico...@orolia.com>
---
 include/uapi/linux/net_tstamp.h | 12 ++++++++++++
 net/core/dev_ioctl.c            |  3 ---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
index 7ed0b3d1c00a..0cfcd490228f 100644
--- a/include/uapi/linux/net_tstamp.h
+++ b/include/uapi/linux/net_tstamp.h
@@ -65,6 +65,18 @@ struct hwtstamp_config {
        int rx_filter;
 };
 
+/* possible values for hwtstamp_config->flags */
+enum hwtsamp_flags {
+       /* No special flag specified */
+       HWTSTAMP_FLAGS_NONE,
+
+       /* Enable fine adjustment mode if the driver supports it */
+       HWTSTAMP_FLAGS_ADJ_FINE,
+
+       /* Enable coarse adjustment mode if the driver supports it */
+       HWTSTAMP_FLAGS_ADJ_COARSE,
+};
+
 /* possible values for hwtstamp_config->tx_type */
 enum hwtstamp_tx_types {
        /*
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 547b587c1950..017671545d45 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -177,9 +177,6 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
        if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
                return -EFAULT;
 
-       if (cfg.flags) /* reserved for future extensions */
-               return -EINVAL;
-
        tx_type = cfg.tx_type;
        rx_filter = cfg.rx_filter;
 
-- 
2.17.1

Reply via email to