Reviewed-by: Petri Savolainen <[email protected]>

> -----Original Message-----
> From: [email protected] [mailto:lng-odp-
> [email protected]] On Behalf Of ext Maxim Uvarov
> Sent: Tuesday, December 16, 2014 5:03 PM
> To: [email protected]
> Subject: [lng-odp] [PATCHv2] api: rename ODP_STATIC_ASSERT to
> _ODP_STATIC_ASSERT
> 
> From: Mike Holmes <[email protected]>
> 
> This assert is used in the public API but is not intended for use in
> applications and so it is marked with an underscore.
> 
> Signed-off-by: Mike Holmes <[email protected]>
> Signed-off-by: Maxim Uvarov <[email protected]>
> ---
>  helper/include/odph_eth.h                            |  6 +++---
>  helper/include/odph_icmp.h                           |  2 +-
>  helper/include/odph_ip.h                             |  4 ++--
>  helper/include/odph_ipsec.h                          |  6 +++---
>  helper/include/odph_udp.h                            |  2 +-
>  platform/linux-generic/include/api/odp_debug.h       |  2 +-
>  platform/linux-generic/include/odp_buffer_internal.h |  9 ++++++---
>  platform/linux-generic/include/odp_packet_internal.h | 12 ++++++++----
>  platform/linux-generic/include/odp_packet_io_queue.h |  4 ++--
>  platform/linux-generic/include/odp_packet_socket.h   |  4 ++--
>  platform/linux-generic/include/odp_timer_internal.h  |  7 +++++++
>  platform/linux-generic/odp_buffer_pool.c             |  3 +++
>  platform/linux-generic/odp_schedule.c                |  3 ++-
>  13 files changed, 41 insertions(+), 23 deletions(-)
> 
> diff --git a/helper/include/odph_eth.h b/helper/include/odph_eth.h
> index 065a94b..6a29b76 100644
> --- a/helper/include/odph_eth.h
> +++ b/helper/include/odph_eth.h
> @@ -39,7 +39,7 @@ typedef struct ODP_PACKED {
>  } odph_ethaddr_t;
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_ethaddr_t) == ODPH_ETHADDR_LEN,
> "ODPH_ETHADDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_ethaddr_t) == ODPH_ETHADDR_LEN,
> "ODPH_ETHADDR_T__SIZE_ERROR");
> 
>  /**
>   * Ethernet header
> @@ -51,7 +51,7 @@ typedef struct ODP_PACKED {
>  } odph_ethhdr_t;
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_ethhdr_t) == ODPH_ETHHDR_LEN,
> "ODPH_ETHHDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_ethhdr_t) == ODPH_ETHHDR_LEN,
> "ODPH_ETHHDR_T__SIZE_ERROR");
> 
>  /**
>   * VLAN header
> @@ -64,7 +64,7 @@ typedef struct ODP_PACKED {
>  } odph_vlanhdr_t;
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN,
> "ODPH_VLANHDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN,
> "ODPH_VLANHDR_T__SIZE_ERROR");
> 
> 
>  /* Ethernet header Ether Type ('type') values, a selected few */
> diff --git a/helper/include/odph_icmp.h b/helper/include/odph_icmp.h
> index 8533fb5..bc97008 100644
> --- a/helper/include/odph_icmp.h
> +++ b/helper/include/odph_icmp.h
> @@ -90,7 +90,7 @@ typedef struct ODP_PACKED {
>                                                               exceeded*/
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN,
> "ODPH_ICMPHDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN,
> "ODPH_ICMPHDR_T__SIZE_ERROR");
> 
>  #ifdef __cplusplus
>  }
> diff --git a/helper/include/odph_ip.h b/helper/include/odph_ip.h
> index f78724e..5b803a0 100644
> --- a/helper/include/odph_ip.h
> +++ b/helper/include/odph_ip.h
> @@ -68,7 +68,7 @@ typedef struct ODP_PACKED {
>  } odph_ipv4hdr_t;
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_ipv4hdr_t) == ODPH_IPV4HDR_LEN,
> "ODPH_IPV4HDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_ipv4hdr_t) == ODPH_IPV4HDR_LEN,
> "ODPH_IPV4HDR_T__SIZE_ERROR");
> 
>  /**
>   * Check if IPv4 checksum is valid
> @@ -141,7 +141,7 @@ typedef struct ODP_PACKED {
>  } odph_ipv6hdr_t;
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_ipv6hdr_t) == ODPH_IPV6HDR_LEN,
> "ODPH_IPV6HDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_ipv6hdr_t) == ODPH_IPV6HDR_LEN,
> "ODPH_IPV6HDR_T__SIZE_ERROR");
> 
>  /** @name
>   * IP protocol values (IPv4:'proto' or IPv6:'next_hdr')
> diff --git a/helper/include/odph_ipsec.h b/helper/include/odph_ipsec.h
> index c58a1c8..fd72bc6 100644
> --- a/helper/include/odph_ipsec.h
> +++ b/helper/include/odph_ipsec.h
> @@ -37,7 +37,7 @@ typedef struct ODP_PACKED {
>  } odph_esphdr_t;
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_esphdr_t) == ODPH_ESPHDR_LEN,
> "ODPH_ESPHDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_esphdr_t) == ODPH_ESPHDR_LEN,
> "ODPH_ESPHDR_T__SIZE_ERROR");
> 
>  /**
>   * IPSec ESP trailer
> @@ -49,7 +49,7 @@ typedef struct ODP_PACKED {
>  } odph_esptrl_t;
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_esptrl_t) == ODPH_ESPTRL_LEN,
> "ODPH_ESPTRL_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_esptrl_t) == ODPH_ESPTRL_LEN,
> "ODPH_ESPTRL_T__SIZE_ERROR");
> 
>  /**
>   * IPSec AH header
> @@ -64,7 +64,7 @@ typedef struct ODP_PACKED {
>  } odph_ahhdr_t;
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_ahhdr_t) == ODPH_AHHDR_LEN,
> "ODPH_AHHDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_ahhdr_t) == ODPH_AHHDR_LEN,
> "ODPH_AHHDR_T__SIZE_ERROR");
> 
>  #ifdef __cplusplus
>  }
> diff --git a/helper/include/odph_udp.h b/helper/include/odph_udp.h
> index b2eaf03..6fac3a6 100644
> --- a/helper/include/odph_udp.h
> +++ b/helper/include/odph_udp.h
> @@ -93,7 +93,7 @@ static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t
> pkt)
>  }
> 
>  /** @internal Compile time assert */
> -ODP_STATIC_ASSERT(sizeof(odph_udphdr_t) == ODPH_UDPHDR_LEN,
> "ODPH_UDPHDR_T__SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(odph_udphdr_t) == ODPH_UDPHDR_LEN,
> "ODPH_UDPHDR_T__SIZE_ERROR");
> 
>  #ifdef __cplusplus
>  }
> diff --git a/platform/linux-generic/include/api/odp_debug.h
> b/platform/linux-generic/include/api/odp_debug.h
> index f5e6821..a4ce1d9 100644
> --- a/platform/linux-generic/include/api/odp_debug.h
> +++ b/platform/linux-generic/include/api/odp_debug.h
> @@ -45,7 +45,7 @@ extern "C" {
>   * Compile time assertion-macro - fail compilation if cond is false.
>   * @note This macro has zero runtime overhead
>   */
> -#define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
> +#define _ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
> 
>  /**
>   * ODP log level.
> diff --git a/platform/linux-generic/include/odp_buffer_internal.h
> b/platform/linux-generic/include/odp_buffer_internal.h
> index 859633e..f0f17c7 100644
> --- a/platform/linux-generic/include/odp_buffer_internal.h
> +++ b/platform/linux-generic/include/odp_buffer_internal.h
> @@ -49,13 +49,13 @@ extern "C" {
>       ((x) <= 65536 ? 16 : \
>        (0/0)))))))))))))))))
> 
> -ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_BUF_LEN_MIN >= 256,
> +_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_BUF_LEN_MIN >= 256,
>                 "ODP Segment size must be a minimum of 256 bytes");
> 
> -ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MIN % ODP_CACHE_LINE_SIZE)
> == 0,
> +_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MIN % ODP_CACHE_LINE_SIZE)
> == 0,
>                 "ODP Segment size must be a multiple of cache line size");
> 
> -ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX %
> +_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX %
>                  ODP_CONFIG_PACKET_BUF_LEN_MIN) == 0,
>                 "Packet max size must be a multiple of segment size");
> 
> @@ -135,6 +135,9 @@ typedef struct odp_buffer_hdr_t {
>  typedef struct odp_buffer_hdr_stride {
>       uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(odp_buffer_hdr_t))];
>  } odp_buffer_hdr_stride;
> +/* Ensure next header starts from 8 byte align */
> +_ODP_STATIC_ASSERT((sizeof(odp_buffer_hdr_t) % 8) == 0,
> +                "ODP_BUFFER_HDR_T__SIZE_ERROR");
> 
>  typedef struct odp_buf_blk_t {
>       struct odp_buf_blk_t *next;
> diff --git a/platform/linux-generic/include/odp_packet_internal.h
> b/platform/linux-generic/include/odp_packet_internal.h
> index f34a83d..e47364d 100644
> --- a/platform/linux-generic/include/odp_packet_internal.h
> +++ b/platform/linux-generic/include/odp_packet_internal.h
> @@ -59,7 +59,8 @@ typedef union {
>       };
>  } input_flags_t;
> 
> -ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t),
> "INPUT_FLAGS_SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t),
> +                "INPUT_FLAGS_SIZE_ERROR");
> 
>  /**
>   * Packet error flags
> @@ -78,7 +79,8 @@ typedef union {
>       };
>  } error_flags_t;
> 
> -ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t),
> "ERROR_FLAGS_SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t),
> +                "ERROR_FLAGS_SIZE_ERROR");
> 
>  /**
>   * Packet output flags
> @@ -93,8 +95,8 @@ typedef union {
>       };
>  } output_flags_t;
> 
> -ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t),
> -               "OUTPUT_FLAGS_SIZE_ERROR");
> +_ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t),
> +                "OUTPUT_FLAGS_SIZE_ERROR");
> 
>  /**
>   * Internal Packet header
> @@ -124,6 +126,8 @@ typedef struct odp_packet_hdr_stride {
>       uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(odp_packet_hdr_t))];
>  } odp_packet_hdr_stride;
> 
> +_ODP_STATIC_ASSERT(sizeof(odp_packet_hdr_t) % sizeof(uint64_t) == 0,
> +                "ODP_PACKET_HDR_T__SIZE_ERR2");
> 
>  /**
>   * Return the packet header
> diff --git a/platform/linux-generic/include/odp_packet_io_queue.h
> b/platform/linux-generic/include/odp_packet_io_queue.h
> index d323a5e..c3b8309 100644
> --- a/platform/linux-generic/include/odp_packet_io_queue.h
> +++ b/platform/linux-generic/include/odp_packet_io_queue.h
> @@ -24,8 +24,8 @@ extern "C" {
>  /** Max nbr of pkts to receive in one burst (keep same as
> QUEUE_MULTI_MAX) */
>  #define ODP_PKTIN_QUEUE_MAX_BURST 16
>  /* pktin_deq_multi() depends on the condition: */
> -ODP_STATIC_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX,
> -        "ODP_PKTIN_DEQ_MULTI_MAX_ERROR");
> +_ODP_STATIC_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX,
> +                "ODP_PKTIN_DEQ_MULTI_MAX_ERROR");
> 
>  int pktin_enqueue(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr);
>  odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *queue);
> diff --git a/platform/linux-generic/include/odp_packet_socket.h
> b/platform/linux-generic/include/odp_packet_socket.h
> index 9c1bd78..c4f8af1 100644
> --- a/platform/linux-generic/include/odp_packet_socket.h
> +++ b/platform/linux-generic/include/odp_packet_socket.h
> @@ -64,8 +64,8 @@ struct ring {
> 
>       struct tpacket_req req;
>  };
> -ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE,
> -        "ERR_STRUCT_RING");
> +_ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <=
> ODP_CACHE_LINE_SIZE,
> +                "ERR_STRUCT_RING");
> 
>  /** Packet socket using mmap rings for both Rx and Tx */
>  typedef struct {
> diff --git a/platform/linux-generic/include/odp_timer_internal.h
> b/platform/linux-generic/include/odp_timer_internal.h
> index 2ff36ce..0d10d00 100644
> --- a/platform/linux-generic/include/odp_timer_internal.h
> +++ b/platform/linux-generic/include/odp_timer_internal.h
> @@ -55,6 +55,13 @@ typedef struct odp_timeout_hdr_stride {
>       uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(odp_timeout_hdr_t))];
>  } odp_timeout_hdr_stride;
> 
> +_ODP_STATIC_ASSERT(sizeof(odp_timeout_hdr_t) ==
> +                ODP_OFFSETOF(odp_timeout_hdr_t, buf_data),
> +                "ODP_TIMEOUT_HDR_T__SIZE_ERR");
> +
> +_ODP_STATIC_ASSERT(sizeof(odp_timeout_hdr_t) % sizeof(uint64_t) == 0,
> +                "ODP_TIMEOUT_HDR_T__SIZE_ERR2");
> +
> 
>  /**
>   * Return timeout header
> diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-
> generic/odp_buffer_pool.c
> index e947dde..a44f350 100644
> --- a/platform/linux-generic/odp_buffer_pool.c
> +++ b/platform/linux-generic/odp_buffer_pool.c
> @@ -35,6 +35,9 @@ typedef union buffer_type_any_u {
>       odp_timeout_hdr_t tmo;
>  } odp_anybuf_t;
> 
> +_ODP_STATIC_ASSERT((sizeof(union buffer_type_any_u) % 8) == 0,
> +                "BUFFER_TYPE_ANY_U__SIZE_ERR");
> +
>  /* Any buffer type header */
>  typedef struct {
>       union buffer_type_any_u any_hdr;    /* any buffer type */
> diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-
> generic/odp_schedule.c
> index aa11b7b..ac76240 100644
> --- a/platform/linux-generic/odp_schedule.c
> +++ b/platform/linux-generic/odp_schedule.c
> @@ -38,7 +38,8 @@
>  /* Mask of queues per priority */
>  typedef uint8_t pri_mask_t;
> 
> -ODP_STATIC_ASSERT((8*sizeof(pri_mask_t)) >= QUEUES_PER_PRIO,
> "pri_mask_t_is_too_small");
> +_ODP_STATIC_ASSERT((8*sizeof(pri_mask_t)) >= QUEUES_PER_PRIO,
> +                "pri_mask_t_is_too_small");
> 
> 
>  typedef struct {
> --
> 1.8.5.1.163.gd7aced9
> 
> 
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to