add hwtstamp_get callback to phy drivers
Subsystems (6)
v3 cover add hwtstamp_get callback to phy drivers
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.
v2 -> v3:
* remove SIOCGHWTSTAMP in phy_mii_ioctl() as we discourage usage of deprecated interface
v1 -> v2:
* split the first patch to rename part and add new callback part
* fix netcp driver calling mii_timestamper::hwtstamp
Vadim Fedorenko (9):
phy: rename hwtstamp callback to hwtstamp_set
phy: add hwtstamp_get callback to phy drivers
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/ethernet/ti/netcp_ethss.c | 2 +- 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 | 14 ++++++--- drivers/ptp/ptp_ines.c | 31 ++++++++++++++++--- include/linux/mii_timestamper.h | 13 +++++--- include/linux/phy.h | 4 +-- 11 files changed, 174 insertions(+), 47 deletions(-)
Signature · 1 line
2.47.3
PATCH v3 1/9 phy: rename hwtstamp callback to hwtstamp_set
PHY devices has hwtstamp callback which actually performs set operation. Rename it to better reflect the action.
--- drivers/net/ethernet/ti/netcp_ethss.c | 2 +- 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 | 11 +++++++---- drivers/ptp/ptp_ines.c | 8 ++++---- include/linux/mii_timestamper.h | 8 ++++---- include/linux/phy.h | 4 ++-- 11 files changed, 46 insertions(+), 43 deletions(-)
drivers/net/ethernet/ti/netcp_ethss.c +1 -1
@@ -2657,7 +2657,7 @@ static int gbe_hwtstamp_set(void *intf_priv, struct kernel_hwtstamp_config *cfg, phy = gbe_intf->slave->phy;if (phy_has_hwtstamp (phy)) -return phy->mii_ts->hwtstamp (phy->mii_ts, cfg, extack); +return phy->mii_ts->hwtstamp_set (phy->mii_ts, cfg, extack);switch (cfg->tx_type) {case HWTSTAMP_TX_OFF :
drivers/net/phy/bcm-phy-ptp.c +4 -4
@@ -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;
drivers/net/phy/dp83640.c +4 -4
@@ -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);
drivers/net/phy/micrel.c +8 -8
@@ -3147,9 +3147,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);
@@ -4389,7 +4389,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;
@@ -5042,9 +5042,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;
@@ -5924,7 +5924,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;
drivers/net/phy/microchip_rds_ptp.c +4 -4
@@ -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;
drivers/net/phy/mscc/mscc_ptp.c +4 -4
@@ -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;
drivers/net/phy/nxp-c45-tja11xx.c +4 -4
@@ -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);
drivers/net/phy/phy.c +7 -4
@@ -405,12 +405,14 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)return 0 ;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;
@@ -493,8 +495,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 ; }
drivers/ptp/ptp_ines.c +4 -4
@@ -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;
include/linux/mii_timestamper.h +4 -4
@@ -27,7 +27,7 @@ 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. * * @link_state: Allows the device to respond to changes in the link * state. The caller invokes this function while holding
@@ -51,9 +51,9 @@ 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);void (*link_state)(struct mii_timestamper *mii_ts,struct phy_device *phydev);
include/linux/phy.h +2 -2
@@ -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,
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 1/9] phy: rename hwtstamp callback to hwtstamp_set
Quoted 5 lines · Vadim Fedorenko
PHY devices has hwtstamp callback which actually performs set operation. Rename it to better reflect the action.
Signed-off-by Vadim Fedorenko <[email protected]>Reviewed-by Andrew Lunn <[email protected]>
Thanks!
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH net-next v3 1/9] phy: rename hwtstamp callback to hwtstamp_set
In reply to Vadim FedorenkoQuoted 2 lines · On Wed, 19 Nov 2025 12:47:17 +0000 Vadim Fedorenko <[email protected]>…
PHY devices has hwtstamp callback which actually performs set operation. Rename it to better reflect the action.
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v3 2/9 phy: add hwtstamp_get callback to phy drivers
In reply to Vadim FedorenkoPHY devices had lack of hwtstamp_get callback even though most of them are tracking configuration info. Introduce new call back to mii_timestamper.
--- drivers/net/phy/phy.c | 3 +++ include/linux/mii_timestamper.h | 5 +++++ 2 files changed, 8 insertions(+)
drivers/net/phy/phy.c +3 -0
@@ -478,6 +478,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 ; }
include/linux/mii_timestamper.h +5 -0
@@ -29,6 +29,8 @@ struct phy_device;* * @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 * the phy_device mutex.
@@ -55,6 +57,9 @@ struct mii_timestamper {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);
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 2/9] phy: add hwtstamp_get callback to phy drivers
Quoted 5 lines · Vadim Fedorenko
PHY devices had lack of
hwtstamp_getcallback even though most of them are tracking configuration info. Introduce new call back tomii_timestamper.Signed-off-by Vadim Fedorenko <[email protected]>
Thanks!
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH net-next v3 2/9] phy: add hwtstamp_get callback to phy drivers
In reply to Vadim FedorenkoQuoted 3 lines · On Wed, 19 Nov 2025 12:47:18 +0000 Vadim Fedorenko <[email protected]>…
PHY devices had lack of
hwtstamp_getcallback even though most of them are tracking configuration info. Introduce new call back tomii_timestamper.
It would be nice to update this kdoc note:
https://elixir.bootlin.com/linux/v6.18-rc6/source/net/core/dev_ioctl.c#L252
Else:
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v3 3/9 net: phy: broadcom: add HW timestamp configuration reporting
In reply to Vadim FedorenkoThe driver stores configuration information and can technically report it. Implement hwtstamp_get callback to report the configuration.
--- drivers/net/phy/bcm-phy-ptp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/phy/bcm-phy-ptp.c +13 -0
@@ -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;
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 3/9] net: phy: broadcom: add HW timestamp configuration reporting
Quoted 2 lines · On Wed, 19 Nov 2025 12:47:19 +0000 Vadim Fedorenko <[email protected]>…
The driver stores configuration information and can technically report it. Implement
hwtstamp_getcallback to report the configuration.
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v3 4/9 net: phy: dp83640: add HW timestamp configuration reporting
In reply to Vadim FedorenkoThe 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.
--- drivers/net/phy/dp83640.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/net/phy/dp83640.c +17 -4
@@ -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);
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 4/9] net: phy: dp83640: add HW timestamp configuration reporting
Quoted 3 lines · On Wed, 19 Nov 2025 12:47:20 +0000 Vadim Fedorenko <[email protected]>…
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.
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v3 5/9 net: phy: micrel: add HW timestamp configuration reporting
In reply to Vadim FedorenkoThe driver stores HW timestamping configuration and can technically report it. Add callback to do it.
--- drivers/net/phy/micrel.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/net/phy/micrel.c +27 -0
@@ -3147,6 +3147,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)
@@ -4390,6 +4402,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;
@@ -5042,6 +5055,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)
@@ -5925,6 +5951,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;
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 5/9] net: phy: micrel: add HW timestamp configuration reporting
Quoted 43 lines · On Wed, 19 Nov 2025 12:47:21 +0000 Vadim Fedorenko <[email protected]>…
The driver stores HW timestamping configuration and can technically report it. Add callback to do it.
Signed-off-by Vadim Fedorenko <[email protected]>--- drivers/net/phy/micrel.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/net/phy/micrel.c +5
-0@@ -3147,6 +3147,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); +drivers/net/phy/micrel.c +7
-0+ 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)@@ -4390,6 +4402,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;@@ -5042,6 +5055,19 @@ static void lan8841_ptp_enable_processing(struct
kszphy_ptp_priv*ptp_priv, #defineLAN8841_PTP_TX_TIMESTAMP_EN
443 #defineLAN8841_PTP_TX_MOD445
drivers/net/phy/micrel.c static void lan8841_ptp_enable_processing(struct kszphy_ptp_priv *ptp_priv, · line 5066
Quoted 9 lines
drivers/net/phy/micrel.c +9
-0+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;
Something related to this patch, it seems there is an issue in the set callback:
https://elixir.bootlin.com/linux/v6.18-rc6/source/drivers/net/phy/micrel.c#L3056
The priv->rx_filter and priv->hwts_tx_type are set before the switch condition. The hwtstamp_get can then report something that is not supported. Also HWTSTAMP_TX_ONESTEP_P2P is not managed by the driver but not returning -ERANGE either so if we set this config the hwtstamp_get will report something wrong as not supported.
I think you will need to add a new patch here to fix the hwtstamp_set ops.
Maybe we should update net_hwtstamp_validate to check on the capabilities reported by ts_info but that is a bigger change.
Quoted 15 lines
drivers/net/phy/micrel.c +5
-0+ +return 0 ; +} +static int lan8841_hwtstamp_set (struct mii_timestamper *mii_ts,struct kernel_hwtstamp_config *config,struct netlink_ext_ack *extack)@@ -5925,6 +5951,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;
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
Re: [PATCH net-next v3 5/9] net: phy: micrel: add HW timestamp configuration reporting
Quoted 60 lines · Kory Maincent
Quoted 43 lines · On Wed, 19 Nov 2025 12:47:21 +0000 Vadim Fedorenko <[email protected]>…
The driver stores HW timestamping configuration and can technically report it. Add callback to do it.
Signed-off-by Vadim Fedorenko <[email protected]>--- drivers/net/phy/micrel.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/net/phy/micrel.c +5
-0@@ -3147,6 +3147,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); +drivers/net/phy/micrel.c +7
-0+ 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)@@ -4390,6 +4402,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;@@ -5042,6 +5055,19 @@ static void lan8841_ptp_enable_processing(struct
kszphy_ptp_priv*ptp_priv, #defineLAN8841_PTP_TX_TIMESTAMP_EN
443 #defineLAN8841_PTP_TX_MOD445drivers/net/phy/micrel.c static void lan8841_ptp_enable_processing(struct kszphy_ptp_priv *ptp_priv, · line 5066
Quoted 9 lines
drivers/net/phy/micrel.c +9
-0+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;Something related to this patch, it seems there is an issue in the set callback:
https://elixir.bootlin.com/linux/v6.18-rc6/source/drivers/net/phy/micrel.c#L3056
Quoted 6 lines
The
priv->rx_filterandpriv->hwts_tx_typeare set before the switch condition. Thehwtstamp_getcan then report something that is not supported. AlsoHWTSTAMP_TX_ONESTEP_P2Pis not managed by the driver but not returning-ERANGEeither so if we set this config thehwtstamp_getwill report something wrong as not supported.
I think you will need to add a new patch here to fix thehwtstamp_setops.
I agree, that there is a problem in the flow, but such change is out of scope of this patch set. I'm going to provide some logic improvements on per-driver basis as follow up work.
Quoted 2 lines
Maybe we should update
net_hwtstamp_validateto check on the capabilities reported byts_infobut that is a bigger change.
In this case we have to introduce validation callback and implement it in drivers. Some drivers do downgrade filter values if provided value is not in the list of what was provided in ethtool::ts_info. And we have to keep this logic as otherwise it may be considered as API breakage.
Quoted 19 lines
Quoted 16 lines
drivers/net/phy/micrel.c +5
-0+ +return 0 ; +} +static int lan8841_hwtstamp_set (struct mii_timestamper *mii_ts,struct kernel_hwtstamp_config *config,struct netlink_ext_ack *extack)@@ -5925,6 +5951,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;
Re: [PATCH net-next v3 5/9] net: phy: micrel: add HW timestamp configuration reporting
Quoted 68 lines · On Wed, 19 Nov 2025 15:10:27 +0000 Vadim Fedorenko <[email protected]>…
Quoted 60 lines · Kory Maincent
Quoted 43 lines · On Wed, 19 Nov 2025 12:47:21 +0000 Vadim Fedorenko <[email protected]>…
The driver stores HW timestamping configuration and can technically report it. Add callback to do it.
Signed-off-by Vadim Fedorenko <[email protected]>--- drivers/net/phy/micrel.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/net/phy/micrel.c +5
-0@@ -3147,6 +3147,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); +drivers/net/phy/micrel.c +7
-0+ 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)@@ -4390,6 +4402,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;@@ -5042,6 +5055,19 @@ static void lan8841_ptp_enable_processing(struct
kszphy_ptp_priv*ptp_priv, #defineLAN8841_PTP_TX_TIMESTAMP_EN
443 #defineLAN8841_PTP_TX_MOD445drivers/net/phy/micrel.c static void lan8841_ptp_enable_processing(struct kszphy_ptp_priv *ptp_priv, · line 5066
Quoted 9 lines
drivers/net/phy/micrel.c +9
-0+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;Something related to this patch, it seems there is an issue in the set callback:
https://elixir.bootlin.com/linux/v6.18-rc6/source/drivers/net/phy/micrel.c#L3056Quoted 6 lines
The
priv->rx_filterandpriv->hwts_tx_typeare set before the switch condition. Thehwtstamp_getcan then report something that is not supported. AlsoHWTSTAMP_TX_ONESTEP_P2Pis not managed by the driver but not returning-ERANGEeither so if we set this config thehwtstamp_getwill report something wrong as not supported.
I think you will need to add a new patch here to fix thehwtstamp_setops.
Quoted 3 lines
I agree, that there is a problem in the flow, but such change is out of scope of this patch set. I'm going to provide some logic improvements on per-driver basis as follow up work.
As you want but patch 5 and 6 won't be accepted without these change.
Quoted 7 lines
Quoted 2 lines
Maybe we should update
net_hwtstamp_validateto check on the capabilities reported byts_infobut that is a bigger change.In this case we have to introduce validation callback and implement it in drivers. Some drivers do downgrade filter values if provided value is not in the list of what was provided in
ethtool::ts_info. And we have to keep this logic as otherwise it may be considered as API breakage.
Indeed so lets keep the current design.
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v3 6/9 net: phy: microchip_rds_ptp: add HW timestamp configuration reporting
In reply to Vadim FedorenkoThe driver stores HW timestamping configuration and can technically report it. Add callback to do it.
--- drivers/net/phy/microchip_rds_ptp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/phy/microchip_rds_ptp.c +13 -0
@@ -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;
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 6/9] net: phy: microchip_rds_ptp: add HW timestamp configuration reporting
Quoted 15 lines · On Wed, 19 Nov 2025 12:47:22 +0000 Vadim Fedorenko <[email protected]>…
The driver stores HW timestamping configuration and can technically report it. Add callback to do it.
Signed-off-by Vadim Fedorenko <[email protected]>--- drivers/net/phy/microchip_rds_ptp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)(quoted diff) +0
-0
b/drivers/net/phy/microchip_rds_ptp.cindex4c6326b0ceaf..d2beb3a2e6c3100644drivers/net/phy/microchip_rds_ptp.c +0
-0@@ -476,6 +476,18 @@ static bool mchp_rds_ptp_rxtstamp(struct mii_timestamper *mii_ts, return true; }
drivers/net/phy/microchip_rds_ptp.c static bool mchp_rds_ptp_rxtstamp(struct mii_timestamper · line 487
Quoted 10 lines
drivers/net/phy/microchip_rds_ptp.c +8
-0+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;
Same issue as patch 5.
Quoted 15 lines
drivers/net/phy/microchip_rds_ptp.c +4
-0+ +return 0 ; +} + static int mchp_rds_ptp_hwtstamp_set(struct mii_timestamper *mii_ts, struct kernel_hwtstamp_config *config,drivers/net/phy/microchip_rds_ptp.c +1
-0struct 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;
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v3 7/9 phy: mscc: add HW timestamp configuration reporting
In reply to Vadim FedorenkoThe driver stores HW configuration and can technically report it. Add callback to do it.
--- drivers/net/phy/mscc/mscc_ptp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/phy/mscc/mscc_ptp.c +13 -0
@@ -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;
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 7/9] phy: mscc: add HW timestamp configuration reporting
Quoted 2 lines · On Wed, 19 Nov 2025 12:47:23 +0000 Vadim Fedorenko <[email protected]>…
The driver stores HW configuration and can technically report it. Add callback to do it.
The hwtstamp_set ops of this driver is well written!
Setting vsc8531->ptp->tx_type and vsc8531->ptp->rx_filter after the switch condition.
Thank you!
Quoted 37 lines
Signed-off-by Vadim Fedorenko <[email protected]>--- drivers/net/phy/mscc/mscc_ptp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/net/phy/mscc/mscc_ptp.c +13
-0@@ -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;
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v3 8/9 net: phy: nxp-c45-tja11xx: add HW timestamp configuration reporting
In reply to Vadim FedorenkoThe driver stores HW timestamping configuration and can technically report it. Add callback to do it.
--- drivers/net/phy/nxp-c45-tja11xx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/phy/nxp-c45-tja11xx.c +14 -0
@@ -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);
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 8/9] net: phy: nxp-c45-tja11xx: add HW timestamp configuration reporting
Quoted 2 lines · On Wed, 19 Nov 2025 12:47:24 +0000 Vadim Fedorenko <[email protected]>…
The driver stores HW timestamping configuration and can technically report it. Add callback to do it.
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v3 9/9 ptp: ptp_ines: add HW timestamp configuration reporting
In reply to Vadim FedorenkoThe driver partially stores HW timestamping configuration, but missing pieces can be read from HW. Add callback to report configuration.
--- drivers/ptp/ptp_ines.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/ptp/ptp_ines.c +23 -0
@@ -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;
Signature · 1 line
2.47.3
Re: [PATCH net-next v3 9/9] ptp: ptp_ines: add HW timestamp configuration reporting
Quoted 32 lines · On Wed, 19 Nov 2025 12:47:25 +0000 Vadim Fedorenko <[email protected]>…
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 <[email protected]>--- drivers/ptp/ptp_ines.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/ptp/ptp_ines.c +14
-0@@ -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
drivers/ptp/ptp_ines.c static u64 ines_find_txts(struct ines_port *port, struct sk_buff *skb) · line 345
Quoted 1 line
drivers/ptp/ptp_ines.c +1
-0+ : HWTSTAMP_TX_OFF;
You could also update txts_enabled to int and save the tx type as you did in other patches. I don't know what the best approach is, but in either way, this is ok to me.
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
Re: [PATCH net-next v3 9/9] ptp: ptp_ines: add HW timestamp configuration reporting
Quoted 32 lines · Kory Maincent
Quoted 29 lines · On Wed, 19 Nov 2025 12:47:25 +0000 Vadim Fedorenko <[email protected]>…
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 <[email protected]>--- drivers/ptp/ptp_ines.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/ptp/ptp_ines.c +12
-0@@ -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);
Quoted 8 lines
drivers/ptp/ptp_ines.c static u64 ines_find_txts(struct ines_port *port, struct sk_buff *skb) · line 345
Quoted 4 lines
drivers/ptp/ptp_ines.c +2
-0+spin_unlock_irqrestore (&port->lock, flags); + cfg->tx_type = (port_conf & CM_ONE_STEP) ?
HWTSTAMP_TX_ONESTEP_P2Pdrivers/ptp/ptp_ines.c +1
-0+ : HWTSTAMP_TX_OFF;You could also update
txts_enabledto int and save the tx type as you did in other patches. I don't know what the best approach is, but in either way, this is ok to me.
I was thinking of this, but it can be treated as logic change, which I
would like to avoid in this series. But I totally agree, there is no
real need to read register each time if we can store the config. Unless the value can be changed by some event outside of kernel configuration flow.
Quoted 4 lines
Reviewed-by Kory Maincent <[email protected]>Thank you!