Re: [PATCH RFC net-next] can: dev: can_skb_get_dll_len(): introduce function to get data length of frame in data link layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/14/20 10:14 AM, Marc Kleine-Budde wrote:
> From: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
> 
> This patch adds the function can_skb_get_dll_len() which returns the length of
> a CAN frame on the data link layer, including Start-of-frame, Identifier,
> various other bits, the CRC, the End-of-frame, the Inter frame spacing and the
> actual data.
> 
> Co-developed-by: Arunachalam Santhanam <arunachalam.santhanam@xxxxxxxxxxxx>
> Not-Signed-off-by: Arunachalam Santhanam <arunachalam.santhanam@xxxxxxxxxxxx>
> Co-developed-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
> Not-Signed-off-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
> Co-developed-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> ---
> Hello,
> 
> while reviewing the etas_es58X driver and hacking on BQL support for the
> mcp251xfd driver, it turned out the a function to calculate the length of the
> CAN frame that's send over the wire should go into the generic CAN dev code.
> 
> Looking at the CAN and OSI layering I think the first layer where we have all
> the bits that we see on the wire is the data link layer (DLL).
> 
> https://www.can-cia.org/can-knowledge/can/can-data-link-layers
> 
> This is why I named the function can_skb_get_dll_len().
> 
> I'm planing to add a (better) calculation of the CAN-FD dll_len, depending on
> the data and including different CRC lengths.
> 
> As this code is copied from the etas_es58X driver, I've added the authors as
> Co-developed-by and I'd like to add their S-o-b to this patch.
> 
> Please review and commnt on the naming on the functions.

When implementing BQL we need the CAN frame's DLL len twice:
1. When sending the package to the hardware
2. After the TX-complete IRQ

We can calculate this information twice, but I thought we might put it into the
struct can_skb_priv.

https://elixir.bootlin.com/linux/latest/source/include/linux/can/skb.h#L34

Thoughts?

regards,
Marc

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

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux