]> git.itanic.dy.fi Git - linux-stable/commit
net: remove phy_has_hwtstamp() -> phy_mii_ioctl() decision from converted drivers
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 1 Aug 2023 14:28:24 +0000 (17:28 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Aug 2023 02:11:06 +0000 (19:11 -0700)
commitfd770e856e226f80fe6e1dc9d1861bcb135cdf0b
tree50922037e9cae3202cbc702a297f0d2bc2ad12f3
parent60495b6622ca67f5180343b89bd932d28d23f63a
net: remove phy_has_hwtstamp() -> phy_mii_ioctl() decision from converted drivers

It is desirable that the new .ndo_hwtstamp_set() API gives more
uniformity, less overhead and future flexibility w.r.t. the PHY
timestamping behavior.

Currently there are some drivers which allow PHY timestamping through
the procedure mentioned in Documentation/networking/timestamping.rst.
They don't do anything locally if phy_has_hwtstamp() is set, except for
lan966x which installs PTP packet traps.

Centralize that behavior in a new dev_set_hwtstamp_phylib() code
function, which calls either phy_mii_ioctl() for the phylib PHY,
or .ndo_hwtstamp_set() of the netdev, based on a single policy
(currently simplistic: phy_has_hwtstamp()).

Any driver converted to .ndo_hwtstamp_set() will automatically opt into
the centralized phylib timestamping policy. Unconverted drivers still
get to choose whether they let the PHY handle timestamping or not.

Netdev drivers with integrated PHY drivers that don't use phylib
presumably don't set dev->phydev, and those will always see
HWTSTAMP_SOURCE_NETDEV requests even when converted. The timestamping
policy will remain 100% up to them.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20230801142824.1772134-13-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/microchip/lan966x/lan966x_main.c
drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
include/linux/net_tstamp.h
include/linux/netdevice.h
net/core/dev_ioctl.c