Hi Marc, > -----Original Message----- > From: Marc Kleine-Budde [mailto:mkl@xxxxxxxxxxxxxx] > Sent: Tuesday, August 7, 2018 8:01 PM > To: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>; Pankaj Bansal > <pankaj.bansal@xxxxxxx>; linux-can@xxxxxxxxxxxxxxx > Subject: Re: [PATCH v3 7/7] net: can: flexcan: use CAN FD frames for Tx/Rx > > On 08/01/2018 07:39 PM, Oliver Hartkopp wrote: > >>> I think the code can be simplified if you introduce a union for > >>> can_fram and canfd_frame. > >> > >> Can you be more specific in which structure/function? > >> > >> I was thinking of passing a skb to mailbox_read function instead of > canfd_frame or can_frame. > >> That way the code in rx_overload.c would become cleaner. > > > > IMO there's no need to have a union of struct can_frame and struct > > canfd_frame as the latter has been defined to have a binary compatible > > layout. See at: > > > > https://can-newsletter.org/engineering/standardization/nr_stand_can-fd > > _linux3.6_120703 > > > > So you can put either type of CAN frame into a struct canfd_frame. But > > whether your content is CAN or CAN FD has to be known somewhere > else!! > > Sure. > > > At least there should be a comment that the struct canfd_frame is used > > for both types of CAN frames. > > But you need to case it to a std canframe to access it. Setting the length > needs if (is_fd) else... > > Maybe the picture comes a bit clearer on my side, once the flexcan driver is > converted to CANFD mode :) Did you look at my proposal to pass skb to mailbox_read function? And to allocate skb_overflow In rx_offload when rx_offload is created and use that when we can't allocate skb during receive? > > 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�����٥