net: Replace hwtstamp_source by timestamping layer
authorKory Maincent <kory.maincent@bootlin.com>
Tue, 14 Nov 2023 11:28:40 +0000 (12:28 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 18 Nov 2023 14:52:57 +0000 (14:52 +0000)
Replace hwtstamp_source which is only used by the kernel_hwtstamp_config
structure by the more widely use timestamp_layer structure. This is done
to prepare the support of selectable timestamping source.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/lan966x/lan966x_main.c
include/linux/net_tstamp.h
net/core/dev_ioctl.c

index 2635ef8958c8045df82b56cb6e532ce401450b9c..fbe56b1bb3868da2fe530b6b064519549dd7cceb 100644 (file)
@@ -470,15 +470,15 @@ static int lan966x_port_hwtstamp_set(struct net_device *dev,
        struct lan966x_port *port = netdev_priv(dev);
        int err;
 
-       if (cfg->source != HWTSTAMP_SOURCE_NETDEV &&
-           cfg->source != HWTSTAMP_SOURCE_PHYLIB)
+       if (cfg->source != MAC_TIMESTAMPING &&
+           cfg->source != PHY_TIMESTAMPING)
                return -EOPNOTSUPP;
 
        err = lan966x_ptp_setup_traps(port, cfg);
        if (err)
                return err;
 
-       if (cfg->source == HWTSTAMP_SOURCE_NETDEV) {
+       if (cfg->source == MAC_TIMESTAMPING) {
                if (!port->lan966x->ptp)
                        return -EOPNOTSUPP;
 
index eb01c37e71e0af1a8592b09fe81ec2379d016b28..bb289c2ad376242303830b6b9ea3111083dddbb7 100644 (file)
@@ -5,11 +5,6 @@
 
 #include <uapi/linux/net_tstamp.h>
 
-enum hwtstamp_source {
-       HWTSTAMP_SOURCE_NETDEV,
-       HWTSTAMP_SOURCE_PHYLIB,
-};
-
 /**
  * struct kernel_hwtstamp_config - Kernel copy of struct hwtstamp_config
  *
@@ -20,8 +15,8 @@ enum hwtstamp_source {
  *     a legacy implementation of a lower driver
  * @copied_to_user: request was passed to a legacy implementation which already
  *     copied the ioctl request back to user space
- * @source: indication whether timestamps should come from the netdev or from
- *     an attached phylib PHY
+ * @source: indication whether timestamps should come from software, the netdev
+ *     or from an attached phylib PHY
  *
  * Prefer using this structure for in-kernel processing of hardware
  * timestamping configuration, over the inextensible struct hwtstamp_config
@@ -33,7 +28,7 @@ struct kernel_hwtstamp_config {
        int rx_filter;
        struct ifreq *ifr;
        bool copied_to_user;
-       enum hwtstamp_source source;
+       enum timestamping_layer source;
 };
 
 static inline void hwtstamp_config_to_kernel(struct kernel_hwtstamp_config *kernel_cfg,
index 9a66cf5015f26ecb512d831d806d048803e4fe63..267cd00269d01ef620ac7b50027a0da0fb660985 100644 (file)
@@ -332,7 +332,7 @@ int dev_set_hwtstamp_phylib(struct net_device *dev,
        bool changed = false;
        int err;
 
-       cfg->source = phy_ts ? HWTSTAMP_SOURCE_PHYLIB : HWTSTAMP_SOURCE_NETDEV;
+       cfg->source = phy_ts ? PHY_TIMESTAMPING : MAC_TIMESTAMPING;
 
        if (phy_ts && (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)) {
                err = ops->ndo_hwtstamp_get(dev, &old_cfg);