diff options
author | Matias Elo <matias.elo@nokia.com> | 2019-02-05 13:49:37 +0200 |
---|---|---|
committer | Matias Elo <matiaselo@users.noreply.github.com> | 2019-02-08 10:30:53 +0200 |
commit | 7d91ea174cb2a25fa85e2d39fc8528841c4956fe (patch) | |
tree | ccb3c0144694a9f42dc9b794fa250c453090d3b8 /platform | |
parent | bf5116a224b8efa3bec8f36ab3035d83b83a72f9 (diff) |
linux-gen: fix internal header code style warnings
Fix checkpatch code style warnings.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
12 files changed, 74 insertions, 81 deletions
diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index ad43b9fe2..5ab4a89af 100644 --- a/platform/linux-generic/include/odp_atomic_internal.h +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -85,7 +85,7 @@ typedef enum { * @return Value of the variable */ static inline uint32_t _odp_atomic_u32_load_mm(const odp_atomic_u32_t *atom, - _odp_memmodel_t mmodel) + _odp_memmodel_t mmodel) { return __atomic_load_n(&atom->v, mmodel); } @@ -98,8 +98,8 @@ static inline uint32_t _odp_atomic_u32_load_mm(const odp_atomic_u32_t *atom, * @param mmodel Memory order associated with the store operation */ static inline void _odp_atomic_u32_store_mm(odp_atomic_u32_t *atom, - uint32_t val, - _odp_memmodel_t mmodel) + uint32_t val, + _odp_memmodel_t mmodel) { __atomic_store_n(&atom->v, val, mmodel); } @@ -114,8 +114,8 @@ static inline void _odp_atomic_u32_store_mm(odp_atomic_u32_t *atom, * @return Old value of the variable */ static inline uint32_t _odp_atomic_u32_xchg_mm(odp_atomic_u32_t *atom, - uint32_t val, - _odp_memmodel_t mmodel) + uint32_t val, + _odp_memmodel_t mmodel) { return __atomic_exchange_n(&atom->v, val, mmodel); @@ -136,12 +136,11 @@ static inline uint32_t _odp_atomic_u32_xchg_mm(odp_atomic_u32_t *atom, * @retval 1 exchange successul * @retval 0 exchange failed and '*exp' updated with current value */ -static inline int _odp_atomic_u32_cmp_xchg_strong_mm( - odp_atomic_u32_t *atom, - uint32_t *exp, - uint32_t val, - _odp_memmodel_t success, - _odp_memmodel_t failure) +static inline int _odp_atomic_u32_cmp_xchg_strong_mm(odp_atomic_u32_t *atom, + uint32_t *exp, + uint32_t val, + _odp_memmodel_t success, + _odp_memmodel_t failure) { return __atomic_compare_exchange_n(&atom->v, exp, val, false/*strong*/, success, failure); @@ -157,8 +156,8 @@ static inline int _odp_atomic_u32_cmp_xchg_strong_mm( * @return Value of the atomic variable before the addition */ static inline uint32_t _odp_atomic_u32_fetch_add_mm(odp_atomic_u32_t *atom, - uint32_t val, - _odp_memmodel_t mmodel) + uint32_t val, + _odp_memmodel_t mmodel) { return __atomic_fetch_add(&atom->v, val, mmodel); } @@ -170,9 +169,8 @@ static inline uint32_t _odp_atomic_u32_fetch_add_mm(odp_atomic_u32_t *atom, * @param val Value to add to the atomic variable * @param mmodel Memory order associated with the add operation */ -static inline void _odp_atomic_u32_add_mm(odp_atomic_u32_t *atom, - uint32_t val, - _odp_memmodel_t mmodel) +static inline void _odp_atomic_u32_add_mm(odp_atomic_u32_t *atom, uint32_t val, + _odp_memmodel_t mmodel) { (void)__atomic_fetch_add(&atom->v, val, mmodel); @@ -188,8 +186,8 @@ static inline void _odp_atomic_u32_add_mm(odp_atomic_u32_t *atom, * @return Value of the atomic variable before the subtraction */ static inline uint32_t _odp_atomic_u32_fetch_sub_mm(odp_atomic_u32_t *atom, - uint32_t val, - _odp_memmodel_t mmodel) + uint32_t val, + _odp_memmodel_t mmodel) { return __atomic_fetch_sub(&atom->v, val, mmodel); } @@ -201,9 +199,8 @@ static inline uint32_t _odp_atomic_u32_fetch_sub_mm(odp_atomic_u32_t *atom, * @param val Value to subtract from the atomic variable * @param mmodel Memory order associated with the subtract operation */ -static inline void _odp_atomic_u32_sub_mm(odp_atomic_u32_t *atom, - uint32_t val, - _odp_memmodel_t mmodel) +static inline void _odp_atomic_u32_sub_mm(odp_atomic_u32_t *atom, uint32_t val, + _odp_memmodel_t mmodel) { (void)__atomic_fetch_sub(&atom->v, val, mmodel); @@ -233,18 +230,18 @@ static inline void _odp_atomic_u32_sub_mm(odp_atomic_u32_t *atom, */ #define ATOMIC_OP_MM(atom, expr, mm) \ ({ \ - uint64_t old_val; \ - /* Loop while lock is already taken, stop when lock becomes clear */ \ - while (__atomic_test_and_set(&(atom)->lock, \ - (mm) == _ODP_MEMMODEL_SC ? \ - __ATOMIC_SEQ_CST : __ATOMIC_ACQUIRE)) \ + uint64_t old_val; \ + /* Loop while lock is already taken, stop when lock becomes clear */ \ + while (__atomic_test_and_set(&(atom)->lock, \ + (mm) == _ODP_MEMMODEL_SC ? \ + __ATOMIC_SEQ_CST : __ATOMIC_ACQUIRE)) \ (void)0; \ - old_val = (atom)->v; \ - (expr); /* Perform whatever update is desired */ \ - __atomic_clear(&(atom)->lock, \ - (mm) == _ODP_MEMMODEL_SC ? \ - __ATOMIC_SEQ_CST : __ATOMIC_RELEASE); \ - old_val; /* Return old value */ \ + old_val = (atom)->v; \ + (expr); /* Perform whatever update is desired */ \ + __atomic_clear(&(atom)->lock, \ + (mm) == _ODP_MEMMODEL_SC ? \ + __ATOMIC_SEQ_CST : __ATOMIC_RELEASE); \ + old_val; /* Return old value */ \ }) /** @@ -317,8 +314,8 @@ static inline int _odp_atomic_u64_cmp_xchg_strong_mm(odp_atomic_u64_t *atom, odp_bool_t ret_succ; /* Loop while lock is already taken, stop when lock becomes clear */ while (__atomic_test_and_set(&(atom)->lock, - (success) == _ODP_MEMMODEL_SC ? - __ATOMIC_SEQ_CST : __ATOMIC_ACQUIRE)) + (success) == _ODP_MEMMODEL_SC ? + __ATOMIC_SEQ_CST : __ATOMIC_ACQUIRE)) (void)0; if (atom->v == *exp) { atom->v = val; @@ -561,7 +558,7 @@ static inline void _odp_atomic_ptr_init(_odp_atomic_ptr_t *atom, void *val) * @return Value of the variable */ static inline void *_odp_atomic_ptr_load(const _odp_atomic_ptr_t *atom, - _odp_memmodel_t mmodel) + _odp_memmodel_t mmodel) { return __atomic_load_n(&atom->v, mmodel); } @@ -573,9 +570,8 @@ static inline void *_odp_atomic_ptr_load(const _odp_atomic_ptr_t *atom, * @param val Value to write to the atomic variable * @param mmodel Memory order associated with the store operation */ -static inline void _odp_atomic_ptr_store(_odp_atomic_ptr_t *atom, - void *val, - _odp_memmodel_t mmodel) +static inline void _odp_atomic_ptr_store(_odp_atomic_ptr_t *atom, void *val, + _odp_memmodel_t mmodel) { __atomic_store_n(&atom->v, val, mmodel); } @@ -589,9 +585,8 @@ static inline void _odp_atomic_ptr_store(_odp_atomic_ptr_t *atom, * * @return Old value of variable */ -static inline void *_odp_atomic_ptr_xchg(_odp_atomic_ptr_t *atom, - void *val, - _odp_memmodel_t mmodel) +static inline void *_odp_atomic_ptr_xchg(_odp_atomic_ptr_t *atom, void *val, + _odp_memmodel_t mmodel) { return __atomic_exchange_n(&atom->v, val, mmodel); } @@ -611,12 +606,10 @@ static inline void *_odp_atomic_ptr_xchg(_odp_atomic_ptr_t *atom, * @retval 1 exchange successful * @retval 0 exchange failed and '*exp' updated with current value */ -static inline int _odp_atomic_ptr_cmp_xchg_strong( - _odp_atomic_ptr_t *atom, - void **exp, - void *val, - _odp_memmodel_t success, - _odp_memmodel_t failure) +static inline int _odp_atomic_ptr_cmp_xchg_strong(_odp_atomic_ptr_t *atom, + void **exp, void *val, + _odp_memmodel_t success, + _odp_memmodel_t failure) { return __atomic_compare_exchange_n(&atom->v, exp, val, false/*strong*/, success, failure); @@ -640,7 +633,7 @@ static inline int _odp_atomic_ptr_cmp_xchg_strong( * @param val The initial value of the variable */ static inline void _odp_atomic_flag_init(_odp_atomic_flag_t *flag, - odp_bool_t val) + odp_bool_t val) { __atomic_clear(flag, __ATOMIC_RELAXED); if (val) diff --git a/platform/linux-generic/include/odp_bitmap_internal.h b/platform/linux-generic/include/odp_bitmap_internal.h index 5800fc28d..9ba6c29e3 100644 --- a/platform/linux-generic/include/odp_bitmap_internal.h +++ b/platform/linux-generic/include/odp_bitmap_internal.h @@ -278,8 +278,8 @@ void raw_bitmap_clear(unsigned long *map, unsigned int bit); * It will enter infinite loop incase that all bits are zero, * so please make sure the bitmap at least has one set. */ -static inline int __bitmap_wraparound_next( - unsigned long *addr, unsigned int nbits, int start) +static inline int __bitmap_wraparound_next(unsigned long *addr, + unsigned int nbits, int start) { unsigned long tmp; diff --git a/platform/linux-generic/include/odp_bitset.h b/platform/linux-generic/include/odp_bitset.h index 8b403bcdc..5c10ef9e5 100644 --- a/platform/linux-generic/include/odp_bitset.h +++ b/platform/linux-generic/include/odp_bitset.h @@ -165,11 +165,11 @@ static inline bitset_t atom_bitset_cmpxchg(bitset_t *bs, bitset_t *old, int mo_success, int mo_failure) { #ifdef LOCKFREE16 - return __lockfree_compare_exchange_16( - bs, old, neu, weak, mo_success, mo_failure); + return __lockfree_compare_exchange_16(bs, old, neu, weak, mo_success, + mo_failure); #else - return __atomic_compare_exchange_n( - bs, old, neu, weak, mo_success, mo_failure); + return __atomic_compare_exchange_n(bs, old, neu, weak, mo_success, + mo_failure); #endif } diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 5e0b2bcc2..f759aac35 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * diff --git a/platform/linux-generic/include/odp_classification_datamodel.h b/platform/linux-generic/include/odp_classification_datamodel.h index bca0dfcbd..1032a1c0b 100644 --- a/platform/linux-generic/include/odp_classification_datamodel.h +++ b/platform/linux-generic/include/odp_classification_datamodel.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * @@ -123,7 +122,6 @@ typedef union cos_u { uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct cos_s))]; } cos_t; - /** Packet Matching Rule diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h index 698192766..36fffc1dc 100644 --- a/platform/linux-generic/include/odp_classification_inlines.h +++ b/platform/linux-generic/include/odp_classification_inlines.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * @@ -51,6 +50,7 @@ static inline int verify_pmr_ip_proto(const uint8_t *pkt_addr, { const _odp_ipv4hdr_t *ip; uint8_t proto; + if (!pkt_hdr->p.input_flags.ipv4) return 0; ip = (const _odp_ipv4hdr_t *)(pkt_addr + pkt_hdr->p.l3_offset); @@ -67,6 +67,7 @@ static inline int verify_pmr_ipv4_saddr(const uint8_t *pkt_addr, { const _odp_ipv4hdr_t *ip; uint32_t ipaddr; + if (!pkt_hdr->p.input_flags.ipv4) return 0; ip = (const _odp_ipv4hdr_t *)(pkt_addr + pkt_hdr->p.l3_offset); @@ -83,6 +84,7 @@ static inline int verify_pmr_ipv4_daddr(const uint8_t *pkt_addr, { const _odp_ipv4hdr_t *ip; uint32_t ipaddr; + if (!pkt_hdr->p.input_flags.ipv4) return 0; ip = (const _odp_ipv4hdr_t *)(pkt_addr + pkt_hdr->p.l3_offset); @@ -99,6 +101,7 @@ static inline int verify_pmr_tcp_sport(const uint8_t *pkt_addr, { uint16_t sport; const _odp_tcphdr_t *tcp; + if (!pkt_hdr->p.input_flags.tcp) return 0; tcp = (const _odp_tcphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset); @@ -115,6 +118,7 @@ static inline int verify_pmr_tcp_dport(const uint8_t *pkt_addr, { uint16_t dport; const _odp_tcphdr_t *tcp; + if (!pkt_hdr->p.input_flags.tcp) return 0; tcp = (const _odp_tcphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset); @@ -131,12 +135,13 @@ static inline int verify_pmr_udp_dport(const uint8_t *pkt_addr, { uint16_t dport; const _odp_udphdr_t *udp; + if (!pkt_hdr->p.input_flags.udp) return 0; udp = (const _odp_udphdr_t *)(pkt_addr + pkt_hdr->p.l4_offset); dport = odp_be_to_cpu_16(udp->dst_port); if (term_value->match.value == (dport & term_value->match.mask)) - return 1; + return 1; return 0; } @@ -373,6 +378,7 @@ static inline int verify_pmr_eth_type_x(const uint8_t *pkt_addr, return 0; } + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_classification_internal.h b/platform/linux-generic/include/odp_classification_internal.h index 84d605e6b..71ad7abf2 100644 --- a/platform/linux-generic/include/odp_classification_internal.h +++ b/platform/linux-generic/include/odp_classification_internal.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 603e7cf49..2e5ef30b8 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -105,7 +105,6 @@ typedef struct { /* Classifier destination queue */ odp_queue_t dst_queue; - union { struct { /* Result for crypto packet op */ @@ -306,7 +305,6 @@ int _odp_packet_tcp_chksum_insert(odp_packet_t pkt); int _odp_packet_udp_chksum_insert(odp_packet_t pkt); int _odp_packet_sctp_chksum_insert(odp_packet_t pkt); - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 53db2c907..40f5f5a3e 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h index 94f859de0..cfd0872af 100644 --- a/platform/linux-generic/include/odp_pool_internal.h +++ b/platform/linux-generic/include/odp_pool_internal.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 15c915904..831afdfa8 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -109,26 +109,29 @@ typedef struct { void (*schedule_resume)(void); void (*schedule_release_atomic)(void); void (*schedule_release_ordered)(void); - void (*schedule_prefetch)(int); + void (*schedule_prefetch)(int num); int (*schedule_min_prio)(void); int (*schedule_max_prio)(void); int (*schedule_default_prio)(void); int (*schedule_num_prio)(void); - odp_schedule_group_t (*schedule_group_create)(const char *, - const odp_thrmask_t *); - int (*schedule_group_destroy)(odp_schedule_group_t); - odp_schedule_group_t (*schedule_group_lookup)(const char *); - int (*schedule_group_join)(odp_schedule_group_t, const odp_thrmask_t *); - int (*schedule_group_leave)(odp_schedule_group_t, - const odp_thrmask_t *); - int (*schedule_group_thrmask)(odp_schedule_group_t, odp_thrmask_t *); - int (*schedule_group_info)(odp_schedule_group_t, - odp_schedule_group_info_t *); - void (*schedule_order_lock)(uint32_t); - void (*schedule_order_unlock)(uint32_t); - void (*schedule_order_unlock_lock)(uint32_t, uint32_t); - void (*schedule_order_lock_start)(uint32_t); - void (*schedule_order_lock_wait)(uint32_t); + odp_schedule_group_t (*schedule_group_create) + (const char *name, const odp_thrmask_t *mask); + int (*schedule_group_destroy)(odp_schedule_group_t group); + odp_schedule_group_t (*schedule_group_lookup)(const char *name); + int (*schedule_group_join)(odp_schedule_group_t group, + const odp_thrmask_t *mask); + int (*schedule_group_leave)(odp_schedule_group_t group, + const odp_thrmask_t *mask); + int (*schedule_group_thrmask)(odp_schedule_group_t group, + odp_thrmask_t *mask); + int (*schedule_group_info)(odp_schedule_group_t group, + odp_schedule_group_info_t *info); + void (*schedule_order_lock)(uint32_t lock_index); + void (*schedule_order_unlock)(uint32_t lock_index); + void (*schedule_order_unlock_lock)(uint32_t unlock_index, + uint32_t lock_index); + void (*schedule_order_lock_start)(uint32_t lock_index); + void (*schedule_order_lock_wait)(uint32_t lock_index); } schedule_api_t; diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h index cd80778a5..59ea19323 100644 --- a/platform/linux-generic/include/odp_timer_internal.h +++ b/platform/linux-generic/include/odp_timer_internal.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * |