* [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers
@ 2025-11-12 0:02 Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config Vadim Fedorenko
` (7 more replies)
0 siblings, 8 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
PHY drivers are able to configure HW time stamping and are not able to
report configuration back to user space. Add callback to report
configuration like it's done for net_device and add implementation to
the drivers.
Vadim Fedorenko (8):
phy: add hwtstamp_get callback to retrieve config
net: phy: broadcom: add HW timestamp configuration reporting
net: phy: dp83640: add HW timestamp configuration reporting
net: phy: micrel: add HW timestamp configuration reporting
net: phy: microchip_rds_ptp: add HW timestamp configuration reporting
phy: mscc: add HW timestamp configuration reporting
net: phy: nxp-c45-tja11xx: add HW timestamp configuration reporting
ptp: ptp_ines: add HW timestamp configuration reporting
drivers/net/phy/bcm-phy-ptp.c | 21 +++++++++++---
drivers/net/phy/dp83640.c | 29 +++++++++++++------
drivers/net/phy/micrel.c | 43 +++++++++++++++++++++++------
drivers/net/phy/microchip_rds_ptp.c | 21 +++++++++++---
drivers/net/phy/mscc/mscc_ptp.c | 21 +++++++++++---
drivers/net/phy/nxp-c45-tja11xx.c | 22 ++++++++++++---
drivers/net/phy/phy.c | 30 ++++++++++++++++----
drivers/ptp/ptp_ines.c | 31 ++++++++++++++++++---
include/linux/mii_timestamper.h | 13 ++++++---
include/linux/phy.h | 4 +--
10 files changed, 188 insertions(+), 47 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
@ 2025-11-12 0:02 ` Vadim Fedorenko
2025-11-12 20:31 ` Andrew Lunn
` (2 more replies)
2025-11-12 0:02 ` [PATCH net-next 2/8] net: phy: broadcom: add HW timestamp configuration reporting Vadim Fedorenko
` (6 subsequent siblings)
7 siblings, 3 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
PHY devices had lack of hwtstamp_get callback even though most of them
are tracking configuration info. Introduce new call back to
mii_timestamper. The old hwtstamp callback is renamed to hwtstamp_set to
better reflect its action.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/phy/bcm-phy-ptp.c | 8 ++++----
drivers/net/phy/dp83640.c | 8 ++++----
drivers/net/phy/micrel.c | 16 +++++++--------
drivers/net/phy/microchip_rds_ptp.c | 8 ++++----
drivers/net/phy/mscc/mscc_ptp.c | 8 ++++----
drivers/net/phy/nxp-c45-tja11xx.c | 8 ++++----
drivers/net/phy/phy.c | 30 ++++++++++++++++++++++++-----
drivers/ptp/ptp_ines.c | 8 ++++----
include/linux/mii_timestamper.h | 13 +++++++++----
include/linux/phy.h | 4 ++--
10 files changed, 68 insertions(+), 43 deletions(-)
diff --git a/drivers/net/phy/bcm-phy-ptp.c b/drivers/net/phy/bcm-phy-ptp.c
index d3501f8487d9..6815e844a62e 100644
--- a/drivers/net/phy/bcm-phy-ptp.c
+++ b/drivers/net/phy/bcm-phy-ptp.c
@@ -780,9 +780,9 @@ static void bcm_ptp_txtstamp(struct mii_timestamper *mii_ts,
kfree_skb(skb);
}
-static int bcm_ptp_hwtstamp(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *cfg,
- struct netlink_ext_ack *extack)
+static int bcm_ptp_hwtstamp_set(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg,
+ struct netlink_ext_ack *extack)
{
struct bcm_ptp_private *priv = mii2priv(mii_ts);
u16 mode, ctrl;
@@ -898,7 +898,7 @@ static void bcm_ptp_init(struct bcm_ptp_private *priv)
priv->mii_ts.rxtstamp = bcm_ptp_rxtstamp;
priv->mii_ts.txtstamp = bcm_ptp_txtstamp;
- priv->mii_ts.hwtstamp = bcm_ptp_hwtstamp;
+ priv->mii_ts.hwtstamp_set = bcm_ptp_hwtstamp_set;
priv->mii_ts.ts_info = bcm_ptp_ts_info;
priv->phydev->mii_ts = &priv->mii_ts;
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 74396453f5bb..f733a8b72d40 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -1176,9 +1176,9 @@ static irqreturn_t dp83640_handle_interrupt(struct phy_device *phydev)
return IRQ_HANDLED;
}
-static int dp83640_hwtstamp(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *cfg,
- struct netlink_ext_ack *extack)
+static int dp83640_hwtstamp_set(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg,
+ struct netlink_ext_ack *extack)
{
struct dp83640_private *dp83640 =
container_of(mii_ts, struct dp83640_private, mii_ts);
@@ -1407,7 +1407,7 @@ static int dp83640_probe(struct phy_device *phydev)
dp83640->phydev = phydev;
dp83640->mii_ts.rxtstamp = dp83640_rxtstamp;
dp83640->mii_ts.txtstamp = dp83640_txtstamp;
- dp83640->mii_ts.hwtstamp = dp83640_hwtstamp;
+ dp83640->mii_ts.hwtstamp_set = dp83640_hwtstamp_set;
dp83640->mii_ts.ts_info = dp83640_ts_info;
INIT_DELAYED_WORK(&dp83640->ts_work, rx_timestamp_work);
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index d167a58924f7..d626106b6e1b 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -3145,9 +3145,9 @@ static void lan8814_flush_fifo(struct phy_device *phydev, bool egress)
lanphy_read_page_reg(phydev, LAN8814_PAGE_PORT_REGS, PTP_TSU_INT_STS);
}
-static int lan8814_hwtstamp(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *config,
- struct netlink_ext_ack *extack)
+static int lan8814_hwtstamp_set(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *config,
+ struct netlink_ext_ack *extack)
{
struct kszphy_ptp_priv *ptp_priv =
container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);
@@ -4387,7 +4387,7 @@ static void lan8814_ptp_init(struct phy_device *phydev)
ptp_priv->mii_ts.rxtstamp = lan8814_rxtstamp;
ptp_priv->mii_ts.txtstamp = lan8814_txtstamp;
- ptp_priv->mii_ts.hwtstamp = lan8814_hwtstamp;
+ ptp_priv->mii_ts.hwtstamp_set = lan8814_hwtstamp_set;
ptp_priv->mii_ts.ts_info = lan8814_ts_info;
phydev->mii_ts = &ptp_priv->mii_ts;
@@ -5028,9 +5028,9 @@ static void lan8841_ptp_enable_processing(struct kszphy_ptp_priv *ptp_priv,
#define LAN8841_PTP_TX_TIMESTAMP_EN 443
#define LAN8841_PTP_TX_MOD 445
-static int lan8841_hwtstamp(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *config,
- struct netlink_ext_ack *extack)
+static int lan8841_hwtstamp_set(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *config,
+ struct netlink_ext_ack *extack)
{
struct kszphy_ptp_priv *ptp_priv = container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);
struct phy_device *phydev = ptp_priv->phydev;
@@ -5910,7 +5910,7 @@ static int lan8841_probe(struct phy_device *phydev)
ptp_priv->mii_ts.rxtstamp = lan8841_rxtstamp;
ptp_priv->mii_ts.txtstamp = lan8814_txtstamp;
- ptp_priv->mii_ts.hwtstamp = lan8841_hwtstamp;
+ ptp_priv->mii_ts.hwtstamp_set = lan8841_hwtstamp_set;
ptp_priv->mii_ts.ts_info = lan8841_ts_info;
phydev->mii_ts = &ptp_priv->mii_ts;
diff --git a/drivers/net/phy/microchip_rds_ptp.c b/drivers/net/phy/microchip_rds_ptp.c
index e6514ce04c29..4c6326b0ceaf 100644
--- a/drivers/net/phy/microchip_rds_ptp.c
+++ b/drivers/net/phy/microchip_rds_ptp.c
@@ -476,9 +476,9 @@ static bool mchp_rds_ptp_rxtstamp(struct mii_timestamper *mii_ts,
return true;
}
-static int mchp_rds_ptp_hwtstamp(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *config,
- struct netlink_ext_ack *extack)
+static int mchp_rds_ptp_hwtstamp_set(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *config,
+ struct netlink_ext_ack *extack)
{
struct mchp_rds_ptp_clock *clock =
container_of(mii_ts, struct mchp_rds_ptp_clock,
@@ -1281,7 +1281,7 @@ struct mchp_rds_ptp_clock *mchp_rds_ptp_probe(struct phy_device *phydev, u8 mmd,
clock->mii_ts.rxtstamp = mchp_rds_ptp_rxtstamp;
clock->mii_ts.txtstamp = mchp_rds_ptp_txtstamp;
- clock->mii_ts.hwtstamp = mchp_rds_ptp_hwtstamp;
+ clock->mii_ts.hwtstamp_set = mchp_rds_ptp_hwtstamp_set;
clock->mii_ts.ts_info = mchp_rds_ptp_ts_info;
phydev->mii_ts = &clock->mii_ts;
diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_ptp.c
index d692df7d975c..dc06614222f6 100644
--- a/drivers/net/phy/mscc/mscc_ptp.c
+++ b/drivers/net/phy/mscc/mscc_ptp.c
@@ -1051,9 +1051,9 @@ static void vsc85xx_ts_reset_fifo(struct phy_device *phydev)
val);
}
-static int vsc85xx_hwtstamp(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *cfg,
- struct netlink_ext_ack *extack)
+static int vsc85xx_hwtstamp_set(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg,
+ struct netlink_ext_ack *extack)
{
struct vsc8531_private *vsc8531 =
container_of(mii_ts, struct vsc8531_private, mii_ts);
@@ -1611,7 +1611,7 @@ int vsc8584_ptp_probe(struct phy_device *phydev)
vsc8531->mii_ts.rxtstamp = vsc85xx_rxtstamp;
vsc8531->mii_ts.txtstamp = vsc85xx_txtstamp;
- vsc8531->mii_ts.hwtstamp = vsc85xx_hwtstamp;
+ vsc8531->mii_ts.hwtstamp_set = vsc85xx_hwtstamp_set;
vsc8531->mii_ts.ts_info = vsc85xx_ts_info;
phydev->mii_ts = &vsc8531->mii_ts;
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 87adb6508017..13a8fac223a9 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -1012,9 +1012,9 @@ static bool nxp_c45_rxtstamp(struct mii_timestamper *mii_ts,
return true;
}
-static int nxp_c45_hwtstamp(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *cfg,
- struct netlink_ext_ack *extack)
+static int nxp_c45_hwtstamp_set(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg,
+ struct netlink_ext_ack *extack)
{
struct nxp_c45_phy *priv = container_of(mii_ts, struct nxp_c45_phy,
mii_ts);
@@ -1749,7 +1749,7 @@ static int nxp_c45_probe(struct phy_device *phydev)
IS_ENABLED(CONFIG_NETWORK_PHY_TIMESTAMPING)) {
priv->mii_ts.rxtstamp = nxp_c45_rxtstamp;
priv->mii_ts.txtstamp = nxp_c45_txtstamp;
- priv->mii_ts.hwtstamp = nxp_c45_hwtstamp;
+ priv->mii_ts.hwtstamp_set = nxp_c45_hwtstamp_set;
priv->mii_ts.ts_info = nxp_c45_ts_info;
phydev->mii_ts = &priv->mii_ts;
ret = nxp_c45_init_ptp_clock(priv);
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 02da4a203ddd..e8c47dd6cf00 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -310,7 +310,7 @@ EXPORT_SYMBOL(phy_ethtool_ksettings_get);
int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
{
struct mii_ioctl_data *mii_data = if_mii(ifr);
- struct kernel_hwtstamp_config kernel_cfg;
+ struct kernel_hwtstamp_config kernel_cfg = {};
struct netlink_ext_ack extack = {};
u16 val = mii_data->val_in;
bool change_autoneg = false;
@@ -404,13 +404,29 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
return 0;
+ case SIOCGHWTSTAMP:
+ if (phydev->mii_ts && phydev->mii_ts->hwtstamp_get) {
+ ret = phydev->mii_ts->hwtstamp_get(phydev->mii_ts,
+ &kernel_cfg);
+ if (ret)
+ return ret;
+
+ hwtstamp_config_from_kernel(&cfg, &kernel_cfg);
+ if (copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)))
+ return -EFAULT;
+
+ return 0;
+ }
+ return -EOPNOTSUPP;
case SIOCSHWTSTAMP:
- if (phydev->mii_ts && phydev->mii_ts->hwtstamp) {
+ if (phydev->mii_ts && phydev->mii_ts->hwtstamp_set) {
if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
return -EFAULT;
hwtstamp_config_to_kernel(&kernel_cfg, &cfg);
- ret = phydev->mii_ts->hwtstamp(phydev->mii_ts, &kernel_cfg, &extack);
+ ret = phydev->mii_ts->hwtstamp_set(phydev->mii_ts,
+ &kernel_cfg,
+ &extack);
if (ret)
return ret;
@@ -476,6 +492,9 @@ int __phy_hwtstamp_get(struct phy_device *phydev,
if (!phydev)
return -ENODEV;
+ if (phydev->mii_ts && phydev->mii_ts->hwtstamp_get)
+ return phydev->mii_ts->hwtstamp_get(phydev->mii_ts, config);
+
return -EOPNOTSUPP;
}
@@ -493,8 +512,9 @@ int __phy_hwtstamp_set(struct phy_device *phydev,
if (!phydev)
return -ENODEV;
- if (phydev->mii_ts && phydev->mii_ts->hwtstamp)
- return phydev->mii_ts->hwtstamp(phydev->mii_ts, config, extack);
+ if (phydev->mii_ts && phydev->mii_ts->hwtstamp_set)
+ return phydev->mii_ts->hwtstamp_set(phydev->mii_ts, config,
+ extack);
return -EOPNOTSUPP;
}
diff --git a/drivers/ptp/ptp_ines.c b/drivers/ptp/ptp_ines.c
index 68f1f7fdaa9d..56c798e77f20 100644
--- a/drivers/ptp/ptp_ines.c
+++ b/drivers/ptp/ptp_ines.c
@@ -328,9 +328,9 @@ static u64 ines_find_txts(struct ines_port *port, struct sk_buff *skb)
return ns;
}
-static int ines_hwtstamp(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *cfg,
- struct netlink_ext_ack *extack)
+static int ines_hwtstamp_set(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg,
+ struct netlink_ext_ack *extack)
{
struct ines_port *port = container_of(mii_ts, struct ines_port, mii_ts);
u32 cm_one_step = 0, port_conf, ts_stat_rx, ts_stat_tx;
@@ -709,7 +709,7 @@ static struct mii_timestamper *ines_ptp_probe_channel(struct device *device,
}
port->mii_ts.rxtstamp = ines_rxtstamp;
port->mii_ts.txtstamp = ines_txtstamp;
- port->mii_ts.hwtstamp = ines_hwtstamp;
+ port->mii_ts.hwtstamp_set = ines_hwtstamp_set;
port->mii_ts.link_state = ines_link_state;
port->mii_ts.ts_info = ines_ts_info;
diff --git a/include/linux/mii_timestamper.h b/include/linux/mii_timestamper.h
index 995db62570f9..3102c425c8e0 100644
--- a/include/linux/mii_timestamper.h
+++ b/include/linux/mii_timestamper.h
@@ -27,7 +27,9 @@ struct phy_device;
* as soon as a timestamp becomes available. One of the PTP_CLASS_
* values is passed in 'type'.
*
- * @hwtstamp: Handles SIOCSHWTSTAMP ioctl for hardware time stamping.
+ * @hwtstamp_set: Handles SIOCSHWTSTAMP ioctl for hardware time stamping.
+ *
+ * @hwtstamp_get: Handles SIOCGHWTSTAMP ioctl for hardware time stamping.
*
* @link_state: Allows the device to respond to changes in the link
* state. The caller invokes this function while holding
@@ -51,9 +53,12 @@ struct mii_timestamper {
void (*txtstamp)(struct mii_timestamper *mii_ts,
struct sk_buff *skb, int type);
- int (*hwtstamp)(struct mii_timestamper *mii_ts,
- struct kernel_hwtstamp_config *kernel_config,
- struct netlink_ext_ack *extack);
+ int (*hwtstamp_set)(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *kernel_config,
+ struct netlink_ext_ack *extack);
+
+ int (*hwtstamp_get)(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *kernel_config);
void (*link_state)(struct mii_timestamper *mii_ts,
struct phy_device *phydev);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index bf5457341ca8..f043d0557c79 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1915,7 +1915,7 @@ static inline bool phy_polling_mode(struct phy_device *phydev)
*/
static inline bool phy_has_hwtstamp(struct phy_device *phydev)
{
- return phydev && phydev->mii_ts && phydev->mii_ts->hwtstamp;
+ return phydev && phydev->mii_ts && phydev->mii_ts->hwtstamp_set;
}
/**
@@ -1950,7 +1950,7 @@ static inline int phy_hwtstamp(struct phy_device *phydev,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack)
{
- return phydev->mii_ts->hwtstamp(phydev->mii_ts, cfg, extack);
+ return phydev->mii_ts->hwtstamp_set(phydev->mii_ts, cfg, extack);
}
static inline bool phy_rxtstamp(struct phy_device *phydev, struct sk_buff *skb,
--
2.47.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 2/8] net: phy: broadcom: add HW timestamp configuration reporting
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config Vadim Fedorenko
@ 2025-11-12 0:02 ` Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 3/8] net: phy: dp83640: " Vadim Fedorenko
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
The driver stores configuration information and can technically report
it. Implement hwtstamp_get callback to report the configuration.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/phy/bcm-phy-ptp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/net/phy/bcm-phy-ptp.c b/drivers/net/phy/bcm-phy-ptp.c
index 6815e844a62e..65d609ed69fb 100644
--- a/drivers/net/phy/bcm-phy-ptp.c
+++ b/drivers/net/phy/bcm-phy-ptp.c
@@ -780,6 +780,18 @@ static void bcm_ptp_txtstamp(struct mii_timestamper *mii_ts,
kfree_skb(skb);
}
+static int bcm_ptp_hwtstamp_get(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg)
+{
+ struct bcm_ptp_private *priv = mii2priv(mii_ts);
+
+ cfg->rx_filter = priv->hwts_rx ? HWTSTAMP_FILTER_PTP_V2_EVENT
+ : HWTSTAMP_FILTER_NONE;
+ cfg->tx_type = priv->tx_type;
+
+ return 0;
+}
+
static int bcm_ptp_hwtstamp_set(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack)
@@ -899,6 +911,7 @@ static void bcm_ptp_init(struct bcm_ptp_private *priv)
priv->mii_ts.rxtstamp = bcm_ptp_rxtstamp;
priv->mii_ts.txtstamp = bcm_ptp_txtstamp;
priv->mii_ts.hwtstamp_set = bcm_ptp_hwtstamp_set;
+ priv->mii_ts.hwtstamp_get = bcm_ptp_hwtstamp_get;
priv->mii_ts.ts_info = bcm_ptp_ts_info;
priv->phydev->mii_ts = &priv->mii_ts;
--
2.47.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 3/8] net: phy: dp83640: add HW timestamp configuration reporting
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 2/8] net: phy: broadcom: add HW timestamp configuration reporting Vadim Fedorenko
@ 2025-11-12 0:02 ` Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 4/8] net: phy: micrel: " Vadim Fedorenko
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
The driver stores configuration of TX timestamping and can technically
report it. Patch RX timestamp configuration storage to be more precise
on reporting and add callback to actually report it.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/phy/dp83640.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index f733a8b72d40..b950acc9c49b 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -1176,6 +1176,18 @@ static irqreturn_t dp83640_handle_interrupt(struct phy_device *phydev)
return IRQ_HANDLED;
}
+static int dp83640_hwtstamp_get(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg)
+{
+ struct dp83640_private *dp83640 =
+ container_of(mii_ts, struct dp83640_private, mii_ts);
+
+ cfg->rx_filter = dp83640->hwts_rx_en;
+ cfg->tx_type = dp83640->hwts_tx_en;
+
+ return 0;
+}
+
static int dp83640_hwtstamp_set(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack)
@@ -1198,7 +1210,7 @@ static int dp83640_hwtstamp_set(struct mii_timestamper *mii_ts,
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
- dp83640->hwts_rx_en = 1;
+ dp83640->hwts_rx_en = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
dp83640->layer = PTP_CLASS_L4;
dp83640->version = PTP_CLASS_V1;
cfg->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
@@ -1206,7 +1218,7 @@ static int dp83640_hwtstamp_set(struct mii_timestamper *mii_ts,
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
- dp83640->hwts_rx_en = 1;
+ dp83640->hwts_rx_en = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
dp83640->layer = PTP_CLASS_L4;
dp83640->version = PTP_CLASS_V2;
cfg->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
@@ -1214,7 +1226,7 @@ static int dp83640_hwtstamp_set(struct mii_timestamper *mii_ts,
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
- dp83640->hwts_rx_en = 1;
+ dp83640->hwts_rx_en = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
dp83640->layer = PTP_CLASS_L2;
dp83640->version = PTP_CLASS_V2;
cfg->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
@@ -1222,7 +1234,7 @@ static int dp83640_hwtstamp_set(struct mii_timestamper *mii_ts,
case HWTSTAMP_FILTER_PTP_V2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_SYNC:
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
- dp83640->hwts_rx_en = 1;
+ dp83640->hwts_rx_en = HWTSTAMP_FILTER_PTP_V2_EVENT;
dp83640->layer = PTP_CLASS_L4 | PTP_CLASS_L2;
dp83640->version = PTP_CLASS_V2;
cfg->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
@@ -1408,6 +1420,7 @@ static int dp83640_probe(struct phy_device *phydev)
dp83640->mii_ts.rxtstamp = dp83640_rxtstamp;
dp83640->mii_ts.txtstamp = dp83640_txtstamp;
dp83640->mii_ts.hwtstamp_set = dp83640_hwtstamp_set;
+ dp83640->mii_ts.hwtstamp_get = dp83640_hwtstamp_get;
dp83640->mii_ts.ts_info = dp83640_ts_info;
INIT_DELAYED_WORK(&dp83640->ts_work, rx_timestamp_work);
--
2.47.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 4/8] net: phy: micrel: add HW timestamp configuration reporting
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
` (2 preceding siblings ...)
2025-11-12 0:02 ` [PATCH net-next 3/8] net: phy: dp83640: " Vadim Fedorenko
@ 2025-11-12 0:02 ` Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 5/8] net: phy: microchip_rds_ptp: " Vadim Fedorenko
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
The driver stores HW timestamping configuration and can technically
report it. Add callback to do it.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/phy/micrel.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index d626106b6e1b..cada0339f9ac 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -3145,6 +3145,18 @@ static void lan8814_flush_fifo(struct phy_device *phydev, bool egress)
lanphy_read_page_reg(phydev, LAN8814_PAGE_PORT_REGS, PTP_TSU_INT_STS);
}
+static int lan8814_hwtstamp_get(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *config)
+{
+ struct kszphy_ptp_priv *ptp_priv =
+ container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);
+
+ config->tx_type = ptp_priv->hwts_tx_type;
+ config->rx_filter = ptp_priv->rx_filter;
+
+ return 0;
+}
+
static int lan8814_hwtstamp_set(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *config,
struct netlink_ext_ack *extack)
@@ -4388,6 +4400,7 @@ static void lan8814_ptp_init(struct phy_device *phydev)
ptp_priv->mii_ts.rxtstamp = lan8814_rxtstamp;
ptp_priv->mii_ts.txtstamp = lan8814_txtstamp;
ptp_priv->mii_ts.hwtstamp_set = lan8814_hwtstamp_set;
+ ptp_priv->mii_ts.hwtstamp_get = lan8814_hwtstamp_get;
ptp_priv->mii_ts.ts_info = lan8814_ts_info;
phydev->mii_ts = &ptp_priv->mii_ts;
@@ -5028,6 +5041,19 @@ static void lan8841_ptp_enable_processing(struct kszphy_ptp_priv *ptp_priv,
#define LAN8841_PTP_TX_TIMESTAMP_EN 443
#define LAN8841_PTP_TX_MOD 445
+static int lan8841_hwtstamp_get(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *config)
+{
+ struct kszphy_ptp_priv *ptp_priv;
+
+ ptp_priv = container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);
+
+ config->tx_type = ptp_priv->hwts_tx_type;
+ config->rx_filter = ptp_priv->rx_filter;
+
+ return 0;
+}
+
static int lan8841_hwtstamp_set(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *config,
struct netlink_ext_ack *extack)
@@ -5911,6 +5937,7 @@ static int lan8841_probe(struct phy_device *phydev)
ptp_priv->mii_ts.rxtstamp = lan8841_rxtstamp;
ptp_priv->mii_ts.txtstamp = lan8814_txtstamp;
ptp_priv->mii_ts.hwtstamp_set = lan8841_hwtstamp_set;
+ ptp_priv->mii_ts.hwtstamp_get = lan8841_hwtstamp_get;
ptp_priv->mii_ts.ts_info = lan8841_ts_info;
phydev->mii_ts = &ptp_priv->mii_ts;
--
2.47.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 5/8] net: phy: microchip_rds_ptp: add HW timestamp configuration reporting
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
` (3 preceding siblings ...)
2025-11-12 0:02 ` [PATCH net-next 4/8] net: phy: micrel: " Vadim Fedorenko
@ 2025-11-12 0:02 ` Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 6/8] phy: mscc: " Vadim Fedorenko
` (2 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
The driver stores HW timestamping configuration and can technically
report it. Add callback to do it.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/phy/microchip_rds_ptp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/net/phy/microchip_rds_ptp.c b/drivers/net/phy/microchip_rds_ptp.c
index 4c6326b0ceaf..d2beb3a2e6c3 100644
--- a/drivers/net/phy/microchip_rds_ptp.c
+++ b/drivers/net/phy/microchip_rds_ptp.c
@@ -476,6 +476,18 @@ static bool mchp_rds_ptp_rxtstamp(struct mii_timestamper *mii_ts,
return true;
}
+static int mchp_rds_ptp_hwtstamp_get(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *config)
+{
+ struct mchp_rds_ptp_clock *clock =
+ container_of(mii_ts, struct mchp_rds_ptp_clock,
+ mii_ts);
+ config->tx_type = clock->hwts_tx_type;
+ config->rx_filter = clock->rx_filter;
+
+ return 0;
+}
+
static int mchp_rds_ptp_hwtstamp_set(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *config,
struct netlink_ext_ack *extack)
@@ -1282,6 +1294,7 @@ struct mchp_rds_ptp_clock *mchp_rds_ptp_probe(struct phy_device *phydev, u8 mmd,
clock->mii_ts.rxtstamp = mchp_rds_ptp_rxtstamp;
clock->mii_ts.txtstamp = mchp_rds_ptp_txtstamp;
clock->mii_ts.hwtstamp_set = mchp_rds_ptp_hwtstamp_set;
+ clock->mii_ts.hwtstamp_get = mchp_rds_ptp_hwtstamp_get;
clock->mii_ts.ts_info = mchp_rds_ptp_ts_info;
phydev->mii_ts = &clock->mii_ts;
--
2.47.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 6/8] phy: mscc: add HW timestamp configuration reporting
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
` (4 preceding siblings ...)
2025-11-12 0:02 ` [PATCH net-next 5/8] net: phy: microchip_rds_ptp: " Vadim Fedorenko
@ 2025-11-12 0:02 ` Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 7/8] net: phy: nxp-c45-tja11xx: " Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 8/8] ptp: ptp_ines: " Vadim Fedorenko
7 siblings, 0 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
The driver stores HW configuration and can technically report it.
Add callback to do it.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/phy/mscc/mscc_ptp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_ptp.c
index dc06614222f6..4865eac74b0e 100644
--- a/drivers/net/phy/mscc/mscc_ptp.c
+++ b/drivers/net/phy/mscc/mscc_ptp.c
@@ -1051,6 +1051,18 @@ static void vsc85xx_ts_reset_fifo(struct phy_device *phydev)
val);
}
+static int vsc85xx_hwtstamp_get(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg)
+{
+ struct vsc8531_private *vsc8531 =
+ container_of(mii_ts, struct vsc8531_private, mii_ts);
+
+ cfg->tx_type = vsc8531->ptp->tx_type;
+ cfg->rx_filter = vsc8531->ptp->rx_filter;
+
+ return 0;
+}
+
static int vsc85xx_hwtstamp_set(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack)
@@ -1612,6 +1624,7 @@ int vsc8584_ptp_probe(struct phy_device *phydev)
vsc8531->mii_ts.rxtstamp = vsc85xx_rxtstamp;
vsc8531->mii_ts.txtstamp = vsc85xx_txtstamp;
vsc8531->mii_ts.hwtstamp_set = vsc85xx_hwtstamp_set;
+ vsc8531->mii_ts.hwtstamp_get = vsc85xx_hwtstamp_get;
vsc8531->mii_ts.ts_info = vsc85xx_ts_info;
phydev->mii_ts = &vsc8531->mii_ts;
--
2.47.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 7/8] net: phy: nxp-c45-tja11xx: add HW timestamp configuration reporting
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
` (5 preceding siblings ...)
2025-11-12 0:02 ` [PATCH net-next 6/8] phy: mscc: " Vadim Fedorenko
@ 2025-11-12 0:02 ` Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 8/8] ptp: ptp_ines: " Vadim Fedorenko
7 siblings, 0 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
The driver stores HW timestamping configuration and can technically
report it. Add callback to do it.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/phy/nxp-c45-tja11xx.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 13a8fac223a9..f526528d2e32 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -1012,6 +1012,19 @@ static bool nxp_c45_rxtstamp(struct mii_timestamper *mii_ts,
return true;
}
+static int nxp_c45_hwtstamp_get(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg)
+{
+ struct nxp_c45_phy *priv = container_of(mii_ts, struct nxp_c45_phy,
+ mii_ts);
+
+ cfg->tx_type = priv->hwts_tx;
+ cfg->rx_filter = priv->hwts_rx ? HWTSTAMP_FILTER_PTP_V2_L2_EVENT
+ : HWTSTAMP_FILTER_NONE;
+
+ return 0;
+}
+
static int nxp_c45_hwtstamp_set(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack)
@@ -1750,6 +1763,7 @@ static int nxp_c45_probe(struct phy_device *phydev)
priv->mii_ts.rxtstamp = nxp_c45_rxtstamp;
priv->mii_ts.txtstamp = nxp_c45_txtstamp;
priv->mii_ts.hwtstamp_set = nxp_c45_hwtstamp_set;
+ priv->mii_ts.hwtstamp_get = nxp_c45_hwtstamp_get;
priv->mii_ts.ts_info = nxp_c45_ts_info;
phydev->mii_ts = &priv->mii_ts;
ret = nxp_c45_init_ptp_clock(priv);
--
2.47.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 8/8] ptp: ptp_ines: add HW timestamp configuration reporting
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
` (6 preceding siblings ...)
2025-11-12 0:02 ` [PATCH net-next 7/8] net: phy: nxp-c45-tja11xx: " Vadim Fedorenko
@ 2025-11-12 0:02 ` Vadim Fedorenko
7 siblings, 0 replies; 12+ messages in thread
From: Vadim Fedorenko @ 2025-11-12 0:02 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Andrew Lunn
Cc: Simon Horman, Vladimir Oltean, Jacob Keller, Kory Maincent,
bcm-kernel-feedback-list, netdev, Vadim Fedorenko
The driver partially stores HW timestamping configuration, but missing
pieces can be read from HW. Add callback to report configuration.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/ptp/ptp_ines.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/ptp/ptp_ines.c b/drivers/ptp/ptp_ines.c
index 56c798e77f20..790eb42b78db 100644
--- a/drivers/ptp/ptp_ines.c
+++ b/drivers/ptp/ptp_ines.c
@@ -328,6 +328,28 @@ static u64 ines_find_txts(struct ines_port *port, struct sk_buff *skb)
return ns;
}
+static int ines_hwtstamp_get(struct mii_timestamper *mii_ts,
+ struct kernel_hwtstamp_config *cfg)
+{
+ struct ines_port *port = container_of(mii_ts, struct ines_port, mii_ts);
+ unsigned long flags;
+ u32 port_conf;
+
+ cfg->rx_filter = port->rxts_enabled ? HWTSTAMP_FILTER_PTP_V2_EVENT
+ : HWTSTAMP_FILTER_NONE;
+ if (port->txts_enabled) {
+ spin_lock_irqsave(&port->lock, flags);
+ port_conf = ines_read32(port, port_conf);
+ spin_unlock_irqrestore(&port->lock, flags);
+ cfg->tx_type = (port_conf & CM_ONE_STEP) ? HWTSTAMP_TX_ONESTEP_P2P
+ : HWTSTAMP_TX_OFF;
+ } else {
+ cfg->tx_type = HWTSTAMP_TX_OFF;
+ }
+
+ return 0;
+}
+
static int ines_hwtstamp_set(struct mii_timestamper *mii_ts,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack)
@@ -710,6 +732,7 @@ static struct mii_timestamper *ines_ptp_probe_channel(struct device *device,
port->mii_ts.rxtstamp = ines_rxtstamp;
port->mii_ts.txtstamp = ines_txtstamp;
port->mii_ts.hwtstamp_set = ines_hwtstamp_set;
+ port->mii_ts.hwtstamp_get = ines_hwtstamp_get;
port->mii_ts.link_state = ines_link_state;
port->mii_ts.ts_info = ines_ts_info;
--
2.47.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config
2025-11-12 0:02 ` [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config Vadim Fedorenko
@ 2025-11-12 20:31 ` Andrew Lunn
2025-11-13 4:49 ` kernel test robot
2025-11-13 4:49 ` kernel test robot
2 siblings, 0 replies; 12+ messages in thread
From: Andrew Lunn @ 2025-11-12 20:31 UTC (permalink / raw)
To: Vadim Fedorenko
Cc: Andrew Lunn, Florian Fainelli, Russell King, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrei Botila, Richard Cochran, Simon Horman, Vladimir Oltean,
Jacob Keller, Kory Maincent, bcm-kernel-feedback-list, netdev
> int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
> {
> struct mii_ioctl_data *mii_data = if_mii(ifr);
> - struct kernel_hwtstamp_config kernel_cfg;
> + struct kernel_hwtstamp_config kernel_cfg = {};
> struct netlink_ext_ack extack = {};
> u16 val = mii_data->val_in;
> bool change_autoneg = false;
> @@ -404,13 +404,29 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
>
> return 0;
>
> + case SIOCGHWTSTAMP:
> + if (phydev->mii_ts && phydev->mii_ts->hwtstamp_get) {
> + ret = phydev->mii_ts->hwtstamp_get(phydev->mii_ts,
> + &kernel_cfg);
> + if (ret)
> + return ret;
> +
> + hwtstamp_config_from_kernel(&cfg, &kernel_cfg);
> + if (copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)))
> + return -EFAULT;
> +
> + return 0;
> + }
> + return -EOPNOTSUPP;
> case SIOCSHWTSTAMP:
> - if (phydev->mii_ts && phydev->mii_ts->hwtstamp) {
> + if (phydev->mii_ts && phydev->mii_ts->hwtstamp_set) {
> if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
> return -EFAULT;
>
> hwtstamp_config_to_kernel(&kernel_cfg, &cfg);
> - ret = phydev->mii_ts->hwtstamp(phydev->mii_ts, &kernel_cfg, &extack);
> + ret = phydev->mii_ts->hwtstamp_set(phydev->mii_ts,
> + &kernel_cfg,
> + &extack);
This is not about renaming a method. Please make it a separate patch.
> @@ -27,7 +27,9 @@ struct phy_device;
> * as soon as a timestamp becomes available. One of the PTP_CLASS_
> * values is passed in 'type'.
> *
> - * @hwtstamp: Handles SIOCSHWTSTAMP ioctl for hardware time stamping.
> + * @hwtstamp_set: Handles SIOCSHWTSTAMP ioctl for hardware time stamping.
> + *
> + * @hwtstamp_get: Handles SIOCGHWTSTAMP ioctl for hardware time stamping.
Adding _get should not be in this patch, which is all about renaming.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config
2025-11-12 0:02 ` [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config Vadim Fedorenko
2025-11-12 20:31 ` Andrew Lunn
@ 2025-11-13 4:49 ` kernel test robot
2025-11-13 4:49 ` kernel test robot
2 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2025-11-13 4:49 UTC (permalink / raw)
To: Vadim Fedorenko, Andrew Lunn, Florian Fainelli, Russell King,
Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrei Botila, Richard Cochran
Cc: oe-kbuild-all, netdev, Simon Horman, Vladimir Oltean,
Jacob Keller, Kory Maincent, bcm-kernel-feedback-list,
Vadim Fedorenko
Hi Vadim,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Vadim-Fedorenko/phy-add-hwtstamp_get-callback-to-retrieve-config/20251112-080606
base: net-next/main
patch link: https://lore.kernel.org/r/20251112000257.1079049-2-vadim.fedorenko%40linux.dev
patch subject: [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20251112/202511122341.yMQLxKfa-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251112/202511122341.yMQLxKfa-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511122341.yMQLxKfa-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/net/ethernet/ti/netcp_ethss.c: In function 'gbe_hwtstamp_set':
>> drivers/net/ethernet/ti/netcp_ethss.c:2660:37: error: 'struct mii_timestamper' has no member named 'hwtstamp'; did you mean 'rxtstamp'?
2660 | return phy->mii_ts->hwtstamp(phy->mii_ts, cfg, extack);
| ^~~~~~~~
| rxtstamp
vim +2660 drivers/net/ethernet/ti/netcp_ethss.c
6246168b4a3835 WingMan Kwok 2016-12-08 2645
3f02b82725576a Vadim Fedorenko 2025-11-03 2646 static int gbe_hwtstamp_set(void *intf_priv, struct kernel_hwtstamp_config *cfg,
3f02b82725576a Vadim Fedorenko 2025-11-03 2647 struct netlink_ext_ack *extack)
6246168b4a3835 WingMan Kwok 2016-12-08 2648 {
3f02b82725576a Vadim Fedorenko 2025-11-03 2649 struct gbe_intf *gbe_intf = intf_priv;
3f02b82725576a Vadim Fedorenko 2025-11-03 2650 struct gbe_priv *gbe_dev;
3f02b82725576a Vadim Fedorenko 2025-11-03 2651 struct phy_device *phy;
3f02b82725576a Vadim Fedorenko 2025-11-03 2652
3f02b82725576a Vadim Fedorenko 2025-11-03 2653 gbe_dev = gbe_intf->gbe_dev;
6246168b4a3835 WingMan Kwok 2016-12-08 2654
3f02b82725576a Vadim Fedorenko 2025-11-03 2655 if (!gbe_dev->cpts)
6246168b4a3835 WingMan Kwok 2016-12-08 2656 return -EOPNOTSUPP;
6246168b4a3835 WingMan Kwok 2016-12-08 2657
3f02b82725576a Vadim Fedorenko 2025-11-03 2658 phy = gbe_intf->slave->phy;
3f02b82725576a Vadim Fedorenko 2025-11-03 2659 if (phy_has_hwtstamp(phy))
3f02b82725576a Vadim Fedorenko 2025-11-03 @2660 return phy->mii_ts->hwtstamp(phy->mii_ts, cfg, extack);
6246168b4a3835 WingMan Kwok 2016-12-08 2661
3f02b82725576a Vadim Fedorenko 2025-11-03 2662 switch (cfg->tx_type) {
6246168b4a3835 WingMan Kwok 2016-12-08 2663 case HWTSTAMP_TX_OFF:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2664 gbe_dev->tx_ts_enabled = 0;
6246168b4a3835 WingMan Kwok 2016-12-08 2665 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2666 case HWTSTAMP_TX_ON:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2667 gbe_dev->tx_ts_enabled = 1;
6246168b4a3835 WingMan Kwok 2016-12-08 2668 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2669 default:
6246168b4a3835 WingMan Kwok 2016-12-08 2670 return -ERANGE;
6246168b4a3835 WingMan Kwok 2016-12-08 2671 }
6246168b4a3835 WingMan Kwok 2016-12-08 2672
3f02b82725576a Vadim Fedorenko 2025-11-03 2673 switch (cfg->rx_filter) {
6246168b4a3835 WingMan Kwok 2016-12-08 2674 case HWTSTAMP_FILTER_NONE:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2675 gbe_dev->rx_ts_enabled = HWTSTAMP_FILTER_NONE;
6246168b4a3835 WingMan Kwok 2016-12-08 2676 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2677 case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
6246168b4a3835 WingMan Kwok 2016-12-08 2678 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
6246168b4a3835 WingMan Kwok 2016-12-08 2679 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2680 gbe_dev->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
3f02b82725576a Vadim Fedorenko 2025-11-03 2681 cfg->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
6246168b4a3835 WingMan Kwok 2016-12-08 2682 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2683 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
6246168b4a3835 WingMan Kwok 2016-12-08 2684 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
6246168b4a3835 WingMan Kwok 2016-12-08 2685 case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
6246168b4a3835 WingMan Kwok 2016-12-08 2686 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
6246168b4a3835 WingMan Kwok 2016-12-08 2687 case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
6246168b4a3835 WingMan Kwok 2016-12-08 2688 case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
6246168b4a3835 WingMan Kwok 2016-12-08 2689 case HWTSTAMP_FILTER_PTP_V2_EVENT:
6246168b4a3835 WingMan Kwok 2016-12-08 2690 case HWTSTAMP_FILTER_PTP_V2_SYNC:
6246168b4a3835 WingMan Kwok 2016-12-08 2691 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2692 gbe_dev->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V2_EVENT;
3f02b82725576a Vadim Fedorenko 2025-11-03 2693 cfg->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
6246168b4a3835 WingMan Kwok 2016-12-08 2694 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2695 default:
6246168b4a3835 WingMan Kwok 2016-12-08 2696 return -ERANGE;
6246168b4a3835 WingMan Kwok 2016-12-08 2697 }
6246168b4a3835 WingMan Kwok 2016-12-08 2698
6246168b4a3835 WingMan Kwok 2016-12-08 2699 gbe_hwtstamp(gbe_intf);
6246168b4a3835 WingMan Kwok 2016-12-08 2700
3f02b82725576a Vadim Fedorenko 2025-11-03 2701 return 0;
6246168b4a3835 WingMan Kwok 2016-12-08 2702 }
6246168b4a3835 WingMan Kwok 2016-12-08 2703
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config
2025-11-12 0:02 ` [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config Vadim Fedorenko
2025-11-12 20:31 ` Andrew Lunn
2025-11-13 4:49 ` kernel test robot
@ 2025-11-13 4:49 ` kernel test robot
2 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2025-11-13 4:49 UTC (permalink / raw)
To: Vadim Fedorenko, Andrew Lunn, Florian Fainelli, Russell King,
Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrei Botila, Richard Cochran
Cc: llvm, oe-kbuild-all, netdev, Simon Horman, Vladimir Oltean,
Jacob Keller, Kory Maincent, bcm-kernel-feedback-list,
Vadim Fedorenko
Hi Vadim,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Vadim-Fedorenko/phy-add-hwtstamp_get-callback-to-retrieve-config/20251112-080606
base: net-next/main
patch link: https://lore.kernel.org/r/20251112000257.1079049-2-vadim.fedorenko%40linux.dev
patch subject: [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config
config: arm-defconfig (https://download.01.org/0day-ci/archive/20251113/202511130038.ODz0uTOK-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 996639d6ebb86ff15a8c99b67f1c2e2117636ae7)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251113/202511130038.ODz0uTOK-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511130038.ODz0uTOK-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/net/ethernet/ti/netcp_ethss.c:2660:23: error: no member named 'hwtstamp' in 'struct mii_timestamper'
2660 | return phy->mii_ts->hwtstamp(phy->mii_ts, cfg, extack);
| ~~~~~~~~~~~ ^
1 error generated.
vim +2660 drivers/net/ethernet/ti/netcp_ethss.c
6246168b4a3835 WingMan Kwok 2016-12-08 2645
3f02b82725576a Vadim Fedorenko 2025-11-03 2646 static int gbe_hwtstamp_set(void *intf_priv, struct kernel_hwtstamp_config *cfg,
3f02b82725576a Vadim Fedorenko 2025-11-03 2647 struct netlink_ext_ack *extack)
6246168b4a3835 WingMan Kwok 2016-12-08 2648 {
3f02b82725576a Vadim Fedorenko 2025-11-03 2649 struct gbe_intf *gbe_intf = intf_priv;
3f02b82725576a Vadim Fedorenko 2025-11-03 2650 struct gbe_priv *gbe_dev;
3f02b82725576a Vadim Fedorenko 2025-11-03 2651 struct phy_device *phy;
3f02b82725576a Vadim Fedorenko 2025-11-03 2652
3f02b82725576a Vadim Fedorenko 2025-11-03 2653 gbe_dev = gbe_intf->gbe_dev;
6246168b4a3835 WingMan Kwok 2016-12-08 2654
3f02b82725576a Vadim Fedorenko 2025-11-03 2655 if (!gbe_dev->cpts)
6246168b4a3835 WingMan Kwok 2016-12-08 2656 return -EOPNOTSUPP;
6246168b4a3835 WingMan Kwok 2016-12-08 2657
3f02b82725576a Vadim Fedorenko 2025-11-03 2658 phy = gbe_intf->slave->phy;
3f02b82725576a Vadim Fedorenko 2025-11-03 2659 if (phy_has_hwtstamp(phy))
3f02b82725576a Vadim Fedorenko 2025-11-03 @2660 return phy->mii_ts->hwtstamp(phy->mii_ts, cfg, extack);
6246168b4a3835 WingMan Kwok 2016-12-08 2661
3f02b82725576a Vadim Fedorenko 2025-11-03 2662 switch (cfg->tx_type) {
6246168b4a3835 WingMan Kwok 2016-12-08 2663 case HWTSTAMP_TX_OFF:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2664 gbe_dev->tx_ts_enabled = 0;
6246168b4a3835 WingMan Kwok 2016-12-08 2665 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2666 case HWTSTAMP_TX_ON:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2667 gbe_dev->tx_ts_enabled = 1;
6246168b4a3835 WingMan Kwok 2016-12-08 2668 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2669 default:
6246168b4a3835 WingMan Kwok 2016-12-08 2670 return -ERANGE;
6246168b4a3835 WingMan Kwok 2016-12-08 2671 }
6246168b4a3835 WingMan Kwok 2016-12-08 2672
3f02b82725576a Vadim Fedorenko 2025-11-03 2673 switch (cfg->rx_filter) {
6246168b4a3835 WingMan Kwok 2016-12-08 2674 case HWTSTAMP_FILTER_NONE:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2675 gbe_dev->rx_ts_enabled = HWTSTAMP_FILTER_NONE;
6246168b4a3835 WingMan Kwok 2016-12-08 2676 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2677 case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
6246168b4a3835 WingMan Kwok 2016-12-08 2678 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
6246168b4a3835 WingMan Kwok 2016-12-08 2679 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2680 gbe_dev->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
3f02b82725576a Vadim Fedorenko 2025-11-03 2681 cfg->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
6246168b4a3835 WingMan Kwok 2016-12-08 2682 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2683 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
6246168b4a3835 WingMan Kwok 2016-12-08 2684 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
6246168b4a3835 WingMan Kwok 2016-12-08 2685 case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
6246168b4a3835 WingMan Kwok 2016-12-08 2686 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
6246168b4a3835 WingMan Kwok 2016-12-08 2687 case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
6246168b4a3835 WingMan Kwok 2016-12-08 2688 case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
6246168b4a3835 WingMan Kwok 2016-12-08 2689 case HWTSTAMP_FILTER_PTP_V2_EVENT:
6246168b4a3835 WingMan Kwok 2016-12-08 2690 case HWTSTAMP_FILTER_PTP_V2_SYNC:
6246168b4a3835 WingMan Kwok 2016-12-08 2691 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
a9423120343cb5 Ivan Khoronzhuk 2018-11-12 2692 gbe_dev->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V2_EVENT;
3f02b82725576a Vadim Fedorenko 2025-11-03 2693 cfg->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
6246168b4a3835 WingMan Kwok 2016-12-08 2694 break;
6246168b4a3835 WingMan Kwok 2016-12-08 2695 default:
6246168b4a3835 WingMan Kwok 2016-12-08 2696 return -ERANGE;
6246168b4a3835 WingMan Kwok 2016-12-08 2697 }
6246168b4a3835 WingMan Kwok 2016-12-08 2698
6246168b4a3835 WingMan Kwok 2016-12-08 2699 gbe_hwtstamp(gbe_intf);
6246168b4a3835 WingMan Kwok 2016-12-08 2700
3f02b82725576a Vadim Fedorenko 2025-11-03 2701 return 0;
6246168b4a3835 WingMan Kwok 2016-12-08 2702 }
6246168b4a3835 WingMan Kwok 2016-12-08 2703
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-11-13 4:50 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-12 0:02 [PATCH net-next 0/8] add hwtstamp_get callback to phy drivers Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 1/8] phy: add hwtstamp_get callback to retrieve config Vadim Fedorenko
2025-11-12 20:31 ` Andrew Lunn
2025-11-13 4:49 ` kernel test robot
2025-11-13 4:49 ` kernel test robot
2025-11-12 0:02 ` [PATCH net-next 2/8] net: phy: broadcom: add HW timestamp configuration reporting Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 3/8] net: phy: dp83640: " Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 4/8] net: phy: micrel: " Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 5/8] net: phy: microchip_rds_ptp: " Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 6/8] phy: mscc: " Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 7/8] net: phy: nxp-c45-tja11xx: " Vadim Fedorenko
2025-11-12 0:02 ` [PATCH net-next 8/8] ptp: ptp_ines: " Vadim Fedorenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).