iplink_can: add Classical CAN frame LEN8_DLC support

The len8_dlc element is filled by the CAN interface driver and used for CAN
frame creation by the CAN driver when the CAN_CTRLMODE_CC_LEN8_DLC flag is
supported by the driver and enabled via netlink configuration interface.

Add the command line support for cc-len8-dlc for Linux 5.11+

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
Oliver Hartkopp 2021-01-25 11:40:55 +01:00 committed by David Ahern
parent 7887500008
commit 2ce313d1bb

View File

@ -37,6 +37,7 @@ static void print_usage(FILE *f)
"\t[ fd { on | off } ]\n" "\t[ fd { on | off } ]\n"
"\t[ fd-non-iso { on | off } ]\n" "\t[ fd-non-iso { on | off } ]\n"
"\t[ presume-ack { on | off } ]\n" "\t[ presume-ack { on | off } ]\n"
"\t[ cc-len8-dlc { on | off } ]\n"
"\n" "\n"
"\t[ restart-ms TIME-MS ]\n" "\t[ restart-ms TIME-MS ]\n"
"\t[ restart ]\n" "\t[ restart ]\n"
@ -103,6 +104,7 @@ static void print_ctrlmode(FILE *f, __u32 cm)
_PF(CAN_CTRLMODE_FD, "FD"); _PF(CAN_CTRLMODE_FD, "FD");
_PF(CAN_CTRLMODE_FD_NON_ISO, "FD-NON-ISO"); _PF(CAN_CTRLMODE_FD_NON_ISO, "FD-NON-ISO");
_PF(CAN_CTRLMODE_PRESUME_ACK, "PRESUME-ACK"); _PF(CAN_CTRLMODE_PRESUME_ACK, "PRESUME-ACK");
_PF(CAN_CTRLMODE_CC_LEN8_DLC, "CC-LEN8-DLC");
#undef _PF #undef _PF
if (cm) if (cm)
print_hex(PRINT_ANY, NULL, "%x", cm); print_hex(PRINT_ANY, NULL, "%x", cm);
@ -211,6 +213,10 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
NEXT_ARG(); NEXT_ARG();
set_ctrlmode("presume-ack", *argv, &cm, set_ctrlmode("presume-ack", *argv, &cm,
CAN_CTRLMODE_PRESUME_ACK); CAN_CTRLMODE_PRESUME_ACK);
} else if (matches(*argv, "cc-len8-dlc") == 0) {
NEXT_ARG();
set_ctrlmode("cc-len8-dlc", *argv, &cm,
CAN_CTRLMODE_CC_LEN8_DLC);
} else if (matches(*argv, "restart") == 0) { } else if (matches(*argv, "restart") == 0) {
__u32 val = 1; __u32 val = 1;