linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [PATCH 1/6] canfd: add new data structures and constants
Date: Mon, 18 Jun 2012 21:13:37 +0200	[thread overview]
Message-ID: <4FDF7DE1.6000803@pengutronix.de> (raw)
In-Reply-To: <4FDF67C3.6020201@hartkopp.net>

[-- Attachment #1: Type: text/plain, Size: 2414 bytes --]

On 06/18/2012 07:39 PM, Oliver Hartkopp wrote:
> - add new struct canfd_frame
> - check identical element offsets in struct can_frame and struct canfd_frame
> - new ETH_P_CANFD definition to tag CAN FD skbs correctly
> - add CAN_MTU and CANFD_MTU definitions for easy frame and mode detection
> - add CAN[FD]_MAX_[DLC|DLEN] helper constants to remove hard coded values
> 
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
> ---
>  include/linux/can.h      |   55 ++++++++++++++++++++++++++++++++++++++++++----
>  include/linux/if_ether.h |    3 ++-
>  net/can/af_can.c         |    7 ++++++
>  3 files changed, 60 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/can.h b/include/linux/can.h
> index 17334c0..25265e7 100644
> --- a/include/linux/can.h
> +++ b/include/linux/can.h
> @@ -46,18 +46,65 @@ typedef __u32 canid_t;
>   */
>  typedef __u32 can_err_mask_t;
>  +#define CAN_MAX_DLC 8
> +#define CAN_MAX_DLEN 8
> +
> +#define CANFD_MAX_DLC 15
> +#define CANFD_MAX_DLEN 64
> +
>  /**
>   * struct can_frame - basic CAN frame structure
> - * @can_id:  the CAN ID of the frame and CAN_*_FLAG flags, see above.
> - * @can_dlc: the data length field of the CAN frame
> - * @data:    the CAN frame payload.
> + * @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
> + * @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; /* data length code: 0 .. 8 */
> +	__u8    can_dlc; /* frame payload length in byte (0 .. 8) */
>  	__u8    data[8] __attribute__((aligned(8)));

checkpatch complains:

WARNING: __aligned(size) is preferred over __attribute__((aligned(size)))
#84: FILE: include/linux/can.h:102:
+       __u8    data[64] __attribute__((aligned(8)));

total: 0 errors, 1 warnings, 97 lines checked

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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  parent reply	other threads:[~2012-06-18 19:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-18 17:39 [PATCH 1/6] canfd: add new data structures and constants Oliver Hartkopp
2012-06-18 17:51 ` Oliver Hartkopp
2012-06-18 19:12   ` Marc Kleine-Budde
2012-06-18 19:13 ` Marc Kleine-Budde [this message]
2012-06-18 19:19   ` Oliver Hartkopp
2012-06-18 19:48     ` Marc Kleine-Budde
2012-06-18 19:55       ` Marc Kleine-Budde
2012-06-18 20:03         ` Oliver Hartkopp
2012-06-18 20:20           ` Marc Kleine-Budde
2012-06-19  6:45 ` Wolfgang Grandegger
2012-06-19  7:11   ` Oliver Hartkopp
2012-06-19  7:28     ` Wolfgang Grandegger
2012-06-19  7:39       ` Oliver Hartkopp
2012-06-19  9:30     ` Oliver Hartkopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FDF7DE1.6000803@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).