All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>,
	Stephane Grosjean <s.grosjean@peak-system.com>,
	linux-can@vger.kernel.org
Subject: Re: iproute2 fd-non-iso PoC - was Re: [PATCH v4] can/peak_usb: add support for PEAK new CANFD USB adapters
Date: Thu, 08 Jan 2015 10:04:33 +0100	[thread overview]
Message-ID: <54AE4821.3090204@pengutronix.de> (raw)
In-Reply-To: <54AD7D06.5030705@hartkopp.net>

[-- Attachment #1: Type: text/plain, Size: 3031 bytes --]

On 01/07/2015 07:37 PM, Oliver Hartkopp wrote:
> 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,

Not needed, as 0 is default.

> +       .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.
> 
> 
> 
> iproute2-fd-non-iso.patch
> 
> 
> 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 */

AFAIC the headers are imported from the Linux tree, so no need to modify
this file in the final patch. You might have to ask for the import when
sending these patches, though.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-01-08  9:04 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     ` iproute2 fd-non-iso PoC - was " Oliver Hartkopp
2015-01-08  9:04       ` Marc Kleine-Budde [this message]
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=54AE4821.3090204@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=s.grosjean@peak-system.com \
    --cc=socketcan@hartkopp.net \
    /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.