Lines Matching refs:queue

47 __queue_consume(xge_queue_t *queue, int data_max_size, xge_queue_item_t *item)  in __queue_consume()  argument
52 if (xge_list_is_empty(&queue->list_head)) in __queue_consume()
55 elem = (xge_queue_item_t *)queue->list_head.next; in __queue_consume()
61 if (queue->head_ptr == elem) { in __queue_consume()
62 queue->head_ptr = (char *)queue->head_ptr + real_size; in __queue_consume()
68 (u64)(ulong_t)queue->start_ptr, in __queue_consume()
69 (u64)(ulong_t)queue->head_ptr, in __queue_consume()
70 (u64)(ulong_t)queue->tail_ptr, in __queue_consume()
71 (u64)(ulong_t)queue->end_ptr, in __queue_consume()
74 } else if ((char *)queue->tail_ptr - real_size == (char*)elem) { in __queue_consume()
75 queue->tail_ptr = (char *)queue->tail_ptr - real_size; in __queue_consume()
81 (u64)(ulong_t)queue->start_ptr, in __queue_consume()
82 (u64)(ulong_t)queue->head_ptr, in __queue_consume()
83 (u64)(ulong_t)queue->tail_ptr, in __queue_consume()
84 (u64)(ulong_t)queue->end_ptr, in __queue_consume()
93 (u64)(ulong_t)queue->start_ptr, in __queue_consume()
94 (u64)(ulong_t)queue->head_ptr, in __queue_consume()
95 (u64)(ulong_t)queue->tail_ptr, in __queue_consume()
96 (u64)(ulong_t)queue->end_ptr, in __queue_consume()
100 xge_assert(queue->tail_ptr >= queue->head_ptr); in __queue_consume()
101 xge_assert(queue->tail_ptr >= queue->start_ptr && in __queue_consume()
102 queue->tail_ptr <= queue->end_ptr); in __queue_consume()
103 xge_assert(queue->head_ptr >= queue->start_ptr && in __queue_consume()
104 queue->head_ptr < queue->end_ptr); in __queue_consume()
109 if (xge_list_is_empty(&queue->list_head)) { in __queue_consume()
111 queue->head_ptr = queue->tail_ptr = queue->start_ptr; in __queue_consume()
142 xge_queue_t *queue = (xge_queue_t *)queueh; in xge_queue_produce() local
149 xge_os_spin_lock_irq(&queue->lock, flags); in xge_queue_produce()
151 if (is_critical && !queue->has_critical_event) { in xge_queue_produce()
158 while (__queue_consume(queue, in xge_queue_produce()
165 if ((char *)queue->tail_ptr + real_size <= (char *)queue->end_ptr) { in xge_queue_produce()
166 elem = (xge_queue_item_t *) queue->tail_ptr; in xge_queue_produce()
167 queue->tail_ptr = (void *)((char *)queue->tail_ptr + real_size); in xge_queue_produce()
173 (u64)(ulong_t)queue->start_ptr, in xge_queue_produce()
174 (u64)(ulong_t)queue->head_ptr, in xge_queue_produce()
175 (u64)(ulong_t)queue->tail_ptr, in xge_queue_produce()
176 (u64)(ulong_t)queue->end_ptr, in xge_queue_produce()
179 } else if ((char *)queue->head_ptr - real_size >= in xge_queue_produce()
180 (char *)queue->start_ptr) { in xge_queue_produce()
181 elem = (xge_queue_item_t *) ((char *)queue->head_ptr - real_size); in xge_queue_produce()
182 queue->head_ptr = elem; in xge_queue_produce()
188 (u64)(ulong_t)queue->start_ptr, in xge_queue_produce()
189 (u64)(ulong_t)queue->head_ptr, in xge_queue_produce()
190 (u64)(ulong_t)queue->tail_ptr, in xge_queue_produce()
191 (u64)(ulong_t)queue->end_ptr, in xge_queue_produce()
196 if (queue->pages_current >= queue->pages_max) { in xge_queue_produce()
197 xge_os_spin_unlock_irq(&queue->lock, flags); in xge_queue_produce()
201 if (queue->has_critical_event) { in xge_queue_produce()
202 xge_os_spin_unlock_irq(&queue->lock, flags); in xge_queue_produce()
209 xge_os_spin_unlock_irq(&queue->lock, flags); in xge_queue_produce()
215 xge_assert(queue->tail_ptr >= queue->head_ptr); in xge_queue_produce()
216 xge_assert(queue->tail_ptr >= queue->start_ptr && in xge_queue_produce()
217 queue->tail_ptr <= queue->end_ptr); in xge_queue_produce()
218 xge_assert(queue->head_ptr >= queue->start_ptr && in xge_queue_produce()
219 queue->head_ptr < queue->end_ptr); in xge_queue_produce()
224 queue->has_critical_event = 1; in xge_queue_produce()
227 xge_list_insert_before(&elem->item, &queue->list_head); in xge_queue_produce()
228 xge_os_spin_unlock_irq(&queue->lock, flags); in xge_queue_produce()
231 queue->queued_func(queue->queued_data, event_type); in xge_queue_produce()
259 xge_queue_t *queue; in xge_queue_create() local
261 if ((queue = (xge_queue_t *) xge_os_malloc(pdev, sizeof(xge_queue_t))) == NULL) in xge_queue_create()
264 queue->queued_func = queued; in xge_queue_create()
265 queue->queued_data = queued_data; in xge_queue_create()
266 queue->pdev = pdev; in xge_queue_create()
267 queue->irqh = irqh; in xge_queue_create()
268 queue->pages_current = pages_initial; in xge_queue_create()
269 queue->start_ptr = xge_os_malloc(pdev, queue->pages_current * in xge_queue_create()
271 if (queue->start_ptr == NULL) { in xge_queue_create()
272 xge_os_free(pdev, queue, sizeof(xge_queue_t)); in xge_queue_create()
275 queue->head_ptr = queue->tail_ptr = queue->start_ptr; in xge_queue_create()
276 queue->end_ptr = (char *)queue->start_ptr + in xge_queue_create()
277 queue->pages_current * XGE_QUEUE_BUF_SIZE; in xge_queue_create()
278 xge_os_spin_lock_init_irq(&queue->lock, irqh); in xge_queue_create()
279 queue->pages_initial = pages_initial; in xge_queue_create()
280 queue->pages_max = pages_max; in xge_queue_create()
281 xge_list_init(&queue->list_head); in xge_queue_create()
283 return queue; in xge_queue_create()
296 xge_queue_t *queue = (xge_queue_t *)queueh; in xge_queue_destroy() local
297 xge_os_spin_lock_destroy_irq(&queue->lock, queue->irqh); in xge_queue_destroy()
298 if (!xge_list_is_empty(&queue->list_head)) { in xge_queue_destroy()
300 XGE_OS_LLXFMT, (u64)(ulong_t)queue); in xge_queue_destroy()
302 xge_os_free(queue->pdev, queue->start_ptr, queue->pages_current * in xge_queue_destroy()
305 xge_os_free(queue->pdev, queue, sizeof(xge_queue_t)); in xge_queue_destroy()
323 xge_queue_t *queue = (xge_queue_t *)queueh; in __io_queue_grow() local
329 (u64)(ulong_t)queue, queue->pages_current); in __io_queue_grow()
331 newbuf = xge_os_malloc(queue->pdev, in __io_queue_grow()
332 (queue->pages_current + 1) * XGE_QUEUE_BUF_SIZE); in __io_queue_grow()
336 xge_os_memcpy(newbuf, queue->start_ptr, in __io_queue_grow()
337 queue->pages_current * XGE_QUEUE_BUF_SIZE); in __io_queue_grow()
338 oldbuf = queue->start_ptr; in __io_queue_grow()
341 queue->start_ptr = newbuf; in __io_queue_grow()
342 queue->end_ptr = (char *)newbuf + in __io_queue_grow()
343 (queue->pages_current + 1) * XGE_QUEUE_BUF_SIZE; in __io_queue_grow()
344 queue->tail_ptr = (char *)newbuf + ((char *)queue->tail_ptr - in __io_queue_grow()
346 queue->head_ptr = (char *)newbuf + ((char *)queue->head_ptr - in __io_queue_grow()
348 xge_assert(!xge_list_is_empty(&queue->list_head)); in __io_queue_grow()
349 queue->list_head.next = (xge_list_t *) (void *)((char *)newbuf + in __io_queue_grow()
350 ((char *)queue->list_head.next - (char *)oldbuf)); in __io_queue_grow()
351 queue->list_head.prev = (xge_list_t *) (void *)((char *)newbuf + in __io_queue_grow()
352 ((char *)queue->list_head.prev - (char *)oldbuf)); in __io_queue_grow()
354 xge_list_for_each(item, &queue->list_head) { in __io_queue_grow()
356 if (elem->item.next != &queue->list_head) { in __io_queue_grow()
361 if (elem->item.prev != &queue->list_head) { in __io_queue_grow()
367 xge_os_free(queue->pdev, oldbuf, in __io_queue_grow()
368 queue->pages_current * XGE_QUEUE_BUF_SIZE); in __io_queue_grow()
369 queue->pages_current++; in __io_queue_grow()
394 xge_queue_t *queue = (xge_queue_t *)queueh; in xge_queue_consume() local
398 xge_os_spin_lock_irq(&queue->lock, flags); in xge_queue_consume()
399 status = __queue_consume(queue, data_max_size, item); in xge_queue_consume()
400 xge_os_spin_unlock_irq(&queue->lock, flags); in xge_queue_consume()
442 xge_queue_t* queue = (xge_queue_t*)qh; in __queue_get_reset_critical() local
443 int c = queue->has_critical_event; in __queue_get_reset_critical()
445 queue->has_critical_event = 0; in __queue_get_reset_critical()