net: partial revert of the "Make timestamping selectable: series

Revert following commits:

commit acec05fb78 ("net_tstamp: Add TIMESTAMPING SOFTWARE and HARDWARE mask")
commit 11d55be06d ("net: ethtool: Add a command to expose current time stamping layer")
commit bb8645b00c ("netlink: specs: Introduce new netlink command to get current timestamp")
commit d905f9c753 ("net: ethtool: Add a command to list available time stamping layers")
commit aed5004ee7 ("netlink: specs: Introduce new netlink command to list available time stamping layers")
commit 51bdf3165f ("net: Replace hwtstamp_source by timestamping layer")
commit 0f7f463d48 ("net: Change the API of PHY default timestamp to MAC")
commit 091fab1228 ("net: ethtool: ts: Update GET_TS to reply the current selected timestamp")
commit 152c75e1d0 ("net: ethtool: ts: Let the active time stamping layer be selectable")
commit ee60ea6be0 ("netlink: specs: Introduce time stamping set command")

They need more time for reviews.

Link: https://lore.kernel.org/all/20231118183529.6e67100c@kernel.org/
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski
2023-11-18 18:38:05 -08:00
parent 055dd7511f
commit 289354f21b
23 changed files with 28 additions and 566 deletions

View File

@@ -259,7 +259,9 @@ static int dev_eth_ioctl(struct net_device *dev,
* @dev: Network device
* @cfg: Timestamping configuration structure
*
* Helper for calling the selected hardware provider timestamping.
* Helper for enforcing a common policy that phylib timestamping, if available,
* should take precedence in front of hardware timestamping provided by the
* netdev.
*
* Note: phy_mii_ioctl() only handles SIOCSHWTSTAMP (not SIOCGHWTSTAMP), and
* there only exists a phydev->mii_ts->hwtstamp() method. So this will return
@@ -269,14 +271,10 @@ static int dev_eth_ioctl(struct net_device *dev,
static int dev_get_hwtstamp_phylib(struct net_device *dev,
struct kernel_hwtstamp_config *cfg)
{
enum timestamping_layer ts_layer = dev->ts_layer;
if (ts_layer == PHY_TIMESTAMPING)
if (phy_has_hwtstamp(dev->phydev))
return phy_hwtstamp_get(dev->phydev, cfg);
else if (ts_layer == MAC_TIMESTAMPING)
return dev->netdev_ops->ndo_hwtstamp_get(dev, cfg);
return -EOPNOTSUPP;
return dev->netdev_ops->ndo_hwtstamp_get(dev, cfg);
}
static int dev_get_hwtstamp(struct net_device *dev, struct ifreq *ifr)
@@ -317,8 +315,9 @@ static int dev_get_hwtstamp(struct net_device *dev, struct ifreq *ifr)
* @cfg: Timestamping configuration structure
* @extack: Netlink extended ack message structure, for error reporting
*
* Helper for calling the selected hardware provider timestamping.
* If the netdev driver needs to perform specific actions even for PHY
* Helper for enforcing a common policy that phylib timestamping, if available,
* should take precedence in front of hardware timestamping provided by the
* netdev. If the netdev driver needs to perform specific actions even for PHY
* timestamping to work properly (a switch port must trap the timestamped
* frames and not forward them), it must set IFF_SEE_ALL_HWTSTAMP_REQUESTS in
* dev->priv_flags.
@@ -328,26 +327,20 @@ int dev_set_hwtstamp_phylib(struct net_device *dev,
struct netlink_ext_ack *extack)
{
const struct net_device_ops *ops = dev->netdev_ops;
enum timestamping_layer ts_layer = dev->ts_layer;
bool phy_ts = phy_has_hwtstamp(dev->phydev);
struct kernel_hwtstamp_config old_cfg = {};
bool changed = false;
int err;
cfg->source = ts_layer;
cfg->source = phy_ts ? HWTSTAMP_SOURCE_PHYLIB : HWTSTAMP_SOURCE_NETDEV;
if (ts_layer != PHY_TIMESTAMPING &&
ts_layer != MAC_TIMESTAMPING)
return -EOPNOTSUPP;
if (ts_layer == PHY_TIMESTAMPING &&
dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS) {
if (phy_ts && (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)) {
err = ops->ndo_hwtstamp_get(dev, &old_cfg);
if (err)
return err;
}
if (ts_layer == MAC_TIMESTAMPING ||
dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS) {
if (!phy_ts || (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)) {
err = ops->ndo_hwtstamp_set(dev, cfg, extack);
if (err) {
if (extack->_msg)
@@ -356,11 +349,10 @@ int dev_set_hwtstamp_phylib(struct net_device *dev,
}
}
if (ts_layer == PHY_TIMESTAMPING &&
dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)
if (phy_ts && (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS))
changed = kernel_hwtstamp_config_changed(&old_cfg, cfg);
if (ts_layer == PHY_TIMESTAMPING) {
if (phy_ts) {
err = phy_hwtstamp_set(dev->phydev, cfg, extack);
if (err) {
if (changed)