Re: ethtool: ring configuration for CAN devices

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

 



On 25.10.2021 14:27:06, Andrew Lunn wrote:
> I would not consider it as two different modes, but as N modes. That
> way, we are prepared for CAN-3.0 which might need other ring
> parameters.

ACK - there's CAN-XL, but I haven't seen any HW, yet. Let's follow the
zero one infinity rule :)

> The netlink API is extensible, unlike the IOCTL interface. I would add
> an additional optional attribute, ETHTOOL_A_RINGS_MODE, with values like:
> 
> ETHTOOL_A_RINGS_MODE_DEFAULT
> ETHTOOL_A_RINGS_MODE_CAN_2
> ETHTOOL_A_RINGS_MODE_CAN_FD
> 
> The IOCTL would always be for mode _DEFAULT, and it would get/set the
> current used setting. If the optionally attribute is missing, then the
> calling into the driver would also use _DEFAULT. However, if it is
> present, the driver can store away the ring parameters for a
> particular mode, and maybe actually put them into use if the mode is
> currently active.
> 
> You cannot change
> 
> struct ethtool_ringparam {
> 	__u32	cmd;
> 	__u32	rx_max_pending;
> 	__u32	rx_mini_max_pending;
> 	__u32	rx_jumbo_max_pending;
> 	__u32	tx_max_pending;
> 	__u32	rx_pending;
> 	__u32	rx_mini_pending;
> 	__u32	rx_jumbo_pending;
> 	__u32	tx_pending;
> };
> 
> Since that is ABI.

ACK

> But you can add an
> 
> struct ethtool_kringparam {
> 	__u32	cmd;
> 	__u32   mode;
> 	__u32	rx_max_pending;
> 	__u32	rx_mini_max_pending;
> 	__u32	rx_jumbo_max_pending;
> 	__u32	tx_max_pending;
> 	__u32	rx_pending;
> 	__u32	rx_mini_pending;
> 	__u32	rx_jumbo_pending;
> 	__u32	tx_pending;
> };
> 
> and use this structure between the ethtool core and the drivers. This
> has already been done at least once to allow extending the
> API. Semantic patches are good for making the needed changes to all
> the drivers.

What about the proposed "two new parameters ringparam_ext and extack for
.get_ringparam and .set_ringparam to extend more ring params through
netlink." by Hao Chen/Guangbin Huang in:

https://lore.kernel.org/all/20211014113943.16231-5-huangguangbin2@xxxxxxxxxx/

I personally like the conversion of the in in-kernel API to struct
ethtool_kringparam better than adding ringparam_ext.


Thanks for you input, regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux