> -----Original Message----- > From: Marc Kleine-Budde [mailto:mkl@xxxxxxxxxxxxxx] > Sent: Tuesday, July 31, 2018 1:29 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:55 AM, Pankaj Bansal wrote: > >>> 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? > > You allocate and use CAN-FD frames, thus this will fail on existing > applications that don't switch on CAN-FD mode on the socket. > I tried with changes that you suggested : diff --git a/candump.c b/candump.c index f98d1c3..be3a23d 100644 --- a/candump.c +++ b/candump.c @@ -535,9 +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) { int curr_rcvbuf_size; I got the same output: # ip link set can0 up type can bitrate 125000 [ 264.890127] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready # ip link set can1 up type can bitrate 125000 [ 280.073214] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready # candump can0 & # candump can1 & # cangen can0 -n 10 can0 09A [3] 81 63 4F can1 09A [03] 81 63 4F can1 264 [04] 7C 07 E1 2F can0 264 [4] 7C 07 E1 2F can1 53F [05] 77 4C 9B 6B F5 can0 53F [5] 77 4C 9B 6B F5 can1 465 [03] A7 F7 27 can0 465 [3] A7 F7 27 can1 570 [08] 68 2D 0D 6D 6C EE DA 43 can0 570 [8] 68 2D 0D 6D 6C EE DA 43 can0 10B [8] 10 DA 9C 28 93 9E B3 7F can1 10B [08] 10 DA 9C 28 93 9E B3 7F can1 4C8 [06] B5 3D 43 16 35 14 can0 4C8 [6] B5 3D 43 16 35 14 can1 06F [04] 9A E8 00 5D can0 06F [4] 9A E8 00 5D can0 197 [8] EE 22 78 74 FB 1B 44 1E can1 197 [08] EE 22 78 74 FB 1B 44 1E can1 450 [08] C6 C8 F3 05 8F A1 13 00 can0 450 [8] C6 C8 F3 05 8F A1 13 00 # cangen -e can0 -n 10 can0 1665376A [4] D8 3E 2A 7F can1 1665376A [04] D8 3E 2A 7F can1 1E6B4A2E [01] DD can0 1E6B4A2E [1] DD can1 1EBB1C5C [08] 2E 63 59 51 28 AA B4 49 can0 1EBB1C5C [8] 2E 63 59 51 28 AA B4 49 can1 19F2E803 [08] 78 E5 BD 43 DD E9 EF 6D can0 19F2E803 [8] 78 E5 BD 43 DD E9 EF 6D can0 1D1DD346 [8] B5 B4 F4 37 43 27 B1 5A can1 1D1DD346 [08] B5 B4 F4 37 43 27 B1 5A can1 1AD678D2 [02] B9 70 can0 1AD678D2 [2] B9 70 can0 1DD9789B [6] CE 23 B0 2E B3 57 can1 1DD9789B [06] CE 23 B0 2E B3 57 can1 1A497CC6 [06] C9 F8 2A 2C 30 B4 can0 1A497CC6 [6] C9 F8 2A 2C 30 B4 can0 03531F4A [2] B9 9D can1 03531F4A [02] B9 9D can1 133AFC43 [07] 03 CA 11 74 9F 18 F6 can0 133AFC43 [7] 03 CA 11 74 9F 18 F6 # cangen -R can0 -n 10 can0 2B2 [0] remote request can1 2B2 [00] can1 48D [04] 03 CA 11 74 can0 48D [4] remote request can1 664 [02] 03 CA can0 664 [2] remote request can0 7A2 [1] remote request can1 7A2 [01] 03 can1 356 [08] 03 CA 11 74 9F 18 F6 00 can0 356 [8] remote request can0 7C1 [4] remote request can1 7C1 [04] 03 CA 11 74 can1 2ED [04] 03 CA 11 74 can0 2ED [4] remote request can0 375 [3] remote request can1 375 [03] 03 CA 11 can1 414 [08] 03 CA 11 74 9F 18 F6 00 can0 414 [8] remote request can0 563 [8] remote request can1 563 [08] 03 CA 11 74 9F 18 F6 00 # > > static struct sk_buff *can_rx_offload_offload_one(struct > > can_rx_offload *offload { > > struct sk_buff *skb = NULL; > > struct can_rx_offload_cb *cb; > > - struct can_frame *cf; > > + struct canfd_frame *cf; > > int ret; > > > > /* If queue is full or skb not available, read to discard mailbox */ > > if (likely(skb_queue_len(&offload->skb_queue) <= > > offload->skb_queue_len_max)) > > - skb = alloc_can_skb(offload->dev, &cf); > > + skb = alloc_canfd_skb(offload->dev, &cf); > > > > 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�����٥