Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: lan743x: convert to ndo_hwtstamp_set()

New timestamping API was introduced in commit 66f7223039c0 ("net: add
NDOs for configuring hardware timestamping") from kernel v6.6.

It is time to convert the lan743x driver to the new API, so that
timestamping configuration can be removed from the ndo_eth_ioctl()
path completely.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20250514151931.1988047-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vladimir Oltean and committed by
Jakub Kicinski
958a857a 87948df5

+12 -27
+1 -2
drivers/net/ethernet/microchip/lan743x_main.c
··· 3351 3351 3352 3352 if (!netif_running(netdev)) 3353 3353 return -EINVAL; 3354 - if (cmd == SIOCSHWTSTAMP) 3355 - return lan743x_ptp_ioctl(netdev, ifr, cmd); 3356 3354 3357 3355 return phylink_mii_ioctl(adapter->phylink, ifr, cmd); 3358 3356 } ··· 3445 3447 .ndo_change_mtu = lan743x_netdev_change_mtu, 3446 3448 .ndo_get_stats64 = lan743x_netdev_get_stats64, 3447 3449 .ndo_set_mac_address = lan743x_netdev_set_mac_address, 3450 + .ndo_hwtstamp_set = lan743x_ptp_hwtstamp_set, 3448 3451 }; 3449 3452 3450 3453 static void lan743x_hardware_cleanup(struct lan743x_adapter *adapter)
+8 -24
drivers/net/ethernet/microchip/lan743x_ptp.c
··· 1736 1736 lan743x_ptp_tx_ts_complete(adapter); 1737 1737 } 1738 1738 1739 - int lan743x_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) 1739 + int lan743x_ptp_hwtstamp_set(struct net_device *netdev, 1740 + struct kernel_hwtstamp_config *config, 1741 + struct netlink_ext_ack *extack) 1740 1742 { 1741 1743 struct lan743x_adapter *adapter = netdev_priv(netdev); 1742 - struct hwtstamp_config config; 1743 - int ret = 0; 1744 1744 int index; 1745 1745 1746 - if (!ifr) { 1747 - netif_err(adapter, drv, adapter->netdev, 1748 - "SIOCSHWTSTAMP, ifr == NULL\n"); 1749 - return -EINVAL; 1750 - } 1751 - 1752 - if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) 1753 - return -EFAULT; 1754 - 1755 - switch (config.tx_type) { 1746 + switch (config->tx_type) { 1756 1747 case HWTSTAMP_TX_OFF: 1757 1748 for (index = 0; index < adapter->used_tx_channels; 1758 1749 index++) ··· 1767 1776 lan743x_ptp_set_sync_ts_insert(adapter, true); 1768 1777 break; 1769 1778 case HWTSTAMP_TX_ONESTEP_P2P: 1770 - ret = -ERANGE; 1771 - break; 1779 + return -ERANGE; 1772 1780 default: 1773 1781 netif_warn(adapter, drv, adapter->netdev, 1774 - " tx_type = %d, UNKNOWN\n", config.tx_type); 1775 - ret = -EINVAL; 1776 - break; 1782 + " tx_type = %d, UNKNOWN\n", config->tx_type); 1783 + return -EINVAL; 1777 1784 } 1778 1785 1779 - ret = lan743x_rx_set_tstamp_mode(adapter, config.rx_filter); 1780 - 1781 - if (!ret) 1782 - return copy_to_user(ifr->ifr_data, &config, 1783 - sizeof(config)) ? -EFAULT : 0; 1784 - return ret; 1786 + return lan743x_rx_set_tstamp_mode(adapter, config->rx_filter); 1785 1787 }
+3 -1
drivers/net/ethernet/microchip/lan743x_ptp.h
··· 52 52 void lan743x_ptp_update_latency(struct lan743x_adapter *adapter, 53 53 u32 link_speed); 54 54 55 - int lan743x_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); 55 + int lan743x_ptp_hwtstamp_set(struct net_device *netdev, 56 + struct kernel_hwtstamp_config *config, 57 + struct netlink_ext_ack *extack); 56 58 57 59 #define LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS (4) 58 60