From b2969caffe45b5e2c321e6f2d7c2f8f412af6bea Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Wed, 22 Apr 2026 13:19:24 -0400 Subject: [PATCH] Revert "net: ixp4xx_eth: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()" This reverts commit a94d5447f6bf827bc29be2520ca636685bbc29e6. Signed-off-by: Sasha Levin --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 61 +++++++++++++----------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index a5e03e66cfd3..3b0c5f177447 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -386,20 +386,16 @@ static void ixp_tx_timestamp(struct port *port, struct sk_buff *skb) __raw_writel(TX_SNAPSHOT_LOCKED, ®s->channel[ch].ch_event); } -static int ixp4xx_hwtstamp_set(struct net_device *netdev, - struct kernel_hwtstamp_config *cfg, - struct netlink_ext_ack *extack) +static int hwtstamp_set(struct net_device *netdev, struct ifreq *ifr) { + struct hwtstamp_config cfg; struct ixp46x_ts_regs *regs; struct port *port = netdev_priv(netdev); int ret; int ch; - if (!cpu_is_ixp46x()) - return -EOPNOTSUPP; - - if (!netif_running(netdev)) - return -EINVAL; + if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) + return -EFAULT; ret = ixp46x_ptp_find(&port->timesync_regs, &port->phc_index); if (ret) @@ -408,10 +404,10 @@ static int ixp4xx_hwtstamp_set(struct net_device *netdev, ch = PORT2CHANNEL(port); regs = port->timesync_regs; - if (cfg->tx_type != HWTSTAMP_TX_OFF && cfg->tx_type != HWTSTAMP_TX_ON) + if (cfg.tx_type != HWTSTAMP_TX_OFF && cfg.tx_type != HWTSTAMP_TX_ON) return -ERANGE; - switch (cfg->rx_filter) { + switch (cfg.rx_filter) { case HWTSTAMP_FILTER_NONE: port->hwts_rx_en = 0; break; @@ -427,45 +423,39 @@ static int ixp4xx_hwtstamp_set(struct net_device *netdev, return -ERANGE; } - port->hwts_tx_en = cfg->tx_type == HWTSTAMP_TX_ON; + port->hwts_tx_en = cfg.tx_type == HWTSTAMP_TX_ON; /* Clear out any old time stamps. */ __raw_writel(TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED, ®s->channel[ch].ch_event); - return 0; + return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; } -static int ixp4xx_hwtstamp_get(struct net_device *netdev, - struct kernel_hwtstamp_config *cfg) +static int hwtstamp_get(struct net_device *netdev, struct ifreq *ifr) { + struct hwtstamp_config cfg; struct port *port = netdev_priv(netdev); - if (!cpu_is_ixp46x()) - return -EOPNOTSUPP; - - if (!netif_running(netdev)) - return -EINVAL; - - cfg->flags = 0; - cfg->tx_type = port->hwts_tx_en ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF; + cfg.flags = 0; + cfg.tx_type = port->hwts_tx_en ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF; switch (port->hwts_rx_en) { case 0: - cfg->rx_filter = HWTSTAMP_FILTER_NONE; + cfg.rx_filter = HWTSTAMP_FILTER_NONE; break; case PTP_SLAVE_MODE: - cfg->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_SYNC; + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_SYNC; break; case PTP_MASTER_MODE: - cfg->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ; + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ; break; default: WARN_ON_ONCE(1); return -ERANGE; } - return 0; + return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; } static int ixp4xx_mdio_cmd(struct mii_bus *bus, int phy_id, int location, @@ -987,6 +977,21 @@ static void eth_set_mcast_list(struct net_device *dev) } +static int eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd) +{ + if (!netif_running(dev)) + return -EINVAL; + + if (cpu_is_ixp46x()) { + if (cmd == SIOCSHWTSTAMP) + return hwtstamp_set(dev, req); + if (cmd == SIOCGHWTSTAMP) + return hwtstamp_get(dev, req); + } + + return phy_mii_ioctl(dev->phydev, req, cmd); +} + /* ethtool support */ static void ixp4xx_get_drvinfo(struct net_device *dev, @@ -1371,11 +1376,9 @@ static const struct net_device_ops ixp4xx_netdev_ops = { .ndo_stop = eth_close, .ndo_start_xmit = eth_xmit, .ndo_set_rx_mode = eth_set_mcast_list, - .ndo_eth_ioctl = phy_do_ioctl_running, + .ndo_eth_ioctl = eth_ioctl, .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, - .ndo_hwtstamp_get = ixp4xx_hwtstamp_get, - .ndo_hwtstamp_set = ixp4xx_hwtstamp_set, }; static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev)