• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/sys/dev/liquidio/base/

Lines Matching refs:oct

52 static void	__lio_check_db_timeout(struct octeon_device *oct,
57 lio_init_instr_queue(struct octeon_device *oct, union octeon_txpciq txpciq,
69 if (LIO_CN23XX_PF(oct))
70 conf = &(LIO_GET_IQ_CFG(LIO_CHIP_CONF(oct, cn23xx_pf)));
72 lio_dev_err(oct, "Unsupported Chip %x\n", oct->chip_id);
77 iq = oct->instr_queue[iq_no];
78 iq->oct_dev = oct;
82 error = bus_dma_tag_create(bus_get_dma_tag(oct->device), /* parent */
95 lio_dev_err(oct, "Cannot allocate memory for instr queue %d\n",
102 lio_dev_err(oct, "Cannot allocate memory for instr queue %d\n",
116 lio_dev_err(oct, "Alloc failed for IQ[%d] nr free list\n",
121 lio_dev_dbg(oct, "IQ[%d]: base: %p basedma: %llx count: %d\n",
130 lio_dev_err(oct, "Unable to create TX DMA map\n");
152 oct->io_qmask.iq |= BIT_ULL(iq_no);
155 oct->io_qmask.iq64B |= ((conf->instr_type == 64) << iq_no);
158 oct->fn_list.setup_iq_regs(oct, iq_no);
160 db_tq = &oct->check_db_tq[iq_no];
164 lio_dev_err(oct, "check db wq create failed for iq %d\n",
172 db_tq->ctxptr = oct;
176 oct->octeon_id, iq_no);
180 oct->instr_queue[iq_no]->br =
182 &oct->instr_queue[iq_no]->enq_lock);
183 if (oct->instr_queue[iq_no]->br == NULL) {
184 lio_dev_err(oct, "Critical Failure setting up buf ring\n");
192 lio_delete_instr_queue(struct octeon_device *oct, uint32_t iq_no)
194 struct lio_instr_queue *iq = oct->instr_queue[iq_no];
200 lio_dev_dbg(oct, "%s[%d]\n", __func__, iq_no);
202 if (oct->check_db_tq[iq_no].tq != NULL) {
203 while (taskqueue_cancel_timeout(oct->check_db_tq[iq_no].tq,
204 &oct->check_db_tq[iq_no].work,
206 taskqueue_drain_timeout(oct->check_db_tq[iq_no].tq,
207 &oct->check_db_tq[iq_no].work);
208 taskqueue_free(oct->check_db_tq[iq_no].tq);
209 oct->check_db_tq[iq_no].tq = NULL;
212 if (LIO_CN23XX_PF(oct))
214 LIO_GET_IQ_INSTR_TYPE_CFG(LIO_CHIP_CONF(oct, cn23xx_pf));
260 oct->io_qmask.iq &= ~(1ULL << iq_no);
261 bzero(oct->instr_queue[iq_no], sizeof(struct lio_instr_queue));
262 oct->num_iqs--;
272 lio_setup_iq(struct octeon_device *oct, int ifidx, int q_index,
277 if (oct->instr_queue[iq_no]->oct_dev != NULL) {
278 lio_dev_dbg(oct, "IQ is in use. Cannot create the IQ: %d again\n",
280 oct->instr_queue[iq_no]->txpciq.txpciq64 = txpciq.txpciq64;
284 oct->instr_queue[iq_no]->q_index = q_index;
285 oct->instr_queue[iq_no]->ifidx = ifidx;
287 if (lio_init_instr_queue(oct, txpciq, num_descs)) {
288 lio_delete_instr_queue(oct, iq_no);
292 oct->num_iqs++;
293 if (oct->fn_list.enable_io_queues(oct))
300 lio_wait_for_instr_fetch(struct octeon_device *oct)
307 for (i = 0; i < LIO_MAX_INSTR_QUEUES(oct); i++) {
308 if (!(oct->io_qmask.iq & BIT_ULL(i)))
311 &oct->instr_queue[i]->instr_pending);
313 __lio_check_db_timeout(oct, i);
328 lio_ring_doorbell(struct octeon_device *oct, struct lio_instr_queue *iq)
331 if (atomic_load_acq_int(&oct->status) == LIO_DEV_RUNNING) {
332 lio_write_csr32(oct, iq->doorbell_reg, iq->fill_cnt);
404 lio_process_iq_request_list(struct octeon_device *oct,
433 if (LIO_CN23XX_PF(oct))
444 mtx_lock(&oct->response_list
446 atomic_add_int(&oct->response_list
449 STAILQ_INSERT_TAIL(&oct->response_list
452 mtx_unlock(&oct->response_list
457 sc->callback(oct, LIO_REQUEST_DONE,
464 lio_dev_err(oct, "%s Unknown reqtype: %d buf: %p at idx %d\n",
486 lio_flush_iq(struct octeon_device *oct, struct lio_instr_queue *iq,
498 iq->octeon_read_index = oct->fn_list.update_iq_read_idx(iq);
507 lio_process_iq_request_list(oct, iq,
512 lio_process_iq_request_list(oct, iq, 0);
540 __lio_check_db_timeout(struct octeon_device *oct, uint64_t iq_no)
545 if (oct == NULL)
548 iq = oct->instr_queue[iq_no];
561 lio_flush_iq(oct, iq, 0);
566 if (oct->props.ifp != NULL && iq->br != NULL) {
568 if (!drbr_empty(oct->props.ifp, iq->br))
569 lio_mq_start_locked(oct->props.ifp, iq);
584 struct octeon_device *oct = db_tq->ctxptr;
588 __lio_check_db_timeout(oct, iq_no);
594 lio_send_command(struct octeon_device *oct, uint32_t iq_no,
599 struct lio_instr_queue *iq = oct->instr_queue[iq_no];
611 LIO_INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, bytes_sent, datasize);
612 LIO_INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, instr_posted, 1);
615 lio_ring_doorbell(oct, iq);
617 LIO_INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, instr_dropped, 1);
631 lio_prepare_soft_command(struct octeon_device *oct, struct lio_soft_command *sc,
644 lio_cfg = lio_get_conf(oct);
646 if (LIO_CN23XX_PF(oct)) {
649 ih3->pkind = oct->instr_queue[sc->iq_no]->txpciq.s.pkind;
656 pki_ih3->uqpg = oct->instr_queue[sc->iq_no]->txpciq.s.use_qpg;
660 pki_ih3->qpg = oct->instr_queue[sc->iq_no]->txpciq.s.qpg;
678 rdp->pcie_port = oct->pcie_port;
695 lio_send_soft_command(struct octeon_device *oct, struct lio_soft_command *sc)
701 if (LIO_CN23XX_PF(oct)) {
723 return (lio_send_command(oct, sc->iq_no, 1, &sc->cmd, sc,
728 lio_setup_sc_buffer_pool(struct octeon_device *oct)
734 STAILQ_INIT(&oct->sc_buf_pool.head);
735 mtx_init(&oct->sc_buf_pool.lock, "sc_pool_lock", NULL, MTX_DEF);
736 atomic_store_rel_int(&oct->sc_buf_pool.alloc_buf_count, 0);
742 lio_free_sc_buffer_pool(oct);
749 STAILQ_INSERT_TAIL(&oct->sc_buf_pool.head, &sc->node, entries);
756 lio_free_sc_buffer_pool(struct octeon_device *oct)
761 mtx_lock(&oct->sc_buf_pool.lock);
763 STAILQ_FOREACH_SAFE(tmp, &oct->sc_buf_pool.head, entries, tmp2) {
764 sc = LIO_STAILQ_FIRST_ENTRY(&oct->sc_buf_pool.head,
767 STAILQ_REMOVE_HEAD(&oct->sc_buf_pool.head, entries);
772 STAILQ_INIT(&oct->sc_buf_pool.head);
774 mtx_unlock(&oct->sc_buf_pool.lock);
780 lio_alloc_soft_command(struct octeon_device *oct, uint32_t datasize,
794 mtx_lock(&oct->sc_buf_pool.lock);
796 if (STAILQ_EMPTY(&oct->sc_buf_pool.head)) {
797 mtx_unlock(&oct->sc_buf_pool.lock);
800 tmp = STAILQ_LAST(&oct->sc_buf_pool.head, lio_stailq_node, entries);
802 STAILQ_REMOVE(&oct->sc_buf_pool.head, tmp, lio_stailq_node, entries);
804 atomic_add_int(&oct->sc_buf_pool.alloc_buf_count, 1);
806 mtx_unlock(&oct->sc_buf_pool.lock);
847 lio_free_soft_command(struct octeon_device *oct,
851 mtx_lock(&oct->sc_buf_pool.lock);
853 STAILQ_INSERT_TAIL(&oct->sc_buf_pool.head, &sc->node, entries);
855 atomic_subtract_int(&oct->sc_buf_pool.alloc_buf_count, 1);
857 mtx_unlock(&oct->sc_buf_pool.lock);