Lines Matching defs:q

18  *   - The driver indices are always masked off to q->index_mask
26 * - By passing the type in the parameter list separate from 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)
97 return (index + 1) & q->index_mask;
100 static inline u32 queue_get_producer(const struct rxe_queue *q,
108 prod = smp_load_acquire(&q->buf->producer_index);
112 prod = q->index;
116 prod = q->buf->producer_index;
120 prod = smp_load_acquire(&q->buf->producer_index);
127 static inline u32 queue_get_consumer(const struct rxe_queue *q,
135 cons = q->index;
139 cons = smp_load_acquire(&q->buf->consumer_index);
143 cons = smp_load_acquire(&q->buf->consumer_index);
147 cons = q->buf->consumer_index;
154 static inline int queue_empty(struct rxe_queue *q, enum queue_type type)
156 u32 prod = queue_get_producer(q, type);
157 u32 cons = queue_get_consumer(q, type);
159 return ((prod - cons) & q->index_mask) == 0;
162 static inline int queue_full(struct rxe_queue *q, enum queue_type type)
164 u32 prod = queue_get_producer(q, type);
165 u32 cons = queue_get_consumer(q, type);
167 return ((prod + 1 - cons) & q->index_mask) == 0;
170 static inline u32 queue_count(const struct rxe_queue *q,
173 u32 prod = queue_get_producer(q, type);
174 u32 cons = queue_get_consumer(q, type);
176 return (prod - cons) & q->index_mask;
179 static inline void queue_advance_producer(struct rxe_queue *q,
193 prod = q->index;
194 prod = (prod + 1) & q->index_mask;
195 q->index = prod;
197 smp_store_release(&q->buf->producer_index, prod);
201 prod = q->buf->producer_index;
202 prod = (prod + 1) & q->index_mask;
204 smp_store_release(&q->buf->producer_index, prod);
215 static inline void queue_advance_consumer(struct rxe_queue *q,
223 cons = (q->index + 1) & q->index_mask;
224 q->index = cons;
226 smp_store_release(&q->buf->consumer_index, cons);
242 cons = q->buf->consumer_index;
243 cons = (cons + 1) & q->index_mask;
245 smp_store_release(&q->buf->consumer_index, cons);
250 static inline void *queue_producer_addr(struct rxe_queue *q,
253 u32 prod = queue_get_producer(q, type);
255 return q->buf->data + (prod << q->log2_elem_size);
258 static inline void *queue_consumer_addr(struct rxe_queue *q,
261 u32 cons = queue_get_consumer(q, type);
263 return q->buf->data + (cons << q->log2_elem_size);
266 static inline void *queue_addr_from_index(struct rxe_queue *q, u32 index)
268 return q->buf->data + ((index & q->index_mask)
269 << q->log2_elem_size);
272 static inline u32 queue_index_from_addr(const struct rxe_queue *q,
275 return (((u8 *)addr - q->buf->data) >> q->log2_elem_size)
276 & q->index_mask;
279 static inline void *queue_head(struct rxe_queue *q, enum queue_type type)
281 return queue_empty(q, type) ? NULL : queue_consumer_addr(q, type);