Lines Matching full:q

46 inline void rxe_queue_reset(struct rxe_queue *q)  in rxe_queue_reset()  argument
52 memset(q->buf->data, 0, q->buf_size - sizeof(struct rxe_queue_buf)); in rxe_queue_reset()
58 struct rxe_queue *q; in rxe_queue_init() local
66 q = kzalloc(sizeof(*q), GFP_KERNEL); in rxe_queue_init()
67 if (!q) in rxe_queue_init()
70 q->rxe = rxe; in rxe_queue_init()
71 q->type = type; in rxe_queue_init()
74 q->elem_size = elem_size; in rxe_queue_init()
81 q->log2_elem_size = order_base_2(elem_size); in rxe_queue_init()
85 q->index_mask = num_slots - 1; in rxe_queue_init()
89 q->buf = vmalloc_user(buf_size); in rxe_queue_init()
90 if (!q->buf) in rxe_queue_init()
93 q->buf->log2_elem_size = q->log2_elem_size; in rxe_queue_init()
94 q->buf->index_mask = q->index_mask; in rxe_queue_init()
96 q->buf_size = buf_size; in rxe_queue_init()
99 return q; in rxe_queue_init()
102 kfree(q); in rxe_queue_init()
106 /* copies elements from original q to new q and then swaps the contents of the
107 * two q headers. This is so that if anyone is holding a pointer to q it will
110 static int resize_finish(struct rxe_queue *q, struct rxe_queue *new_q, in resize_finish() argument
113 enum queue_type type = q->type; in resize_finish()
118 if (!queue_empty(q, q->type) && (num_elem < queue_count(q, type))) in resize_finish()
122 prod = queue_get_producer(q, type); in resize_finish()
123 cons = queue_get_consumer(q, type); in resize_finish()
125 while ((prod - cons) & q->index_mask) { in resize_finish()
127 queue_addr_from_index(q, cons), new_q->elem_size); in resize_finish()
129 cons = queue_next_index(q, cons); in resize_finish()
133 q->buf->consumer_index = cons; in resize_finish()
139 q->index = q->buf->consumer_index; in resize_finish()
142 swap(*q, *new_q); in resize_finish()
147 int rxe_queue_resize(struct rxe_queue *q, unsigned int *num_elem_p, in rxe_queue_resize() argument
158 new_q = rxe_queue_init(q->rxe, &num_elem, elem_size, q->type); in rxe_queue_resize()
174 err = resize_finish(q, new_q, num_elem); in rxe_queue_resize()
177 err = resize_finish(q, new_q, num_elem); in rxe_queue_resize()
193 void rxe_queue_cleanup(struct rxe_queue *q) in rxe_queue_cleanup() argument
195 if (q->ip) in rxe_queue_cleanup()
196 kref_put(&q->ip->ref, rxe_mmap_release); in rxe_queue_cleanup()
198 vfree(q->buf); in rxe_queue_cleanup()
200 kfree(q); in rxe_queue_cleanup()