Lines Matching +full:rx +full:- +full:eq

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
34 * freebsd-drivers@emulex.com
50 static int oce_wq_create(struct oce_wq *wq, struct oce_eq *eq);
57 static int oce_rq_create(struct oce_rq *rq, uint32_t if_id, struct oce_eq *eq);
65 static void oce_eq_del(struct oce_eq *eq);
67 struct oce_eq *eq, uint32_t q_len);
72 struct oce_eq *eq,
93 /* alloc TX/RX queues */ 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()
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()
115 for (vector = 0; vector < sc->intr_count; vector++) { in oce_queue_init_all()
117 aic = &sc->aic_obj[vector]; in oce_queue_init_all()
118 aic->max_eqd = OCE_MAX_EQD; in oce_queue_init_all()
119 aic->min_eqd = OCE_MIN_EQD; in oce_queue_init_all()
120 aic->et_eqd = OCE_MIN_EQD; in oce_queue_init_all()
121 aic->enable = TRUE; in oce_queue_init_all()
123 sc->eq[vector] = oce_eq_create(sc, sc->enable_hwlro ? EQ_LEN_2048 : EQ_LEN_1024, in oce_queue_init_all()
126 if (!sc->eq[vector]) in oce_queue_init_all()
130 /* create Tx, Rx and mcc queues */ 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()
140 rc = oce_rq_create(rq, sc->if_id, in oce_queue_init_all()
141 sc->eq[(i == 0) ? 0:(i-1)]); in oce_queue_init_all()
144 rq->queue_index = i; in oce_queue_init_all()
147 sc->mq = oce_mq_create(sc, sc->eq[0], 64); in oce_queue_init_all()
148 if (!sc->mq) in oce_queue_init_all()
168 struct oce_eq *eq; in oce_queue_release_all() local
171 if(sc->enable_hwlro) 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()
183 oce_wq_del(sc->wq[i]); in oce_queue_release_all()
184 oce_wq_free(sc->wq[i]); in oce_queue_release_all()
188 if (sc->mq) in oce_queue_release_all()
189 oce_mq_free(sc->mq); in oce_queue_release_all()
191 for_all_evnt_queues(sc, eq, i) { in oce_queue_release_all()
192 if (eq) in oce_queue_release_all()
193 oce_eq_del(sc->eq[i]); in oce_queue_release_all()
212 device_printf(sc->dev, 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()
232 rc = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 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()
265 device_printf(sc->dev, "Create WQ failed\n"); in oce_wq_init()
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()
308 * @param eq pointer to associated event queue
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()
319 eq, in oce_wq_create()
325 wq->cq = cq; 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()
336 eq->cq[eq->cq_valid] = cq; in oce_wq_create()
337 eq->cq_valid++; in oce_wq_create()
338 cq->cb_arg = wq; in oce_wq_create()
339 cq->cq_handler = oce_wq_handler; in oce_wq_create()
344 device_printf(sc->dev, "WQ create failed\n"); in oce_wq_create()
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()
382 * @param rss is-rss-queue flag
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()
415 rc = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 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()
442 device_printf(sc->dev, "Create RQ failed\n"); in oce_rq_init()
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()
484 * @param eq pointer to event queue
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()
492 cq = oce_cq_create(sc, eq, in oce_rq_create()
493 sc->enable_hwlro ? CQ_LEN_2048 : CQ_LEN_1024, 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()
506 eq->cq[eq->cq_valid] = cq; in oce_rq_create()
507 eq->cq_valid++; in oce_rq_create()
508 cq->cb_arg = rq; in oce_rq_create()
509 cq->cq_handler = oce_rq_handler; in oce_rq_create()
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()
536 fwcmd1->params.req.rq_flags = (NIC_RQ_FLAGS_RSS | NIC_RQ_FLAGS_LRO); 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()
554 * @retval eq success, pointer to event queue
563 struct oce_eq *eq; in oce_eq_create() local
566 /* allocate an eq */ in oce_eq_create()
567 eq = malloc(sizeof(struct oce_eq), M_DEVBUF, M_NOWAIT | M_ZERO); in oce_eq_create()
568 if (eq == NULL) in oce_eq_create()
571 eq->parent = (void *)sc; in oce_eq_create()
572 eq->eq_id = 0xffff; in oce_eq_create()
573 eq->ring = oce_create_ring_buffer(sc, q_len, item_size); in oce_eq_create()
574 if (!eq->ring) in oce_eq_create()
577 eq->eq_cfg.q_len = q_len; in oce_eq_create()
578 eq->eq_cfg.item_size = item_size; in oce_eq_create()
579 eq->eq_cfg.cur_eqd = (uint8_t) eq_delay; in oce_eq_create()
581 rc = oce_mbox_create_eq(eq); in oce_eq_create()
585 sc->intrs[sc->neqs++].eq = eq; in oce_eq_create()
587 return eq; in oce_eq_create()
590 oce_eq_del(eq); in oce_eq_create()
596 * @param eq pointer to an event queue
599 oce_eq_del(struct oce_eq *eq) in oce_eq_del() argument
603 POCE_SOFTC sc = (POCE_SOFTC) eq->parent; in oce_eq_del()
605 if (eq->eq_id != 0xffff) { in oce_eq_del()
608 fwcmd->params.req.id = eq->eq_id; in oce_eq_del()
613 if (eq->ring != NULL) { in oce_eq_del()
614 oce_destroy_ring_buffer(sc, eq->ring); in oce_eq_del()
615 eq->ring = NULL; in oce_eq_del()
618 free(eq, M_DEVBUF); in oce_eq_del()
625 * @param eq the EQ to associate with the MQ for event notification
630 oce_mq_create(POCE_SOFTC sc, struct oce_eq *eq, uint32_t q_len) in oce_mq_create() argument
641 cq = oce_cq_create(sc, eq, CQ_LEN_256, in oce_mq_create()
653 mq->parent = sc; in oce_mq_create()
655 mq->ring = oce_create_ring_buffer(sc, q_len, sizeof(struct oce_mbx)); in oce_mq_create()
656 if (!mq->ring) in oce_mq_create()
663 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0, in oce_mq_create()
670 num_pages = oce_page_list(mq->ring, &fwcmd->params.req.pages[0]); in oce_mq_create()
672 ctx = &fwcmd->params.req.context; in oce_mq_create()
675 ctx->v1.num_pages = num_pages; in oce_mq_create()
676 ctx->v1.ring_size = OCE_LOG2(q_len) + 1; in oce_mq_create()
677 ctx->v1.cq_id = cq->cq_id; in oce_mq_create()
678 ctx->v1.valid = 1; in oce_mq_create()
679 ctx->v1.async_cq_id = cq->cq_id; in oce_mq_create()
680 ctx->v1.async_cq_valid = 1; in oce_mq_create()
682 ctx->v1.async_evt_bitmap |= LE_32(0x00000022); in oce_mq_create()
683 ctx->v1.async_evt_bitmap |= LE_32(1 << ASYNC_EVENT_CODE_DEBUG); in oce_mq_create()
684 ctx->v1.async_evt_bitmap |= in oce_mq_create()
688 ctx->v0.num_pages = num_pages; in oce_mq_create()
689 ctx->v0.cq_id = cq->cq_id; in oce_mq_create()
690 ctx->v0.ring_size = OCE_LOG2(q_len) + 1; in oce_mq_create()
691 ctx->v0.valid = 1; in oce_mq_create()
693 ctx->v0.async_evt_bitmap = 0xffffffff; in oce_mq_create()
702 rc = fwcmd->hdr.u0.rsp.status; in oce_mq_create()
704 device_printf(sc->dev,"%s failed - cmd status: %d\n", in oce_mq_create()
708 mq->mq_id = LE_16(fwcmd->params.rsp.mq_id); in oce_mq_create()
709 mq->cq = cq; in oce_mq_create()
710 eq->cq[eq->cq_valid] = cq; in oce_mq_create()
711 eq->cq_valid++; in oce_mq_create()
712 mq->cq->eq = eq; in oce_mq_create()
713 mq->cfg.q_len = (uint8_t) q_len; in oce_mq_create()
714 mq->cfg.eqd = 0; in oce_mq_create()
715 mq->qstate = QCREATED; in oce_mq_create()
717 mq->cq->cb_arg = mq; in oce_mq_create()
718 mq->cq->cq_handler = oce_mq_handler; in oce_mq_create()
723 device_printf(sc->dev, "MQ create failed\n"); in oce_mq_create()
736 POCE_SOFTC sc = (POCE_SOFTC) mq->parent; in oce_mq_free()
743 if (mq->ring != NULL) { in oce_mq_free()
744 oce_destroy_ring_buffer(sc, mq->ring); in oce_mq_free()
745 mq->ring = NULL; in oce_mq_free()
746 if (mq->qstate == QCREATED) { in oce_mq_free()
749 fwcmd->params.req.id = mq->mq_id; in oce_mq_free()
754 mq->qstate = QDELETED; in oce_mq_free()
757 if (mq->cq != NULL) { in oce_mq_free()
758 oce_cq_del(sc, mq->cq); in oce_mq_free()
759 mq->cq = NULL; in oce_mq_free()
767 * @brief Function to delete a EQ, CQ, MQ, WQ or RQ
772 * @param qtype the type of queue i.e. EQ, CQ, MQ, WQ or RQ
779 struct mbx_hdr *hdr = (struct mbx_hdr *)&mbx->payload; in oce_destroy_q()
813 mbx->u0.s.embedded = 1; in oce_destroy_q()
814 mbx->payload_length = (uint32_t) req_size; in oce_destroy_q()
815 DW_SWAP(u32ptr(mbx), mbx->payload_length + OCE_BMBX_RHDR_SZ); in oce_destroy_q()
819 rc = hdr->u0.rsp.status; in oce_destroy_q()
821 device_printf(sc->dev,"%s failed - cmd status: %d\n", in oce_destroy_q()
829 * @param eq optional eq to be associated with to the cq
839 oce_cq_create(POCE_SOFTC sc, struct oce_eq *eq, in oce_cq_create() argument
853 cq->ring = oce_create_ring_buffer(sc, q_len, item_size); in oce_cq_create()
854 if (!cq->ring) in oce_cq_create()
857 cq->parent = sc; in oce_cq_create()
858 cq->eq = eq; in oce_cq_create()
859 cq->cq_cfg.q_len = q_len; in oce_cq_create()
860 cq->cq_cfg.item_size = item_size; in oce_cq_create()
861 cq->cq_cfg.nodelay = (uint8_t) nodelay; in oce_cq_create()
867 sc->cq[sc->ncqs++] = cq; in oce_cq_create()
872 device_printf(sc->dev, "CQ create failed\n"); in oce_cq_create()
888 if (cq->ring != NULL) { in oce_cq_del()
892 fwcmd->params.req.id = cq->cq_id; in oce_cq_del()
896 oce_destroy_ring_buffer(sc, cq->ring); in oce_cq_del()
897 cq->ring = NULL; in oce_cq_del()
911 POCE_SOFTC sc = (POCE_SOFTC) rq->parent; in oce_start_rq()
914 if(sc->enable_hwlro) 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()
932 oce_arm_cq(wq->parent, wq->cq->cq_id, 0, TRUE); in oce_start_wq()
943 oce_arm_cq(mq->parent, mq->cq->cq_id, 0, TRUE); in oce_start_mq()
948 * @brief Function to arm an EQ so that it can generate events
950 * @param qid id of the EQ returned by the fw at the time of creation
992 * @param eq pointer to event queue structure
996 oce_drain_eq(struct oce_eq *eq) in oce_drain_eq() argument
1001 POCE_SOFTC sc = eq->parent; in oce_drain_eq()
1004 eqe = RING_GET_CONSUMER_ITEM_VA(eq->ring, struct oce_eqe); in oce_drain_eq()
1005 if (eqe->evnt == 0) in oce_drain_eq()
1007 eqe->evnt = 0; in oce_drain_eq()
1008 bus_dmamap_sync(eq->ring->dma.tag, eq->ring->dma.map, in oce_drain_eq()
1011 RING_GET(eq->ring, 1); in oce_drain_eq()
1015 oce_arm_eq(sc, eq->eq_id, num_eqe, FALSE, TRUE); in oce_drain_eq()
1022 POCE_SOFTC sc = wq->parent; in oce_drain_wq_cq()
1023 struct oce_cq *cq = wq->cq; in oce_drain_wq_cq()
1027 bus_dmamap_sync(cq->ring->dma.tag, cq->ring->dma.map, in oce_drain_wq_cq()
1031 cqe = RING_GET_CONSUMER_ITEM_VA(cq->ring, struct oce_nic_tx_cqe); in oce_drain_wq_cq()
1032 if (cqe->u0.dw[3] == 0) in oce_drain_wq_cq()
1034 cqe->u0.dw[3] = 0; in oce_drain_wq_cq()
1035 bus_dmamap_sync(cq->ring->dma.tag, cq->ring->dma.map, in oce_drain_wq_cq()
1037 RING_GET(cq->ring, 1); in oce_drain_wq_cq()
1042 oce_arm_cq(sc, cq->cq_id, num_cqes, FALSE); in oce_drain_wq_cq()
1072 sc = rq->parent; in oce_drain_rq_cq()
1073 cq = rq->cq; in oce_drain_rq_cq()
1074 cqe = RING_GET_CONSUMER_ITEM_VA(cq->ring, struct oce_nic_rx_cqe); in oce_drain_rq_cq()
1078 RING_GET(cq->ring, 1); in oce_drain_rq_cq()
1079 cqe = RING_GET_CONSUMER_ITEM_VA(cq->ring, in oce_drain_rq_cq()
1083 oce_arm_cq(sc, cq->cq_id, num_cqe, FALSE); in oce_drain_rq_cq()
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()
1097 if (pd->mbuf != NULL) { in oce_free_posted_rxbuf()
1098 m_freem(pd->mbuf); in oce_free_posted_rxbuf()
1099 pd->mbuf = NULL; in oce_free_posted_rxbuf()
1102 RING_GET(rq->ring,1); in oce_free_posted_rxbuf()
1103 rq->pending--; in oce_free_posted_rxbuf()
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()
1120 bus_dmamap_sync(cq->ring->dma.tag,cq->ring->dma.map, BUS_DMASYNC_POSTWRITE); in oce_rx_cq_clean_hwlro()
1121 cqe = RING_GET_CONSUMER_ITEM_VA(cq->ring, struct nic_hwlro_singleton_cqe); in oce_rx_cq_clean_hwlro()
1122 if(cqe->valid) { in oce_rx_cq_clean_hwlro()
1123 if(cqe->cqe_type == 0) { /* singleton cqe */ in oce_rx_cq_clean_hwlro()
1125 if(rq->cqe_firstpart != NULL) { in oce_rx_cq_clean_hwlro()
1126 device_printf(sc->dev, "Got singleton cqe after cqe1 \n"); 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()
1134 if(!cqe->pkt_size) in oce_rx_cq_clean_hwlro()
1136 cqe->valid = 0; in oce_rx_cq_clean_hwlro()
1137 RING_GET(cq->ring, 1); in oce_rx_cq_clean_hwlro()
1138 }else if(cqe->cqe_type == 0x1) { /* first part */ in oce_rx_cq_clean_hwlro()
1140 if(rq->cqe_firstpart != NULL) { in oce_rx_cq_clean_hwlro()
1141 device_printf(sc->dev, "Got cqe1 after cqe1 \n"); in oce_rx_cq_clean_hwlro()
1144 rq->cqe_firstpart = (struct nic_hwlro_cqe_part1 *)cqe; in oce_rx_cq_clean_hwlro()
1145 RING_GET(cq->ring, 1); in oce_rx_cq_clean_hwlro()
1146 }else if(cqe->cqe_type == 0x2) { /* second part */ in oce_rx_cq_clean_hwlro()
1149 if(rq->cqe_firstpart == NULL) { in oce_rx_cq_clean_hwlro()
1150 device_printf(sc->dev, "Got cqe2 without cqe1 \n"); 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()
1160 rq->cqe_firstpart->valid = 0; in oce_rx_cq_clean_hwlro()
1161 cqe2->valid = 0; in oce_rx_cq_clean_hwlro()
1162 rq->cqe_firstpart = NULL; in oce_rx_cq_clean_hwlro()
1163 RING_GET(cq->ring, 1); in oce_rx_cq_clean_hwlro()
1165 oce_arm_cq(sc, cq->cq_id, 1, FALSE); in oce_rx_cq_clean_hwlro()
1170 device_printf(sc->dev, "did not receive hwlro flush compl\n"); in oce_rx_cq_clean_hwlro()
1173 oce_arm_cq(sc, cq->cq_id, 0, TRUE); in oce_rx_cq_clean_hwlro()
1179 oce_arm_cq(sc, cq->cq_id, 0, FALSE); in oce_rx_cq_clean_hwlro()
1193 sc = rq->parent; in oce_rx_cq_clean()
1194 cq = rq->cq; in oce_rx_cq_clean()
1197 bus_dmamap_sync(cq->ring->dma.tag, in oce_rx_cq_clean()
1198 cq->ring->dma.map, BUS_DMASYNC_POSTWRITE); in oce_rx_cq_clean()
1199 cqe = RING_GET_CONSUMER_ITEM_VA(cq->ring, struct oce_nic_rx_cqe); in oce_rx_cq_clean()
1202 oce_discard_rx_comp(rq, cqe->u0.s.num_fragments); in oce_rx_cq_clean()
1204 … if((cqe->u0.s.num_fragments==0)&&(cqe->u0.s.pkt_size == 0)&&(cqe->u0.s.error == 0)) in oce_rx_cq_clean()
1208 RING_GET(cq->ring, 1); in oce_rx_cq_clean()
1213 oce_arm_cq(sc, cq->cq_id, 1, FALSE); in oce_rx_cq_clean()
1218 device_printf(sc->dev, "did not receive flush compl\n"); in oce_rx_cq_clean()
1221 oce_arm_cq(sc, cq->cq_id, 0, TRUE); in oce_rx_cq_clean()
1227 oce_arm_cq(sc, cq->cq_id, 0, FALSE); in oce_rx_cq_clean()
1242 if(sc->enable_hwlro) 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()
1258 fwcmd1->params.req.rq_flags = (NIC_RQ_FLAGS_RSS | NIC_RQ_FLAGS_LRO); in oce_stop_rx()
1262 rq->qstate = QDELETED; in oce_stop_rx()
1266 if(!rq->islro) in oce_stop_rx()
1271 /* Free posted RX buffers that are not used */ in oce_stop_rx()
1273 UNLOCK(&rq->rx_lock); in oce_stop_rx()
1286 if (rq->qstate == QCREATED) in oce_start_rx()
1288 if((i == 0) || (!sc->enable_hwlro)) { in oce_start_rx()
1292 rq->islro = 0; 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()
1306 if(sc->enable_hwlro) { in oce_start_rx()
1316 rc = oce_config_nic_rss(sc, (uint8_t) sc->if_id, RSS_ENABLE); in oce_start_rx()
1324 device_printf(sc->dev, "Start RX failed\n"); in oce_start_rx()