[PATCH 6/7] iplink_can: add CAN XL's "tms" option

Vincent Mailhol posted 7 patches 2 days, 6 hours ago
Re: [PATCH 6/7] iplink_can: add CAN XL's "tms" option
Posted by Oliver Hartkopp 2 days, 4 hours ago
Hi Vincent,

On 29.11.25 16:29, Vincent Mailhol wrote:
> This is the iproute2 counterpart of Linux kernel's commit 233134af2086
> ("can: netlink: add CAN_CTRLMODE_XL_TMS flag").
> 
> The Transceiver Mode Switching (TMS) indicates whether the CAN XL
> controller shall use the PWM or NRZ encoding during the data phase.
> 
> The term "transceiver mode switching" is used in both ISO 11898-1 and CiA
> 612-2 (although only the latter one uses the abbreviation TMS). We adopt
> the same naming convention here for consistency.
> 
> Add the "tms" option to iplink_can which controls the CAN_CTRLMODE_XL_TMS
> flag of the CAN netlink interface.
> 
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
> ---
>   ip/iplink_can.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/ip/iplink_can.c b/ip/iplink_can.c
> index 24f59aad..3e7925e8 100644
> --- a/ip/iplink_can.c
> +++ b/ip/iplink_can.c
> @@ -49,6 +49,7 @@ static void print_usage(FILE *f)
>   		"\t[ restricted { on | off } ]\n"
>   		"\t[ xl { on | off } ]\n"
>   		"\t[ xtdc-mode { auto | manual | off } ]\n"
> +		"\t[ tms { on | off } ]\n"
>   		"\n"
>   		"\t[ restart-ms TIME-MS ]\n"
>   		"\t[ restart ]\n"
> @@ -127,6 +128,7 @@ static void print_ctrlmode(enum output_type t, __u32 flags, const char *key)
>   	print_flag(t, &flags, CAN_CTRLMODE_XL, "XL");
>   	print_flag(t, &flags, CAN_CTRLMODE_XL_TDC_AUTO, "XL-TDC-AUTO");
>   	print_flag(t, &flags, CAN_CTRLMODE_XL_TDC_MANUAL, "XL-TDC-MANUAL");
> +	print_flag(t, &flags, CAN_CTRLMODE_XL_TMS, "XL-TMS");

print_flag(t, &flags, CAN_CTRLMODE_XL_TMS, "TMS");

That fits to the command line option and the messages inside the kernel now.

Best regards,
Oliver

>   
>   	if (flags)
>   		print_hex(t, NULL, "%x", flags);
> @@ -333,6 +335,9 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
>   				invarg("\"xtdc-mode\" must be either of \"auto\", \"manual\" or \"off\"",
>   					*argv);
>   			}
> +		} else if (matches(*argv, "tms") == 0) {
> +			NEXT_ARG();
> +			set_ctrlmode("tms", *argv, &cm, CAN_CTRLMODE_XL_TMS);
>   		} else if (matches(*argv, "restart") == 0) {
>   			__u32 val = 1;
>   
>
Re: [PATCH 6/7] iplink_can: add CAN XL's "tms" option
Posted by Vincent Mailhol 1 day, 22 hours ago
Hi Oliver,

On 29/11/2025 at 18:21, Oliver Hartkopp wrote:
> Hi Vincent,
> 
> On 29.11.25 16:29, Vincent Mailhol wrote:
>> This is the iproute2 counterpart of Linux kernel's commit 233134af2086
>> ("can: netlink: add CAN_CTRLMODE_XL_TMS flag").
>>
>> The Transceiver Mode Switching (TMS) indicates whether the CAN XL
>> controller shall use the PWM or NRZ encoding during the data phase.
>>
>> The term "transceiver mode switching" is used in both ISO 11898-1 and CiA
>> 612-2 (although only the latter one uses the abbreviation TMS). We adopt
>> the same naming convention here for consistency.
>>
>> Add the "tms" option to iplink_can which controls the CAN_CTRLMODE_XL_TMS
>> flag of the CAN netlink interface.
>>
>> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
>> ---
>>   ip/iplink_can.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/ip/iplink_can.c b/ip/iplink_can.c
>> index 24f59aad..3e7925e8 100644
>> --- a/ip/iplink_can.c
>> +++ b/ip/iplink_can.c
>> @@ -49,6 +49,7 @@ static void print_usage(FILE *f)
>>           "\t[ restricted { on | off } ]\n"
>>           "\t[ xl { on | off } ]\n"
>>           "\t[ xtdc-mode { auto | manual | off } ]\n"
>> +        "\t[ tms { on | off } ]\n"
>>           "\n"
>>           "\t[ restart-ms TIME-MS ]\n"
>>           "\t[ restart ]\n"
>> @@ -127,6 +128,7 @@ static void print_ctrlmode(enum output_type t, __u32
>> flags, const char *key)
>>       print_flag(t, &flags, CAN_CTRLMODE_XL, "XL");
>>       print_flag(t, &flags, CAN_CTRLMODE_XL_TDC_AUTO, "XL-TDC-AUTO");
>>       print_flag(t, &flags, CAN_CTRLMODE_XL_TDC_MANUAL, "XL-TDC-MANUAL");
>> +    print_flag(t, &flags, CAN_CTRLMODE_XL_TMS, "XL-TMS");
> 
> print_flag(t, &flags, CAN_CTRLMODE_XL_TMS, "TMS");
> 
> That fits to the command line option and the messages inside the kernel now.

OK. This will be addressed in v2 (including the updates on Patch #7 description).


Yours sincerely,
Vincent Mailhol