@@ -111,14 +111,14 @@ static inline void llring_pause(void) { _mm_pause(); }
111111
112112#endif
113113
114- /* llring can be used between execution contexts having different address widths.
115- * In such circumstances, use phys_addr_t rather than void *, whose size would
116- * be different in 32 bit versus 64 bit contexts.
114+ /* llring can be used between execution contexts having different address
115+ * widths. In such circumstances, use phys_addr_t rather than void *, whose size
116+ * would be different in 32 bit versus 64 bit contexts.
117117 */
118118#ifdef __LLRING_USE_PHYS_ADDR__
119119typedef phys_addr_t llring_addr_t ;
120120#else
121- typedef void * llring_addr_t ;
121+ typedef void * llring_addr_t ;
122122#endif
123123
124124/* dummy assembly operation to prevent compiler re-ordering of instructions */
@@ -210,10 +210,11 @@ struct llring {
210210 /* it seems to help */
211211 char _pad [LLRING_CACHELINE_SIZE ];
212212
213- llring_addr_t ring [0 ]
214- __llring_cache_aligned ; /**< Memory space of ring starts here.
215- * not volatile so need to be careful
216- * about compiler re-ordering */
213+ llring_addr_t ring [0 ] __llring_cache_aligned ; /**< Memory space of ring
214+ * starts here. not
215+ * volatile so need to be
216+ * careful about compiler
217+ * re-ordering */
217218} __llring_cache_aligned ;
218219
219220#define RING_QUOT_EXCEED (1 << 31) /**< Quota exceed for burst ops */
@@ -236,7 +237,9 @@ struct llring {
236237 r->stats[__lcore_id].name##_bulk += 1; \
237238 } while (0)
238239#else
239- #define __RING_STAT_ADD (r , name , n ) do {} while(0)
240+ #define __RING_STAT_ADD (r , name , n ) \
241+ do { \
242+ } while (0)
240243#endif
241244
242245static inline int llring_bytes_with_slots (unsigned int slots )
@@ -324,8 +327,10 @@ static inline int llring_set_water_mark(struct llring *r, unsigned count)
324327 switch (n & 0x3) { \
325328 case 3: \
326329 r->ring[idx++] = obj_table[i++]; \
330+ [[gnu::fallthrough]]; \
327331 case 2: \
328332 r->ring[idx++] = obj_table[i++]; \
333+ [[gnu::fallthrough]]; \
329334 case 1: \
330335 r->ring[idx++] = obj_table[i++]; \
331336 } \
@@ -355,8 +360,10 @@ static inline int llring_set_water_mark(struct llring *r, unsigned count)
355360 switch (n & 0x3) { \
356361 case 3: \
357362 obj_table[i++] = r->ring[idx++]; \
363+ [[gnu::fallthrough]]; \
358364 case 2: \
359365 obj_table[i++] = r->ring[idx++]; \
366+ [[gnu::fallthrough]]; \
360367 case 1: \
361368 obj_table[i++] = r->ring[idx++]; \
362369 } \
@@ -395,8 +402,8 @@ static inline int llring_set_water_mark(struct llring *r, unsigned count)
395402 * - n: Actual number of objects enqueued.
396403 */
397404static inline int __attribute__((always_inline ))
398- __llring_mp_do_enqueue (struct llring * r , llring_addr_t const * obj_table , unsigned n ,
399- enum llring_queue_behavior behavior )
405+ __llring_mp_do_enqueue (struct llring * r , llring_addr_t const * obj_table ,
406+ unsigned n , enum llring_queue_behavior behavior )
400407{
401408 uint32_t prod_head , prod_next ;
402409 uint32_t cons_tail , free_entries ;
@@ -491,8 +498,8 @@ __llring_mp_do_enqueue(struct llring *r, llring_addr_t const *obj_table, unsigne
491498 * - n: Actual number of objects enqueued.
492499 */
493500static inline int __attribute__((always_inline ))
494- __llring_sp_do_enqueue (struct llring * r , llring_addr_t const * obj_table , unsigned n ,
495- enum llring_queue_behavior behavior )
501+ __llring_sp_do_enqueue (struct llring * r , llring_addr_t const * obj_table ,
502+ unsigned n , enum llring_queue_behavior behavior )
496503{
497504 uint32_t prod_head , cons_tail ;
498505 uint32_t prod_next , free_entries ;
@@ -723,19 +730,22 @@ __llring_sc_do_dequeue(struct llring *r, llring_addr_t *obj_table, unsigned n,
723730 * enqueued.
724731 */
725732static inline int __attribute__((always_inline ))
726- llring_mp_enqueue_bulk (struct llring * r , llring_addr_t const * obj_table , unsigned n )
733+ llring_mp_enqueue_bulk (struct llring * r , llring_addr_t const * obj_table ,
734+ unsigned n )
727735{
728736 return __llring_mp_do_enqueue (r , obj_table , n , LLRING_QUEUE_FIXED );
729737}
730738
731739static inline int __attribute__((always_inline ))
732- llring_sp_enqueue_bulk (struct llring * r , llring_addr_t const * obj_table , unsigned n )
740+ llring_sp_enqueue_bulk (struct llring * r , llring_addr_t const * obj_table ,
741+ unsigned n )
733742{
734743 return __llring_sp_do_enqueue (r , obj_table , n , LLRING_QUEUE_FIXED );
735744}
736745
737746static inline int __attribute__((always_inline ))
738- llring_enqueue_bulk (struct llring * r , llring_addr_t const * obj_table , unsigned n )
747+ llring_enqueue_bulk (struct llring * r , llring_addr_t const * obj_table ,
748+ unsigned n )
739749{
740750 if (r -> common .sp_enqueue )
741751 return llring_sp_enqueue_bulk (r , obj_table , n );
@@ -1057,7 +1067,8 @@ llring_sp_enqueue_burst(struct llring *r, llring_addr_t const *obj_table,
10571067 * - n: Actual number of objects enqueued.
10581068 */
10591069static inline int __attribute__((always_inline ))
1060- llring_enqueue_burst (struct llring * r , llring_addr_t const * obj_table , unsigned n )
1070+ llring_enqueue_burst (struct llring * r , llring_addr_t const * obj_table ,
1071+ unsigned n )
10611072{
10621073 if (r -> common .sp_enqueue )
10631074 return llring_sp_enqueue_burst (r , obj_table , n );
0 commit comments