Linux CAN drivers development
 help / color / mirror / Atom feed
From: Vincent Mailhol <mailhol@kernel.org>
To: netdev@vger.kernel.org,
	Stephen Hemminger <stephen@networkplumber.org>,
	 Marc Kleine-Budde <mkl@pengutronix.de>,
	 Oliver Hartkopp <socketcan@hartkopp.net>,
	David Ahern <dsahern@kernel.org>
Cc: "Rakuram Eswaran" <rakuram.e96@gmail.com>,
	"Stéphane Grosjean" <stephane.grosjean@free.fr>,
	linux-kernel@vger.kernel.org, linux-can@vger.kernel.org,
	"Vincent Mailhol" <mailhol@kernel.org>
Subject: [PATCH iproute2-next v2 4/7] iplink_can: add the "restricted" option
Date: Mon, 01 Dec 2025 23:55:12 +0100	[thread overview]
Message-ID: <20251201-canxl-netlink-v2-4-dadfac811872@kernel.org> (raw)
In-Reply-To: <20251201-canxl-netlink-v2-0-dadfac811872@kernel.org>

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@kernel.org>
---
Changelog:

v1 -> v2:

  - s/matches/strcmp/g in can_parse_opt()
---
 ip/iplink_can.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index d5abc43a..0ba86550 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 (strcmp(*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


  parent reply	other threads:[~2025-12-01 22:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 22:55 [PATCH iproute2-next v2 0/7] iplink_can: add CAN XL support Vincent Mailhol
2025-12-01 22:55 ` [PATCH iproute2-next v2 1/7] iplink_can: print_usage: fix the text indentation Vincent Mailhol
2025-12-01 22:55 ` [PATCH iproute2-next v2 2/7] iplink_can: print_usage: change unit for minimum time quanta to mtq Vincent Mailhol
2025-12-01 22:55 ` [PATCH iproute2-next v2 3/7] iplink_can: print_usage: describe the CAN bittiming units Vincent Mailhol
2025-12-01 22:55 ` Vincent Mailhol [this message]
2025-12-01 22:55 ` [PATCH iproute2-next v2 5/7] iplink_can: add initial CAN XL interface Vincent Mailhol
2025-12-02  0:38   ` Stephen Hemminger
2025-12-02 22:30     ` Vincent Mailhol
2025-12-01 22:55 ` [PATCH iproute2-next v2 6/7] iplink_can: add CAN XL's "tms" option Vincent Mailhol
2025-12-01 22:55 ` [PATCH iproute2-next v2 7/7] iplink_can: add CAN XL's PWM interface Vincent Mailhol
2025-12-02  9:33 ` [PATCH iproute2-next v2 0/7] iplink_can: add CAN XL support Oliver Hartkopp
2025-12-02 22:50   ` Vincent Mailhol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251201-canxl-netlink-v2-4-dadfac811872@kernel.org \
    --to=mailhol@kernel.org \
    --cc=dsahern@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=rakuram.e96@gmail.com \
    --cc=socketcan@hartkopp.net \
    --cc=stephane.grosjean@free.fr \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox