Re: [RFC PATCH net-next v6 1/5] net: Add NDOs for hardware timestamp get/set

Vladimir Oltean
2023-05-11T12:32:55Z

On Mon, May 01, 2023 at 10:31:46PM -0600, Maxim Georgiev wrote:
> struct net_device_ops {
> int (*ndo_init)(struct net_device *dev);
> @@ -1649,6 +1659,12 @@ struct net_device_ops {
> ktime_t (*ndo_get_tstamp)(struct net_device *dev,
> const struct skb_shared_hwtstamps *hwtstamps,
> bool cycles);
> + int (*ndo_hwtstamp_get)(struct net_device *dev,
> + struct kernel_hwtstamp_config *kernel_config,
> + struct netlink_ext_ack *extack);

I'm not sure it is necessary to pass an extack to "get". That should
only give a more detailed reason if the driver refuses something.

For that matter, now that ndo_hwtstamp_get() should no longer be
concerned with the copy_to_user(), I'm not even sure that it should
return int at all, and not void. The transition is going to be slightly
problematic though, with the generic_hwtstamp_get_lower() necessarily
still calling dev_eth_ioctl() -> copy_to_user(), so we probably can't
make it void just now.