From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Stephane Grosjean <s.grosjean@peak-system.com>,
linux-can@vger.kernel.org
Subject: iproute2 fd-non-iso PoC - was Re: [PATCH v4] can/peak_usb: add support for PEAK new CANFD USB adapters
Date: Wed, 07 Jan 2015 19:37:58 +0100 [thread overview]
Message-ID: <54AD7D06.5030705@hartkopp.net> (raw)
In-Reply-To: <54AD6ED8.2020808@hartkopp.net>
[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]
Just a short test:
I added u32 ctrlmode in Stephanes peak_usb_adapter struct for a test:
@@ -44,8 +46,11 @@ struct peak_usb_device;
struct peak_usb_adapter {
char *name;
u32 device_id;
+ u32 ctrlmode_supported;
+ u32 ctrlmode;
struct can_clock clock;
Which looks like this in pcan_usb_pro.c
@@ -1015,6 +1007,8 @@ struct peak_usb_adapter pcan_usb_pro = {
.name = "PCAN-USB Pro",
.device_id = PCAN_USBPRO_PRODUCT_ID,
.ctrl_count = PCAN_USBPRO_CHANNEL_COUNT,
+ .ctrlmode = 0,
+ .ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY,
.clock = {
and in pcan_usb_fd.c :
/* describes the PCAN-USB Pro FD adapter */
struct peak_usb_adapter pcan_usb_pro_fd = {
.name = "PCAN-USB Pro FD",
.device_id = PCAN_USBPROFD_PRODUCT_ID,
.ctrl_count = PCAN_USBPROFD_CHANNEL_COUNT,
.ctrlmode = CAN_CTRLMODE_FD_NON_ISO,
.ctrlmode_supported = CAN_CTRLMODE_FD |
CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY,
.clock = {
Finally the ip tools gives this output (when FD is enabled):
# ip -det link show can0
17: can0: <NOARP,ECHO> mtu 72 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can <FD,FD-NON-ISO> state STOPPED restart-ms 0
pcan_usb_fd: tseg1 1..64 tseg2 1..16 sjw 1..16 brp 1..1024 brp-inc 1
pcan_usb_fd: dtseg1 1..16 dtseg2 1..8 dsjw 1..4 dbrp 1..1024 dbrp-inc 1
clock 80000000
AND - as expected - removing this flag is denied:
# ip link set dev can0 type can fd-non-iso off
RTNETLINK answers: Operation not supported
Regards,
Oliver
ps. Current patch for iproute2 is attached. Will send a proper patch when
CAN_CTRLMODE_FD_NON_ISO found its way into mainline.
[-- Attachment #2: iproute2-fd-non-iso.patch --]
[-- Type: text/x-patch, Size: 1624 bytes --]
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
index 25fd52c..6d4ec2a 100644
--- a/include/linux/can/netlink.h
+++ b/include/linux/can/netlink.h
@@ -98,6 +98,7 @@ struct can_ctrlmode {
#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */
#define CAN_CTRLMODE_PRESUME_ACK 0x40 /* Ignore missing CAN ACKs */
+#define CAN_CTRLMODE_FD_NON_ISO 0x80 /* CAN FD in non-ISO mode */
/*
* CAN device statistics
diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index fb50332..f1b089d 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -37,6 +37,7 @@ static void print_usage(FILE *f)
"\t[ one-shot { on | off } ]\n"
"\t[ berr-reporting { on | off } ]\n"
"\t[ fd { on | off } ]\n"
+ "\t[ fd-non-iso { on | off } ]\n"
"\t[ presume-ack { on | off } ]\n"
"\n"
"\t[ restart-ms TIME-MS ]\n"
@@ -100,6 +101,7 @@ static void print_ctrlmode(FILE *f, __u32 cm)
_PF(CAN_CTRLMODE_ONE_SHOT, "ONE-SHOT");
_PF(CAN_CTRLMODE_BERR_REPORTING, "BERR-REPORTING");
_PF(CAN_CTRLMODE_FD, "FD");
+ _PF(CAN_CTRLMODE_FD_NON_ISO, "FD-NON-ISO");
_PF(CAN_CTRLMODE_PRESUME_ACK, "PRESUME-ACK");
#undef _PF
if (cm)
@@ -203,6 +205,10 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
NEXT_ARG();
set_ctrlmode("fd", *argv, &cm,
CAN_CTRLMODE_FD);
+ } else if (matches(*argv, "fd-non-iso") == 0) {
+ NEXT_ARG();
+ set_ctrlmode("fd-non-iso", *argv, &cm,
+ CAN_CTRLMODE_FD_NON_ISO);
} else if (matches(*argv, "presume-ack") == 0) {
NEXT_ARG();
set_ctrlmode("presume-ack", *argv, &cm,
next prev parent reply other threads:[~2015-01-07 18:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 10:00 [PATCH v4] can/peak_usb: add support for PEAK new CANFD USB adapters Stephane Grosjean
2015-01-07 17:03 ` Marc Kleine-Budde
2015-01-07 17:37 ` Oliver Hartkopp
2015-01-07 18:37 ` Oliver Hartkopp [this message]
2015-01-08 9:04 ` iproute2 fd-non-iso PoC - was " Marc Kleine-Budde
2015-01-08 9:09 ` Marc Kleine-Budde
2015-01-13 13:18 ` Stephane Grosjean
2015-01-13 13:29 ` Marc Kleine-Budde
2015-01-13 13:32 ` Marc Kleine-Budde
2015-01-14 10:50 ` Stephane Grosjean
2015-01-14 10:51 ` Marc Kleine-Budde
2015-01-14 10:56 ` Stephane Grosjean
2015-01-14 11:07 ` Marc Kleine-Budde
2015-01-14 18:55 ` Oliver Hartkopp
2015-01-14 20:57 ` Marc Kleine-Budde
2015-01-15 15:49 ` Marc Kleine-Budde
2015-01-14 12:05 ` Fwd: " Stephane Grosjean
2015-01-14 13:00 ` Andri Yngvason
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=54AD7D06.5030705@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=s.grosjean@peak-system.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.