Lines Matching refs:q
83 void rxe_queue_reset(struct rxe_queue *q);
88 int rxe_queue_resize(struct rxe_queue *q, unsigned int *num_elem_p,
95 static inline u32 queue_next_index(struct rxe_queue *q, int index) in queue_next_index() argument
97 return (index + 1) & q->index_mask; in queue_next_index()
100 static inline u32 queue_get_producer(const struct rxe_queue *q, in queue_get_producer() argument
108 prod = smp_load_acquire(&q->buf->producer_index); in queue_get_producer()
112 prod = q->index; in queue_get_producer()
116 prod = q->buf->producer_index; in queue_get_producer()
120 prod = smp_load_acquire(&q->buf->producer_index); in queue_get_producer()
127 static inline u32 queue_get_consumer(const struct rxe_queue *q, in queue_get_consumer() argument
135 cons = q->index; in queue_get_consumer()
139 cons = smp_load_acquire(&q->buf->consumer_index); in queue_get_consumer()
143 cons = smp_load_acquire(&q->buf->consumer_index); in queue_get_consumer()
147 cons = q->buf->consumer_index; in queue_get_consumer()
154 static inline int queue_empty(struct rxe_queue *q, enum queue_type type) in queue_empty() argument
156 u32 prod = queue_get_producer(q, type); in queue_empty()
157 u32 cons = queue_get_consumer(q, type); in queue_empty()
159 return ((prod - cons) & q->index_mask) == 0; in queue_empty()
162 static inline int queue_full(struct rxe_queue *q, enum queue_type type) in queue_full() argument
164 u32 prod = queue_get_producer(q, type); in queue_full()
165 u32 cons = queue_get_consumer(q, type); in queue_full()
167 return ((prod + 1 - cons) & q->index_mask) == 0; in queue_full()
170 static inline u32 queue_count(const struct rxe_queue *q, in queue_count() argument
173 u32 prod = queue_get_producer(q, type); in queue_count()
174 u32 cons = queue_get_consumer(q, type); in queue_count()
176 return (prod - cons) & q->index_mask; in queue_count()
179 static inline void queue_advance_producer(struct rxe_queue *q, in queue_advance_producer() argument
193 prod = q->index; in queue_advance_producer()
194 prod = (prod + 1) & q->index_mask; in queue_advance_producer()
195 q->index = prod; in queue_advance_producer()
197 smp_store_release(&q->buf->producer_index, prod); in queue_advance_producer()
201 prod = q->buf->producer_index; in queue_advance_producer()
202 prod = (prod + 1) & q->index_mask; in queue_advance_producer()
204 smp_store_release(&q->buf->producer_index, prod); in queue_advance_producer()
215 static inline void queue_advance_consumer(struct rxe_queue *q, in queue_advance_consumer() argument
223 cons = (q->index + 1) & q->index_mask; in queue_advance_consumer()
224 q->index = cons; in queue_advance_consumer()
226 smp_store_release(&q->buf->consumer_index, cons); in queue_advance_consumer()
242 cons = q->buf->consumer_index; in queue_advance_consumer()
243 cons = (cons + 1) & q->index_mask; in queue_advance_consumer()
245 smp_store_release(&q->buf->consumer_index, cons); in queue_advance_consumer()
250 static inline void *queue_producer_addr(struct rxe_queue *q, in queue_producer_addr() argument
253 u32 prod = queue_get_producer(q, type); in queue_producer_addr()
255 return q->buf->data + (prod << q->log2_elem_size); in queue_producer_addr()
258 static inline void *queue_consumer_addr(struct rxe_queue *q, in queue_consumer_addr() argument
261 u32 cons = queue_get_consumer(q, type); in queue_consumer_addr()
263 return q->buf->data + (cons << q->log2_elem_size); in queue_consumer_addr()
266 static inline void *queue_addr_from_index(struct rxe_queue *q, u32 index) in queue_addr_from_index() argument
268 return q->buf->data + ((index & q->index_mask) in queue_addr_from_index()
269 << q->log2_elem_size); in queue_addr_from_index()
272 static inline u32 queue_index_from_addr(const struct rxe_queue *q, in queue_index_from_addr() argument
275 return (((u8 *)addr - q->buf->data) >> q->log2_elem_size) in queue_index_from_addr()
276 & q->index_mask; in queue_index_from_addr()
279 static inline void *queue_head(struct rxe_queue *q, enum queue_type type) in queue_head() argument
281 return queue_empty(q, type) ? NULL : queue_consumer_addr(q, type); in queue_head()