[RFC PATCH v1 0/1] add the netlink interface for CAN-FD Transmitter Delay Compensation (TDC)

From: Vincent Mailhol
Date: Thu May 06 2021 - 07:14:31 EST


This serie contains a single patch which adds a netlink interface for
the TDC parameters using netlink nested attributes.

In March, I introduced the Transmitter Delay Compensation (TDC) to the
kernel though two patches:
- commit 289ea9e4ae59 ("can: add new CAN FD bittiming parameters:
Transmitter Delay Compensation (TDC)")
- commit c25cc7993243 ("can: bittiming: add calculation for CAN FD
Transmitter Delay Compensation (TDC)")

The netlink interface was missing from this series because the initial
patch needed rework in order to make it more flexible for future
changes.

At that time, Marc suggested to take inspiration from the recently
released ethtool-netlink interface.
Ref: https://lore.kernel.org/linux-can/20210407081557.m3sotnepbgasarri@xxxxxxxxxxxxxx/

After further research, it appears that ethtool uses nested attributes
(c.f. NLA_NESTED type in validation policy). A bit of trivia: the
NLA_NESTED type was introduced in version 2.6.15 of the kernel and
thus actually predates Socket CAN.
Ref: commit bfa83a9e03cf ("[NETLINK]: Type-safe netlink
messages/attributes interface")

It took me a bit of time to understand and figure out how to use those
nested attributes. While the patch should be functional, I am not fully
done with my testing yet. I thus send this version as an RFC. I wish
to receive comments of the overall design. Contents of the functions
might still be subjected to small changes.

After gathering the comments, I will send a new version in which I
will also include an update to Documentation/networking/can.rst.

Vincent Mailhol (1):
can: netlink: add interface for CAN-FD Transmitter Delay Compensation
(TDC)

drivers/net/can/dev/Makefile | 1 +
drivers/net/can/dev/netlink-tdc.c | 122 ++++++++++++++++++++++++++++++
drivers/net/can/dev/netlink-tdc.h | 18 +++++
drivers/net/can/dev/netlink.c | 15 +++-
include/uapi/linux/can/netlink.h | 28 ++++++-
5 files changed, 179 insertions(+), 5 deletions(-)
create mode 100644 drivers/net/can/dev/netlink-tdc.c
create mode 100644 drivers/net/can/dev/netlink-tdc.h

--
2.26.3