[PATCH v5 1/6] ring: common functions for 'move head' ops

Morten Brørup mb at smartsharesystems.com
Tue Oct 15 17:04:59 CEST 2024


> From: Konstantin Ananyev [mailto:konstantin.v.ananyev at yandex.ru]
> Sent: Tuesday, 15 October 2024 15.01

Cleaning up is good. :-)

Only a few initial comments; haven't reviewed in depth.


> +__rte_ring_headtail_move_head(struct rte_ring_headtail *d,
> +		const struct rte_ring_headtail *s, uint32_t capacity,
> +		unsigned int is_st, unsigned int n,
> +		enum rte_ring_queue_behavior behavior,
> +		uint32_t *old_head, uint32_t *new_head, uint32_t *entries)

No description for the new function?
Also in the other files.

>  {
> -	const uint32_t capacity = r->capacity;
> -	uint32_t cons_tail;
> -	unsigned int max = n;
> +	uint32_t stail;
>  	int success;
> +	unsigned int max = n;
> 
> -	*old_head = rte_atomic_load_explicit(&r->prod.head,
> rte_memory_order_relaxed);
> +	*old_head = rte_atomic_load_explicit(&d->head,
> +			rte_memory_order_relaxed);
>  	do {
>  		/* Reset n to the initial burst count */
>  		n = max;
> @@ -73,112 +51,36 @@ __rte_ring_move_prod_head(struct rte_ring *r,
> unsigned int is_sp,
>  		/* load-acquire synchronize with store-release of ht->tail
>  		 * in update_tail.
>  		 */
> -		cons_tail = rte_atomic_load_explicit(&r->cons.tail,
> +		stail = rte_atomic_load_explicit(&s->tail,
>  					rte_memory_order_acquire);
> 
>  		/* The subtraction is done between two unsigned 32bits
> value
>  		 * (the result is always modulo 32 bits even if we have
> -		 * *old_head > cons_tail). So 'free_entries' is always
> between 0
> +		 * *old_head > s->tail). So 'free_entries' is always
> between 0

The comment refers to 'free_entries', which was renamed to 'entries' in the code.
Also in the other files.



More information about the dev mailing list