[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251129-canxl-netlink-v1-4-96f2c0c54011@kernel.org>
Date: Sat, 29 Nov 2025 16:29:09 +0100
From: Vincent Mailhol <mailhol@...nel.org>
To: netdev@...r.kernel.org, Stephen Hemminger <stephen@...workplumber.org>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Oliver Hartkopp <socketcan@...tkopp.net>, David Ahern <dsahern@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-can@...r.kernel.org,
Vincent Mailhol <mailhol@...nel.org>
Subject: [PATCH 4/7] iplink_can: add the "restricted" option
This is the iproute2 counterpart of Linux kernel's commit 60f511f443e5
("can: netlink: add CAN_CTRLMODE_RESTRICTED").
ISO 11898-1:2024 adds a new restricted operation mode. This mode is added
as a mandatory feature for nodes which support CAN XL and is retrofitted as
optional for legacy nodes (i.e. the ones which only support Classical CAN
and CAN FD).
The restricted operation mode is nearly the same as the listen only mode:
the node can not send data frames or remote frames and can not send
dominant bits if an error occurs. The only exception is that the node shall
still send the acknowledgment bit.
Add the "restricted" option to iplink_can which controls the
CAN_CTRLMODE_RESTRICTED flag of the netlink interface.
Signed-off-by: Vincent Mailhol <mailhol@...nel.org>
---
ip/iplink_can.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index a2f59764..aeae6185 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -42,6 +42,7 @@ static void print_usage(FILE *f)
"\t[ presume-ack { on | off } ]\n"
"\t[ cc-len8-dlc { on | off } ]\n"
"\t[ tdc-mode { auto | manual | off } ]\n"
+ "\t[ restricted { on | off } ]\n"
"\n"
"\t[ restart-ms TIME-MS ]\n"
"\t[ restart ]\n"
@@ -116,6 +117,7 @@ static void print_ctrlmode(enum output_type t, __u32 flags, const char *key)
print_flag(t, &flags, CAN_CTRLMODE_CC_LEN8_DLC, "CC-LEN8-DLC");
print_flag(t, &flags, CAN_CTRLMODE_TDC_AUTO, "TDC-AUTO");
print_flag(t, &flags, CAN_CTRLMODE_TDC_MANUAL, "TDC-MANUAL");
+ print_flag(t, &flags, CAN_CTRLMODE_RESTRICTED, "RESTRICTED");
if (flags)
print_hex(t, NULL, "%x", flags);
@@ -257,6 +259,9 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
invarg("\"tdc-mode\" must be either of \"auto\", \"manual\" or \"off\"",
*argv);
}
+ } else if (matches(*argv, "restricted") == 0) {
+ NEXT_ARG();
+ set_ctrlmode("restricted", *argv, &cm, CAN_CTRLMODE_RESTRICTED);
} else if (matches(*argv, "restart") == 0) {
__u32 val = 1;
--
2.51.2
Powered by blists - more mailing lists