net: Make timestamping selectable
Subsystems (63)
v14 cover net: Make timestamping selectable
Up until now, there was no way to let the user select the hardware PTP provider at which time stamping occurs. The stack assumed that PHY time stamping is always preferred, but some MAC/PHY combinations were buggy.
This series updates the default MAC/PHY default timestamping and aims to allow the user to select the desired hwtstamp provider administratively.
Changes in v14:
- Add back an EXPORT_SYMBOL() missing.
- Link to v13: https://lore.kernel.org/r/[email protected]
Changes in v13:
- Add PTP builtin code to fix build errors when building PTP as a module.
- Fix error spotted by smatch and sparse.
- Link to v12: https://lore.kernel.org/r/[email protected]
Changes in v12:
- Add missing return description in the kdoc.
- Fix few nit.
- Link to v11: https://lore.kernel.org/r/[email protected]
Changes in v11:
- Add netlink examples.
- Remove a change of my out of tree marvell_ptp patch in the patch series.
- Remove useless extern.
- Link to v10: https://lore.kernel.org/r/[email protected]
Changes in v10:
- Move declarations to net/core/dev.h instead of netdevice.h
- Add netlink documentation.
- Add ETHTOOL_A_TSINFO_GHWTSTAMP netlink attributes instead of a bit in ETHTOOL_A_TSINFO_TIMESTAMPING bitset.
- Send "Move from simple ida to xarray" patch standalone.
- Add tsinfo ntf command.
- Add rcu_lock protection mechanism to avoid memory leak.
- Fixed doc and kdoc issue.
- Link to v9: https://lore.kernel.org/r/[email protected]
Changes in v9:
- Remove the RFC prefix.
- Correct few NIT fixes.
- Link to v8: https://lore.kernel.org/r/[email protected]
Changes in v8:
- Drop the 6 first patch as they are now merged.
- Change the full implementation to not be based on the hwtstamp layer
(MAC/PHY) but on the hwtstamp provider which mean a ptp clock and a
phc qualifier.
- Made some patch to prepare the new implementation.
- Expand netlink tsinfo instead of a new ts command for new hwtstamp
configuration uAPI and for dumping tsinfo of specific hwtstamp provider.
- Link to v7: https://lore.kernel.org/r/[email protected]
Changes in v7:
- Fix a temporary build error.
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v6:
- Few fixes from the reviews.
- Replace the allowlist to default_timestamp flag to know which phy is using old API behavior.
- Rename the timestamping layer enum values.
- Move to a simple enum instead of the mix between enum and bitfield.
- Update ts_info and ts-set in software timestamping case.
Changes in v5:
- Update to ndo_hwstamp_get/set. This bring several new patches.
- Add few patches to make the glue.
- Convert macb to ndo_hwstamp_get/set.
- Add netlink specs description of new ethtool commands.
- Removed netdev notifier.
- Split the patches that expose the timestamping to userspace to separate the core and ethtool development.
- Add description of software timestamping.
- Convert PHYs hwtstamp callback to use kernel_hwtstamp_config.
Changes in v4:
- Move on to ethtool netlink instead of ioctl.
- Add a netdev notifier to allow packet trapping by the MAC in case of PHY time stamping.
- Add a PHY whitelist to not break the old PHY default time-stamping preference API.
Changes in v3:
- Expose the PTP choice to ethtool instead of sysfs.
You can test it with the ethtool source on branch feature_ptp of:
https://github.com/kmaincent/ethtool
- Added a devicetree binding to select the preferred timestamp.
Changes in v2:
- Move selected_timestamping_layer variable of the concerned patch.
- Use sysfs_streq instead of strmcmp.
- Use the PHY timestamp only if available.
---
Kory Maincent (14):
net_tstamp: Add TIMESTAMPING SOFTWARE and HARDWARE mask
net: Move dev_set_hwtstamp_phylib to net/core/dev.h
net: Make dev_get_hwtstamp_phylib accessible
net: Make net_hwtstamp_validate accessible
net: Change the API of PHY default timestamp to MAC
net: net_tstamp: Add unspec field to hwtstamp_source enumeration
net: Add struct kernel_ethtool_ts_info
ptp: Add phc source and helpers to register specific PTP clock or get information
net: Add the possibility to support a selected hwtstamp in netdevice
net: netdevsim: ptp_mock: Convert to netdev_ptp_clock_register
net: macb: Convert to netdev_ptp_clock_register
net: ptp: Move ptp_clock_index() to builtin symbol
net: ethtool: tsinfo: Add support for hwtstamp provider and get/set hwtstamp config
netlink: specs: tsinfo: Enhance netlink attributes and add a set command
Documentation/netlink/specs/ethtool.yaml | 43 +- Documentation/networking/ethtool-netlink.rst | 38 +- Documentation/networking/timestamping.rst | 35 +- drivers/net/bonding/bond_main.c | 4 +- drivers/net/can/dev/dev.c | 2 +- drivers/net/can/peak_canfd/peak_canfd.c | 2 +- drivers/net/can/usb/gs_usb.c | 2 +- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 +- drivers/net/can/usb/peak_usb/pcan_usb_core.h | 2 +- drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c | 2 +- drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h | 2 +- drivers/net/dsa/microchip/ksz_ptp.c | 2 +- drivers/net/dsa/microchip/ksz_ptp.h | 2 +- drivers/net/dsa/mv88e6xxx/hwtstamp.c | 2 +- drivers/net/dsa/mv88e6xxx/hwtstamp.h | 4 +- drivers/net/dsa/ocelot/felix.c | 2 +- drivers/net/dsa/sja1105/sja1105_ptp.c | 2 +- drivers/net/dsa/sja1105/sja1105_ptp.h | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 2 +- .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 2 +- .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- drivers/net/ethernet/broadcom/tg3.c | 2 +- drivers/net/ethernet/cadence/macb.h | 2 +- drivers/net/ethernet/cadence/macb_main.c | 4 +- drivers/net/ethernet/cadence/macb_ptp.c | 2 +- drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 2 +- .../net/ethernet/cavium/thunder/nicvf_ethtool.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 2 +- drivers/net/ethernet/cisco/enic/enic_ethtool.c | 2 +- drivers/net/ethernet/engleder/tsnep_ethtool.c | 2 +- drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 2 +- .../net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +- .../net/ethernet/freescale/enetc/enetc_ethtool.c | 2 +- drivers/net/ethernet/freescale/fec_main.c | 2 +- drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +- .../net/ethernet/fungible/funeth/funeth_ethtool.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h | 2 +- drivers/net/ethernet/intel/e1000e/ethtool.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +- .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 +- .../ethernet/mellanox/mlx5/core/ipoib/ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +- .../net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c | 4 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h | 10 +- drivers/net/ethernet/microchip/lan743x_ethtool.c | 2 +- .../ethernet/microchip/lan966x/lan966x_ethtool.c | 2 +- .../net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +- drivers/net/ethernet/mscc/ocelot_net.c | 2 +- drivers/net/ethernet/mscc/ocelot_ptp.c | 2 +- .../net/ethernet/pensando/ionic/ionic_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ptp.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ptp.h | 2 +- drivers/net/ethernet/renesas/ravb_main.c | 2 +- drivers/net/ethernet/renesas/rswitch.c | 2 +- drivers/net/ethernet/sfc/ethtool.c | 2 +- drivers/net/ethernet/sfc/falcon/nic.h | 2 +- drivers/net/ethernet/sfc/ptp.c | 2 +- drivers/net/ethernet/sfc/ptp.h | 5 +- drivers/net/ethernet/sfc/siena/ethtool.c | 2 +- drivers/net/ethernet/sfc/siena/ptp.c | 2 +- drivers/net/ethernet/sfc/siena/ptp.h | 4 +- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +- drivers/net/ethernet/ti/am65-cpsw-ethtool.c | 2 +- drivers/net/ethernet/ti/cpsw_ethtool.c | 4 +- drivers/net/ethernet/ti/cpsw_priv.h | 2 +- drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 2 +- drivers/net/ethernet/ti/netcp_ethss.c | 4 +- drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +- drivers/net/macvlan.c | 2 +- drivers/net/netdevsim/ethtool.c | 2 +- drivers/net/netdevsim/netdev.c | 19 +- drivers/net/phy/bcm-phy-ptp.c | 5 +- drivers/net/phy/dp83640.c | 4 +- drivers/net/phy/micrel.c | 10 +- drivers/net/phy/mscc/mscc_ptp.c | 5 +- drivers/net/phy/nxp-c45-tja11xx.c | 5 +- drivers/net/phy/phy_device.c | 11 + drivers/ptp/Makefile | 5 + drivers/ptp/ptp_clock.c | 39 +- drivers/ptp/ptp_clock_consumer.c | 172 ++++++ drivers/ptp/ptp_ines.c | 2 +- drivers/ptp/ptp_mock.c | 4 +- drivers/ptp/ptp_private.h | 7 + drivers/s390/net/qeth_ethtool.c | 2 +- include/linux/can/dev.h | 2 +- include/linux/ethtool.h | 29 +- include/linux/mii_timestamper.h | 2 +- include/linux/net_tstamp.h | 16 + include/linux/netdevice.h | 8 +- include/linux/phy.h | 21 +- include/linux/ptp_clock_kernel.h | 178 ++++++ include/linux/ptp_mock.h | 4 +- include/net/dsa.h | 2 +- include/soc/mscc/ocelot.h | 2 +- include/uapi/linux/ethtool_netlink.h | 14 + include/uapi/linux/net_tstamp.h | 11 + net/8021q/vlan_dev.c | 2 +- net/core/dev.h | 7 + net/core/dev_ioctl.c | 56 +- net/core/timestamping.c | 49 +- net/dsa/user.c | 2 +- net/ethtool/common.c | 40 +- net/ethtool/common.h | 5 +- net/ethtool/ioctl.c | 12 +- net/ethtool/netlink.c | 16 +- net/ethtool/netlink.h | 6 +- net/ethtool/tsinfo.c | 641 ++++++++++++++++++++- net/sched/sch_taprio.c | 2 +- 122 files changed, 1520 insertions(+), 202 deletions(-)
---
base-commit: caaa6a85f0658de87358e08fb9e3768d2daf5e01
change-id: 20231011-feature_ptp_netnext-3f278578e84b
Best regards,
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v14 1/14 net_tstamp: Add TIMESTAMPING SOFTWARE and HARDWARE mask
Timestamping software or hardware flags are often used as a group, therefore adding these masks will ease future use.
I did not use SOF_TIMESTAMPING_SYS_HARDWARE flag as it is deprecated and not used at all.
---
Changes in v7:
- Move the masks out of uapi to include/linux/net_tstamp.h
Changes in v9:
- Fix commit message typos
--- include/linux/net_tstamp.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/linux/net_tstamp.h +8 -0
@@ -5,6 +5,14 @@#include <uapi/linux/net_tstamp.h> +#define SOF_TIMESTAMPING_SOFTWARE_MASK (SOF_TIMESTAMPING_RX_SOFTWARE | \ + SOF_TIMESTAMPING_TX_SOFTWARE | \ + SOF_TIMESTAMPING_SOFTWARE) + +#define SOF_TIMESTAMPING_HARDWARE_MASK (SOF_TIMESTAMPING_RX_HARDWARE | \ + SOF_TIMESTAMPING_TX_HARDWARE | \ + SOF_TIMESTAMPING_RAW_HARDWARE) +enum hwtstamp_source {HWTSTAMP_SOURCE_NETDEV ,HWTSTAMP_SOURCE_PHYLIB ,
Signature · 1 line
2.34.1
PATCH v14 2/14 net: Move dev_set_hwtstamp_phylib to net/core/dev.h
In reply to Kory MaincentThis declaration was added to the header to be called from ethtool. ethtool is separated from core for code organization but it is not really a separate entity, it controls very core things.
As ethtool is an internal stuff it is not wise to have it in netdevice.h. Move the declaration to net/core/dev.h instead.
Remove the EXPORT_SYMBOL_GPL call as ethtool can not be built as a module.
---
Change in v10:
- New patch.
--- include/linux/netdevice.h | 3 --- net/core/dev.h | 4 ++++ net/core/dev_ioctl.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-)
include/linux/netdevice.h +0 -3
@@ -3903,9 +3903,6 @@ int generic_hwtstamp_get_lower(struct net_device *dev,int generic_hwtstamp_set_lower (struct net_device *dev,struct kernel_hwtstamp_config *kernel_cfg,struct netlink_ext_ack *extack); -int dev_set_hwtstamp_phylib (struct net_device *dev, -struct kernel_hwtstamp_config *cfg, -struct netlink_ext_ack *extack);int dev_ethtool (struct net *net,struct ifreq *ifr,void __user *userdata);unsigned int dev_get_flags (const struct net_device *); int __dev_change_flags(struct net_device *dev, unsigned int flags,
net/core/dev.h +4 -0
@@ -166,4 +166,8 @@ static inline void dev_xmit_recursion_dec(void) __this_cpu_dec(softnet_data.xmit.recursion); } +int dev_set_hwtstamp_phylib (struct net_device *dev, +struct kernel_hwtstamp_config *cfg, +struct netlink_ext_ack *extack); +#endif
net/core/dev_ioctl.c +0 -1
@@ -363,7 +363,6 @@ int dev_set_hwtstamp_phylib(struct net_device *dev,return 0 ; } -EXPORT_SYMBOL_GPL (dev_set_hwtstamp_phylib);static int dev_set_hwtstamp (struct net_device *dev,struct ifreq *ifr) {
Signature · 1 line
2.34.1
PATCH v14 3/14 net: Make dev_get_hwtstamp_phylib accessible
In reply to Kory MaincentMake the dev_get_hwtstamp_phylib function accessible in prevision to use it from ethtool to read the hwtstamp current configuration.
---
Change in v8:
- New patch
Change in v10:
- Remove export symbol as ethtool can't be built as a module.
- Move the declaration to net/core/dev.h instead of netdevice.h
--- net/core/dev.h | 2 ++ net/core/dev_ioctl.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
net/core/dev.h +2 -0
@@ -169,5 +169,7 @@ static inline void dev_xmit_recursion_dec(void)int dev_set_hwtstamp_phylib (struct net_device *dev,struct kernel_hwtstamp_config *cfg,struct netlink_ext_ack *extack); +int dev_get_hwtstamp_phylib (struct net_device *dev, +struct kernel_hwtstamp_config *cfg);#endif
net/core/dev_ioctl.c +2 -2
@@ -268,8 +268,8 @@ static int dev_eth_ioctl(struct net_device *dev,* -EOPNOTSUPP for phylib for now, which is still more accurate than letting * the netdev handle the GET request. */ -static int dev_get_hwtstamp_phylib (struct net_device *dev, -struct kernel_hwtstamp_config *cfg) +int dev_get_hwtstamp_phylib (struct net_device *dev, +struct kernel_hwtstamp_config *cfg) {if (phy_has_hwtstamp (dev->phydev))return phy_hwtstamp_get (dev->phydev, cfg);
Signature · 1 line
2.34.1
PATCH v14 4/14 net: Make net_hwtstamp_validate accessible
In reply to Kory MaincentMake the net_hwtstamp_validate function accessible in prevision to use it from ethtool to validate the hwtstamp configuration before setting it.
---
Change in v8:
- New patch
Change in v10:
- Remove export symbol as ethtool can't be built as a module.
- Move the declaration to net/core/dev.h instead of netdevice.h
--- net/core/dev.h | 1 + net/core/dev_ioctl.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
net/core/dev.h +1 -0
@@ -171,5 +171,6 @@ int dev_set_hwtstamp_phylib(struct net_device *dev, struct netlink_ext_ack *extack);int dev_get_hwtstamp_phylib (struct net_device *dev,struct kernel_hwtstamp_config *cfg); +int net_hwtstamp_validate (const struct kernel_hwtstamp_config *cfg);#endif
net/core/dev_ioctl.c +1 -1
@@ -184,7 +184,7 @@ static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cmreturn err; } -static int net_hwtstamp_validate (const struct kernel_hwtstamp_config *cfg) +int net_hwtstamp_validate (const struct kernel_hwtstamp_config *cfg) {enum hwtstamp_tx_types tx_type;enum hwtstamp_rx_filters rx_filter;
Signature · 1 line
2.34.1
PATCH v14 5/14 net: Change the API of PHY default timestamp to MAC
In reply to Kory MaincentChange the API to select MAC default time stamping instead of the PHY. Indeed the PHY is closer to the wire therefore theoretically it has less delay than the MAC timestamping but the reality is different. Due to lower time stamping clock frequency, latency in the MDIO bus and no PHC hardware synchronization between different PHY, the PHY PTP is often less precise than the MAC. The exception is for PHY designed specially for PTP case but these devices are not very widespread. For not breaking the compatibility default_timestamp flag has been introduced in phy_device that is set by the phy driver to know we are using the old API behavior.
---
Changes in v5:
- Extract the API change in this patch.
- Rename whitelist to allowlist.
- Set NETDEV_TIMESTAMPING in register_netdevice function.
- Add software timestamping case description in ts_info.
Change in v6:
- Replace the allowlist phy with a default_timestamp flag to know which phy is using old API behavior.
- Fix dereferenced of a possible null pointer.
- Follow timestamping layer naming update.
- Update timestamp default set between MAC and software.
- Update ts_info returned in case of software timestamping.
Change in v8:
- Reform the implementation to use a simple phy_is_default_hwtstamp helper instead of saving the hwtstamp in the net_device struct.
Change in v9:
- Update few nit following the review.
Change in v12:
- Add missing return description in the kdoc.
--- drivers/net/phy/bcm-phy-ptp.c | 3 +++ drivers/net/phy/dp83640.c | 2 ++ drivers/net/phy/micrel.c | 6 ++++++ drivers/net/phy/mscc/mscc_ptp.c | 3 +++ drivers/net/phy/nxp-c45-tja11xx.c | 3 +++ include/linux/phy.h | 19 +++++++++++++++++++ net/core/dev_ioctl.c | 8 +++----- net/core/timestamping.c | 5 +++-- net/ethtool/common.c | 2 +- 9 files changed, 43 insertions(+), 8 deletions(-)
drivers/net/phy/bcm-phy-ptp.c +3 -0
@@ -931,6 +931,9 @@ struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev)return ERR_CAST (clock); priv->ptp_clock = clock; +/* Timestamp selected by default to keep legacy API */ + phydev->default_timestamp = true; + priv->phydev = phydev;bcm_ptp_init (priv);
drivers/net/phy/dp83640.c +2 -0
@@ -1447,6 +1447,8 @@ static int dp83640_probe(struct phy_device *phydev)for (i =0 ; i <MAX_RXTS ; i++)list_add (&dp83640->rx_pool_data[i].list, &dp83640->rxpool); +/* Timestamp selected by default to keep legacy API */ + phydev->default_timestamp = true; phydev->mii_ts = &dp83640->mii_ts; phydev->priv = dp83640;
drivers/net/phy/micrel.c +6 -0
@@ -3691,6 +3691,9 @@ static void lan8814_ptp_init(struct phy_device *phydev) ptp_priv->mii_ts.ts_info = lan8814_ts_info; phydev->mii_ts = &ptp_priv->mii_ts; + +/* Timestamp selected by default to keep legacy API */ + phydev->default_timestamp = true; }static int lan8814_ptp_probe_once (struct phy_device *phydev)
@@ -5181,6 +5184,9 @@ static int lan8841_probe(struct phy_device *phydev) phydev->mii_ts = &ptp_priv->mii_ts; +/* Timestamp selected by default to keep legacy API */ + phydev->default_timestamp = true; +return 0 ; }
drivers/net/phy/mscc/mscc_ptp.c +3 -0
@@ -1570,6 +1570,9 @@ int vsc8584_ptp_probe(struct phy_device *phydev)return PTR_ERR (vsc8531->load_save); } +/* Timestamp selected by default to keep legacy API */ + phydev->default_timestamp = true; + vsc8531->ptp->phydev = phydev;return 0 ;
drivers/net/phy/nxp-c45-tja11xx.c +3 -0
@@ -1660,6 +1660,9 @@ static int nxp_c45_probe(struct phy_device *phydev) priv->mii_ts.ts_info = nxp_c45_ts_info; phydev->mii_ts = &priv->mii_ts; ret =nxp_c45_init_ptp_clock (priv); + +/* Timestamp selected by default to keep legacy API */ + phydev->default_timestamp = true; }else {phydev_dbg (phydev,"PTP support not enabled even if the phy supports it" ); }
include/linux/phy.h +19 -0
@@ -612,6 +612,8 @@ struct macsec_ops;* handling shall be postponed until PHY has resumed * @irq_rerun: Flag indicating interrupts occurred while PHY was suspended, * requiring a rerun of the interrupt handler after resume +* @default_timestamp: Flag indicating whether we are using the phy +* timestamp as the default one * @interface: enum phy_interface_t value * @possible_interfaces: bitmap if interface modes that the attached PHY * will switch between depending on media speed.
@@ -677,6 +679,8 @@ struct phy_device { unsigned irq_suspended:1; unsigned irq_rerun:1; + unsigned default_timestamp:1; +int rate_matching;enum phy_state state;
@@ -1621,6 +1625,21 @@ static inline void phy_txtstamp(struct phy_device *phydev, struct sk_buff *skb, phydev->mii_ts->txtstamp (phydev->mii_ts, skb, type); } +/** +* phy_is_default_hwtstamp - Is the PHY hwtstamp the default timestamp +* @phydev: Pointer to phy_device +* +* This is used to get default timestamping device taking into account +* the new API choice, which is selecting the timestamping from MAC by +* default if the phydev does not have default_timestamp flag enabled. +* +* Return: True if phy is the default hw timestamp, false otherwise. +*/ +static inline bool phy_is_default_hwtstamp (struct phy_device *phydev) +{ +return phy_has_hwtstamp (phydev) && phydev->default_timestamp; +} +/** * phy_is_internal - Convenience function for testing if a PHY is internal * @phydev: the phy_device struct
net/core/dev_ioctl.c +3 -5
@@ -259,9 +259,7 @@ static int dev_eth_ioctl(struct net_device *dev,* @dev: Network device * @cfg: Timestamping configuration structure * -* Helper for enforcing a common policy that phylib timestamping, if available, -* should take precedence in front of hardware timestamping provided by the -* netdev. +* Helper for calling the default hardware provider timestamping. * * Note: phy_mii_ioctl() only handles SIOCSHWTSTAMP (not SIOCGHWTSTAMP), and * there only exists a phydev->mii_ts->hwtstamp() method. So this will return
@@ -271,7 +269,7 @@ static int dev_eth_ioctl(struct net_device *dev,int dev_get_hwtstamp_phylib (struct net_device *dev,struct kernel_hwtstamp_config *cfg) { -if (phy_has_hwtstamp (dev->phydev)) +if (phy_is_default_hwtstamp (dev->phydev))return phy_hwtstamp_get (dev->phydev, cfg);return dev->netdev_ops->ndo_hwtstamp_get (dev, cfg);
@@ -327,7 +325,7 @@ int dev_set_hwtstamp_phylib(struct net_device *dev, struct netlink_ext_ack *extack) {const struct net_device_ops *ops = dev->netdev_ops; -bool phy_ts =phy_has_hwtstamp (dev->phydev); +bool phy_ts =phy_is_default_hwtstamp (dev->phydev);struct kernel_hwtstamp_config old_cfg = {};bool changed = false;int err;
net/core/timestamping.c +3 -2
@@ -25,7 +25,8 @@ void skb_clone_tx_timestamp(struct sk_buff *skb)struct sk_buff *clone;unsigned int type; -if (!skb->sk) +if (!skb->sk || !skb->dev || + !phy_is_default_hwtstamp (skb->dev->phydev))return ; type =classify (skb);
@@ -47,7 +48,7 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)struct mii_timestamper *mii_ts;unsigned int type; -if (!skb->dev || !skb->dev->phydev || !skb->dev->phydev->mii_ts) +if (!skb->dev || !phy_is_default_hwtstamp (skb->dev->phydev))return false;if (skb_headroom (skb) <ETH_HLEN )
net/ethtool/common.c +1 -1
@@ -637,7 +637,7 @@ int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)memset (info,0 ,sizeof (*info)); info->cmd =ETHTOOL_GET_TS_INFO ; -if (phy_has_tsinfo (phydev)) +if (phy_is_default_hwtstamp (phydev) &&phy_has_tsinfo (phydev))return phy_ts_info (phydev, info);if (ops->get_ts_info)return ops->get_ts_info (dev, info);
Signature · 1 line
2.34.1
PATCH v14 6/14 net: net_tstamp: Add unspec field to hwtstamp_source enumeration
In reply to Kory MaincentPrepare for future support of saving hwtstamp source in PTP xarray by introducing HWTSTAMP_SOURCE_UNSPEC to hwtstamp_source enum, setting it to 0 to match old behavior of no source defined.
---
Change in v8:
- New patch
--- include/linux/net_tstamp.h | 1 + 1 file changed, 1 insertion(+)
include/linux/net_tstamp.h +1 -0
@@ -14,6 +14,7 @@ SOF_TIMESTAMPING_RAW_HARDWARE)enum hwtstamp_source { +HWTSTAMP_SOURCE_UNSPEC ,HWTSTAMP_SOURCE_NETDEV ,HWTSTAMP_SOURCE_PHYLIB , };
Signature · 1 line
2.34.1
PATCH v14 7/14 net: Add struct kernel_ethtool_ts_info
In reply to Kory MaincentIn prevision to add new UAPI for hwtstamp we will be limited to the struct ethtool_ts_info that is currently passed in fixed binary format through the ETHTOOL_GET_TS_INFO ethtool ioctl. It would be good if new kernel code already started operating on an extensible kernel variant of that structure, similar in concept to struct kernel_hwtstamp_config vs struct hwtstamp_config.
Since struct ethtool_ts_info is in include/uapi/linux/ethtool.h, here we introduce the kernel-only structure in include/linux/ethtool.h. The manual copy is then made in the function called by ETHTOOL_GET_TS_INFO.
---
Change in v8:
- New patch
Change in v11:
- Remove a change of my out of tree patch.
--- drivers/net/bonding/bond_main.c | 4 ++-- drivers/net/can/dev/dev.c | 2 +- drivers/net/can/peak_canfd/peak_canfd.c | 2 +- drivers/net/can/usb/gs_usb.c | 2 +- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 +- drivers/net/can/usb/peak_usb/pcan_usb_core.h | 2 +- drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c | 2 +- drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h | 2 +- drivers/net/dsa/microchip/ksz_ptp.c | 2 +- drivers/net/dsa/microchip/ksz_ptp.h | 2 +- drivers/net/dsa/mv88e6xxx/hwtstamp.c | 2 +- drivers/net/dsa/mv88e6xxx/hwtstamp.h | 4 ++-- drivers/net/dsa/ocelot/felix.c | 2 +- drivers/net/dsa/sja1105/sja1105_ptp.c | 2 +- drivers/net/dsa/sja1105/sja1105_ptp.h | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 2 +- .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 2 +- .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- drivers/net/ethernet/broadcom/tg3.c | 2 +- drivers/net/ethernet/cadence/macb.h | 2 +- drivers/net/ethernet/cadence/macb_main.c | 4 ++-- drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 2 +- .../net/ethernet/cavium/thunder/nicvf_ethtool.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 2 +- drivers/net/ethernet/cisco/enic/enic_ethtool.c | 2 +- drivers/net/ethernet/engleder/tsnep_ethtool.c | 2 +- drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 2 +- .../net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +- .../net/ethernet/freescale/enetc/enetc_ethtool.c | 2 +- drivers/net/ethernet/freescale/fec_main.c | 2 +- drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +- .../net/ethernet/fungible/funeth/funeth_ethtool.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h | 2 +- drivers/net/ethernet/intel/e1000e/ethtool.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +- .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 ++-- .../ethernet/mellanox/mlx5/core/ipoib/ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +- .../net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h | 10 ++++----- drivers/net/ethernet/microchip/lan743x_ethtool.c | 2 +- .../ethernet/microchip/lan966x/lan966x_ethtool.c | 2 +- .../net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +- drivers/net/ethernet/mscc/ocelot_net.c | 2 +- drivers/net/ethernet/mscc/ocelot_ptp.c | 2 +- .../net/ethernet/pensando/ionic/ionic_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ptp.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ptp.h | 2 +- drivers/net/ethernet/renesas/ravb_main.c | 2 +- drivers/net/ethernet/renesas/rswitch.c | 2 +- drivers/net/ethernet/sfc/ethtool.c | 2 +- drivers/net/ethernet/sfc/falcon/nic.h | 2 +- drivers/net/ethernet/sfc/ptp.c | 2 +- drivers/net/ethernet/sfc/ptp.h | 5 +++-- drivers/net/ethernet/sfc/siena/ethtool.c | 2 +- drivers/net/ethernet/sfc/siena/ptp.c | 2 +- drivers/net/ethernet/sfc/siena/ptp.h | 4 ++-- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +- drivers/net/ethernet/ti/am65-cpsw-ethtool.c | 2 +- drivers/net/ethernet/ti/cpsw_ethtool.c | 4 ++-- drivers/net/ethernet/ti/cpsw_priv.h | 2 +- drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 2 +- drivers/net/ethernet/ti/netcp_ethss.c | 4 ++-- drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +- drivers/net/macvlan.c | 2 +- drivers/net/netdevsim/ethtool.c | 2 +- drivers/net/phy/bcm-phy-ptp.c | 2 +- drivers/net/phy/dp83640.c | 2 +- drivers/net/phy/micrel.c | 4 ++-- drivers/net/phy/mscc/mscc_ptp.c | 2 +- drivers/net/phy/nxp-c45-tja11xx.c | 2 +- drivers/ptp/ptp_ines.c | 2 +- drivers/s390/net/qeth_ethtool.c | 2 +- include/linux/can/dev.h | 2 +- include/linux/ethtool.h | 25 +++++++++++++++++++--- include/linux/mii_timestamper.h | 2 +- include/linux/phy.h | 2 +- include/net/dsa.h | 2 +- include/soc/mscc/ocelot.h | 2 +- net/8021q/vlan_dev.c | 2 +- net/dsa/user.c | 2 +- net/ethtool/common.c | 6 +++--- net/ethtool/common.h | 2 +- net/ethtool/ioctl.c | 12 +++++++++-- net/ethtool/tsinfo.c | 6 +++--- net/sched/sch_taprio.c | 2 +- 100 files changed, 149 insertions(+), 121 deletions(-)
drivers/net/bonding/bond_main.c +2 -2
@@ -5755,10 +5755,10 @@ static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, }static int bond_ethtool_get_ts_info (struct net_device *bond_dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct bonding *bond =netdev_priv (bond_dev); -struct ethtool_ts_info ts_info; +struct kernel_ethtool_ts_info ts_info;struct net_device *real_dev;bool sw_tx_support = false;struct list_head *iter;
drivers/net/can/dev/dev.c +1 -1
@@ -376,7 +376,7 @@ EXPORT_SYMBOL(can_eth_ioctl_hwts);* supporting hardware timestamps */ int can_ethtool_op_get_ts_info_hwts (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
drivers/net/can/peak_canfd/peak_canfd.c +1 -1
@@ -777,7 +777,7 @@ static const struct net_device_ops peak_canfd_netdev_ops = { };static int peak_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
drivers/net/can/usb/gs_usb.c +1 -1
@@ -1145,7 +1145,7 @@ static int gs_usb_set_phys_id(struct net_device *netdev, }static int gs_usb_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct gs_can *dev =netdev_priv (netdev);
drivers/net/can/usb/peak_usb/pcan_usb_core.c +1 -1
@@ -897,7 +897,7 @@ int peak_usb_set_eeprom(struct net_device *netdev,return 0 ; } -int pcan_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +int pcan_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
drivers/net/can/usb/peak_usb/pcan_usb_core.h +1 -1
@@ -145,7 +145,7 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *tv);int peak_usb_netif_rx_64 (struct sk_buff *skb,u32 ts_low,u32 ts_high);void peak_usb_async_complete (struct urb *urb);void peak_usb_restart_complete (struct peak_usb_device *dev); -int pcan_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info); +int pcan_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info);/* common 32-bit CAN channel ID ethtool management */ int peak_usb_get_eeprom_len (struct net_device *netdev);
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c +1 -1
@@ -16,7 +16,7 @@#include "hellcreek_ptp.h" int hellcreek_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct hellcreek *hellcreek = ds->priv;
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h +1 -1
@@ -48,7 +48,7 @@ void hellcreek_port_txtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb);int hellcreek_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);long hellcreek_hwtstamp_work (struct ptp_clock_info *ptp);
drivers/net/dsa/microchip/ksz_ptp.c +1 -1
@@ -293,7 +293,7 @@ static int ksz_ptp_enable_mode(struct ksz_device *dev)/* The function is return back the capability of timestamping feature when * requested through ethtool -T <interface> utility */ -int ksz_get_ts_info (struct dsa_switch *ds,int port,struct ethtool_ts_info *ts) +int ksz_get_ts_info (struct dsa_switch *ds,int port,struct kernel_ethtool_ts_info *ts) {struct ksz_device *dev = ds->priv;struct ksz_ptp_data *ptp_data;
drivers/net/dsa/microchip/ksz_ptp.h +1 -1
@@ -38,7 +38,7 @@ int ksz_ptp_clock_register(struct dsa_switch *ds);void ksz_ptp_clock_unregister (struct dsa_switch *ds);int ksz_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *ts); +struct kernel_ethtool_ts_info *ts);int ksz_hwtstamp_get (struct dsa_switch *ds,int port,struct ifreq *ifr);int ksz_hwtstamp_set (struct dsa_switch *ds,int port,struct ifreq *ifr);void ksz_port_txtstamp (struct dsa_switch *ds,int port,struct sk_buff *skb);
drivers/net/dsa/mv88e6xxx/hwtstamp.c +1 -1
@@ -64,7 +64,7 @@ static int mv88e6xxx_ptp_read(struct mv88e6xxx_chip *chip, int addr,#define TX_TSTAMP_TIMEOUT msecs_to_jiffies(40)int mv88e6xxx_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {const struct mv88e6xxx_ptp_ops *ptp_ops;struct mv88e6xxx_chip *chip;
drivers/net/dsa/mv88e6xxx/hwtstamp.h +2 -2
@@ -121,7 +121,7 @@ void mv88e6xxx_port_txtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb);int mv88e6xxx_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int mv88e6xxx_hwtstamp_setup (struct mv88e6xxx_chip *chip);void mv88e6xxx_hwtstamp_free (struct mv88e6xxx_chip *chip);
@@ -157,7 +157,7 @@ static inline void mv88e6xxx_port_txtstamp(struct dsa_switch *ds, int port, }static inline int mv88e6xxx_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {return -EOPNOTSUPP ; }
drivers/net/dsa/ocelot/felix.c +1 -1
@@ -1220,7 +1220,7 @@ static int felix_get_sset_count(struct dsa_switch *ds, int port, int sset) }static int felix_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ocelot *ocelot = ds->priv;
drivers/net/dsa/sja1105/sja1105_ptp.c +1 -1
@@ -111,7 +111,7 @@ int sja1105_hwtstamp_get(struct dsa_switch *ds, int port, struct ifreq *ifr) }int sja1105_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct sja1105_private *priv = ds->priv;struct sja1105_ptp_data *ptp_data = &priv->ptp_data;
drivers/net/dsa/sja1105/sja1105_ptp.h +1 -1
@@ -101,7 +101,7 @@ void sja1105pqrs_ptp_cmd_packing(u8 *buf, struct sja1105_ptp_cmd *cmd, enum packing_op op);int sja1105_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *ts); +struct kernel_ethtool_ts_info *ts);void sja1105_ptp_txtstamp_skb (struct dsa_switch *ds,int slot,struct sk_buff *clone);
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1 -1
@@ -577,7 +577,7 @@ static int xgbe_set_rxfh(struct net_device *netdev, }static int xgbe_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct xgbe_prv_data *pdata =netdev_priv (netdev);
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +1 -1
@@ -652,7 +652,7 @@ static int aq_ethtool_set_wol(struct net_device *ndev, }static int aq_ethtool_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct aq_nic_s *aq_nic =netdev_priv (ndev);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +1 -1
@@ -3634,7 +3634,7 @@ static int bnx2x_set_channels(struct net_device *dev, }static int bnx2x_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct bnx2x *bp =netdev_priv (dev);
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -1
@@ -5013,7 +5013,7 @@ static int bnxt_get_dump_data(struct net_device *dev, struct ethtool_dump *dump, }static int bnxt_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct bnxt *bp =netdev_priv (dev);struct bnxt_ptp_cfg *ptp;
drivers/net/ethernet/broadcom/tg3.c +1 -1
@@ -6141,7 +6141,7 @@ static void tg3_refclk_write(struct tg3 *tp, u64 newval)static inline void tg3_full_lock (struct tg3 *tp,int irq_sync);static inline void tg3_full_unlock (struct tg3 *tp); -static int tg3_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +static int tg3_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) {struct tg3 *tp =netdev_priv (dev);
drivers/net/ethernet/cadence/macb.h +1 -1
@@ -1163,7 +1163,7 @@ struct macb_ptp_info {s32 (*get_ptp_max_adj)(void);unsigned int (*get_tsu_rate)(struct macb *bp);int (*get_ts_info)(struct net_device *dev, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int (*get_hwtst)(struct net_device *netdev,struct kernel_hwtstamp_config *tstamp_config); int (*set_hwtst)(struct net_device *netdev,
drivers/net/ethernet/cadence/macb_main.c +2 -2
@@ -3376,7 +3376,7 @@ static s32 gem_get_ptp_max_adj(void) }static int gem_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct macb *bp =netdev_priv (dev);
@@ -3417,7 +3417,7 @@ static struct macb_ptp_info gem_ptp_info = {#endif static int macb_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct macb *bp =netdev_priv (netdev);
drivers/net/ethernet/cavium/liquidio/lio_ethtool.c +1 -1
@@ -2497,7 +2497,7 @@ static int lio_set_intr_coalesce(struct net_device *netdev, }static int lio_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct lio *lio =GET_LIO (netdev);
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c +1 -1
@@ -836,7 +836,7 @@ static int nicvf_set_pauseparam(struct net_device *dev, }static int nicvf_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct nicvf *nic =netdev_priv (netdev);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +1 -1
@@ -1550,7 +1550,7 @@ static int set_flash(struct net_device *netdev, struct ethtool_flash *ef)return ret; } -static int get_ts_info (struct net_device *dev,struct ethtool_ts_info *ts_info) +static int get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *ts_info) {struct port_info *pi =netdev_priv (dev);struct adapter *adapter = pi->adapter;
drivers/net/ethernet/cisco/enic/enic_ethtool.c +1 -1
@@ -599,7 +599,7 @@ static int enic_set_rxfh(struct net_device *netdev, }static int enic_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping =SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE |
drivers/net/ethernet/engleder/tsnep_ethtool.c +1 -1
@@ -305,7 +305,7 @@ static void tsnep_ethtool_get_channels(struct net_device *netdev, }static int tsnep_ethtool_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct tsnep_adapter *adapter =netdev_priv (netdev);
drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c +1 -1
@@ -394,7 +394,7 @@ static int dpaa_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) }static int dpaa_get_ts_info (struct net_device *net_dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct device *dev = net_dev->dev.parent;struct device_node *mac_node = dev->of_node;
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +1 -1
@@ -794,7 +794,7 @@ int dpaa2_phc_index = -1;EXPORT_SYMBOL (dpaa2_phc_index);static int dpaa2_eth_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {if (!dpaa2_ptp)return ethtool_op_get_ts_info (dev, info);
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +1 -1
@@ -841,7 +841,7 @@ static int enetc_set_coalesce(struct net_device *ndev, }static int enetc_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {int *phc_idx;
drivers/net/ethernet/freescale/fec_main.c +1 -1
@@ -2762,7 +2762,7 @@ static void fec_enet_get_regs(struct net_device *ndev, }static int fec_enet_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct fec_enet_private *fep =netdev_priv (ndev);
drivers/net/ethernet/freescale/gianfar_ethtool.c +1 -1
@@ -1448,7 +1448,7 @@ static int gfar_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, }static int gfar_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct gfar_private *priv =netdev_priv (dev);struct platform_device *ptp_dev;
drivers/net/ethernet/fungible/funeth/funeth_ethtool.c +1 -1
@@ -1040,7 +1040,7 @@ static int fun_set_rxfh(struct net_device *netdev, }static int fun_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping =SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_RX_HARDWARE |
drivers/net/ethernet/hisilicon/hns3/hnae3.h +1 -1
@@ -786,7 +786,7 @@ struct hnae3_ae_ops {void (*get_rx_hwts)(struct hnae3_handle *handle,struct sk_buff *skb,u32 nsec,u32 sec);int (*get_ts_info)(struct hnae3_handle *handle, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int (*get_link_diagnosis_info)(struct hnae3_handle *handle,u32 *status_code);void (*clean_vf_config)(struct hnae3_ae_dev *ae_dev,int num_vfs);
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +1 -1
@@ -2009,7 +2009,7 @@ static int hns3_set_tunable(struct net_device *netdev, ETHTOOL_RING_USE_TX_PUSH) static int hns3_get_ts_info(struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct hnae3_handle *handle =hns3_get_handle (netdev);
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c +1 -1
@@ -378,7 +378,7 @@ int hclge_ptp_set_cfg(struct hclge_dev *hdev, struct ifreq *ifr) }int hclge_ptp_get_ts_info (struct hnae3_handle *handle, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct hclge_vport *vport =hclge_get_vport (handle);struct hclge_dev *hdev = vport->back;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h +1 -1
@@ -138,6 +138,6 @@ int hclge_ptp_set_cfg(struct hclge_dev *hdev, struct ifreq *ifr);int hclge_ptp_init (struct hclge_dev *hdev);void hclge_ptp_uninit (struct hclge_dev *hdev);int hclge_ptp_get_ts_info (struct hnae3_handle *handle, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int hclge_ptp_cfg_qry (struct hclge_dev *hdev,u32 *cfg);#endif
drivers/net/ethernet/intel/e1000e/ethtool.c +1 -1
@@ -2263,7 +2263,7 @@ static int e1000e_set_eee(struct net_device *netdev, struct ethtool_keee *edata) }static int e1000e_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct e1000_adapter *adapter =netdev_priv (netdev);
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -1
@@ -2546,7 +2546,7 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset, }static int i40e_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct i40e_pf *pf =i40e_netdev_to_pf (dev);
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -1
@@ -3434,7 +3434,7 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh, }static int -ice_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +ice_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) {struct ice_pf *pf =ice_netdev_to_pf (dev);
drivers/net/ethernet/intel/igb/igb_ethtool.c +1 -1
@@ -2381,7 +2381,7 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) }static int igb_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct igb_adapter *adapter =netdev_priv (dev);
drivers/net/ethernet/intel/igc/igc_ethtool.c +1 -1
@@ -1559,7 +1559,7 @@ static int igc_ethtool_set_channels(struct net_device *netdev, }static int igc_ethtool_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct igc_adapter *adapter =netdev_priv (dev);
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +1 -1
@@ -3170,7 +3170,7 @@ static int ixgbe_set_rxfh(struct net_device *netdev, }static int ixgbe_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ixgbe_adapter *adapter =netdev_priv (dev);
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1 -1
@@ -5256,7 +5256,7 @@ static int mvpp2_get_ts_config(struct mvpp2_port *port, struct ifreq *ifr) }static int mvpp2_ethtool_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mvpp2_port *port =netdev_priv (dev);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +1 -1
@@ -954,7 +954,7 @@ static u32 otx2_get_link(struct net_device *netdev) }static int otx2_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct otx2_nic *pfvf =netdev_priv (netdev);
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +1 -1
@@ -1903,7 +1903,7 @@ static int mlx4_en_set_channels(struct net_device *dev, }static int mlx4_en_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mlx4_en_priv *priv =netdev_priv (dev);struct mlx4_en_dev *mdev = priv->mdev;
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -1
@@ -1207,7 +1207,7 @@ int mlx5e_set_per_queue_coalesce(struct net_device *dev, u32 queue,u32 mlx5e_ethtool_get_rxfh_key_size (struct mlx5e_priv *priv);u32 mlx5e_ethtool_get_rxfh_indir_size (struct mlx5e_priv *priv);int mlx5e_ethtool_get_ts_info (struct mlx5e_priv *priv, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int mlx5e_ethtool_flash_device (struct mlx5e_priv *priv,struct ethtool_flash *flash);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +2 -2
@@ -1658,7 +1658,7 @@ static int mlx5e_set_pauseparam(struct net_device *netdev, }int mlx5e_ethtool_get_ts_info (struct mlx5e_priv *priv, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mlx5_core_dev *mdev = priv->mdev;
@@ -1682,7 +1682,7 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv, }static int mlx5e_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mlx5e_priv *priv =netdev_priv (dev);
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c +1 -1
@@ -136,7 +136,7 @@ static int mlx5i_get_coalesce(struct net_device *netdev, }static int mlx5i_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mlx5e_priv *priv =mlx5i_epriv (netdev);
drivers/net/ethernet/mellanox/mlxsw/spectrum.h +1 -1
@@ -238,7 +238,7 @@ struct mlxsw_sp_ptp_ops { struct hwtstamp_config *config);void (*shaper_work)(struct work_struct *work);int (*get_ts_info)(struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int (*get_stats_count)(void );void (*get_stats_strings)(u8 **p); void (*get_stats)(struct mlxsw_sp_port *mlxsw_sp_port,
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +1 -1
@@ -1068,7 +1068,7 @@ mlxsw_sp_get_module_eeprom_by_page(struct net_device *dev, }static int -mlxsw_sp_get_ts_info (struct net_device *netdev,struct ethtool_ts_info *info) +mlxsw_sp_get_ts_info (struct net_device *netdev,struct kernel_ethtool_ts_info *info) {struct mlxsw_sp_port *mlxsw_sp_port =netdev_priv (netdev);struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +2 -2
@@ -1276,7 +1276,7 @@ int mlxsw_sp1_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, }int mlxsw_sp1_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->phc_index =ptp_clock_index (mlxsw_sp->clock->ptp);
@@ -1661,7 +1661,7 @@ int mlxsw_sp2_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, }int mlxsw_sp2_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->phc_index =ptp_clock_index (mlxsw_sp->clock->ptp);
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h +5 -5
@@ -11,7 +11,7 @@ struct mlxsw_sp;struct mlxsw_sp_port ;struct mlxsw_sp_ptp_clock ; -static inline int mlxsw_sp_ptp_get_ts_info_noptp (struct ethtool_ts_info *info) +static inline int mlxsw_sp_ptp_get_ts_info_noptp (struct kernel_ethtool_ts_info *info) { info->so_timestamping =SOF_TIMESTAMPING_RX_SOFTWARE |SOF_TIMESTAMPING_SOFTWARE ;
@@ -50,7 +50,7 @@ int mlxsw_sp1_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port,void mlxsw_sp1_ptp_shaper_work (struct work_struct *work);int mlxsw_sp1_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int mlxsw_sp1_get_stats_count (void );void mlxsw_sp1_get_stats_strings (u8 **p);
@@ -84,7 +84,7 @@ int mlxsw_sp2_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, struct hwtstamp_config *config);int mlxsw_sp2_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info); int mlxsw_sp2_ptp_txhdr_construct(struct mlxsw_core *mlxsw_core, struct mlxsw_sp_port *mlxsw_sp_port,
@@ -152,7 +152,7 @@ static inline void mlxsw_sp1_ptp_shaper_work(struct work_struct *work) }static inline int mlxsw_sp1_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {return mlxsw_sp_ptp_get_ts_info_noptp (info); }
@@ -227,7 +227,7 @@ mlxsw_sp2_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, }static inline int mlxsw_sp2_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {return mlxsw_sp_ptp_get_ts_info_noptp (info); }
drivers/net/ethernet/microchip/lan743x_ethtool.c +1 -1
@@ -1029,7 +1029,7 @@ static int lan743x_ethtool_set_rxfh(struct net_device *netdev, }static int lan743x_ethtool_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct lan743x_adapter *adapter =netdev_priv (netdev);
drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c +1 -1
@@ -546,7 +546,7 @@ static int lan966x_set_pauseparam(struct net_device *dev, }static int lan966x_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct lan966x_port *port =netdev_priv (dev);struct lan966x *lan966x = port->lan966x;
drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c +1 -1
@@ -1183,7 +1183,7 @@ static void sparx5_config_port_stats(struct sparx5 *sparx5, int portno) }static int sparx5_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct sparx5_port *port =netdev_priv (dev);struct sparx5 *sparx5 = port->sparx5;
drivers/net/ethernet/mscc/ocelot_net.c +1 -1
@@ -980,7 +980,7 @@ static int ocelot_port_get_sset_count(struct net_device *dev, int sset) }static int ocelot_port_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ocelot_port_private *priv =netdev_priv (dev);struct ocelot *ocelot = priv->port.ocelot;
drivers/net/ethernet/mscc/ocelot_ptp.c +1 -1
@@ -580,7 +580,7 @@ int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr)EXPORT_SYMBOL (ocelot_hwstamp_set);int ocelot_get_ts_info (struct ocelot *ocelot,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->phc_index = ocelot->ptp_clock ?ptp_clock_index (ocelot->ptp_clock) :-1 ;
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +1 -1
@@ -968,7 +968,7 @@ static int ionic_get_module_eeprom(struct net_device *netdev, }static int ionic_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ionic_lif *lif =netdev_priv (netdev);struct ionic *ionic = lif->ionic;
drivers/net/ethernet/qlogic/qede/qede_ethtool.c +1 -1
@@ -1137,7 +1137,7 @@ static int qede_set_channels(struct net_device *dev, }static int qede_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct qede_dev *edev =netdev_priv (dev);
drivers/net/ethernet/qlogic/qede/qede_ptp.c +1 -1
@@ -321,7 +321,7 @@ int qede_ptp_hw_ts(struct qede_dev *edev, struct ifreq *ifr) sizeof(config)) ? -EFAULT : 0; } -int qede_ptp_get_ts_info (struct qede_dev *edev,struct ethtool_ts_info *info) +int qede_ptp_get_ts_info (struct qede_dev *edev,struct kernel_ethtool_ts_info *info) {struct qede_ptp *ptp = edev->ptp;
drivers/net/ethernet/qlogic/qede/qede_ptp.h +1 -1
@@ -17,7 +17,7 @@ void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb);int qede_ptp_hw_ts (struct qede_dev *edev,struct ifreq *req);void qede_ptp_disable (struct qede_dev *edev);int qede_ptp_enable (struct qede_dev *edev); -int qede_ptp_get_ts_info (struct qede_dev *edev,struct ethtool_ts_info *ts); +int qede_ptp_get_ts_info (struct qede_dev *edev,struct kernel_ethtool_ts_info *ts); static inline void qede_ptp_record_rx_ts(struct qede_dev *edev, union eth_rx_cqe *cqe,
drivers/net/ethernet/renesas/ravb_main.c +1 -1
@@ -1696,7 +1696,7 @@ static int ravb_set_ringparam(struct net_device *ndev, }static int ravb_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ravb_private *priv =netdev_priv (ndev);const struct ravb_hw_info *hw_info = priv->info;
drivers/net/ethernet/renesas/rswitch.c +1 -1
@@ -1809,7 +1809,7 @@ static const struct net_device_ops rswitch_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, }; -static int rswitch_get_ts_info (struct net_device *ndev,struct ethtool_ts_info *info) +static int rswitch_get_ts_info (struct net_device *ndev,struct kernel_ethtool_ts_info *info) {struct rswitch_device *rdev =netdev_priv (ndev);
drivers/net/ethernet/sfc/ethtool.c +1 -1
@@ -226,7 +226,7 @@ static void efx_ethtool_get_fec_stats(struct net_device *net_dev, }static int efx_ethtool_get_ts_info (struct net_device *net_dev, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct efx_nic *efx =efx_netdev_priv (net_dev);
drivers/net/ethernet/sfc/falcon/nic.h +1 -1
@@ -297,7 +297,7 @@ static inline struct falcon_board *falcon_board(struct ef4_nic *efx)return &data->board; } -struct ethtool_ts_info ; +struct kernel_ethtool_ts_info ;extern const struct ef4_nic_type falcon_a1_nic_type;extern const struct ef4_nic_type falcon_b0_nic_type;
drivers/net/ethernet/sfc/ptp.c +1 -1
@@ -1864,7 +1864,7 @@ static int efx_ptp_ts_init(struct efx_nic *efx, struct kernel_hwtstamp_config *ireturn 0 ; } -void efx_ptp_get_ts_info (struct efx_nic *efx,struct ethtool_ts_info *ts_info) +void efx_ptp_get_ts_info (struct efx_nic *efx,struct kernel_ethtool_ts_info *ts_info) {struct efx_ptp_data *ptp = efx->ptp_data;struct efx_nic *primary = efx->primary;
drivers/net/ethernet/sfc/ptp.h +3 -2
@@ -12,7 +12,7 @@#include <linux/net_tstamp.h> #include "net_driver.h" -struct ethtool_ts_info ; +struct kernel_ethtool_ts_info ;int efx_ptp_probe (struct efx_nic *efx,struct efx_channel *channel);void efx_ptp_defer_probe_with_channel (struct efx_nic *efx);struct efx_channel *efx_ptp_channel (struct efx_nic *efx);
@@ -23,7 +23,8 @@ int efx_ptp_set_ts_config(struct efx_nic *efx, struct netlink_ext_ack *extack);int efx_ptp_get_ts_config (struct efx_nic *efx,struct kernel_hwtstamp_config *config); -void efx_ptp_get_ts_info (struct efx_nic *efx,struct ethtool_ts_info *ts_info); +void efx_ptp_get_ts_info (struct efx_nic *efx, +struct kernel_ethtool_ts_info *ts_info);bool efx_ptp_is_ptp_tx (struct efx_nic *efx,struct sk_buff *skb);int efx_ptp_get_mode (struct efx_nic *efx); int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
drivers/net/ethernet/sfc/siena/ethtool.c +1 -1
@@ -226,7 +226,7 @@ static void efx_ethtool_get_fec_stats(struct net_device *net_dev, }static int efx_ethtool_get_ts_info (struct net_device *net_dev, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct efx_nic *efx =netdev_priv (net_dev);
drivers/net/ethernet/sfc/siena/ptp.c +1 -1
@@ -1780,7 +1780,7 @@ static int efx_ptp_ts_init(struct efx_nic *efx, }void efx_siena_ptp_get_ts_info (struct efx_nic *efx, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct efx_ptp_data *ptp = efx->ptp_data;struct efx_nic *primary = efx->primary;
drivers/net/ethernet/sfc/siena/ptp.h +2 -2
@@ -12,7 +12,7 @@#include <linux/net_tstamp.h> #include "net_driver.h" -struct ethtool_ts_info ; +struct kernel_ethtool_ts_info ;void efx_siena_ptp_defer_probe_with_channel (struct efx_nic *efx);struct efx_channel *efx_siena_ptp_channel (struct efx_nic *efx); int efx_siena_ptp_set_ts_config(struct efx_nic *efx,
@@ -21,7 +21,7 @@ int efx_siena_ptp_set_ts_config(struct efx_nic *efx,int efx_siena_ptp_get_ts_config (struct efx_nic *efx,struct kernel_hwtstamp_config *config);void efx_siena_ptp_get_ts_info (struct efx_nic *efx, -struct ethtool_ts_info *ts_info); +struct kernel_ethtool_ts_info *ts_info);bool efx_siena_ptp_is_ptp_tx (struct efx_nic *efx,struct sk_buff *skb);int efx_siena_ptp_get_mode (struct efx_nic *efx); int efx_siena_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +1 -1
@@ -1199,7 +1199,7 @@ static int stmmac_set_channels(struct net_device *dev, }static int stmmac_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct stmmac_priv *priv =netdev_priv (dev);
drivers/net/ethernet/ti/am65-cpsw-ethtool.c +1 -1
@@ -692,7 +692,7 @@ static void am65_cpsw_get_eth_mac_stats(struct net_device *ndev, };static int am65_cpsw_get_ethtool_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct am65_cpsw_common *common =am65_ndev_to_common (ndev);unsigned int ptp_v2_filter;
drivers/net/ethernet/ti/cpsw_ethtool.c +2 -2
@@ -717,7 +717,7 @@ int cpsw_set_ringparam(struct net_device *ndev, }#if IS_ENABLED (CONFIG_TI_CPTS ) -int cpsw_get_ts_info (struct net_device *ndev,struct ethtool_ts_info *info) +int cpsw_get_ts_info (struct net_device *ndev,struct kernel_ethtool_ts_info *info) {struct cpsw_common *cpsw =ndev_to_cpsw (ndev);
@@ -738,7 +738,7 @@ int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info)return 0 ; }#else -int cpsw_get_ts_info (struct net_device *ndev,struct ethtool_ts_info *info) +int cpsw_get_ts_info (struct net_device *ndev,struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
drivers/net/ethernet/ti/cpsw_priv.h +1 -1
@@ -510,6 +510,6 @@ int cpsw_set_ringparam(struct net_device *ndev,int cpsw_set_channels_common (struct net_device *ndev,struct ethtool_channels *chs,cpdma_handler_fn rx_handler); -int cpsw_get_ts_info (struct net_device *ndev,struct ethtool_ts_info *info); +int cpsw_get_ts_info (struct net_device *ndev,struct kernel_ethtool_ts_info *info);#endif /* DRIVERS_NET_ETHERNET_TI_CPSW_PRIV_H_ */
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +1 -1
@@ -110,7 +110,7 @@ static void emac_get_ethtool_stats(struct net_device *ndev, }static int emac_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct prueth_emac *emac =netdev_priv (ndev);
drivers/net/ethernet/ti/netcp_ethss.c +2 -2
@@ -1999,7 +1999,7 @@ static int keystone_set_link_ksettings(struct net_device *ndev,#if IS_ENABLED (CONFIG_TI_CPTS )static int keystone_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct netcp_intf *netcp =netdev_priv (ndev);struct gbe_intf *gbe_intf;
@@ -2027,7 +2027,7 @@ static int keystone_get_ts_info(struct net_device *ndev, }#else static int keystone_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
drivers/net/ethernet/xscale/ixp4xx_eth.c +1 -1
@@ -1015,7 +1015,7 @@ static void ixp4xx_get_drvinfo(struct net_device *dev, }static int ixp4xx_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct port *port =netdev_priv (dev);
drivers/net/macvlan.c +1 -1
@@ -1084,7 +1084,7 @@ static int macvlan_ethtool_get_link_ksettings(struct net_device *dev, }static int macvlan_ethtool_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct net_device *real_dev =macvlan_dev_real_dev (dev);
drivers/net/netdevsim/ethtool.c +1 -1
@@ -148,7 +148,7 @@ nsim_get_fec_stats(struct net_device *dev, struct ethtool_fec_stats *fec_stats) }static int nsim_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct netdevsim *ns =netdev_priv (dev);
drivers/net/phy/bcm-phy-ptp.c +1 -1
@@ -841,7 +841,7 @@ static int bcm_ptp_hwtstamp(struct mii_timestamper *mii_ts, }static int bcm_ptp_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct bcm_ptp_private *priv =mii2priv (mii_ts);
drivers/net/phy/dp83640.c +1 -1
@@ -1395,7 +1395,7 @@ static void dp83640_txtstamp(struct mii_timestamper *mii_ts, }static int dp83640_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct dp83640_private *dp83640 = container_of(mii_ts, struct dp83640_private, mii_ts);
drivers/net/phy/micrel.c +2 -2
@@ -2462,7 +2462,7 @@ static void lan8814_ptp_tx_ts_get(struct phy_device *phydev, *seq_id =lanphy_read_page_reg (phydev,5 ,PTP_TX_MSG_HEADER2 ); } -static int lan8814_ts_info (struct mii_timestamper *mii_ts,struct ethtool_ts_info *info) +static int lan8814_ts_info (struct mii_timestamper *mii_ts,struct kernel_ethtool_ts_info *info) { struct kszphy_ptp_priv *ptp_priv = container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);struct phy_device *phydev = ptp_priv->phydev;
@@ -4219,7 +4219,7 @@ static irqreturn_t lan8841_handle_interrupt(struct phy_device *phydev) }static int lan8841_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct kszphy_ptp_priv *ptp_priv;
drivers/net/phy/mscc/mscc_ptp.c +1 -1
@@ -1134,7 +1134,7 @@ static int vsc85xx_hwtstamp(struct mii_timestamper *mii_ts, }static int vsc85xx_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct vsc8531_private *vsc8531 = container_of(mii_ts, struct vsc8531_private, mii_ts);
drivers/net/phy/nxp-c45-tja11xx.c +1 -1
@@ -1058,7 +1058,7 @@ static int nxp_c45_hwtstamp(struct mii_timestamper *mii_ts, }static int nxp_c45_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) { struct nxp_c45_phy *priv = container_of(mii_ts, struct nxp_c45_phy, mii_ts);
drivers/ptp/ptp_ines.c +1 -1
@@ -556,7 +556,7 @@ static bool ines_timestamp_expired(struct ines_timestamp *ts) }static int ines_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE |
drivers/s390/net/qeth_ethtool.c +1 -1
@@ -247,7 +247,7 @@ static int qeth_set_channels(struct net_device *dev, }static int qeth_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct qeth_card *card = dev->ml_priv;
include/linux/can/dev.h +1 -1
@@ -186,7 +186,7 @@ void close_candev(struct net_device *dev);int can_change_mtu (struct net_device *dev,int new_mtu);int can_eth_ioctl_hwts (struct net_device *netdev,struct ifreq *ifr,int cmd);int can_ethtool_op_get_ts_info_hwts (struct net_device *dev, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int register_candev (struct net_device *dev);void unregister_candev (struct net_device *dev);
include/linux/ethtool.h +22 -3
@@ -18,6 +18,7 @@#include <linux/if_ether.h> #include <linux/netlink.h> #include <uapi/linux/ethtool.h> +#include <uapi/linux/net_tstamp.h> struct compat_ethtool_rx_flow_spec {u32 flow_type;
@@ -661,6 +662,22 @@ struct ethtool_rxfh_param {u8 input_xfrm; }; +/** +* struct kernel_ethtool_ts_info - kernel copy of struct ethtool_ts_info +* @cmd: command number = %ETHTOOL_GET_TS_INFO +* @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags +* @phc_index: device index of the associated PHC, or -1 if there is none +* @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values +* @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values +*/ +struct kernel_ethtool_ts_info { +u32 cmd; +u32 so_timestamping; +int phc_index; +enum hwtstamp_tx_types tx_types; +enum hwtstamp_rx_filters rx_filters; +}; +/** * struct ethtool_ops - optional netdev operations * @cap_link_lanes_supported: indicates if the driver supports lanes
@@ -920,7 +937,7 @@ struct ethtool_ops {int (*get_dump_data)(struct net_device *,struct ethtool_dump *,void *);int (*set_dump)(struct net_device *,struct ethtool_dump *); -int (*get_ts_info)(struct net_device *,struct ethtool_ts_info *); +int (*get_ts_info)(struct net_device *,struct kernel_ethtool_ts_info *);void (*get_ts_stats)(struct net_device *dev,struct ethtool_ts_stats *ts_stats); int (*get_module_info)(struct net_device *,
@@ -1063,7 +1080,8 @@ int ethtool_get_phc_vclocks(struct net_device *dev, int **vclock_index);/* Some generic methods drivers may use in their ethtool_ops */ u32 ethtool_op_get_link (struct net_device *dev); -int ethtool_op_get_ts_info (struct net_device *dev,struct ethtool_ts_info *eti); +int ethtool_op_get_ts_info (struct net_device *dev, +struct kernel_ethtool_ts_info *eti);/** * ethtool_mm_frag_size_add_to_min - Translate (standard) additional fragment
@@ -1112,7 +1130,8 @@ static inline int ethtool_mm_frag_size_min_to_add(u32 val_min, u32 *val_add,* @info: buffer to hold the result * Returns zero on success, non-zero otherwise. */ -int ethtool_get_ts_info_by_layer (struct net_device *dev,struct ethtool_ts_info *info); +int ethtool_get_ts_info_by_layer (struct net_device *dev, +struct kernel_ethtool_ts_info *info);/** * ethtool_sprintf - Write formatted string to ethtool string data
include/linux/mii_timestamper.h +1 -1
@@ -59,7 +59,7 @@ struct mii_timestamper { struct phy_device *phydev);int (*ts_info)(struct mii_timestamper *mii_ts, -struct ethtool_ts_info *ts_info); +struct kernel_ethtool_ts_info *ts_info);struct device *device; };
include/linux/phy.h +1 -1
@@ -1614,7 +1614,7 @@ static inline bool phy_rxtstamp(struct phy_device *phydev, struct sk_buff *skb, }static inline int phy_ts_info (struct phy_device *phydev, -struct ethtool_ts_info *tsinfo) +struct kernel_ethtool_ts_info *tsinfo) {return phydev->mii_ts->ts_info (phydev->mii_ts, tsinfo); }
include/net/dsa.h +1 -1
@@ -940,7 +940,7 @@ struct dsa_switch_ops {* ethtool timestamp info */ int (*get_ts_info)(struct dsa_switch *ds,int port, -struct ethtool_ts_info *ts); +struct kernel_ethtool_ts_info *ts);/* * ethtool MAC merge layer
include/soc/mscc/ocelot.h +1 -1
@@ -1016,7 +1016,7 @@ void ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port,void ocelot_port_get_eth_phy_stats (struct ocelot *ocelot,int port,struct ethtool_eth_phy_stats *phy_stats);int ocelot_get_ts_info (struct ocelot *ocelot,int port, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);void ocelot_set_ageing_time (struct ocelot *ocelot,unsigned int msecs);int ocelot_port_vlan_filtering (struct ocelot *ocelot,int port,bool enabled,struct netlink_ext_ack *extack);
net/8021q/vlan_dev.c +1 -1
@@ -677,7 +677,7 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev, }static int vlan_ethtool_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {const struct vlan_dev_priv *vlan =vlan_dev_priv (dev);return ethtool_get_ts_info_by_layer (vlan->real_dev, info);
net/dsa/user.c +1 -1
@@ -1726,7 +1726,7 @@ static int dsa_user_set_rxnfc(struct net_device *dev, }static int dsa_user_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *ts) +struct kernel_ethtool_ts_info *ts) {struct dsa_user_priv *p =netdev_priv (dev);struct dsa_switch *ds = p->dp->ds;
net/ethtool/common.c +3 -3
@@ -629,7 +629,7 @@ int ethtool_check_ops(const struct ethtool_ops *ops)return 0 ; } -int __ethtool_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +int __ethtool_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) {const struct ethtool_ops *ops = dev->ethtool_ops;struct phy_device *phydev = dev->phydev;
@@ -651,7 +651,7 @@ int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)int ethtool_get_phc_vclocks (struct net_device *dev,int **vclock_index) { -struct ethtool_ts_info info = { }; +struct kernel_ethtool_ts_info info = { };int num =0 ;if (!__ethtool_get_ts_info (dev, &info))
@@ -661,7 +661,7 @@ int ethtool_get_phc_vclocks(struct net_device *dev, int **vclock_index) }EXPORT_SYMBOL (ethtool_get_phc_vclocks); -int ethtool_get_ts_info_by_layer (struct net_device *dev,struct ethtool_ts_info *info) +int ethtool_get_ts_info_by_layer (struct net_device *dev,struct kernel_ethtool_ts_info *info) {return __ethtool_get_ts_info (dev, info); }
net/ethtool/common.h +1 -1
@@ -44,7 +44,7 @@ bool convert_legacy_settings_to_link_ksettings( const struct ethtool_cmd *legacy_settings);int ethtool_get_max_rxfh_channel (struct net_device *dev,u32 *max);int ethtool_get_max_rxnfc_channel (struct net_device *dev,u64 *max); -int __ethtool_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info); +int __ethtool_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info);extern const struct ethtool_phy_ops *ethtool_phy_ops;extern const struct ethtool_pse_ops *ethtool_pse_ops;
net/ethtool/ioctl.c +10 -2
@@ -65,7 +65,8 @@ u32 ethtool_op_get_link(struct net_device *dev) }EXPORT_SYMBOL (ethtool_op_get_link); -int ethtool_op_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +int ethtool_op_get_ts_info (struct net_device *dev, +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
@@ -2443,13 +2444,20 @@ static int ethtool_get_dump_data(struct net_device *dev,static int ethtool_get_ts_info (struct net_device *dev,void __user *useraddr) { +struct kernel_ethtool_ts_info kernel_info;struct ethtool_ts_info info;int err; - err =__ethtool_get_ts_info (dev, &info); + err =__ethtool_get_ts_info (dev, &kernel_info);if (err)return err; + info.cmd = kernel_info.cmd; + info.so_timestamping = kernel_info.so_timestamping; + info.phc_index = kernel_info.phc_index; + info.tx_types = kernel_info.tx_types; + info.rx_filters = kernel_info.rx_filters; +if (copy_to_user (useraddr, &info,sizeof (info)))return -EFAULT ;
net/ethtool/tsinfo.c +3 -3
@@ -12,7 +12,7 @@ struct tsinfo_req_info {struct tsinfo_reply_data {struct ethnl_reply_data base; -struct ethtool_ts_info ts_info; +struct kernel_ethtool_ts_info ts_info;struct ethtool_ts_stats stats; };
@@ -55,7 +55,7 @@ static int tsinfo_reply_size(const struct ethnl_req_info *req_base, {const struct tsinfo_reply_data *data =TSINFO_REPDATA (reply_base);bool compact = req_base->flags ÐTOOL_FLAG_COMPACT_BITSETS ; -const struct ethtool_ts_info *ts_info = &data->ts_info; +const struct kernel_ethtool_ts_info *ts_info = &data->ts_info;int len =0 ;int ret;
@@ -136,7 +136,7 @@ static int tsinfo_fill_reply(struct sk_buff *skb, {const struct tsinfo_reply_data *data =TSINFO_REPDATA (reply_base);bool compact = req_base->flags ÐTOOL_FLAG_COMPACT_BITSETS ; -const struct ethtool_ts_info *ts_info = &data->ts_info; +const struct kernel_ethtool_ts_info *ts_info = &data->ts_info;int ret;if (ts_info->so_timestamping) {
net/sched/sch_taprio.c +1 -1
@@ -1613,7 +1613,7 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb,if (FULL_OFFLOAD_IS_ENABLED (q->flags)) {const struct ethtool_ops *ops = dev->ethtool_ops; -struct ethtool_ts_info info = { +struct kernel_ethtool_ts_info info = { .cmd =ETHTOOL_GET_TS_INFO , .phc_index =-1 , };
Signature · 1 line
2.34.1
Re: [PATCH net-next v14 07/14] net: Add struct kernel_ethtool_ts_info
Quoted 8 lines · Kory Maincent
In prevision to add new UAPI for hwtstamp we will be limited to the struct
ethtool_ts_infothat is currently passed in fixed binary format through theETHTOOL_GET_TS_INFOethtool ioctl. It would be good if new kernel code already started operating on an extensible kernel variant of that structure, similar in concept to structkernel_hwtstamp_configvs structhwtstamp_config.
Quoted 6 lines
Since struct
ethtool_ts_infois ininclude/uapi/linux/ethtool.h, here we introduce the kernel-only structure ininclude/linux/ethtool.h. The manual copy is then made in the function called byETHTOOL_GET_TS_INFO.Acked-by Alexandra Winter <[email protected]>Signed-off-by Kory Maincent <[email protected]>
Quoted 1,645 lines
---
Change in v8:
- New patchChange in v11:
- Remove a change of my out of tree patch.--- drivers/net/bonding/bond_main.c | 4 ++-- drivers/net/can/dev/dev.c | 2 +- drivers/net/can/peak_canfd/peak_canfd.c | 2 +- drivers/net/can/usb/gs_usb.c | 2 +- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 +- drivers/net/can/usb/peak_usb/pcan_usb_core.h | 2 +- drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c | 2 +- drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h | 2 +- drivers/net/dsa/microchip/ksz_ptp.c | 2 +- drivers/net/dsa/microchip/ksz_ptp.h | 2 +- drivers/net/dsa/mv88e6xxx/hwtstamp.c | 2 +- drivers/net/dsa/mv88e6xxx/hwtstamp.h | 4 ++-- drivers/net/dsa/ocelot/felix.c | 2 +- drivers/net/dsa/sja1105/sja1105_ptp.c | 2 +- drivers/net/dsa/sja1105/sja1105_ptp.h | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 2 +- .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 2 +- .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- drivers/net/ethernet/broadcom/tg3.c | 2 +- drivers/net/ethernet/cadence/macb.h | 2 +- drivers/net/ethernet/cadence/macb_main.c | 4 ++-- drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 2 +- .../net/ethernet/cavium/thunder/nicvf_ethtool.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 2 +- drivers/net/ethernet/cisco/enic/enic_ethtool.c | 2 +- drivers/net/ethernet/engleder/tsnep_ethtool.c | 2 +- drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 2 +- .../net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +- .../net/ethernet/freescale/enetc/enetc_ethtool.c | 2 +- drivers/net/ethernet/freescale/fec_main.c | 2 +- drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +- .../net/ethernet/fungible/funeth/funeth_ethtool.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h | 2 +- drivers/net/ethernet/intel/e1000e/ethtool.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +- .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 ++-- .../ethernet/mellanox/mlx5/core/ipoib/ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +- .../net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h | 10 ++++----- drivers/net/ethernet/microchip/lan743x_ethtool.c | 2 +- .../ethernet/microchip/lan966x/lan966x_ethtool.c | 2 +- .../net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +- drivers/net/ethernet/mscc/ocelot_net.c | 2 +- drivers/net/ethernet/mscc/ocelot_ptp.c | 2 +- .../net/ethernet/pensando/ionic/ionic_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ptp.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ptp.h | 2 +- drivers/net/ethernet/renesas/ravb_main.c | 2 +- drivers/net/ethernet/renesas/rswitch.c | 2 +- drivers/net/ethernet/sfc/ethtool.c | 2 +- drivers/net/ethernet/sfc/falcon/nic.h | 2 +- drivers/net/ethernet/sfc/ptp.c | 2 +- drivers/net/ethernet/sfc/ptp.h | 5 +++-- drivers/net/ethernet/sfc/siena/ethtool.c | 2 +- drivers/net/ethernet/sfc/siena/ptp.c | 2 +- drivers/net/ethernet/sfc/siena/ptp.h | 4 ++-- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +- drivers/net/ethernet/ti/am65-cpsw-ethtool.c | 2 +- drivers/net/ethernet/ti/cpsw_ethtool.c | 4 ++-- drivers/net/ethernet/ti/cpsw_priv.h | 2 +- drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 2 +- drivers/net/ethernet/ti/netcp_ethss.c | 4 ++-- drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +- drivers/net/macvlan.c | 2 +- drivers/net/netdevsim/ethtool.c | 2 +- drivers/net/phy/bcm-phy-ptp.c | 2 +- drivers/net/phy/dp83640.c | 2 +- drivers/net/phy/micrel.c | 4 ++-- drivers/net/phy/mscc/mscc_ptp.c | 2 +- drivers/net/phy/nxp-c45-tja11xx.c | 2 +- drivers/ptp/ptp_ines.c | 2 +- drivers/s390/net/qeth_ethtool.c | 2 +- include/linux/can/dev.h | 2 +- include/linux/ethtool.h | 25 +++++++++++++++++++--- include/linux/mii_timestamper.h | 2 +- include/linux/phy.h | 2 +- include/net/dsa.h | 2 +- include/soc/mscc/ocelot.h | 2 +- net/8021q/vlan_dev.c | 2 +- net/dsa/user.c | 2 +- net/ethtool/common.c | 6 +++--- net/ethtool/common.h | 2 +- net/ethtool/ioctl.c | 12 +++++++++-- net/ethtool/tsinfo.c | 6 +++--- net/sched/sch_taprio.c | 2 +- 100 files changed, 149 insertions(+), 121 deletions(-)drivers/net/bonding/bond_main.c +2
-2@@ -5755,10 +5755,10 @@ static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, }static int bond_ethtool_get_ts_info (struct net_device *bond_dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct bonding *bond =netdev_priv (bond_dev); -struct ethtool_ts_info ts_info; +struct kernel_ethtool_ts_info ts_info;struct net_device *real_dev;bool sw_tx_support = false;struct list_head *iter;drivers/net/can/dev/dev.c +1
-1@@ -376,7 +376,7 @@ EXPORT_SYMBOL(can_eth_ioctl_hwts);* supporting hardware timestamps */ int can_ethtool_op_get_ts_info_hwts (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |drivers/net/can/peak_canfd/peak_canfd.c +1
-1@@ -777,7 +777,7 @@ static const struct net_device_ops peak_canfd_netdev_ops = { };static int peak_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |drivers/net/can/usb/gs_usb.c +1
-1@@ -1145,7 +1145,7 @@ static int gs_usb_set_phys_id(struct net_device *netdev, }static int gs_usb_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct gs_can *dev =netdev_priv (netdev);drivers/net/can/usb/peak_usb/pcan_usb_core.c +1
-1@@ -897,7 +897,7 @@ int peak_usb_set_eeprom(struct net_device *netdev,return 0 ; } -int pcan_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +int pcan_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |drivers/net/can/usb/peak_usb/pcan_usb_core.h +1
-1@@ -145,7 +145,7 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *tv);int peak_usb_netif_rx_64 (struct sk_buff *skb,u32 ts_low,u32 ts_high);void peak_usb_async_complete (struct urb *urb);void peak_usb_restart_complete (struct peak_usb_device *dev); -int pcan_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info); +int pcan_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info);/* common 32-bit CAN channel ID ethtool management */ int peak_usb_get_eeprom_len (struct net_device *netdev);drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c +1
-1@@ -16,7 +16,7 @@#include "hellcreek_ptp.h" int hellcreek_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct hellcreek *hellcreek = ds->priv;drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h +1
-1@@ -48,7 +48,7 @@ void hellcreek_port_txtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb);int hellcreek_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);long hellcreek_hwtstamp_work (struct ptp_clock_info *ptp);drivers/net/dsa/microchip/ksz_ptp.c +1
-1@@ -293,7 +293,7 @@ static int ksz_ptp_enable_mode(struct ksz_device *dev)/* The function is return back the capability of timestamping feature when * requested through ethtool -T <interface> utility */ -int ksz_get_ts_info (struct dsa_switch *ds,int port,struct ethtool_ts_info *ts) +int ksz_get_ts_info (struct dsa_switch *ds,int port,struct kernel_ethtool_ts_info *ts) {struct ksz_device *dev = ds->priv;struct ksz_ptp_data *ptp_data;drivers/net/dsa/microchip/ksz_ptp.h +1
-1@@ -38,7 +38,7 @@ int ksz_ptp_clock_register(struct dsa_switch *ds);void ksz_ptp_clock_unregister (struct dsa_switch *ds);int ksz_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *ts); +struct kernel_ethtool_ts_info *ts);int ksz_hwtstamp_get (struct dsa_switch *ds,int port,struct ifreq *ifr);int ksz_hwtstamp_set (struct dsa_switch *ds,int port,struct ifreq *ifr);void ksz_port_txtstamp (struct dsa_switch *ds,int port,struct sk_buff *skb);drivers/net/dsa/mv88e6xxx/hwtstamp.c +1
-1@@ -64,7 +64,7 @@ static int mv88e6xxx_ptp_read(struct mv88e6xxx_chip *chip, int addr,#define TX_TSTAMP_TIMEOUT msecs_to_jiffies(40)int mv88e6xxx_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {const struct mv88e6xxx_ptp_ops *ptp_ops;struct mv88e6xxx_chip *chip;drivers/net/dsa/mv88e6xxx/hwtstamp.h +2
-2@@ -121,7 +121,7 @@ void mv88e6xxx_port_txtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb);int mv88e6xxx_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int mv88e6xxx_hwtstamp_setup (struct mv88e6xxx_chip *chip);void mv88e6xxx_hwtstamp_free (struct mv88e6xxx_chip *chip);@@ -157,7 +157,7 @@ static inline void mv88e6xxx_port_txtstamp(struct dsa_switch *ds, int port, }static inline int mv88e6xxx_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {return -EOPNOTSUPP ; }drivers/net/dsa/ocelot/felix.c +1
-1@@ -1220,7 +1220,7 @@ static int felix_get_sset_count(struct dsa_switch *ds, int port, int sset) }static int felix_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ocelot *ocelot = ds->priv;drivers/net/dsa/sja1105/sja1105_ptp.c +1
-1@@ -111,7 +111,7 @@ int sja1105_hwtstamp_get(struct dsa_switch *ds, int port, struct ifreq *ifr) }int sja1105_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct sja1105_private *priv = ds->priv;struct sja1105_ptp_data *ptp_data = &priv->ptp_data;drivers/net/dsa/sja1105/sja1105_ptp.h +1
-1@@ -101,7 +101,7 @@ void sja1105pqrs_ptp_cmd_packing(u8 *buf, struct sja1105_ptp_cmd *cmd, enum packing_op op);int sja1105_get_ts_info (struct dsa_switch *ds,int port, -struct ethtool_ts_info *ts); +struct kernel_ethtool_ts_info *ts);void sja1105_ptp_txtstamp_skb (struct dsa_switch *ds,int slot,struct sk_buff *clone);drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-1@@ -577,7 +577,7 @@ static int xgbe_set_rxfh(struct net_device *netdev, }static int xgbe_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct xgbe_prv_data *pdata =netdev_priv (netdev);drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +1
-1@@ -652,7 +652,7 @@ static int aq_ethtool_set_wol(struct net_device *ndev, }static int aq_ethtool_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct aq_nic_s *aq_nic =netdev_priv (ndev);drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +1
-1@@ -3634,7 +3634,7 @@ static int bnx2x_set_channels(struct net_device *dev, }static int bnx2x_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct bnx2x *bp =netdev_priv (dev);drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1
-1@@ -5013,7 +5013,7 @@ static int bnxt_get_dump_data(struct net_device *dev, struct ethtool_dump *dump, }static int bnxt_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct bnxt *bp =netdev_priv (dev);struct bnxt_ptp_cfg *ptp;drivers/net/ethernet/broadcom/tg3.c +1
-1@@ -6141,7 +6141,7 @@ static void tg3_refclk_write(struct tg3 *tp, u64 newval)static inline void tg3_full_lock (struct tg3 *tp,int irq_sync);static inline void tg3_full_unlock (struct tg3 *tp); -static int tg3_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +static int tg3_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) {struct tg3 *tp =netdev_priv (dev);drivers/net/ethernet/cadence/macb.h +1
-1@@ -1163,7 +1163,7 @@ struct macb_ptp_info {s32 (*get_ptp_max_adj)(void);unsigned int (*get_tsu_rate)(struct macb *bp);int (*get_ts_info)(struct net_device *dev, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int (*get_hwtst)(struct net_device *netdev,struct kernel_hwtstamp_config *tstamp_config); int (*set_hwtst)(struct net_device *netdev,drivers/net/ethernet/cadence/macb_main.c +2
-2@@ -3376,7 +3376,7 @@ static s32 gem_get_ptp_max_adj(void) }static int gem_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct macb *bp =netdev_priv (dev);@@ -3417,7 +3417,7 @@ static struct macb_ptp_info gem_ptp_info = {#endif static int macb_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct macb *bp =netdev_priv (netdev);drivers/net/ethernet/cavium/liquidio/lio_ethtool.c +1
-1@@ -2497,7 +2497,7 @@ static int lio_set_intr_coalesce(struct net_device *netdev, }static int lio_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct lio *lio =GET_LIO (netdev);drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c +1
-1@@ -836,7 +836,7 @@ static int nicvf_set_pauseparam(struct net_device *dev, }static int nicvf_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct nicvf *nic =netdev_priv (netdev);drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +1
-1@@ -1550,7 +1550,7 @@ static int set_flash(struct net_device *netdev, struct ethtool_flash *ef)return ret; } -static int get_ts_info (struct net_device *dev,struct ethtool_ts_info *ts_info) +static int get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *ts_info) {struct port_info *pi =netdev_priv (dev);struct adapter *adapter = pi->adapter;drivers/net/ethernet/cisco/enic/enic_ethtool.c +1
-1@@ -599,7 +599,7 @@ static int enic_set_rxfh(struct net_device *netdev, }static int enic_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping =SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE |drivers/net/ethernet/engleder/tsnep_ethtool.c +1
-1@@ -305,7 +305,7 @@ static void tsnep_ethtool_get_channels(struct net_device *netdev, }static int tsnep_ethtool_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct tsnep_adapter *adapter =netdev_priv (netdev);drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c +1
-1@@ -394,7 +394,7 @@ static int dpaa_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) }static int dpaa_get_ts_info (struct net_device *net_dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct device *dev = net_dev->dev.parent;struct device_node *mac_node = dev->of_node;drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +1
-1@@ -794,7 +794,7 @@ int dpaa2_phc_index = -1;EXPORT_SYMBOL (dpaa2_phc_index);static int dpaa2_eth_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {if (!dpaa2_ptp)return ethtool_op_get_ts_info (dev, info);drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +1
-1@@ -841,7 +841,7 @@ static int enetc_set_coalesce(struct net_device *ndev, }static int enetc_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {int *phc_idx;drivers/net/ethernet/freescale/fec_main.c +1
-1@@ -2762,7 +2762,7 @@ static void fec_enet_get_regs(struct net_device *ndev, }static int fec_enet_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct fec_enet_private *fep =netdev_priv (ndev);drivers/net/ethernet/freescale/gianfar_ethtool.c +1
-1@@ -1448,7 +1448,7 @@ static int gfar_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, }static int gfar_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct gfar_private *priv =netdev_priv (dev);struct platform_device *ptp_dev;drivers/net/ethernet/fungible/funeth/funeth_ethtool.c +1
-1@@ -1040,7 +1040,7 @@ static int fun_set_rxfh(struct net_device *netdev, }static int fun_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping =SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_RX_HARDWARE |drivers/net/ethernet/hisilicon/hns3/hnae3.h +1
-1@@ -786,7 +786,7 @@ struct hnae3_ae_ops {void (*get_rx_hwts)(struct hnae3_handle *handle,struct sk_buff *skb,u32 nsec,u32 sec);int (*get_ts_info)(struct hnae3_handle *handle, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int (*get_link_diagnosis_info)(struct hnae3_handle *handle,u32 *status_code);void (*clean_vf_config)(struct hnae3_ae_dev *ae_dev,int num_vfs);drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +1
-1@@ -2009,7 +2009,7 @@ static int hns3_set_tunable(struct net_device *netdev, ETHTOOL_RING_USE_TX_PUSH) static int hns3_get_ts_info(struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct hnae3_handle *handle =hns3_get_handle (netdev);drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c +1
-1@@ -378,7 +378,7 @@ int hclge_ptp_set_cfg(struct hclge_dev *hdev, struct ifreq *ifr) }int hclge_ptp_get_ts_info (struct hnae3_handle *handle, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct hclge_vport *vport =hclge_get_vport (handle);struct hclge_dev *hdev = vport->back;drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h +1
-1@@ -138,6 +138,6 @@ int hclge_ptp_set_cfg(struct hclge_dev *hdev, struct ifreq *ifr);int hclge_ptp_init (struct hclge_dev *hdev);void hclge_ptp_uninit (struct hclge_dev *hdev);int hclge_ptp_get_ts_info (struct hnae3_handle *handle, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int hclge_ptp_cfg_qry (struct hclge_dev *hdev,u32 *cfg);#endif drivers/net/ethernet/intel/e1000e/ethtool.c +1
-1@@ -2263,7 +2263,7 @@ static int e1000e_set_eee(struct net_device *netdev, struct ethtool_keee *edata) }static int e1000e_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct e1000_adapter *adapter =netdev_priv (netdev);drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1
-1@@ -2546,7 +2546,7 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset, }static int i40e_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct i40e_pf *pf =i40e_netdev_to_pf (dev);drivers/net/ethernet/intel/ice/ice_ethtool.c +1
-1@@ -3434,7 +3434,7 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh, }static int -ice_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +ice_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) {struct ice_pf *pf =ice_netdev_to_pf (dev);drivers/net/ethernet/intel/igb/igb_ethtool.c +1
-1@@ -2381,7 +2381,7 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) }static int igb_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct igb_adapter *adapter =netdev_priv (dev);drivers/net/ethernet/intel/igc/igc_ethtool.c +1
-1@@ -1559,7 +1559,7 @@ static int igc_ethtool_set_channels(struct net_device *netdev, }static int igc_ethtool_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct igc_adapter *adapter =netdev_priv (dev);drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +1
-1@@ -3170,7 +3170,7 @@ static int ixgbe_set_rxfh(struct net_device *netdev, }static int ixgbe_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ixgbe_adapter *adapter =netdev_priv (dev);drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1
-1@@ -5256,7 +5256,7 @@ static int mvpp2_get_ts_config(struct mvpp2_port *port, struct ifreq *ifr) }static int mvpp2_ethtool_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mvpp2_port *port =netdev_priv (dev);drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +1
-1@@ -954,7 +954,7 @@ static u32 otx2_get_link(struct net_device *netdev) }static int otx2_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct otx2_nic *pfvf =netdev_priv (netdev);drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +1
-1@@ -1903,7 +1903,7 @@ static int mlx4_en_set_channels(struct net_device *dev, }static int mlx4_en_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mlx4_en_priv *priv =netdev_priv (dev);struct mlx4_en_dev *mdev = priv->mdev;drivers/net/ethernet/mellanox/mlx5/core/en.h +1
-1@@ -1207,7 +1207,7 @@ int mlx5e_set_per_queue_coalesce(struct net_device *dev, u32 queue,u32 mlx5e_ethtool_get_rxfh_key_size (struct mlx5e_priv *priv);u32 mlx5e_ethtool_get_rxfh_indir_size (struct mlx5e_priv *priv);int mlx5e_ethtool_get_ts_info (struct mlx5e_priv *priv, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int mlx5e_ethtool_flash_device (struct mlx5e_priv *priv,struct ethtool_flash *flash);drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +2
-2@@ -1658,7 +1658,7 @@ static int mlx5e_set_pauseparam(struct net_device *netdev, }int mlx5e_ethtool_get_ts_info (struct mlx5e_priv *priv, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mlx5_core_dev *mdev = priv->mdev;@@ -1682,7 +1682,7 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv, }static int mlx5e_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mlx5e_priv *priv =netdev_priv (dev);drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c +1
-1@@ -136,7 +136,7 @@ static int mlx5i_get_coalesce(struct net_device *netdev, }static int mlx5i_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct mlx5e_priv *priv =mlx5i_epriv (netdev);drivers/net/ethernet/mellanox/mlxsw/spectrum.h +1
-1@@ -238,7 +238,7 @@ struct mlxsw_sp_ptp_ops { struct hwtstamp_config *config);void (*shaper_work)(struct work_struct *work);int (*get_ts_info)(struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int (*get_stats_count)(void );void (*get_stats_strings)(u8 **p); void (*get_stats)(struct mlxsw_sp_port *mlxsw_sp_port,drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +1
-1@@ -1068,7 +1068,7 @@ mlxsw_sp_get_module_eeprom_by_page(struct net_device *dev, }static int -mlxsw_sp_get_ts_info (struct net_device *netdev,struct ethtool_ts_info *info) +mlxsw_sp_get_ts_info (struct net_device *netdev,struct kernel_ethtool_ts_info *info) {struct mlxsw_sp_port *mlxsw_sp_port =netdev_priv (netdev);struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +2
-2@@ -1276,7 +1276,7 @@ int mlxsw_sp1_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, }int mlxsw_sp1_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->phc_index =ptp_clock_index (mlxsw_sp->clock->ptp);@@ -1661,7 +1661,7 @@ int mlxsw_sp2_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, }int mlxsw_sp2_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->phc_index =ptp_clock_index (mlxsw_sp->clock->ptp);drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h +5
-5@@ -11,7 +11,7 @@ struct mlxsw_sp;struct mlxsw_sp_port ;struct mlxsw_sp_ptp_clock ; -static inline int mlxsw_sp_ptp_get_ts_info_noptp (struct ethtool_ts_info *info) +static inline int mlxsw_sp_ptp_get_ts_info_noptp (struct kernel_ethtool_ts_info *info) { info->so_timestamping =SOF_TIMESTAMPING_RX_SOFTWARE |SOF_TIMESTAMPING_SOFTWARE ;@@ -50,7 +50,7 @@ int mlxsw_sp1_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port,void mlxsw_sp1_ptp_shaper_work (struct work_struct *work);int mlxsw_sp1_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int mlxsw_sp1_get_stats_count (void );void mlxsw_sp1_get_stats_strings (u8 **p);@@ -84,7 +84,7 @@ int mlxsw_sp2_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, struct hwtstamp_config *config);int mlxsw_sp2_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info); int mlxsw_sp2_ptp_txhdr_construct(struct mlxsw_core *mlxsw_core, struct mlxsw_sp_port *mlxsw_sp_port,@@ -152,7 +152,7 @@ static inline void mlxsw_sp1_ptp_shaper_work(struct work_struct *work) }static inline int mlxsw_sp1_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {return mlxsw_sp_ptp_get_ts_info_noptp (info); }@@ -227,7 +227,7 @@ mlxsw_sp2_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, }static inline int mlxsw_sp2_ptp_get_ts_info (struct mlxsw_sp *mlxsw_sp, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {return mlxsw_sp_ptp_get_ts_info_noptp (info); }drivers/net/ethernet/microchip/lan743x_ethtool.c +1
-1@@ -1029,7 +1029,7 @@ static int lan743x_ethtool_set_rxfh(struct net_device *netdev, }static int lan743x_ethtool_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct lan743x_adapter *adapter =netdev_priv (netdev);drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c +1
-1@@ -546,7 +546,7 @@ static int lan966x_set_pauseparam(struct net_device *dev, }static int lan966x_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct lan966x_port *port =netdev_priv (dev);struct lan966x *lan966x = port->lan966x;drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c +1
-1@@ -1183,7 +1183,7 @@ static void sparx5_config_port_stats(struct sparx5 *sparx5, int portno) }static int sparx5_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct sparx5_port *port =netdev_priv (dev);struct sparx5 *sparx5 = port->sparx5;drivers/net/ethernet/mscc/ocelot_net.c +1
-1@@ -980,7 +980,7 @@ static int ocelot_port_get_sset_count(struct net_device *dev, int sset) }static int ocelot_port_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ocelot_port_private *priv =netdev_priv (dev);struct ocelot *ocelot = priv->port.ocelot;drivers/net/ethernet/mscc/ocelot_ptp.c +1
-1@@ -580,7 +580,7 @@ int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr)EXPORT_SYMBOL (ocelot_hwstamp_set);int ocelot_get_ts_info (struct ocelot *ocelot,int port, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->phc_index = ocelot->ptp_clock ?ptp_clock_index (ocelot->ptp_clock) :-1 ;drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +1
-1@@ -968,7 +968,7 @@ static int ionic_get_module_eeprom(struct net_device *netdev, }static int ionic_get_ts_info (struct net_device *netdev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ionic_lif *lif =netdev_priv (netdev);struct ionic *ionic = lif->ionic;drivers/net/ethernet/qlogic/qede/qede_ethtool.c +1
-1@@ -1137,7 +1137,7 @@ static int qede_set_channels(struct net_device *dev, }static int qede_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct qede_dev *edev =netdev_priv (dev);drivers/net/ethernet/qlogic/qede/qede_ptp.c +1
-1@@ -321,7 +321,7 @@ int qede_ptp_hw_ts(struct qede_dev *edev, struct ifreq *ifr) sizeof(config)) ? -EFAULT : 0; } -int qede_ptp_get_ts_info (struct qede_dev *edev,struct ethtool_ts_info *info) +int qede_ptp_get_ts_info (struct qede_dev *edev,struct kernel_ethtool_ts_info *info) {struct qede_ptp *ptp = edev->ptp;drivers/net/ethernet/qlogic/qede/qede_ptp.h +1
-1@@ -17,7 +17,7 @@ void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb);int qede_ptp_hw_ts (struct qede_dev *edev,struct ifreq *req);void qede_ptp_disable (struct qede_dev *edev);int qede_ptp_enable (struct qede_dev *edev); -int qede_ptp_get_ts_info (struct qede_dev *edev,struct ethtool_ts_info *ts); +int qede_ptp_get_ts_info (struct qede_dev *edev,struct kernel_ethtool_ts_info *ts); static inline void qede_ptp_record_rx_ts(struct qede_dev *edev, union eth_rx_cqe *cqe,drivers/net/ethernet/renesas/ravb_main.c +1
-1@@ -1696,7 +1696,7 @@ static int ravb_set_ringparam(struct net_device *ndev, }static int ravb_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct ravb_private *priv =netdev_priv (ndev);const struct ravb_hw_info *hw_info = priv->info;drivers/net/ethernet/renesas/rswitch.c +1
-1@@ -1809,7 +1809,7 @@ static const struct net_device_ops rswitch_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, }; -static int rswitch_get_ts_info (struct net_device *ndev,struct ethtool_ts_info *info) +static int rswitch_get_ts_info (struct net_device *ndev,struct kernel_ethtool_ts_info *info) {struct rswitch_device *rdev =netdev_priv (ndev);drivers/net/ethernet/sfc/ethtool.c +1
-1@@ -226,7 +226,7 @@ static void efx_ethtool_get_fec_stats(struct net_device *net_dev, }static int efx_ethtool_get_ts_info (struct net_device *net_dev, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct efx_nic *efx =efx_netdev_priv (net_dev);drivers/net/ethernet/sfc/falcon/nic.h +1
-1@@ -297,7 +297,7 @@ static inline struct falcon_board *falcon_board(struct ef4_nic *efx)return &data->board; } -struct ethtool_ts_info ; +struct kernel_ethtool_ts_info ;extern const struct ef4_nic_type falcon_a1_nic_type;extern const struct ef4_nic_type falcon_b0_nic_type;drivers/net/ethernet/sfc/ptp.c +1
-1@@ -1864,7 +1864,7 @@ static int efx_ptp_ts_init(struct efx_nic *efx, struct kernel_hwtstamp_config *ireturn 0 ; } -void efx_ptp_get_ts_info (struct efx_nic *efx,struct ethtool_ts_info *ts_info) +void efx_ptp_get_ts_info (struct efx_nic *efx,struct kernel_ethtool_ts_info *ts_info) {struct efx_ptp_data *ptp = efx->ptp_data;struct efx_nic *primary = efx->primary;drivers/net/ethernet/sfc/ptp.h +3
-2@@ -12,7 +12,7 @@#include <linux/net_tstamp.h> #include "net_driver.h" -struct ethtool_ts_info ; +struct kernel_ethtool_ts_info ;int efx_ptp_probe (struct efx_nic *efx,struct efx_channel *channel);void efx_ptp_defer_probe_with_channel (struct efx_nic *efx);struct efx_channel *efx_ptp_channel (struct efx_nic *efx);@@ -23,7 +23,8 @@ int efx_ptp_set_ts_config(struct efx_nic *efx, struct netlink_ext_ack *extack);int efx_ptp_get_ts_config (struct efx_nic *efx,struct kernel_hwtstamp_config *config); -void efx_ptp_get_ts_info (struct efx_nic *efx,struct ethtool_ts_info *ts_info); +void efx_ptp_get_ts_info (struct efx_nic *efx, +struct kernel_ethtool_ts_info *ts_info);bool efx_ptp_is_ptp_tx (struct efx_nic *efx,struct sk_buff *skb);int efx_ptp_get_mode (struct efx_nic *efx); int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,drivers/net/ethernet/sfc/siena/ethtool.c +1
-1@@ -226,7 +226,7 @@ static void efx_ethtool_get_fec_stats(struct net_device *net_dev, }static int efx_ethtool_get_ts_info (struct net_device *net_dev, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct efx_nic *efx =netdev_priv (net_dev);drivers/net/ethernet/sfc/siena/ptp.c +1
-1@@ -1780,7 +1780,7 @@ static int efx_ptp_ts_init(struct efx_nic *efx, }void efx_siena_ptp_get_ts_info (struct efx_nic *efx, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct efx_ptp_data *ptp = efx->ptp_data;struct efx_nic *primary = efx->primary;drivers/net/ethernet/sfc/siena/ptp.h +2
-2@@ -12,7 +12,7 @@#include <linux/net_tstamp.h> #include "net_driver.h" -struct ethtool_ts_info ; +struct kernel_ethtool_ts_info ;void efx_siena_ptp_defer_probe_with_channel (struct efx_nic *efx);struct efx_channel *efx_siena_ptp_channel (struct efx_nic *efx); int efx_siena_ptp_set_ts_config(struct efx_nic *efx,@@ -21,7 +21,7 @@ int efx_siena_ptp_set_ts_config(struct efx_nic *efx,int efx_siena_ptp_get_ts_config (struct efx_nic *efx,struct kernel_hwtstamp_config *config);void efx_siena_ptp_get_ts_info (struct efx_nic *efx, -struct ethtool_ts_info *ts_info); +struct kernel_ethtool_ts_info *ts_info);bool efx_siena_ptp_is_ptp_tx (struct efx_nic *efx,struct sk_buff *skb);int efx_siena_ptp_get_mode (struct efx_nic *efx); int efx_siena_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +1
-1@@ -1199,7 +1199,7 @@ static int stmmac_set_channels(struct net_device *dev, }static int stmmac_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct stmmac_priv *priv =netdev_priv (dev);drivers/net/ethernet/ti/am65-cpsw-ethtool.c +1
-1@@ -692,7 +692,7 @@ static void am65_cpsw_get_eth_mac_stats(struct net_device *ndev, };static int am65_cpsw_get_ethtool_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct am65_cpsw_common *common =am65_ndev_to_common (ndev);unsigned int ptp_v2_filter;drivers/net/ethernet/ti/cpsw_ethtool.c +2
-2@@ -717,7 +717,7 @@ int cpsw_set_ringparam(struct net_device *ndev, }#if IS_ENABLED (CONFIG_TI_CPTS ) -int cpsw_get_ts_info (struct net_device *ndev,struct ethtool_ts_info *info) +int cpsw_get_ts_info (struct net_device *ndev,struct kernel_ethtool_ts_info *info) {struct cpsw_common *cpsw =ndev_to_cpsw (ndev);@@ -738,7 +738,7 @@ int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info)return 0 ; }#else -int cpsw_get_ts_info (struct net_device *ndev,struct ethtool_ts_info *info) +int cpsw_get_ts_info (struct net_device *ndev,struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |drivers/net/ethernet/ti/cpsw_priv.h +1
-1@@ -510,6 +510,6 @@ int cpsw_set_ringparam(struct net_device *ndev,int cpsw_set_channels_common (struct net_device *ndev,struct ethtool_channels *chs,cpdma_handler_fn rx_handler); -int cpsw_get_ts_info (struct net_device *ndev,struct ethtool_ts_info *info); +int cpsw_get_ts_info (struct net_device *ndev,struct kernel_ethtool_ts_info *info);#endif /* DRIVERS_NET_ETHERNET_TI_CPSW_PRIV_H_ */ drivers/net/ethernet/ti/icssg/icssg_ethtool.c +1
-1@@ -110,7 +110,7 @@ static void emac_get_ethtool_stats(struct net_device *ndev, }static int emac_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct prueth_emac *emac =netdev_priv (ndev);drivers/net/ethernet/ti/netcp_ethss.c +2
-2@@ -1999,7 +1999,7 @@ static int keystone_set_link_ksettings(struct net_device *ndev,#if IS_ENABLED (CONFIG_TI_CPTS )static int keystone_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct netcp_intf *netcp =netdev_priv (ndev);struct gbe_intf *gbe_intf;@@ -2027,7 +2027,7 @@ static int keystone_get_ts_info(struct net_device *ndev, }#else static int keystone_get_ts_info (struct net_device *ndev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |drivers/net/ethernet/xscale/ixp4xx_eth.c +1
-1@@ -1015,7 +1015,7 @@ static void ixp4xx_get_drvinfo(struct net_device *dev, }static int ixp4xx_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct port *port =netdev_priv (dev);drivers/net/macvlan.c +1
-1@@ -1084,7 +1084,7 @@ static int macvlan_ethtool_get_link_ksettings(struct net_device *dev, }static int macvlan_ethtool_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct net_device *real_dev =macvlan_dev_real_dev (dev);drivers/net/netdevsim/ethtool.c +1
-1@@ -148,7 +148,7 @@ nsim_get_fec_stats(struct net_device *dev, struct ethtool_fec_stats *fec_stats) }static int nsim_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct netdevsim *ns =netdev_priv (dev);drivers/net/phy/bcm-phy-ptp.c +1
-1@@ -841,7 +841,7 @@ static int bcm_ptp_hwtstamp(struct mii_timestamper *mii_ts, }static int bcm_ptp_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) {struct bcm_ptp_private *priv =mii2priv (mii_ts);drivers/net/phy/dp83640.c +1
-1@@ -1395,7 +1395,7 @@ static void dp83640_txtstamp(struct mii_timestamper *mii_ts, }static int dp83640_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct dp83640_private *dp83640 = container_of(mii_ts, struct dp83640_private, mii_ts);drivers/net/phy/micrel.c +2
-2@@ -2462,7 +2462,7 @@ static void lan8814_ptp_tx_ts_get(struct phy_device *phydev, *seq_id =lanphy_read_page_reg (phydev,5 ,PTP_TX_MSG_HEADER2 ); } -static int lan8814_ts_info (struct mii_timestamper *mii_ts,struct ethtool_ts_info *info) +static int lan8814_ts_info (struct mii_timestamper *mii_ts,struct kernel_ethtool_ts_info *info) { struct kszphy_ptp_priv *ptp_priv = container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);struct phy_device *phydev = ptp_priv->phydev;@@ -4219,7 +4219,7 @@ static irqreturn_t lan8841_handle_interrupt(struct phy_device *phydev) }static int lan8841_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct kszphy_ptp_priv *ptp_priv;drivers/net/phy/mscc/mscc_ptp.c +1
-1@@ -1134,7 +1134,7 @@ static int vsc85xx_hwtstamp(struct mii_timestamper *mii_ts, }static int vsc85xx_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct vsc8531_private *vsc8531 = container_of(mii_ts, struct vsc8531_private, mii_ts);drivers/net/phy/nxp-c45-tja11xx.c +1
-1@@ -1058,7 +1058,7 @@ static int nxp_c45_hwtstamp(struct mii_timestamper *mii_ts, }static int nxp_c45_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *ts_info) +struct kernel_ethtool_ts_info *ts_info) { struct nxp_c45_phy *priv = container_of(mii_ts, struct nxp_c45_phy, mii_ts);drivers/ptp/ptp_ines.c +1
-1@@ -556,7 +556,7 @@ static bool ines_timestamp_expired(struct ines_timestamp *ts) }static int ines_ts_info (struct mii_timestamper *mii_ts, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE |drivers/s390/net/qeth_ethtool.c +1
-1@@ -247,7 +247,7 @@ static int qeth_set_channels(struct net_device *dev, }static int qeth_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {struct qeth_card *card = dev->ml_priv;include/linux/can/dev.h +1
-1@@ -186,7 +186,7 @@ void close_candev(struct net_device *dev);int can_change_mtu (struct net_device *dev,int new_mtu);int can_eth_ioctl_hwts (struct net_device *netdev,struct ifreq *ifr,int cmd);int can_ethtool_op_get_ts_info_hwts (struct net_device *dev, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);int register_candev (struct net_device *dev);void unregister_candev (struct net_device *dev);include/linux/ethtool.h +22
-3@@ -18,6 +18,7 @@#include <linux/if_ether.h> #include <linux/netlink.h> #include <uapi/linux/ethtool.h> +#include <uapi/linux/net_tstamp.h> struct compat_ethtool_rx_flow_spec {u32 flow_type;@@ -661,6 +662,22 @@ struct ethtool_rxfh_param {u8 input_xfrm; }; +/** +* struct kernel_ethtool_ts_info - kernel copy of struct ethtool_ts_info +* @cmd: command number = %ETHTOOL_GET_TS_INFO +* @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags +* @phc_index: device index of the associated PHC, or -1 if there is none +* @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values +* @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values +*/ +struct kernel_ethtool_ts_info { +u32 cmd; +u32 so_timestamping; +int phc_index; +enum hwtstamp_tx_types tx_types; +enum hwtstamp_rx_filters rx_filters; +}; +/** * struct ethtool_ops - optional netdev operations * @cap_link_lanes_supported: indicates if the driver supports lanes @@ -920,7 +937,7 @@ struct ethtool_ops {int (*get_dump_data)(struct net_device *,struct ethtool_dump *,void *);int (*set_dump)(struct net_device *,struct ethtool_dump *); -int (*get_ts_info)(struct net_device *,struct ethtool_ts_info *); +int (*get_ts_info)(struct net_device *,struct kernel_ethtool_ts_info *);void (*get_ts_stats)(struct net_device *dev,struct ethtool_ts_stats *ts_stats); int (*get_module_info)(struct net_device *,@@ -1063,7 +1080,8 @@ int ethtool_get_phc_vclocks(struct net_device *dev, int **vclock_index);/* Some generic methods drivers may use in their ethtool_ops */ u32 ethtool_op_get_link (struct net_device *dev); -int ethtool_op_get_ts_info (struct net_device *dev,struct ethtool_ts_info *eti); +int ethtool_op_get_ts_info (struct net_device *dev, +struct kernel_ethtool_ts_info *eti);/** * ethtool_mm_frag_size_add_to_min - Translate (standard) additional fragment @@ -1112,7 +1130,8 @@ static inline int ethtool_mm_frag_size_min_to_add(u32 val_min, u32 *val_add,* @info: buffer to hold the result * Returns zero on success, non-zero otherwise. */ -int ethtool_get_ts_info_by_layer (struct net_device *dev,struct ethtool_ts_info *info); +int ethtool_get_ts_info_by_layer (struct net_device *dev, +struct kernel_ethtool_ts_info *info);/** * ethtool_sprintf - Write formatted string to ethtool string data include/linux/mii_timestamper.h +1
-1@@ -59,7 +59,7 @@ struct mii_timestamper { struct phy_device *phydev);int (*ts_info)(struct mii_timestamper *mii_ts, -struct ethtool_ts_info *ts_info); +struct kernel_ethtool_ts_info *ts_info);struct device *device; };include/linux/phy.h +1
-1@@ -1614,7 +1614,7 @@ static inline bool phy_rxtstamp(struct phy_device *phydev, struct sk_buff *skb, }static inline int phy_ts_info (struct phy_device *phydev, -struct ethtool_ts_info *tsinfo) +struct kernel_ethtool_ts_info *tsinfo) {return phydev->mii_ts->ts_info (phydev->mii_ts, tsinfo); }include/net/dsa.h +1
-1@@ -940,7 +940,7 @@ struct dsa_switch_ops {* ethtool timestamp info */ int (*get_ts_info)(struct dsa_switch *ds,int port, -struct ethtool_ts_info *ts); +struct kernel_ethtool_ts_info *ts);/* * ethtool MAC merge layer include/soc/mscc/ocelot.h +1
-1@@ -1016,7 +1016,7 @@ void ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port,void ocelot_port_get_eth_phy_stats (struct ocelot *ocelot,int port,struct ethtool_eth_phy_stats *phy_stats);int ocelot_get_ts_info (struct ocelot *ocelot,int port, -struct ethtool_ts_info *info); +struct kernel_ethtool_ts_info *info);void ocelot_set_ageing_time (struct ocelot *ocelot,unsigned int msecs);int ocelot_port_vlan_filtering (struct ocelot *ocelot,int port,bool enabled,struct netlink_ext_ack *extack);net/8021q/vlan_dev.c +1
-1@@ -677,7 +677,7 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev, }static int vlan_ethtool_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *info) +struct kernel_ethtool_ts_info *info) {const struct vlan_dev_priv *vlan =vlan_dev_priv (dev);return ethtool_get_ts_info_by_layer (vlan->real_dev, info);net/dsa/user.c +1
-1@@ -1726,7 +1726,7 @@ static int dsa_user_set_rxnfc(struct net_device *dev, }static int dsa_user_get_ts_info (struct net_device *dev, -struct ethtool_ts_info *ts) +struct kernel_ethtool_ts_info *ts) {struct dsa_user_priv *p =netdev_priv (dev);struct dsa_switch *ds = p->dp->ds;net/ethtool/common.c +3
-3@@ -629,7 +629,7 @@ int ethtool_check_ops(const struct ethtool_ops *ops)return 0 ; } -int __ethtool_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +int __ethtool_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) {const struct ethtool_ops *ops = dev->ethtool_ops;struct phy_device *phydev = dev->phydev;@@ -651,7 +651,7 @@ int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)int ethtool_get_phc_vclocks (struct net_device *dev,int **vclock_index) { -struct ethtool_ts_info info = { }; +struct kernel_ethtool_ts_info info = { };int num =0 ;if (!__ethtool_get_ts_info (dev, &info))@@ -661,7 +661,7 @@ int ethtool_get_phc_vclocks(struct net_device *dev, int **vclock_index) }EXPORT_SYMBOL (ethtool_get_phc_vclocks); -int ethtool_get_ts_info_by_layer (struct net_device *dev,struct ethtool_ts_info *info) +int ethtool_get_ts_info_by_layer (struct net_device *dev,struct kernel_ethtool_ts_info *info) {return __ethtool_get_ts_info (dev, info); }net/ethtool/common.h +1
-1@@ -44,7 +44,7 @@ bool convert_legacy_settings_to_link_ksettings( const struct ethtool_cmd *legacy_settings);int ethtool_get_max_rxfh_channel (struct net_device *dev,u32 *max);int ethtool_get_max_rxnfc_channel (struct net_device *dev,u64 *max); -int __ethtool_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info); +int __ethtool_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info);extern const struct ethtool_phy_ops *ethtool_phy_ops;extern const struct ethtool_pse_ops *ethtool_pse_ops;net/ethtool/ioctl.c +10
-2@@ -65,7 +65,8 @@ u32 ethtool_op_get_link(struct net_device *dev) }EXPORT_SYMBOL (ethtool_op_get_link); -int ethtool_op_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info) +int ethtool_op_get_ts_info (struct net_device *dev, +struct kernel_ethtool_ts_info *info) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |@@ -2443,13 +2444,20 @@ static int ethtool_get_dump_data(struct net_device *dev,static int ethtool_get_ts_info (struct net_device *dev,void __user *useraddr) { +struct kernel_ethtool_ts_info kernel_info;struct ethtool_ts_info info;int err; - err =__ethtool_get_ts_info (dev, &info); + err =__ethtool_get_ts_info (dev, &kernel_info);if (err)return err; + info.cmd = kernel_info.cmd; + info.so_timestamping = kernel_info.so_timestamping; + info.phc_index = kernel_info.phc_index; + info.tx_types = kernel_info.tx_types; + info.rx_filters = kernel_info.rx_filters; +if (copy_to_user (useraddr, &info,sizeof (info)))return -EFAULT ;net/ethtool/tsinfo.c +3
-3@@ -12,7 +12,7 @@ struct tsinfo_req_info {struct tsinfo_reply_data {struct ethnl_reply_data base; -struct ethtool_ts_info ts_info; +struct kernel_ethtool_ts_info ts_info;struct ethtool_ts_stats stats; };@@ -55,7 +55,7 @@ static int tsinfo_reply_size(const struct ethnl_req_info *req_base, {const struct tsinfo_reply_data *data =TSINFO_REPDATA (reply_base);bool compact = req_base->flags ÐTOOL_FLAG_COMPACT_BITSETS ; -const struct ethtool_ts_info *ts_info = &data->ts_info; +const struct kernel_ethtool_ts_info *ts_info = &data->ts_info;int len =0 ;int ret;@@ -136,7 +136,7 @@ static int tsinfo_fill_reply(struct sk_buff *skb, {const struct tsinfo_reply_data *data =TSINFO_REPDATA (reply_base);bool compact = req_base->flags ÐTOOL_FLAG_COMPACT_BITSETS ; -const struct ethtool_ts_info *ts_info = &data->ts_info; +const struct kernel_ethtool_ts_info *ts_info = &data->ts_info;int ret;if (ts_info->so_timestamping) {net/sched/sch_taprio.c +1
-2@@ -1613,7 +1613,7 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb,if (FULL_OFFLOAD_IS_ENABLED (q->flags)) {const struct ethtool_ops *ops = dev->ethtool_ops; -struct ethtool_ts_info info = { +struct kernel_ethtool_ts_info info = { .cmd =ETHTOOL_GET_TS_INFO , .phc_index =-1 , }; --2.34.1
Paolo Abeni
maintainerRe: [PATCH net-next v14 07/14] net: Add struct kernel_ethtool_ts_info
In reply to Kory MaincentQuoted 8 lines · Kory Maincent
net/ethtool/ioctl.c +1
-0@@ -2443,13 +2444,20 @@ static int ethtool_get_dump_data(struct net_device *dev,static int ethtool_get_ts_info (struct net_device *dev,void __user *useraddr) { +struct kernel_ethtool_ts_info kernel_info;struct ethtool_ts_info info;int err;
net/ethtool/ioctl.c static int ethtool_get_dump_data(struct net_device *dev, · line 2459
Quoted 10 lines
net/ethtool/ioctl.c +6
-1- err =__ethtool_get_ts_info (dev, &info); + err =__ethtool_get_ts_info (dev, &kernel_info);if (err)return err; + info.cmd = kernel_info.cmd; + info.so_timestamping = kernel_info.so_timestamping; + info.phc_index = kernel_info.phc_index; + info.tx_types = kernel_info.tx_types; + info.rx_filters = kernel_info.rx_filters;
It looks like 'info' is not zeroed anymore...
net/ethtool/ioctl.c static int ethtool_get_dump_data(struct net_device *dev, · line 2462
Quoted 3 lines
net/ethtool/ioctl.c +1
-0+if (copy_to_user (useraddr, &info,sizeof (info)))return -EFAULT ;
... so this risk exposing to user-space unintialized kernel memory
Cheers,
Paolo
Re: [PATCH net-next v14 07/14] net: Add struct kernel_ethtool_ts_info
Quoted 8 lines · On Thu, 06 Jun 2024 11:14:47 +0200 Paolo Abeni <[email protected]> wrote:
On Tue, 2024-06-04 at 12:39 +0200, Kory Maincent wrote:
[...]It looks like 'info' is not zeroed anymore...
[...]
... so this risk exposing to user-space unintialized kernel memory
You are right, tx/rx_reserved fields are indeed not initialized anymore. Thanks for spotting it!
Regards,
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH v14 8/14 ptp: Add phc source and helpers to register specific PTP clock or get information
In reply to Kory MaincentPrepare for future hardware timestamp selection by adding source and corresponding pointers to ptp_clock structure.
Additionally, introduce helpers for registering specific phydev or netdev PTP clocks, retrieving PTP clock information such as hwtstamp source or phydev/netdev pointers, and obtaining the ptp_clock structure from the phc index.
These helpers are added to a new ptp_clock_consumer.c file, built as builtin. This is necessary because these helpers will be called by ethtool or net timestamping, which are builtin code.
---
Change in v8:
- New patch.
Change in v10:
- Add get and put function to avoid unregistering a ptp clock object used.
- Fix kdoc issues.
Change in v11:
- Remove useless extern.
Change in v12:
- Add missing return description in the kdoc.
Change in v13:
- Remove a semicolon which bring errors while not building PTP driver.
- Remove few useless EXPORT_SYMBOL().
- Separate PTP consumer symbole which are builtin from PTP provider.
Change in v14:
- Add back missing EXPORT_SYMBOL().
--- drivers/ptp/Makefile | 5 ++ drivers/ptp/ptp_clock.c | 33 ++++++++++- drivers/ptp/ptp_clock_consumer.c | 100 +++++++++++++++++++++++++++++++ drivers/ptp/ptp_private.h | 7 +++ include/linux/ptp_clock_kernel.h | 125 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 269 insertions(+), 1 deletion(-)
drivers/ptp/Makefile +5 -0
@@ -3,6 +3,11 @@ # Makefile for PTP 1588 clock support. # +ifdef CONFIG_PTP_1588_CLOCK +# The ptp_clock consumer is built-in whenever PTP_1588_CLOCK is built-in +# or module +obj-y := ptp_clock_consumer.o +endif ptp-y := ptp_clock.o ptp_chardev.o ptp_sysfs.o ptp_vclock.o ptp_kvm-$(CONFIG_X86) := ptp_kvm_x86.o ptp_kvm_common.o ptp_kvm-$(CONFIG_HAVE_ARM_SMCCC) := ptp_kvm_arm.o ptp_kvm_common.o
drivers/ptp/ptp_clock.c +32 -1
@@ -34,7 +34,6 @@ const struct class ptp_class = {static dev_t ptp_devt; -static DEFINE_XARRAY_ALLOC (ptp_clocks_map);/* time stamp event queue operations */
@@ -512,6 +511,38 @@ void ptp_cancel_worker_sync(struct ptp_clock *ptp) }EXPORT_SYMBOL (ptp_cancel_worker_sync); +struct ptp_clock *netdev_ptp_clock_register (struct ptp_clock_info *info, +struct net_device *dev) +{ +struct ptp_clock *ptp; + + ptp =ptp_clock_register (info, &dev->dev); +if (IS_ERR (ptp)) +return ptp; + + ptp->phc_source =HWTSTAMP_SOURCE_NETDEV ; + ptp->netdev = dev; + +return ptp; +} +EXPORT_SYMBOL (netdev_ptp_clock_register); + +struct ptp_clock *phydev_ptp_clock_register (struct ptp_clock_info *info, +struct phy_device *phydev) +{ +struct ptp_clock *ptp; + + ptp =ptp_clock_register (info, &phydev->mdio.dev); +if (IS_ERR (ptp)) +return ptp; + + ptp->phc_source =HWTSTAMP_SOURCE_PHYLIB ; + ptp->phydev = phydev; + +return ptp; +} +EXPORT_SYMBOL (phydev_ptp_clock_register); +/* module operations */ static void __exit ptp_exit(void)
drivers/ptp/ptp_clock_consumer.c new file +100 -0
100 lines not on this page · raw message
drivers/ptp/ptp_private.h +7 -0
@@ -24,6 +24,8 @@#define PTP_DEFAULT_MAX_VCLOCKS 20#define PTP_MAX_CHANNELS 2048 +extern struct xarray ptp_clocks_map; +struct timestamp_event_queue {struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS ];int head;
@@ -41,6 +43,11 @@ struct ptp_clock {struct ptp_clock_info *info;dev_t devid;int index;/* index into clocks.map */ +enum hwtstamp_source phc_source; +union {/* Pointer of the phc_source device */ +struct net_device *netdev; +struct phy_device *phydev; + };struct pps_device *pps_source;long dialed_frequency;/* remembers the frequency adjustment */ struct list_head tsevqs;/* timestamp fifo list */
include/linux/ptp_clock_kernel.h +125 -0
144 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v14 9/14 net: Add the possibility to support a selected hwtstamp in netdevice
In reply to Kory MaincentIntroduce the description of a hwtstamp provider which is define with a ptp_clock pointer and a qualifier value.
Add a hwtstamp provider description within the netdev structure to be able to select the hwtstamp we want too use. By default we use the old API that does not support hwtstamp selectability which mean the hwtstamp ptp_clock pointer is unset.
---
Change in v8:
- New patch
Change in v10:
- Set hwtstamp in netdevice as a pointer for future use of rcu lock.
- Fix a nit in teh order of setting phydev pointer.
- Add a missing kdoc description.
Change in v13:
- Remove an include from netdevices.h.
--- drivers/net/phy/phy_device.c | 10 ++++++++++ include/linux/net_tstamp.h | 7 +++++++ include/linux/netdevice.h | 5 +++++ include/uapi/linux/net_tstamp.h | 11 +++++++++++ net/core/dev_ioctl.c | 38 ++++++++++++++++++++++++++++++++++++-- net/core/timestamping.c | 38 +++++++++++++++++++++++++++++++++----- 6 files changed, 102 insertions(+), 7 deletions(-)
drivers/net/phy/phy_device.c +10 -0
@@ -31,6 +31,7 @@#include <linux/phy_led_triggers.h> #include <linux/pse-pd/pse.h> #include <linux/property.h> +#include <linux/ptp_clock_kernel.h> #include <linux/rtnetlink.h> #include <linux/sfp.h> #include <linux/skbuff.h>
@@ -1936,6 +1937,15 @@ void phy_detach(struct phy_device *phydev)phy_suspend (phydev);if (dev) { +struct hwtstamp_provider *hwtstamp = dev->hwtstamp; + +/* Disable timestamp if selected */ +if (hwtstamp && +ptp_clock_phydev (hwtstamp->ptp) == phydev) { + dev->hwtstamp =NULL ; +kfree (hwtstamp); + } + phydev->attached_dev->phydev =NULL ; phydev->attached_dev =NULL ; }
include/linux/net_tstamp.h +7 -0
@@ -19,6 +19,11 @@ enum hwtstamp_source { HWTSTAMP_SOURCE_PHYLIB, }; +struct hwtstamp_provider { +struct ptp_clock *ptp; +enum hwtstamp_provider_qualifier qualifier; +}; +/** * struct kernel_hwtstamp_config - Kernel copy of struct hwtstamp_config *
@@ -31,6 +36,7 @@ enum hwtstamp_source {* copied the ioctl request back to user space * @source: indication whether timestamps should come from the netdev or from * an attached phylib PHY +* @qualifier: qualifier of the hwtstamp provider * * Prefer using this structure for in-kernel processing of hardware * timestamping configuration, over the inextensible struct hwtstamp_config
@@ -43,6 +49,7 @@ struct kernel_hwtstamp_config {struct ifreq *ifr;bool copied_to_user;enum hwtstamp_source source; +enum hwtstamp_provider_qualifier qualifier; }; static inline void hwtstamp_config_to_kernel(struct kernel_hwtstamp_config *kernel_cfg,
include/linux/netdevice.h +5 -0
@@ -79,6 +79,7 @@ struct xdp_buff;struct xdp_frame ;struct xdp_metadata_ops ;struct xdp_md ; +struct hwtstamp_provider ;typedef u32 xdp_features_t ;
@@ -2026,6 +2027,8 @@ enum netdev_reg_state {* @dpll_pin: Pointer to the SyncE source pin of a DPLL subsystem, * where the clock is recovered. * +* @hwtstamp: Tracks which PTP performs hardware packet time stamping. +* * FIXME: cleanup struct net_device such that network protocol info * moves out. */
@@ -2401,6 +2404,8 @@ struct net_device {/** @page_pools: page pools created for this netdevice */ struct hlist_head page_pools;#endif + +struct hwtstamp_provider *hwtstamp; };#define to_net_dev (d) container_of(d, struct net_device, dev)
include/uapi/linux/net_tstamp.h +11 -0
@@ -13,6 +13,17 @@#include <linux/types.h> #include <linux/socket.h> /* for SO_TIMESTAMPING */ +/* +* Possible type of htstamp provider. Mainly "precise" the default one +* is for IEEE 1588 quality and "approx" is for NICs DMA point. +*/ +enum hwtstamp_provider_qualifier { +HWTSTAMP_PROVIDER_QUALIFIER_PRECISE , +HWTSTAMP_PROVIDER_QUALIFIER_APPROX , + +HWTSTAMP_PROVIDER_QUALIFIER_CNT , +}; +/* SO_TIMESTAMPING flags */ enum {SOF_TIMESTAMPING_TX_HARDWARE = (1 <<0 ),
net/core/dev_ioctl.c +36 -2
@@ -6,6 +6,7 @@#include <linux/rtnetlink.h> #include <linux/net_tstamp.h> #include <linux/phylib_stubs.h> +#include <linux/ptp_clock_kernel.h> #include <linux/wireless.h> #include <linux/if_bridge.h> #include <net/dsa_stubs.h>
@@ -269,6 +270,19 @@ static int dev_eth_ioctl(struct net_device *dev,int dev_get_hwtstamp_phylib (struct net_device *dev,struct kernel_hwtstamp_config *cfg) { +if (dev->hwtstamp) { +struct ptp_clock *ptp = dev->hwtstamp->ptp; + + cfg->qualifier = dev->hwtstamp->qualifier; +if (ptp_clock_from_phylib (ptp)) +return phy_hwtstamp_get (ptp_clock_phydev (ptp), cfg); + +if (ptp_clock_from_netdev (ptp)) +return dev->netdev_ops->ndo_hwtstamp_get (dev, cfg); + +return -EOPNOTSUPP ; + } +if (phy_is_default_hwtstamp (dev->phydev))return phy_hwtstamp_get (dev->phydev, cfg);
@@ -325,11 +339,31 @@ int dev_set_hwtstamp_phylib(struct net_device *dev, struct netlink_ext_ack *extack) {const struct net_device_ops *ops = dev->netdev_ops; -bool phy_ts =phy_is_default_hwtstamp (dev->phydev);struct kernel_hwtstamp_config old_cfg = {}; +struct phy_device *phydev;bool changed = false; +bool phy_ts;int err; +if (dev->hwtstamp) { +struct ptp_clock *ptp = dev->hwtstamp->ptp; + +if (ptp_clock_from_phylib (ptp)) { + phy_ts = true; + phydev =ptp_clock_phydev (ptp); + }else if (ptp_clock_from_netdev (ptp)) { + phy_ts = false; + }else { +return -EOPNOTSUPP ; + } + + cfg->qualifier = dev->hwtstamp->qualifier; + }else { + phy_ts =phy_is_default_hwtstamp (dev->phydev); +if (phy_ts) + phydev = dev->phydev; + } + cfg->source = phy_ts ?HWTSTAMP_SOURCE_PHYLIB :HWTSTAMP_SOURCE_NETDEV ;if (phy_ts && (dev->priv_flags &IFF_SEE_ALL_HWTSTAMP_REQUESTS )) {
@@ -351,7 +385,7 @@ int dev_set_hwtstamp_phylib(struct net_device *dev, changed =kernel_hwtstamp_config_changed (&old_cfg, cfg);if (phy_ts) { - err =phy_hwtstamp_set (dev->phydev, cfg, extack); + err =phy_hwtstamp_set (phydev, cfg, extack);if (err) {if (changed) ops->ndo_hwtstamp_set (dev, &old_cfg,NULL );
net/core/timestamping.c +33 -5
@@ -9,6 +9,7 @@#include <linux/ptp_classify.h> #include <linux/skbuff.h> #include <linux/export.h> +#include <linux/ptp_clock_kernel.h> static unsigned int classify (const struct sk_buff *skb) {
@@ -22,18 +23,31 @@ static unsigned int classify(const struct sk_buff *skb)void skb_clone_tx_timestamp (struct sk_buff *skb) {struct mii_timestamper *mii_ts; +struct phy_device *phydev;struct sk_buff *clone;unsigned int type; -if (!skb->sk || !skb->dev || - !phy_is_default_hwtstamp (skb->dev->phydev)) +if (!skb->sk || !skb->dev)return ; +if (skb->dev->hwtstamp) { +struct ptp_clock *ptp = skb->dev->hwtstamp->ptp; + +if (!ptp_clock_from_phylib (ptp)) +return ; + + phydev =ptp_clock_phydev (ptp); + }else { + phydev = skb->dev->phydev; +if (!phy_is_default_hwtstamp (phydev)) +return ; + } + type =classify (skb);if (type ==PTP_CLASS_NONE )return ; - mii_ts = skb->dev->phydev->mii_ts; + mii_ts = phydev->mii_ts;if (likely (mii_ts->txtstamp)) { clone =skb_clone_sk (skb);if (!clone)
@@ -46,11 +60,25 @@ EXPORT_SYMBOL_GPL(skb_clone_tx_timestamp);bool skb_defer_rx_timestamp (struct sk_buff *skb) {struct mii_timestamper *mii_ts; +struct phy_device *phydev;unsigned int type; -if (!skb->dev || !phy_is_default_hwtstamp (skb->dev->phydev)) +if (!skb->dev)return false; +if (skb->dev->hwtstamp) { +struct ptp_clock *ptp = skb->dev->hwtstamp->ptp; + +if (!ptp_clock_from_phylib (ptp)) +return false; + + phydev =ptp_clock_phydev (ptp); + }else { + phydev = skb->dev->phydev; +if (!phy_is_default_hwtstamp (phydev)) +return false; + } +if (skb_headroom (skb) <ETH_HLEN )return false;
@@ -63,7 +91,7 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)if (type ==PTP_CLASS_NONE )return false; - mii_ts = skb->dev->phydev->mii_ts; + mii_ts = phydev->mii_ts;if (likely (mii_ts->rxtstamp))return mii_ts->rxtstamp (mii_ts, skb, type);
Signature · 1 line
2.34.1
PATCH v14 10/14 net: netdevsim: ptp_mock: Convert to netdev_ptp_clock_register
In reply to Kory MaincentThe hardware registration clock for net device is now using netdev_ptp_clock_register to save the net_device pointer within the PTP clock xarray. netdevsim is registering its ptp through the mock driver. It is the only driver using the mock driver to register a ptp clock. Convert the mock driver to the new API.
---
Changes in v8:
- New patch
--- drivers/net/netdevsim/netdev.c | 19 +++++++++++-------- drivers/ptp/ptp_mock.c | 4 ++-- include/linux/ptp_mock.h | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-)
drivers/net/netdevsim/netdev.c +11 -8
@@ -662,17 +662,12 @@ static int nsim_init_netdevsim(struct netdevsim *ns)struct mock_phc *phc;int err; - phc =mock_phc_create (&ns->nsim_bus_dev->dev); -if (IS_ERR (phc)) -return PTR_ERR (phc); - - ns->phc = phc; ns->netdev->netdev_ops = &nsim_netdev_ops; ns->netdev->stat_ops = &nsim_stat_ops; err =nsim_udp_tunnels_info_create (ns->nsim_dev, ns->netdev);if (err) - goto err_phc_destroy; +return err;rtnl_lock (); err =nsim_queue_init (ns);
@@ -690,8 +685,18 @@ static int nsim_init_netdevsim(struct netdevsim *ns)if (err) goto err_ipsec_teardown;rtnl_unlock (); + + phc =mock_phc_create (ns->netdev); +if (IS_ERR (phc)) { + err =PTR_ERR (phc); + goto err_register_netdevice; + } + + ns->phc = phc;return 0 ; +err_register_netdevice: +unregister_netdevice (ns->netdev); err_ipsec_teardown:nsim_ipsec_teardown (ns);nsim_macsec_teardown (ns);
@@ -701,8 +706,6 @@ static int nsim_init_netdevsim(struct netdevsim *ns) err_utn_destroy:rtnl_unlock ();nsim_udp_tunnels_info_destroy (ns->netdev); -err_phc_destroy: -mock_phc_destroy (ns->phc);return err; }
drivers/ptp/ptp_mock.c +2 -2
@@ -115,7 +115,7 @@ int mock_phc_index(struct mock_phc *phc) }EXPORT_SYMBOL_GPL (mock_phc_index); -struct mock_phc *mock_phc_create (struct device *dev) +struct mock_phc *mock_phc_create (struct net_device *dev) {struct mock_phc *phc;int err;
@@ -147,7 +147,7 @@ struct mock_phc *mock_phc_create(struct device *dev)spin_lock_init (&phc->lock);timecounter_init (&phc->tc, &phc->cc,0 ); - phc->clock =ptp_clock_register (&phc->info, dev); + phc->clock =netdev_ptp_clock_register (&phc->info, dev);if (IS_ERR (phc->clock)) { err =PTR_ERR (phc->clock); goto out_free_phc;
include/linux/ptp_mock.h +2 -2
@@ -13,13 +13,13 @@ struct mock_phc;#if IS_ENABLED (CONFIG_PTP_1588_CLOCK_MOCK ) -struct mock_phc *mock_phc_create (struct device *dev); +struct mock_phc *mock_phc_create (struct net_device *dev);void mock_phc_destroy (struct mock_phc *phc);int mock_phc_index (struct mock_phc *phc);#else -static inline struct mock_phc *mock_phc_create (struct device *dev) +static inline struct mock_phc *mock_phc_create (struct net_device *dev) {return NULL ; }
Signature · 1 line
2.34.1
PATCH v14 11/14 net: macb: Convert to netdev_ptp_clock_register
In reply to Kory MaincentThe hardware registration clock for net device is now using netdev_ptp_clock_register to save the net_device pointer within the ptp clock xarray. Convert the macb driver to the new API.
---
Change in v8:
- New patch
--- drivers/net/ethernet/cadence/macb_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_ptp.c +1 -1
@@ -332,7 +332,7 @@ void gem_ptp_init(struct net_device *dev) bp->tsu_rate = bp->ptp_info->get_tsu_rate (bp); bp->ptp_clock_info.max_adj = bp->ptp_info->get_ptp_max_adj ();gem_ptp_init_timer (bp); - bp->ptp_clock =ptp_clock_register (&bp->ptp_clock_info, &dev->dev); + bp->ptp_clock =netdev_ptp_clock_register (&bp->ptp_clock_info, dev);if (IS_ERR (bp->ptp_clock)) {pr_err ("ptp clock register failed: %ld\n" ,PTR_ERR (bp->ptp_clock));
Signature · 1 line
2.34.1
PATCH v14 12/14 net: ptp: Move ptp_clock_index() to builtin symbol
In reply to Kory MaincentMove ptp_clock_index() to builtin symbols to prepare for supporting get and set hardware timestamps from ethtool, which is builtin.
---
Change in v13:
- New patch
--- drivers/ptp/ptp_clock.c | 6 ------ drivers/ptp/ptp_clock_consumer.c | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/ptp/ptp_clock.c +0 -6
@@ -460,12 +460,6 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event) }EXPORT_SYMBOL (ptp_clock_event); -int ptp_clock_index (struct ptp_clock *ptp) -{ -return ptp->index; -} -EXPORT_SYMBOL (ptp_clock_index); -int ptp_find_pin (struct ptp_clock *ptp,enum ptp_pin_function func,unsigned int chan) {
drivers/ptp/ptp_clock_consumer.c +6 -0
@@ -98,3 +98,9 @@ void ptp_clock_put(struct device *dev, struct ptp_clock *ptp)put_device (&ptp->dev);module_put (ptp->info->owner); } + +int ptp_clock_index (struct ptp_clock *ptp) +{ +return ptp->index; +} +EXPORT_SYMBOL (ptp_clock_index);
Signature · 1 line
2.34.1
PATCH v14 13/14 net: ethtool: tsinfo: Add support for hwtstamp provider and get/set hwtstamp config
In reply to Kory MaincentEnhance 'get' command to retrieve tsinfo of hwtstamp providers within a network topology and read current hwtstamp configuration.
Introduce support for ETHTOOL_MSG_TSINFO_SET ethtool netlink socket to configure hwtstamp of a PHC provider. Note that simultaneous hwtstamp isn't supported; configuring a new one disables the previous setting.
Also, add support for a specific dump command to retrieve all hwtstamp providers within the network topology, with added functionality for filtered dump to target a single interface.
---
Pointer attached_dev is used to know if the phy is on the net topology. This might not be enough and might need Maxime Chevallier link topology patch series:
https://lore.kernel.org/netdev/[email protected]/
Change in v8:
- New patch
Change in v9:
- Fix nit in done callback.
Change in v10:
- Add documentation.
- Add extack error messages.
- Add NLA_POLICY_* checks.
- Fix few nits.
- Add ETHTOOL_A_TSINFO_GHWTSTAMP netlink attributes instead of a bit in ETHTOOL_A_TSINFO_TIMESTAMPING bitset.
- Add tsinfo_parse_hwtstamp_provider function for more readability.
- Move netdev_support_hwtstamp_qualifier function in core ptp instead of core net.
- Add refcount put to release the ptp object.
- Use rcu lock to avoid memory leak.
Change in v12:
- Add missing return description in the kdoc.
- Fix possible leak due to uninitialised variable.
- Add a missing static.
Change in v13:
- Remove useless EXPORT_SYMBOL().
- Fix issues reported by sparse and smatch.
- Fix issues when building PTP as a module.
- Rename HWTSTAMP_PROVIDER_NEST to HWTSTAMP_PROVIDER.
--- Documentation/networking/ethtool-netlink.rst | 38 +- Documentation/networking/timestamping.rst | 35 +- drivers/net/phy/phy_device.c | 9 +- drivers/ptp/ptp_clock_consumer.c | 66 +++ include/linux/ethtool.h | 4 + include/linux/netdevice.h | 2 +- include/linux/ptp_clock_kernel.h | 53 +++ include/uapi/linux/ethtool_netlink.h | 14 + net/core/dev_ioctl.c | 17 +- net/core/timestamping.c | 36 +- net/ethtool/common.c | 32 ++ net/ethtool/common.h | 3 + net/ethtool/netlink.c | 16 +- net/ethtool/netlink.h | 6 +- net/ethtool/tsinfo.c | 639 ++++++++++++++++++++++++++- 15 files changed, 903 insertions(+), 67 deletions(-)
Documentation/networking/ethtool-netlink.rst +30 -8
@@ -1221,24 +1221,28 @@ callback supports. TSINFO_GET ========== -Gets timestamping information like ``ETHTOOL_GET_TS_INFO`` ioctl request. +Gets timestamping information like ``ETHTOOL_GET_TS_INFO`` ioctl request or +get hardware timestamping configuration like ``SIOCGHWTSTAMP`` ioctl request. Request contents: - ===================================== ====== ========================== - ``ETHTOOL_A_TSINFO_HEADER`` nested request header - ===================================== ====== ========================== + ======================================== ====== ============================ + ``ETHTOOL_A_TSINFO_HEADER`` nested request header + ``ETHTOOL_A_TSINFO_GHWTSTAMP`` bool get hwtstamp configuration + ``ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER`` nested PTP hw clock provider + ======================================== ====== ============================ Kernel response contents: - ===================================== ====== ========================== + ===================================== ====== ================================== ``ETHTOOL_A_TSINFO_HEADER`` nested request header ``ETHTOOL_A_TSINFO_TIMESTAMPING`` bitset SO_TIMESTAMPING flags - ``ETHTOOL_A_TSINFO_TX_TYPES`` bitset supported Tx types - ``ETHTOOL_A_TSINFO_RX_FILTERS`` bitset supported Rx filters + ``ETHTOOL_A_TSINFO_TX_TYPES`` bitset supported or configured Tx types + ``ETHTOOL_A_TSINFO_RX_FILTERS`` bitset supported or configured Rx filters ``ETHTOOL_A_TSINFO_PHC_INDEX`` u32 PTP hw clock index ``ETHTOOL_A_TSINFO_STATS`` nested HW timestamping statistics - ===================================== ====== ========================== + ``ETHTOOL_A_TSINFO_HWTSTAMP_FLAGS`` u32 hwstamp flags + ===================================== ====== ================================== ``ETHTOOL_A_TSINFO_PHC_INDEX`` is absent if there is no associated PHC (there is no special value for this case). The bitset attributes are omitted if they
@@ -1252,6 +1256,24 @@ Additional hardware timestamping statistics response contents: ``ETHTOOL_A_TS_STAT_TX_ERR`` uint HW error request Tx timestamp count ===================================== ====== =================================== +TSINFO_SET +========== + +Sets hardware timestamping configuration like ``SIOCSHWTSTAMP`` ioctl request. + +Request contents: + + =========================================== ====== ======================== + ``ETHTOOL_A_TSINFO_HEADER`` nested request header + ``ETHTOOL_A_TSINFO_TX_TYPES`` bitset configured Tx type + ``ETHTOOL_A_TSINFO_RX_FILTERS`` bitset configured Rx filter + ``ETHTOOL_A_TSINFO_HWTSTAMP_FLAGS`` u32 hwstamp flags + ``ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER`` nested PTP hw clock provider + =========================================== ====== ======================== + +If ``ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER`` is absent, set the hwtstamp +configuration of the current hwtstamp. + CABLE_TEST ==========
Documentation/networking/timestamping.rst +23 -12
@@ -493,8 +493,8 @@ implicitly defined. ts[0] holds a software timestamp if set, ts[1] is again deprecated and ts[2] holds a hardware timestamp if set. -3. Hardware Timestamping configuration: SIOCSHWTSTAMP and SIOCGHWTSTAMP -======================================================================= +3. Hardware Timestamping configuration: ETHTOOL_MSG_TSINFO_SET/GET +================================================================== Hardware time stamping must also be initialized for each device driver that is expected to do hardware time stamping. The parameter is defined in
@@ -507,10 +507,16 @@ include/uapi/linux/net_tstamp.h as:: }; Desired behavior is passed into the kernel and to a specific device by -calling ioctl(SIOCSHWTSTAMP) with a pointer to a struct ifreq whose -ifr_data points to a struct hwtstamp_config. The tx_type and -rx_filter are hints to the driver what it is expected to do. If -the requested fine-grained filtering for incoming packets is not +calling the tsinfo netlink socket ETHTOOL_MSG_TSINFO_SET. +The ETHTOOL_A_TSINFO_TX_TYPES, ETHTOOL_A_TSINFO_RX_FILTERS and +ETHTOOL_A_TSINFO_HWTSTAMP_FLAGS netlink attributes are then used to set the +struct hwtstamp_config accordingly. + +The legacy configuration is the use of the ioctl(SIOCSHWTSTAMP) with a pointer +to a struct ifreq whose ifr_data points to a struct hwtstamp_config. + +The tx_type and rx_filter are hints to the driver what it is expected to do. +If the requested fine-grained filtering for incoming packets is not supported, the driver may time stamp more than just the requested types of packets.
@@ -531,9 +537,13 @@ Only a processes with admin rights may change the configuration. User space is responsible to ensure that multiple processes don't interfere with each other and that the settings are reset. -Any process can read the actual configuration by passing this -structure to ioctl(SIOCGHWTSTAMP) in the same way. However, this has -not been implemented in all drivers. +Any process can read the actual configuration by requesting tsinfo netlink +socket ETHTOOL_MSG_TSINFO_GET with ETHTOOL_MSG_TSINFO_GHWTSTAMP netlink +attribute set. + +The legacy usage is to pass this structure to ioctl(SIOCGHWTSTAMP) in the +same way as the ioctl(SIOCSHWTSTAMP). However, this has not been implemented +in all drivers. ::
@@ -578,9 +588,10 @@ not been implemented in all drivers. -------------------------------------------------------- A driver which supports hardware time stamping must support the -SIOCSHWTSTAMP ioctl and update the supplied struct hwtstamp_config with -the actual values as described in the section on SIOCSHWTSTAMP. It -should also support SIOCGHWTSTAMP. +ndo_hwtstamp_set NDO or the legacy SIOCSHWTSTAMP ioctl and update the +supplied struct hwtstamp_config with the actual values as described in +the section on SIOCSHWTSTAMP. It should also support ndo_hwtstamp_get or +the legacy SIOCGHWTSTAMP. Time stamps for received packets must be stored in the skb. To get a pointer to the shared time stamp structure of the skb call skb_hwtstamps(). Then
drivers/net/phy/phy_device.c +5 -4
@@ -1937,12 +1937,13 @@ void phy_detach(struct phy_device *phydev)phy_suspend (phydev);if (dev) { -struct hwtstamp_provider *hwtstamp = dev->hwtstamp; +struct hwtstamp_provider *hwtstamp; + hwtstamp =rtnl_dereference (dev->hwtstamp);/* Disable timestamp if selected */ -if (hwtstamp && -ptp_clock_phydev (hwtstamp->ptp) == phydev) { - dev->hwtstamp =NULL ; +if (hwtstamp &&ptp_clock_phydev (hwtstamp->ptp) == phydev) { +rcu_assign_pointer (dev->hwtstamp,NULL ); +synchronize_rcu ();kfree (hwtstamp); }
drivers/ptp/ptp_clock_consumer.c +66 -0
69 lines not on this page · raw message
include/linux/ethtool.h +4 -0
@@ -667,6 +667,7 @@ struct ethtool_rxfh_param {* @cmd: command number = %ETHTOOL_GET_TS_INFO * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags * @phc_index: device index of the associated PHC, or -1 if there is none +* @phc_qualifier: qualifier of the associated PHC * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values */
@@ -674,6 +675,7 @@ struct kernel_ethtool_ts_info {u32 cmd;u32 so_timestamping;int phc_index; +enum hwtstamp_provider_qualifier phc_qualifier;enum hwtstamp_tx_types tx_types;enum hwtstamp_rx_filters rx_filters; };
@@ -688,6 +690,7 @@ struct kernel_ethtool_ts_info {* RSS. * @supported_coalesce_params: supported types of interrupt coalescing. * @supported_ring_params: supported ring params. +* @supported_hwtstamp_qualifiers: bitfield of supported hwtstamp qualifier. * @get_drvinfo: Report driver/device information. Modern drivers no * longer have to implement this callback. Most fields are * correctly filled in by the core using system information, or
@@ -871,6 +874,7 @@ struct ethtool_ops { u32 cap_rss_sym_xor_supported:1;u32 supported_coalesce_params;u32 supported_ring_params; +u32 supported_hwtstamp_qualifiers;void (*get_drvinfo)(struct net_device *,struct ethtool_drvinfo *);int (*get_regs_len)(struct net_device *);void (*get_regs)(struct net_device *,struct ethtool_regs *,void *);
include/linux/netdevice.h +1 -1
@@ -2405,7 +2405,7 @@ struct net_device {struct hlist_head page_pools;#endif -struct hwtstamp_provider *hwtstamp; +struct hwtstamp_provider __rcu *hwtstamp; };#define to_net_dev (d) container_of(d, struct net_device, dev)
include/linux/ptp_clock_kernel.h +53 -0
71 lines not on this page · raw message
include/uapi/linux/ethtool_netlink.h +14 -0
@@ -57,6 +57,7 @@ enum {ETHTOOL_MSG_PLCA_GET_STATUS ,ETHTOOL_MSG_MM_GET ,ETHTOOL_MSG_MM_SET , +ETHTOOL_MSG_TSINFO_SET ,/* add new constants above here */ __ETHTOOL_MSG_USER_CNT,
@@ -109,6 +110,7 @@ enum {ETHTOOL_MSG_PLCA_NTF ,ETHTOOL_MSG_MM_GET_REPLY ,ETHTOOL_MSG_MM_NTF , +ETHTOOL_MSG_TSINFO_NTF ,/* add new constants above here */ __ETHTOOL_MSG_KERNEL_CNT,
@@ -469,6 +471,15 @@ enum { };/* TSINFO */ +enum { +ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_UNSPEC , +ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_INDEX ,/* u32 */ +ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_QUALIFIER ,/* u32 */ + + __ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_CNT, +ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_MAX = (__ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_CNT -1 ) +}; +enum {ETHTOOL_A_TSINFO_UNSPEC ,
@@ -478,6 +489,9 @@ enum {ETHTOOL_A_TSINFO_RX_FILTERS ,/* bitset */ ETHTOOL_A_TSINFO_PHC_INDEX ,/* u32 */ ETHTOOL_A_TSINFO_STATS ,/* nest - _A_TSINFO_STAT */ +ETHTOOL_A_TSINFO_GHWTSTAMP ,/* u8 */ +ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER ,/* nest - *_TSINFO_HWTSTAMP_PROVIDER_* */ +ETHTOOL_A_TSINFO_HWTSTAMP_FLAGS ,/* u32 */ /* add new constants above here */ __ETHTOOL_A_TSINFO_CNT,
net/core/dev_ioctl.c +11 -6
@@ -270,10 +270,13 @@ static int dev_eth_ioctl(struct net_device *dev,int dev_get_hwtstamp_phylib (struct net_device *dev,struct kernel_hwtstamp_config *cfg) { -if (dev->hwtstamp) { -struct ptp_clock *ptp = dev->hwtstamp->ptp; +struct hwtstamp_provider *hwtstamp; - cfg->qualifier = dev->hwtstamp->qualifier; + hwtstamp =rtnl_dereference (dev->hwtstamp); +if (hwtstamp) { +struct ptp_clock *ptp = hwtstamp->ptp; + + cfg->qualifier = hwtstamp->qualifier;if (ptp_clock_from_phylib (ptp))return phy_hwtstamp_get (ptp_clock_phydev (ptp), cfg);
@@ -340,13 +343,15 @@ int dev_set_hwtstamp_phylib(struct net_device *dev, {const struct net_device_ops *ops = dev->netdev_ops;struct kernel_hwtstamp_config old_cfg = {}; +struct hwtstamp_provider *hwtstamp;struct phy_device *phydev;bool changed = false;bool phy_ts;int err; -if (dev->hwtstamp) { -struct ptp_clock *ptp = dev->hwtstamp->ptp; + hwtstamp =rtnl_dereference (dev->hwtstamp); +if (hwtstamp) { +struct ptp_clock *ptp = hwtstamp->ptp;if (ptp_clock_from_phylib (ptp)) { phy_ts = true;
@@ -357,7 +362,7 @@ int dev_set_hwtstamp_phylib(struct net_device *dev,return -EOPNOTSUPP ; } - cfg->qualifier = dev->hwtstamp->qualifier; + cfg->qualifier = hwtstamp->qualifier; }else { phy_ts =phy_is_default_hwtstamp (dev->phydev);if (phy_ts)
net/core/timestamping.c +24 -12
@@ -22,6 +22,7 @@ static unsigned int classify(const struct sk_buff *skb)void skb_clone_tx_timestamp (struct sk_buff *skb) { +struct hwtstamp_provider *hwtstamp;struct mii_timestamper *mii_ts;struct phy_device *phydev;struct sk_buff *clone;
@@ -30,18 +31,23 @@ void skb_clone_tx_timestamp(struct sk_buff *skb)if (!skb->sk || !skb->dev)return ; -if (skb->dev->hwtstamp) { -struct ptp_clock *ptp = skb->dev->hwtstamp->ptp; - -if (!ptp_clock_from_phylib (ptp)) +rcu_read_lock (); + hwtstamp =rcu_dereference (skb->dev->hwtstamp); +if (hwtstamp) { +if (!ptp_clock_from_phylib (hwtstamp->ptp)) { +rcu_read_unlock ();return ; + } - phydev =ptp_clock_phydev (ptp); + phydev =ptp_clock_phydev (hwtstamp->ptp); }else { phydev = skb->dev->phydev; -if (!phy_is_default_hwtstamp (phydev)) +if (!phy_is_default_hwtstamp (phydev)) { +rcu_read_unlock ();return ; + } } +rcu_read_unlock (); type =classify (skb);if (type ==PTP_CLASS_NONE )
@@ -59,6 +65,7 @@ EXPORT_SYMBOL_GPL(skb_clone_tx_timestamp);bool skb_defer_rx_timestamp (struct sk_buff *skb) { +struct hwtstamp_provider *hwtstamp;struct mii_timestamper *mii_ts;struct phy_device *phydev;unsigned int type;
@@ -66,18 +73,23 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)if (!skb->dev)return false; -if (skb->dev->hwtstamp) { -struct ptp_clock *ptp = skb->dev->hwtstamp->ptp; - -if (!ptp_clock_from_phylib (ptp)) +rcu_read_lock (); + hwtstamp =rcu_dereference (skb->dev->hwtstamp); +if (hwtstamp) { +if (!ptp_clock_from_phylib (hwtstamp->ptp)) { +rcu_read_unlock ();return false; + } - phydev =ptp_clock_phydev (ptp); + phydev =ptp_clock_phydev (hwtstamp->ptp); }else { phydev = skb->dev->phydev; -if (!phy_is_default_hwtstamp (phydev)) +if (!phy_is_default_hwtstamp (phydev)) { +rcu_read_unlock ();return false; + } } +rcu_read_unlock ();if (skb_headroom (skb) <ETH_HLEN )return false;
net/ethtool/common.c +32 -0
@@ -629,10 +629,42 @@ int ethtool_check_ops(const struct ethtool_ops *ops)return 0 ; } +int ethtool_get_ts_info_by_phc (struct net_device *dev, +struct kernel_ethtool_ts_info *info, +struct hwtstamp_provider *hwtstamp) +{ +const struct ethtool_ops *ops = dev->ethtool_ops; + +memset (info,0 ,sizeof (*info)); + info->cmd =ETHTOOL_GET_TS_INFO ; + info->phc_qualifier = hwtstamp->qualifier; + +if (!netdev_support_hwtstamp (dev, hwtstamp)) +return -ENODEV ; + +if (ptp_clock_from_phylib (hwtstamp->ptp) && +phy_has_tsinfo (ptp_clock_phydev (hwtstamp->ptp))) +return phy_ts_info (ptp_clock_phydev (hwtstamp->ptp), info); + +if (ptp_clock_from_netdev (hwtstamp->ptp) && ops->get_ts_info) +return ops->get_ts_info (dev, info); + + info->so_timestamping =SOF_TIMESTAMPING_RX_SOFTWARE | +SOF_TIMESTAMPING_SOFTWARE ; + info->phc_index =-1 ; + +return 0 ; +} +int __ethtool_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info) {const struct ethtool_ops *ops = dev->ethtool_ops;struct phy_device *phydev = dev->phydev; +struct hwtstamp_provider *hwtstamp; + + hwtstamp =rtnl_dereference (dev->hwtstamp); +if (hwtstamp) +return ethtool_get_ts_info_by_phc (dev, info, hwtstamp);memset (info,0 ,sizeof (*info)); info->cmd =ETHTOOL_GET_TS_INFO ;
net/ethtool/common.h +3 -0
@@ -45,6 +45,9 @@ bool convert_legacy_settings_to_link_ksettings(int ethtool_get_max_rxfh_channel (struct net_device *dev,u32 *max);int ethtool_get_max_rxnfc_channel (struct net_device *dev,u64 *max);int __ethtool_get_ts_info (struct net_device *dev,struct kernel_ethtool_ts_info *info); +int ethtool_get_ts_info_by_phc (struct net_device *dev, +struct kernel_ethtool_ts_info *info, +struct hwtstamp_provider *hwtst);extern const struct ethtool_phy_ops *ethtool_phy_ops;extern const struct ethtool_pse_ops *ethtool_pse_ops;
net/ethtool/netlink.c +13 -3
@@ -306,6 +306,7 @@ ethnl_default_requests[__ETHTOOL_MSG_USER_CNT] = { [ETHTOOL_MSG_PLCA_GET_STATUS] = ðnl_plca_status_request_ops, [ETHTOOL_MSG_MM_GET] = ðnl_mm_request_ops, [ETHTOOL_MSG_MM_SET] = ðnl_mm_request_ops, + [ETHTOOL_MSG_TSINFO_SET] = ðnl_tsinfo_request_ops, };static struct ethnl_dump_ctx *ethnl_dump_context (struct netlink_callback *cb)
@@ -635,6 +636,7 @@ ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = { [ETHTOOL_MSG_MODULE_NTF] = ðnl_module_request_ops, [ETHTOOL_MSG_PLCA_NTF] = ðnl_plca_cfg_request_ops, [ETHTOOL_MSG_MM_NTF] = ðnl_mm_request_ops, + [ETHTOOL_MSG_TSINFO_NTF] = ðnl_tsinfo_request_ops, };/* default notification handler */
@@ -733,6 +735,7 @@ static const ethnl_notify_handler_t ethnl_notify_handlers[] = { [ETHTOOL_MSG_MODULE_NTF] = ethnl_default_notify, [ETHTOOL_MSG_PLCA_NTF] = ethnl_default_notify, [ETHTOOL_MSG_MM_NTF] = ethnl_default_notify, + [ETHTOOL_MSG_TSINFO_NTF] = ethnl_default_notify, };void ethtool_notify (struct net_device *dev,unsigned int cmd,const void *data)
@@ -974,9 +977,9 @@ static const struct genl_ops ethtool_genl_ops[] = { { .cmd = ETHTOOL_MSG_TSINFO_GET, .doit = ethnl_default_doit, - .start = ethnl_default_start, - .dumpit = ethnl_default_dumpit, - .done = ethnl_default_done, + .start = ethnl_tsinfo_start, + .dumpit = ethnl_tsinfo_dumpit, + .done = ethnl_tsinfo_done, .policy = ethnl_tsinfo_get_policy, .maxattr = ARRAY_SIZE(ethnl_tsinfo_get_policy) - 1, },
@@ -1125,6 +1128,13 @@ static const struct genl_ops ethtool_genl_ops[] = { .policy = ethnl_mm_set_policy, .maxattr = ARRAY_SIZE(ethnl_mm_set_policy) - 1, }, + { + .cmd = ETHTOOL_MSG_TSINFO_SET, + .flags = GENL_UNS_ADMIN_PERM, + .doit = ethnl_default_set_doit, + .policy = ethnl_tsinfo_set_policy, + .maxattr = ARRAY_SIZE(ethnl_tsinfo_set_policy) - 1, + }, };static const struct genl_multicast_group ethtool_nl_mcgrps[] = {
net/ethtool/netlink.h +5 -1
@@ -422,7 +422,7 @@ extern const struct nla_policy ethnl_pause_get_policy[ETHTOOL_A_PAUSE_STATS_SRCextern const struct nla_policy ethnl_pause_set_policy[ETHTOOL_A_PAUSE_TX +1 ];extern const struct nla_policy ethnl_eee_get_policy[ETHTOOL_A_EEE_HEADER +1 ];extern const struct nla_policy ethnl_eee_set_policy[ETHTOOL_A_EEE_TX_LPI_TIMER +1 ]; -extern const struct nla_policy ethnl_tsinfo_get_policy[ETHTOOL_A_TSINFO_HEADER +1 ]; +extern const struct nla_policy ethnl_tsinfo_get_policy[ETHTOOL_A_TSINFO_MAX +1 ];extern const struct nla_policy ethnl_cable_test_act_policy[ETHTOOL_A_CABLE_TEST_HEADER +1 ];extern const struct nla_policy ethnl_cable_test_tdr_act_policy[ETHTOOL_A_CABLE_TEST_TDR_CFG +1 ];extern const struct nla_policy ethnl_tunnel_info_get_policy[ETHTOOL_A_TUNNEL_INFO_HEADER +1 ];
@@ -441,6 +441,7 @@ extern const struct nla_policy ethnl_plca_set_cfg_policy[ETHTOOL_A_PLCA_MAX + 1]extern const struct nla_policy ethnl_plca_get_status_policy[ETHTOOL_A_PLCA_HEADER +1 ];extern const struct nla_policy ethnl_mm_get_policy[ETHTOOL_A_MM_HEADER +1 ];extern const struct nla_policy ethnl_mm_set_policy[ETHTOOL_A_MM_MAX +1 ]; +extern const struct nla_policy ethnl_tsinfo_set_policy[ETHTOOL_A_TSINFO_MAX +1 ];int ethnl_set_features (struct sk_buff *skb,struct genl_info *info);int ethnl_act_cable_test (struct sk_buff *skb,struct genl_info *info);
@@ -448,6 +449,9 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info);int ethnl_tunnel_info_doit (struct sk_buff *skb,struct genl_info *info);int ethnl_tunnel_info_start (struct netlink_callback *cb);int ethnl_tunnel_info_dumpit (struct sk_buff *skb,struct netlink_callback *cb); +int ethnl_tsinfo_start (struct netlink_callback *cb); +int ethnl_tsinfo_dumpit (struct sk_buff *skb,struct netlink_callback *cb); +int ethnl_tsinfo_done (struct netlink_callback *cb);extern const char stats_std_names[__ETHTOOL_STATS_CNT][ETH_GSTRING_LEN ];extern const char stats_eth_phy_names[__ETHTOOL_A_STATS_ETH_PHY_CNT][ETH_GSTRING_LEN ];
net/ethtool/tsinfo.c +619 -20
731 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v14 14/14 netlink: specs: tsinfo: Enhance netlink attributes and add a set command
In reply to Kory MaincentAdd new attributed to tsinfo allowing to get the tsinfo and the hwtstamp from a phc provider (composed by a phc index and a phc qualifier) on a netdevice's link.
Add simultaneously a set command to be able to set hwtstamp configuration for a specified phc provider.
Here is few examples:./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema
--dump tsinfo-get
--json '{"header":{"dev-name":"eth0"}}'[{'header': {'dev-index': 3, 'dev-name': 'eth0'},
'hwtst-provider': {'index': 0, 'qualifier': 0}, 'phc-index': 0,
'rx-filters': {'bits': {'bit': [{'index': 0, 'name': 'none'},
{'index': 2, 'name': 'some'}]},
'nomask': True,
'size': 16},
'timestamping': {'bits': {'bit': [{'index': 0, 'name': 'hardware-transmit'},
{'index': 2, 'name': 'hardware-receive'},
{'index': 6,
'name': 'hardware-raw-clock'}]},
'nomask': True,
'size': 17},
'tx-types': {'bits': {'bit': [{'index': 0, 'name': 'off'},
{'index': 1, 'name': 'on'}]},
'nomask': True,
'size': 4}},
{'header': {'dev-index': 3, 'dev-name': 'eth0'},
'hwtst-provider': {'index': 2, 'qualifier': 0},
'phc-index': 2,
'rx-filters': {'bits': {'bit': [{'index': 0, 'name': 'none'},
{'index': 1, 'name': 'all'}]},
'nomask': True,
'size': 16},
'timestamping': {'bits': {'bit': [{'index': 0, 'name': 'hardware-transmit'},
{'index': 1, 'name': 'software-transmit'},
{'index': 2, 'name': 'hardware-receive'},
{'index': 3, 'name': 'software-receive'},
{'index': 4,
'name': 'software-system-clock'},
{'index': 6,
'name': 'hardware-raw-clock'}]},
'nomask': True,
'size': 17},
'tx-types': {'bits': {'bit': [{'index': 0, 'name': 'off'},
{'index': 1, 'name': 'on'},
{'index': 2, 'name': 'onestep-sync'}]},
'nomask': True,
'size': 4}}]./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do tsinfo-get
--json '{"header":{"dev-name":"eth0"},
"hwtst-provider":{"index":0, "qualifier":0 }
}'{'header': {'dev-index': 3, 'dev-name': 'eth0'},
'hwtst-provider': {'index': 0, 'qualifier': 0}, 'phc-index': 0,
'rx-filters': {'bits': {'bit': [{'index': 0, 'name': 'none'},
{'index': 2, 'name': 'some'}]},
'nomask': True,
'size': 16},
'timestamping': {'bits': {'bit': [{'index': 0, 'name': 'hardware-transmit'},
{'index': 2, 'name': 'hardware-receive'},
{'index': 6, 'name': 'hardware-raw-clock'}]},
'nomask': True,
'size': 17},
'tx-types': {'bits': {'bit': [{'index': 0, 'name': 'off'},
{'index': 1, 'name': 'on'}]},
'nomask': True,
'size': 4}}./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do tsinfo-set
--json '{"header":{"dev-name":"eth0"},
"hwtst-provider":{"index":2, "qualifier":0}}'None
./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do tsinfo-get
--json '{"header":{"dev-name":"eth0"}, "ghwtstamp":1}'
{'header': {'dev-index': 3, 'dev-name': 'eth0'},
'hwtst-flags': 1,
'rx-filters': {'bits': {'bit': [{'index': 0, 'name': 'none'}]},
'nomask': True,
'size': 16},
'tx-types': {'bits': {'bit': [{'index': 0, 'name': 'off'}]},
'nomask': True,
'size': 4}}./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do tsinfo-set
--json '{"header":{"dev-name":"eth0"},
"rx-filters":{"bits": {"bit": {"name":"ptpv2-l4-event"}},
"nomask": 1},
"tx-types":{"bits": {"bit": {"name":"on"}},
"nomask": 1}}'None
---
Changes in v8:
- New patch
Changes in v10:
- Add ghwtstamp attributes
- Add tsinfo ntf command
Changes in v11:
- Add examples in the commit message.
Changes in v13:
- Replace shorter name by real name.
- Fix an issue reported by "make -C tools/net/ynl" on the namings.
--- Documentation/netlink/specs/ethtool.yaml | 43 +++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-)
Documentation/netlink/specs/ethtool.yaml +42 -1
@@ -576,6 +576,15 @@ attribute-sets: - name: tx-err type: uint + - + name: tsinfo-hwtstamp-provider + attributes: + - + name: index + type: u32 + - + name: qualifier + type: u32 - name: tsinfo attributes:
@@ -602,6 +611,16 @@ attribute-sets: name: stats type: nest nested-attributes: ts-stat + - + name: ghwtstamp + type: u8 + - + name: hwtstamp-provider + type: nest + nested-attributes: tsinfo-hwtstamp-provider + - + name: hwtstamp-flags + type: u32 - name: cable-result attributes:
@@ -1406,7 +1425,7 @@ operations: notify: eee-get - name: tsinfo-get - doc: Get tsinfo params. + doc: Get tsinfo params or hwtstamp config. attribute-set: tsinfo
@@ -1414,6 +1433,8 @@ operations: request: attributes: - header + - ghwtstamp + - hwtstamp-provider reply: attributes: - header
@@ -1422,6 +1443,8 @@ operations: - rx-filters - phc-index - stats + - hwtstamp-provider + - hwtstamp-flags dump: *tsinfo-get-op - name: cable-test-act
@@ -1730,3 +1753,21 @@ operations: name: mm-ntf doc: Notification for change in MAC Merge configuration. notify: mm-get + - + name: tsinfo-set + doc: Set hwtstamp. + + attribute-set: tsinfo + + do: + request: + attributes: + - header + - tx-types + - rx-filters + - hwtstamp-provider + - hwtstamp-flags + - + name: tsinfo-ntf + doc: Notification for change in tsinfo configuration. + notify: tsinfo-get
Signature · 1 line
2.34.1
Paolo Abeni
maintainerQuoted 7 lines · Kory Maincent
Up until now, there was no way to let the user select the hardware PTP provider at which time stamping occurs. The stack assumed that PHY time stamping is always preferred, but some MAC/PHY combinations were buggy.
This series updates the default MAC/PHY default timestamping and aims to allow the user to select the desired hwtstamp provider administratively.
I'm sorry to ask the question this late, but are there any plan to introduce self-tests, eventually in a follow-up patch/series?
Thanks,
Paolo
Hello Paolo,
Quoted 5 lines · On Thu, 06 Jun 2024 15:28:28 +0200 Paolo Abeni <[email protected]> wrote:
On Tue, 2024-06-04 at 12:39 +0200, Kory Maincent wrote:
[...]I'm sorry to ask the question this late, but are there any plan to introduce self-tests, eventually in a follow-up patch/series?
There was no plan about it but it could change if it is needed. rxtimestamp.sh and txtimestammp.sh should still work. I will verify that next week.
Before writing tests the next patch series will be in ethtool.
Regards,
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com