linux/drivers/net/can
Vincent Mailhol 383f0993fc can: netlink: report the CAN controller mode supported flags
Currently, the CAN netlink interface provides no easy ways to check
the capabilities of a given controller. The only method from the
command line is to try each CAN_CTRLMODE_* individually to check
whether the netlink interface returns an -EOPNOTSUPP error or not
(alternatively, one may find it easier to directly check the source
code of the driver instead...)

This patch introduces a method for the user to check both the
supported and the static capabilities. The proposed method introduces
a new IFLA nest: IFLA_CAN_CTRLMODE_EXT which extends the current
IFLA_CAN_CTRLMODE. This is done to guaranty a full forward and
backward compatibility between the kernel and the user land
applications.

The IFLA_CAN_CTRLMODE_EXT nest contains one single entry:
IFLA_CAN_CTRLMODE_SUPPORTED. Because this entry is only used in one
direction: kernel to userland, no new struct nla_policy are
introduced.

Below table explains how IFLA_CAN_CTRLMODE_SUPPORTED (hereafter:
"supported") and can_ctrlmode::flags (hereafter: "flags") allow us to
identify both the supported and the static capabilities, when masked
with any of the CAN_CTRLMODE_* bit flags:

 supported &	flags &		Controller capabilities
 CAN_CTRLMODE_*	CAN_CTRLMODE_*
 -----------------------------------------------------------------------
 false		false		Feature not supported (always disabled)
 false		true		Static feature (always enabled)
 true		false		Feature supported but disabled
 true		true		Feature supported and enabled

Link: https://lore.kernel.org/all/20211213160226.56219-5-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-01-05 12:09:06 +01:00
..
c_can can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
cc770 can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
dev can: netlink: report the CAN controller mode supported flags 2022-01-05 12:09:06 +01:00
ifi_canfd can: do not increase rx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
m_can can: dev: add sanity check in can_set_static_ctrlmode() 2022-01-05 12:09:05 +01:00
mscan can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
peak_canfd can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
rcar can: dev: add sanity check in can_set_static_ctrlmode() 2022-01-05 12:09:05 +01:00
sja1000 can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
softing can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
spi can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
usb can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
at91_can.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
flexcan.c can: flexcan: Use struct_group() to zero struct flexcan_regs regions 2021-09-25 08:20:48 -07:00
grcan.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
janz-ican3.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
Kconfig can: flexcan: update Kconfig to enable coldfire 2021-07-25 11:36:29 +02:00
kvaser_pciefd.c can: do not increase rx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
led.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Makefile can: dev: move driver related infrastructure into separate subdir 2021-01-13 09:42:58 +01:00
pch_can.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
slcan.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
sun4i_can.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
ti_hecc.c can: ti_hecc: ti_hecc_probe(): use platform_get_irq() to get the interrupt 2022-01-05 12:08:19 +01:00
vcan.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
vxcan.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
xilinx_can.c can: do not increase rx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00