Lines Matching refs:wq

50 static int oce_wq_create(struct oce_wq *wq, struct oce_eq *eq);
51 static void oce_wq_free(struct oce_wq *wq);
52 static void oce_wq_del(struct oce_wq *wq);
89 struct oce_wq *wq; in oce_queue_init_all() local
94 for_all_wq_queues(sc, wq, i) { in oce_queue_init_all()
95 sc->wq[i] = oce_wq_init(sc, sc->tx_ring_size, in oce_queue_init_all()
97 if (!sc->wq[i]) in oce_queue_init_all()
131 for_all_wq_queues(sc, wq, i) { in oce_queue_init_all()
132 rc = oce_wq_create(wq, sc->eq[i]); in oce_queue_init_all()
135 wq->queue_index = i; in oce_queue_init_all()
136 TASK_INIT(&wq->txtask, 1, oce_tx_task, wq); in oce_queue_init_all()
166 struct oce_wq *wq; in oce_queue_release_all() local
181 for_all_wq_queues(sc, wq, i) { in oce_queue_release_all()
182 if (wq) { in oce_queue_release_all()
183 oce_wq_del(sc->wq[i]); in oce_queue_release_all()
184 oce_wq_free(sc->wq[i]); in oce_queue_release_all()
207 struct oce_wq *wq; in oce_wq_init() local
219 wq = malloc(sizeof(struct oce_wq), M_DEVBUF, M_NOWAIT | M_ZERO); in oce_wq_init()
220 if (!wq) in oce_wq_init()
224 wq->cfg.q_len = q_len; in oce_wq_init()
225 wq->cfg.wq_type = (uint8_t) wq_type; in oce_wq_init()
226 wq->cfg.eqd = OCE_DEFAULT_WQ_EQD; in oce_wq_init()
227 wq->cfg.nbufs = 2 * wq->cfg.q_len; in oce_wq_init()
228 wq->cfg.nhdl = 2 * wq->cfg.q_len; in oce_wq_init()
230 wq->parent = (void *)sc; in oce_wq_init()
239 PAGE_SIZE, 0, NULL, NULL, &wq->tag); in oce_wq_init()
245 rc = bus_dmamap_create(wq->tag, 0, &wq->pckts[i].map); in oce_wq_init()
250 wq->ring = oce_create_ring_buffer(sc, q_len, NIC_WQE_SIZE); in oce_wq_init()
251 if (!wq->ring) in oce_wq_init()
254 LOCK_CREATE(&wq->tx_lock, "TX_lock"); in oce_wq_init()
255 LOCK_CREATE(&wq->tx_compl_lock, "WQ_HANDLER_LOCK"); in oce_wq_init()
258 wq->br = buf_ring_alloc(4096, M_DEVBUF, in oce_wq_init()
259 M_WAITOK, &wq->tx_lock.mutex); in oce_wq_init()
260 if (!wq->br) in oce_wq_init()
262 return wq; in oce_wq_init()
266 oce_wq_free(wq); in oce_wq_init()
275 oce_wq_free(struct oce_wq *wq) in oce_wq_free() argument
277 POCE_SOFTC sc = (POCE_SOFTC) wq->parent; in oce_wq_free()
280 taskqueue_drain(taskqueue_swi, &wq->txtask); in oce_wq_free()
282 if (wq->ring != NULL) { in oce_wq_free()
283 oce_destroy_ring_buffer(sc, wq->ring); in oce_wq_free()
284 wq->ring = NULL; in oce_wq_free()
288 if (wq->pckts[i].map != NULL) { in oce_wq_free()
289 bus_dmamap_unload(wq->tag, wq->pckts[i].map); in oce_wq_free()
290 bus_dmamap_destroy(wq->tag, wq->pckts[i].map); in oce_wq_free()
291 wq->pckts[i].map = NULL; in oce_wq_free()
295 if (wq->tag != NULL) in oce_wq_free()
296 bus_dma_tag_destroy(wq->tag); in oce_wq_free()
297 if (wq->br != NULL) in oce_wq_free()
298 buf_ring_free(wq->br, M_DEVBUF); in oce_wq_free()
300 LOCK_DESTROY(&wq->tx_lock); in oce_wq_free()
301 LOCK_DESTROY(&wq->tx_compl_lock); in oce_wq_free()
302 free(wq, M_DEVBUF); in oce_wq_free()
311 oce_wq_create(struct oce_wq *wq, struct oce_eq *eq) in oce_wq_create() argument
313 POCE_SOFTC sc = wq->parent; in oce_wq_create()
325 wq->cq = cq; in oce_wq_create()
327 rc = oce_mbox_create_wq(wq); in oce_wq_create()
331 wq->qstate = QCREATED; in oce_wq_create()
332 wq->wq_free = wq->cfg.q_len; in oce_wq_create()
333 wq->ring->cidx = 0; in oce_wq_create()
334 wq->ring->pidx = 0; in oce_wq_create()
338 cq->cb_arg = wq; in oce_wq_create()
345 oce_wq_del(wq); in oce_wq_create()
354 oce_wq_del(struct oce_wq *wq) in oce_wq_del() argument
358 POCE_SOFTC sc = (POCE_SOFTC) wq->parent; in oce_wq_del()
360 if (wq->qstate == QCREATED) { in oce_wq_del()
364 fwcmd->params.req.wq_id = wq->wq_id; in oce_wq_del()
367 wq->qstate = QDELETED; in oce_wq_del()
370 if (wq->cq != NULL) { in oce_wq_del()
371 oce_cq_del(sc, wq->cq); in oce_wq_del()
372 wq->cq = NULL; in oce_wq_del()
930 oce_start_wq(struct oce_wq *wq) in oce_start_wq() argument
932 oce_arm_cq(wq->parent, wq->cq->cq_id, 0, TRUE); in oce_start_wq()
1020 oce_drain_wq_cq(struct oce_wq *wq) in oce_drain_wq_cq() argument
1022 POCE_SOFTC sc = wq->parent; in oce_drain_wq_cq()
1023 struct oce_cq *cq = wq->cq; in oce_drain_wq_cq()