]> git.itanic.dy.fi Git - linux-stable/commitdiff
net: fec: delete fec_ptp_disable_hwts()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 1 Aug 2023 14:28:19 +0000 (17:28 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Aug 2023 02:11:06 +0000 (19:11 -0700)
Commit 340746398b67 ("net: fec: fix hardware time stamping by external
devices") was overly cautious with calling fec_ptp_disable_hwts() when
cmd == SIOCSHWTSTAMP and use_fec_hwts == false, because use_fec_hwts is
based on a runtime invariant (phy_has_hwtstamp()). Thus, if use_fec_hwts
is false, then fep->hwts_tx_en and fep->hwts_rx_en cannot be changed at
runtime; their values depend on the initial memory allocation, which
already sets them to zeroes.

If the core will ever gain support for switching timestamping layers,
it will arrange for a more organized calling convention and disable
timestamping in the previous layer as a first step. This means that the
code in the FEC driver is not necessary in any case.

The purpose of this change is to arrange the phy_has_hwtstamp() code in
a way in which it can be refactored away into generic logic.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
Link: https://lore.kernel.org/r/20230801142824.1772134-8-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fec.h
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/freescale/fec_ptp.c

index ec64067ca782e1638f8fccc46b2f061392ee2b02..110f2e9f3e3fa97ded601c73fca20cb787f1e983 100644 (file)
@@ -698,7 +698,6 @@ struct fec_enet_private {
 void fec_ptp_init(struct platform_device *pdev, int irq_idx);
 void fec_ptp_stop(struct platform_device *pdev);
 void fec_ptp_start_cyclecounter(struct net_device *ndev);
-void fec_ptp_disable_hwts(struct net_device *ndev);
 int fec_ptp_set(struct net_device *ndev, struct kernel_hwtstamp_config *config,
                struct netlink_ext_ack *extack);
 void fec_ptp_get(struct net_device *ndev, struct kernel_hwtstamp_config *config);
index bbd0cc97905a0ada3c90d95c65d56c6f17f3dc2d..6d81fff0227e55c3b117486b49640fa5f1afc266 100644 (file)
@@ -3895,11 +3895,8 @@ static int fec_hwtstamp_set(struct net_device *ndev,
        struct fec_enet_private *fep = netdev_priv(ndev);
        struct phy_device *phydev = ndev->phydev;
 
-       if (phy_has_hwtstamp(phydev)) {
-               fec_ptp_disable_hwts(ndev);
-
+       if (phy_has_hwtstamp(phydev))
                return phy_mii_ioctl(phydev, config->ifr, SIOCSHWTSTAMP);
-       }
 
        if (!netif_running(ndev))
                return -EINVAL;
index befd49b8bd718a32fb0aed021d83964e75c08ec0..181d9bfbee220f1a5ca0212ce467482e5417ccf8 100644 (file)
@@ -605,18 +605,6 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
        }
 }
 
-/**
- * fec_ptp_disable_hwts - disable hardware time stamping
- * @ndev: pointer to net_device
- */
-void fec_ptp_disable_hwts(struct net_device *ndev)
-{
-       struct fec_enet_private *fep = netdev_priv(ndev);
-
-       fep->hwts_tx_en = 0;
-       fep->hwts_rx_en = 0;
-}
-
 int fec_ptp_set(struct net_device *ndev, struct kernel_hwtstamp_config *config,
                struct netlink_ext_ack *extack)
 {