> -----Original Message----- > From: Marc Kleine-Budde [mailto:mkl@xxxxxxxxxxxxxx] > Sent: Tuesday, July 31, 2018 1:19 PM > To: Pankaj Bansal <pankaj.bansal@xxxxxxx>; linux-can@xxxxxxxxxxxxxxx > Subject: Re: [PATCH 6/6] net: can: flexcan: use CAN FD frames for Tx/Rx > > On 07/31/2018 09:38 AM, Pankaj Bansal wrote: > > > >> -----Original Message----- > >> From: Marc Kleine-Budde [mailto:mkl@xxxxxxxxxxxxxx] > >> Sent: Tuesday, July 31, 2018 12:44 PM > >> To: Pankaj Bansal <pankaj.bansal@xxxxxxx>; linux-can@xxxxxxxxxxxxxxx > >> Subject: Re: [PATCH 6/6] net: can: flexcan: use CAN FD frames for > >> Tx/Rx > >> > >> On 07/31/2018 08:00 AM, Pankaj Bansal wrote: > >>>> -----Original Message----- > >>>> From: Marc Kleine-Budde [mailto:mkl@xxxxxxxxxxxxxx] > >>>> Sent: Monday, July 30, 2018 8:16 PM > >>>> To: Pankaj Bansal <pankaj.bansal@xxxxxxx>; > >>>> linux-can@xxxxxxxxxxxxxxx > >>>> Subject: Re: [PATCH 6/6] net: can: flexcan: use CAN FD frames for > >>>> Tx/Rx > >>>> > >>>> On 07/30/2018 06:07 PM, Pankaj Bansal wrote: > >>>>> Use can FD frames for Tx/Rx operations. This would be needed in > >>>>> upcoming SOC LX2160A, which supports CAN FD protocol > >>>> > >>>> Have you tested this with a CAN-2.0 compatible controller? Does the > >>>> userspace still work as expected if you pass CAN_RAW a CAN-FD > >>>> frames which only carries CAN-2.0? See > >>>> https://elixir.bootlin.com/linux/latest/source/net/can/raw.c#L811 > >>> > >>> I have tested this using cangen command to generate CAN 2.0 frames, > >>> in > >> LS1021A-TWR board. > >> > >> Yes.... > >> > >>> # ip link set can0 up type can bitrate 125000 [ 103.699095] IPv6: > >>> ADDRCONF(NETDEV_CHANGE): can0: link becomes ready # ip link set > >> can1 > >>> up type can bitrate 125000 [ 107.832078] IPv6: > >>> ADDRCONF(NETDEV_CHANGE): can1: link becomes ready # candump > can0 > >> & # > >>> candump can1 & > >> > >> ... but candump will switch the socket into CAN-FD mode. Your code > >> will however break existing userspace applications that do not switch > >> on CAN- FD mode. Maybe we should add a cmd-line parameter to > candump > >> do disable CAN-FD mode. > > > > There is an option in ip command to turn the FD mode on. > > -> ip link set can0 up type can bitrate 125000 dbitrate 250000 fd on > > > > I thought this command configures the CAN interface in FD mode. And > > normal command > > -> ip link set can0 up type can bitrate 125000 > > configures CAN interface In CAN 2.0 mode. > > Yes - If your driver supports this "ip" command. But your patches switch the > driver into CAN-FD mode unconditionally. I have limited the payload size to 8 bytes only in flexcan_probe: " BUT, limit the only possible payload value to be 8, because the CAN FD changes are not in place yet." + if (devtype_data->payload_size != CAN_MAX_DLEN) { + dev_err(&pdev->dev, "payload_size %d not supported\n", + devtype_data->payload_size); + err = -ENODEV; + goto failed_register; + } Also I am not advertising the CAN_CTRLMODE_FD in can.ctrlmode_supported. Is there any other change in my patches that conveys that the interface supports CAN FD? > > > Is there any test steps that I can follow to test if these changes > > will break existing applications or not? > > Yes - don't let candump switch on CAN-FD mode: > > -------->8-------->8-------->8-------->8-------->8-------->8-------->8-------->8-------->8- > ------- > diff --git a/candump.c b/candump.c > index f98d1c3d378c..331320a7a696 100644 > --- a/candump.c > +++ b/candump.c > @@ -535,8 +535,10 @@ int main(int argc, char **argv) > > } /* if (nptr) */ > > +#if 0 > /* try to switch the socket into CAN FD mode */ > setsockopt(s[i], SOL_CAN_RAW, CAN_RAW_FD_FRAMES, > &canfd_on, sizeof(canfd_on)); > +#endif > > if (rcvbuf_size) { > > -------->8-------->8-------->8-------->8-------->8-------->8-------->8-------->8-------->8- > ------- OK, I will try with these changes > > 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 | ��.n��������+%������w��{.n�����{����*jg��������ݢj����G�������j:+v���w�m������w�������h�����٥