Re: [PATCH v3 1/4] can: add optional DLC element to Classical CAN frame structure

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

 



On 29.10.20 17:32, Oliver Hartkopp wrote:
>  /* CAN FD payload length and DLC definitions according to ISO 11898-7 */
>  #define CANFD_MAX_DLC 15
>  #define CANFD_MAX_DLEN 64
>
>  /**
>   * struct can_frame - basic CAN frame structure

struct can_frame - Classical CAN frame structure.

This is just a nitpick but I was reading again the past email
exchanges and using "Classical CAN" instead of "basic CAN" here would
be more consistent and help people to better understand the CC
acronym.

> - * @can_id:  CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition
> - * @can_dlc: frame payload length in byte (0 .. 8) aka data length code
> - *           N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1
> - *           mapping of the 'data length code' to the real payload length
> - * @__pad:   padding
> - * @__res0:  reserved / padding
> - * @__res1:  reserved / padding
> - * @data:    CAN frame payload (up to 8 byte)
> + * @can_id:   CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition
> + * @len:      CAN frame payload length in byte (0 .. 8)
> + * @can_dlc:  deprecated name for CAN frame payload length in byte (0 .. 8)
> + * @__pad:    padding
> + * @__res0:   reserved / padding
> + * @len8_dlc: optional DLC value (9 .. 15) at 8 byte payload length
> + *            len8_dlc contains values from 9 .. 15 when the payload length is
> + *            8 bytes but the DLC value (see ISO 11898-1) is greater then 8.
> + *            CAN_CTRLMODE_CC_LEN8_DLC flag has to be enabled in CAN driver.
> + * @data:     CAN frame payload (up to 8 byte)
>   */
>  struct can_frame {
>         canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
> -       __u8    can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */
> -       __u8    __pad;   /* padding */
> -       __u8    __res0;  /* reserved / padding */
> -       __u8    __res1;  /* reserved / padding */
> -       __u8    data[CAN_MAX_DLEN] __attribute__((aligned(8)));
> +       union {
> +               /* CAN frame payload length in byte (0 .. CAN_MAX_DLEN)
> +                * was previously named can_dlc so we need to carry that
> +                * name for legacy support
> +                */
> +               __u8 len;
> +               __u8 can_dlc; /* deprecated */
> +       };
> +       __u8 __pad; /* padding */
> +       __u8 __res0; /* reserved / padding */
> +       __u8 len8_dlc; /* optional DLC for 8 byte payload length (9 .. 15) */
> +       __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8)));
>  };

Yours sincerely,
Vincent Mailhol



[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