Re: [RFC net-next 4/7] net: add ioctl interface for recover reference clock on netdev

From: Arnd Bergmann
Date: Mon Aug 16 2021 - 15:47:03 EST


On Mon, Aug 16, 2021 at 6:18 PM Arkadiusz Kubalewski
<arkadiusz.kubalewski@xxxxxxxxx> wrote:

> +/*
> + * Structure used for passing data with SIOCSSYNCE and SIOCGSYNCE ioctls
> + */
> +struct synce_ref_clk_cfg {
> + __u8 pin_id;
> + _Bool enable;
> +};

I'm not sure if there are any guarantees about the size and alignment of _Bool,
maybe better use __u8 here as well, if only for clarity.

> +#endif /* _NET_SYNCE_H */
> diff --git a/include/uapi/linux/sockios.h b/include/uapi/linux/sockios.h
> index 7d1bccbbef78..32c7d4909c31 100644
> --- a/include/uapi/linux/sockios.h
> +++ b/include/uapi/linux/sockios.h
> @@ -153,6 +153,10 @@
> #define SIOCSHWTSTAMP 0x89b0 /* set and get config */
> #define SIOCGHWTSTAMP 0x89b1 /* get config */
>
> +/* synchronous ethernet config per physical function */
> +#define SIOCSSYNCE 0x89c0 /* set and get config */
> +#define SIOCGSYNCE 0x89c1 /* get config */

I understand that these are traditionally using the old-style 16-bit
numbers, but is there any reason to keep doing that rather than
making them modern like this?

#define SIOCSSYNCE _IOWR(0x89, 0xc0, struct synce_ref_clk_cfg)
/* set and get config */
#define SIOCGSYNCE _IOR(0x89, 0xc1, struct synce_ref_clk_cfg)
/* get config */

Arnd