Lines Matching refs:rq

57 static int oce_rq_create(struct oce_rq *rq, uint32_t if_id, struct oce_eq *eq);
58 static void oce_rq_free(struct oce_rq *rq);
59 static void oce_rq_del(struct oce_rq *rq);
90 struct oce_rq *rq; in oce_queue_init_all() local
102 for_all_rq_queues(sc, rq, i) { in oce_queue_init_all()
103 sc->rq[i] = oce_rq_init(sc, sc->rx_ring_size, sc->rq_frag_size, in oce_queue_init_all()
106 if (!sc->rq[i]) in oce_queue_init_all()
139 for_all_rq_queues(sc, rq, i) { in oce_queue_init_all()
140 rc = oce_rq_create(rq, sc->if_id, in oce_queue_init_all()
144 rq->queue_index = i; in oce_queue_init_all()
167 struct oce_rq *rq; in oce_queue_release_all() local
174 for_all_rq_queues(sc, rq, i) { in oce_queue_release_all()
175 if (rq) { in oce_queue_release_all()
176 oce_rq_del(sc->rq[i]); in oce_queue_release_all()
177 oce_rq_free(sc->rq[i]); in oce_queue_release_all()
391 struct oce_rq *rq; in oce_rq_init() local
401 rq = malloc(sizeof(struct oce_rq), M_DEVBUF, M_NOWAIT | M_ZERO); in oce_rq_init()
402 if (!rq) in oce_rq_init()
405 rq->cfg.q_len = q_len; in oce_rq_init()
406 rq->cfg.frag_size = frag_size; in oce_rq_init()
407 rq->cfg.mtu = mtu; in oce_rq_init()
408 rq->cfg.eqd = 0; in oce_rq_init()
409 rq->lro_pkts_queued = 0; in oce_rq_init()
410 rq->cfg.is_rss_queue = rss; in oce_rq_init()
411 rq->pending = 0; in oce_rq_init()
413 rq->parent = (void *)sc; in oce_rq_init()
421 1, oce_rq_buf_size, 0, NULL, NULL, &rq->tag); in oce_rq_init()
426 rc = bus_dmamap_create(rq->tag, 0, &rq->pckts[i].map); in oce_rq_init()
432 rq->ring = oce_create_ring_buffer(sc, q_len, in oce_rq_init()
434 if (!rq->ring) in oce_rq_init()
437 LOCK_CREATE(&rq->rx_lock, "RX_lock"); in oce_rq_init()
439 return rq; in oce_rq_init()
443 oce_rq_free(rq); in oce_rq_init()
452 oce_rq_free(struct oce_rq *rq) in oce_rq_free() argument
454 POCE_SOFTC sc = (POCE_SOFTC) rq->parent; in oce_rq_free()
457 if (rq->ring != NULL) { in oce_rq_free()
458 oce_destroy_ring_buffer(sc, rq->ring); in oce_rq_free()
459 rq->ring = NULL; in oce_rq_free()
462 if (rq->pckts[i].map != NULL) { in oce_rq_free()
463 bus_dmamap_unload(rq->tag, rq->pckts[i].map); in oce_rq_free()
464 bus_dmamap_destroy(rq->tag, rq->pckts[i].map); in oce_rq_free()
465 rq->pckts[i].map = NULL; in oce_rq_free()
467 if (rq->pckts[i].mbuf) { in oce_rq_free()
468 m_free(rq->pckts[i].mbuf); in oce_rq_free()
469 rq->pckts[i].mbuf = NULL; in oce_rq_free()
473 if (rq->tag != NULL) in oce_rq_free()
474 bus_dma_tag_destroy(rq->tag); in oce_rq_free()
476 LOCK_DESTROY(&rq->rx_lock); in oce_rq_free()
477 free(rq, M_DEVBUF); in oce_rq_free()
487 oce_rq_create(struct oce_rq *rq, uint32_t if_id, struct oce_eq *eq) in oce_rq_create() argument
489 POCE_SOFTC sc = rq->parent; in oce_rq_create()
499 rq->cq = cq; in oce_rq_create()
500 rq->cfg.if_id = if_id; in oce_rq_create()
503 rq->qstate = 0; in oce_rq_create()
504 rq->ring->cidx = 0; in oce_rq_create()
505 rq->ring->pidx = 0; in oce_rq_create()
508 cq->cb_arg = rq; in oce_rq_create()
520 oce_rq_del(struct oce_rq *rq) in oce_rq_del() argument
522 POCE_SOFTC sc = (POCE_SOFTC) rq->parent; in oce_rq_del()
527 if (rq->qstate == QCREATED) { in oce_rq_del()
529 if(!rq->islro) { in oce_rq_del()
531 fwcmd->params.req.rq_id = rq->rq_id; in oce_rq_del()
535 fwcmd1->params.req.rq_id = rq->rq_id; in oce_rq_del()
539 rq->qstate = QDELETED; in oce_rq_del()
542 if (rq->cq != NULL) { in oce_rq_del()
543 oce_cq_del(sc, rq->cq); in oce_rq_del()
544 rq->cq = NULL; in oce_rq_del()
909 oce_start_rq(struct oce_rq *rq) in oce_start_rq() argument
911 POCE_SOFTC sc = (POCE_SOFTC) rq->parent; in oce_start_rq()
915 rc = oce_alloc_rx_bufs(rq, 960); in oce_start_rq()
917 rc = oce_alloc_rx_bufs(rq, rq->cfg.q_len - 1); in oce_start_rq()
920 oce_arm_cq(rq->parent, rq->cq->cq_id, 0, TRUE); in oce_start_rq()
1065 oce_drain_rq_cq(struct oce_rq *rq) in oce_drain_rq_cq() argument
1072 sc = rq->parent; in oce_drain_rq_cq()
1073 cq = rq->cq; in oce_drain_rq_cq()
1089 oce_free_posted_rxbuf(struct oce_rq *rq) in oce_free_posted_rxbuf() argument
1093 while (rq->pending) { in oce_free_posted_rxbuf()
1094 pd = &rq->pckts[rq->ring->cidx]; in oce_free_posted_rxbuf()
1095 bus_dmamap_sync(rq->tag, pd->map, BUS_DMASYNC_POSTWRITE); in oce_free_posted_rxbuf()
1096 bus_dmamap_unload(rq->tag, pd->map); in oce_free_posted_rxbuf()
1102 RING_GET(rq->ring,1); in oce_free_posted_rxbuf()
1103 rq->pending--; in oce_free_posted_rxbuf()
1109 oce_rx_cq_clean_hwlro(struct oce_rq *rq) in oce_rx_cq_clean_hwlro() argument
1111 struct oce_cq *cq = rq->cq; in oce_rx_cq_clean_hwlro()
1112 POCE_SOFTC sc = rq->parent; in oce_rx_cq_clean_hwlro()
1125 if(rq->cqe_firstpart != NULL) { in oce_rx_cq_clean_hwlro()
1129 num_frags = cqe->pkt_size / rq->cfg.frag_size; in oce_rx_cq_clean_hwlro()
1130 if(cqe->pkt_size % rq->cfg.frag_size) in oce_rx_cq_clean_hwlro()
1132 oce_discard_rx_comp(rq, num_frags); in oce_rx_cq_clean_hwlro()
1140 if(rq->cqe_firstpart != NULL) { in oce_rx_cq_clean_hwlro()
1144 rq->cqe_firstpart = (struct nic_hwlro_cqe_part1 *)cqe; in oce_rx_cq_clean_hwlro()
1149 if(rq->cqe_firstpart == NULL) { in oce_rx_cq_clean_hwlro()
1153 num_frags = cqe2->coalesced_size / rq->cfg.frag_size; in oce_rx_cq_clean_hwlro()
1154 if(cqe2->coalesced_size % rq->cfg.frag_size) in oce_rx_cq_clean_hwlro()
1158 oce_discard_rx_comp(rq, num_frags); in oce_rx_cq_clean_hwlro()
1160 rq->cqe_firstpart->valid = 0; in oce_rx_cq_clean_hwlro()
1162 rq->cqe_firstpart = NULL; in oce_rx_cq_clean_hwlro()
1186 oce_rx_cq_clean(struct oce_rq *rq) in oce_rx_cq_clean() argument
1193 sc = rq->parent; in oce_rx_cq_clean()
1194 cq = rq->cq; in oce_rx_cq_clean()
1202 oce_discard_rx_comp(rq, cqe->u0.s.num_fragments); in oce_rx_cq_clean()
1211 oce_rx_flush_lro(rq); in oce_rx_cq_clean()
1237 struct oce_rq *rq; in oce_stop_rx() local
1245 for_all_rq_queues(sc, rq, i) { in oce_stop_rx()
1246 if (rq->qstate == QCREATED) { in oce_stop_rx()
1248 LOCK(&rq->rx_lock); in oce_stop_rx()
1251 if(!rq->islro) { in oce_stop_rx()
1253 fwcmd->params.req.rq_id = rq->rq_id; in oce_stop_rx()
1257 fwcmd1->params.req.rq_id = rq->rq_id; in oce_stop_rx()
1262 rq->qstate = QDELETED; in oce_stop_rx()
1266 if(!rq->islro) in oce_stop_rx()
1267 oce_rx_cq_clean(rq); in oce_stop_rx()
1269 oce_rx_cq_clean_hwlro(rq); in oce_stop_rx()
1272 oce_free_posted_rxbuf(rq); in oce_stop_rx()
1273 UNLOCK(&rq->rx_lock); in oce_stop_rx()
1282 struct oce_rq *rq; in oce_start_rx() local
1285 for_all_rq_queues(sc, rq, i) { in oce_start_rx()
1286 if (rq->qstate == QCREATED) in oce_start_rx()
1289 rc = oce_mbox_create_rq(rq); in oce_start_rx()
1292 rq->islro = 0; in oce_start_rx()
1294 rc = oce_mbox_create_rq_v2(rq); in oce_start_rx()
1297 rq->islro = 1; in oce_start_rx()
1300 rq->qstate = QCREATED; in oce_start_rx()
1301 rq->pending = 0; in oce_start_rx()
1302 rq->ring->cidx = 0; in oce_start_rx()
1303 rq->ring->pidx = 0; in oce_start_rx()