Lines Matching refs:queue
4 * internal queue handling
75 /* struct generic queue in linux kernel virtual memory (kv) */
77 u64 current_q_offset; /* current queue entry */
79 struct ipz_page **queue_pages; /* array of pages belonging to queue */
80 u32 qe_size; /* queue entry size */
82 u32 queue_length; /* queue length allocated in bytes */
93 static inline void *ipz_qeit_calc(struct ipz_queue *queue, u64 q_offset)
96 if (q_offset >= queue->queue_length)
98 current_page = (queue->queue_pages)[q_offset >> EHCA_PAGESHIFT];
106 static inline void *ipz_qeit_get(struct ipz_queue *queue)
108 return ipz_qeit_calc(queue, queue->current_q_offset);
118 void *ipz_qpageit_get_inc(struct ipz_queue *queue);
126 static inline void *ipz_qeit_get_inc(struct ipz_queue *queue)
128 void *ret = ipz_qeit_get(queue);
129 queue->current_q_offset += queue->qe_size;
130 if (queue->current_q_offset >= queue->queue_length) {
131 queue->current_q_offset = 0;
133 queue->toggle_state = (~queue->toggle_state) & 1;
142 static inline int ipz_qeit_is_valid(struct ipz_queue *queue)
144 struct ehca_cqe *cqe = ipz_qeit_get(queue);
145 return ((cqe->cqe_flags >> 7) == (queue->toggle_state & 1));
155 static inline void *ipz_qeit_get_inc_valid(struct ipz_queue *queue)
157 return ipz_qeit_is_valid(queue) ? ipz_qeit_get_inc(queue) : NULL;
164 static inline void *ipz_qeit_reset(struct ipz_queue *queue)
166 queue->current_q_offset = 0;
167 return ipz_qeit_get(queue);
173 int ipz_queue_abs_to_offset(struct ipz_queue *queue, u64 addr, u64 *q_offset);
176 * return the next queue offset. don't modify the queue.
178 static inline u64 ipz_queue_advance_offset(struct ipz_queue *queue, u64 offset)
180 offset += queue->qe_size;
181 if (offset >= queue->queue_length) offset = 0;
190 /* struct page table for a queue, only to be used in pf */
192 /* queue page tables (kv), use u64 because we know the element length */
204 * allocate+pin queue
208 int ipz_queue_ctor(struct ehca_pd *pd, struct ipz_queue *queue,
215 * -# free queue
217 * returns true if ok, false if queue was NULL-ptr of free failed
219 int ipz_queue_dtor(struct ehca_pd *pd, struct ipz_queue *queue);
226 * -# allocate+pin queue
248 void *ipz_qeit_eq_get_inc(struct ipz_queue *queue);
258 static inline void *ipz_eqit_eq_get_inc_valid(struct ipz_queue *queue)
260 void *ret = ipz_qeit_get(queue);
262 if ((qe >> 7) != (queue->toggle_state & 1))
264 ipz_qeit_eq_get_inc(queue); /* this is a good one */
268 static inline void *ipz_eqit_eq_peek_valid(struct ipz_queue *queue)
270 void *ret = ipz_qeit_get(queue);
272 if ((qe >> 7) != (queue->toggle_state & 1))
277 /* returns address (GX) of first queue entry */
283 /* returns address (kv) of first page of queue page table */