Re: [PATCH net-next v2 1/7] net: ti: am65-cpsw: move hw timestamping to ndo callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 10/14/2025 3:42 PM, Vadim Fedorenko wrote:
> Migrate driver to new API for HW timestamping.
> 
> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@xxxxxxxxx>
> ---
>  drivers/net/ethernet/ti/am65-cpsw-nuss.c | 44 +++++++++++-------------
>  1 file changed, 20 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index 110eb2da8dbc..d5f358ec9820 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -1788,28 +1788,28 @@ static int am65_cpsw_nuss_ndo_slave_set_mac_address(struct net_device *ndev,
>  }
>  
>  static int am65_cpsw_nuss_hwtstamp_set(struct net_device *ndev,
> -				       struct ifreq *ifr)
> +				       struct kernel_hwtstamp_config *cfg,
> +				       struct netlink_ext_ack *extack)
>  {
>  	struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
>  	u32 ts_ctrl, seq_id, ts_ctrl_ltype2, ts_vlan_ltype;
> -	struct hwtstamp_config cfg;
>  
> -	if (!IS_ENABLED(CONFIG_TI_K3_AM65_CPTS))
> +	if (!IS_ENABLED(CONFIG_TI_K3_AM65_CPTS)) {
> +		NL_SET_ERR_MSG(extack, "Time stamping is not supported");
>  		return -EOPNOTSUPP;
> -
> -	if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
> -		return -EFAULT;
> +	}
>  
>  	/* TX HW timestamp */
> -	switch (cfg.tx_type) {
> +	switch (cfg->tx_type) {
>  	case HWTSTAMP_TX_OFF:
>  	case HWTSTAMP_TX_ON:
>  		break;
>  	default:
> +		NL_SET_ERR_MSG(extack, "TX mode is not supported");

We could use NL_ST_ERR_MSG_MOD_FMT and format the particular invalid
type here, but not certain how helpful that would be in practice.
Perhaps the unsupported filter type is obvious from context of sending
the invalid netlink command?

Either way, the conversion looks quite straight forward.

Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Discussion]     [TCP Instrumentation]     [Netfilter]     [Berkeley Packet Filter]     [Ethernet Bridging]     [Linux Wireless Networking]     [Openconnect]     [Linux WPAN Networking]     [Linux Host AP]     [Linux WPAN Networking]     [Linux Bluetooth Networking]     [Linux ATH6KL Networking]     [Linux Networking Users]     [XDP Newbies]     [Linux Coverity]     [VLAN]     [Git]     [IETF Annouce]     [Linux Assembly]     [Security]     [Bugtraq]     [Yosemite Information]     [MIPS Linux]     [ARM Linux Kernel]     [ARM Linux]     [Linux Virtualization]     [Linux IDE]     [Linux RAID]     [Linux SCSI]     [Squid]
  Powered by Linux