On Mar 15 Dec. 2020 at 21:55, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote: > > Cc: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx> > Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> > --- > drivers/net/can/dev.c | 21 +++++++++++++++++++++ > include/linux/can/dev.h | 3 +++ > 2 files changed, 24 insertions(+) > > diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c > index 68f37ac54327..fa81e3067b3b 100644 > --- a/drivers/net/can/dev.c > +++ b/drivers/net/can/dev.c > @@ -60,6 +60,27 @@ u8 can_len2dlc(u8 len) > } > EXPORT_SYMBOL_GPL(can_len2dlc); > > +static const u8 len2dll_len[] = { > + 0, 1, 2, 3, 4, 5, 6, 7, 8, /* 0 - 8 */ > + 12, 12, 12, 12, /* 9 - 12 */ > + 16, 16, 16, 16, /* 13 - 16 */ > + 20, 20, 20, 20, /* 17 - 20 */ > + 24, 24, 24, 24, /* 21 - 24 */ > + 32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */ > + 40, 40, 40, 40, 40, 40, 40, 40, /* 33 - 40 */ > + 48, 48, 48, 48, 48, 48, 48, 48 /* 41 - 48 */ > +}; I totally misunderstood what you wanted to do in my previous email. I thought that the numbers were placeholders and that the final goal was to take into account the CRC as you previously mentioned in your first email. This function is just here to sanitize the data length, right? Then we could simply name it can_fd_sanitize_len().