Lines Matching full:ch

121 	struct dpaa2_channel *ch = NULL;  in dpaa2_chan_setup()  local
148 ch = malloc(sizeof(struct dpaa2_channel), M_DPAA2_CH, M_WAITOK | M_ZERO); in dpaa2_chan_setup()
149 ch->ni_dev = dev; in dpaa2_chan_setup()
150 ch->io_dev = iodev; in dpaa2_chan_setup()
151 ch->con_dev = condev; in dpaa2_chan_setup()
152 ch->id = consc->attr.chan_id; in dpaa2_chan_setup()
153 ch->flowid = flowid; in dpaa2_chan_setup()
154 ch->tx_frames = 0; /* for debug purposes */ in dpaa2_chan_setup()
155 ch->tx_dropped = 0; /* for debug purposes */ in dpaa2_chan_setup()
156 ch->store_sz = 0; in dpaa2_chan_setup()
157 ch->store_idx = 0; in dpaa2_chan_setup()
158 ch->recycled_n = 0; in dpaa2_chan_setup()
159 ch->rxq_n = 0; in dpaa2_chan_setup()
161 NET_TASK_INIT(&ch->cleanup_task, 0, cleanup_task_fn, ch); in dpaa2_chan_setup()
162 NET_TASK_INIT(&ch->bp_task, 0, dpaa2_chan_bp_task, ch); in dpaa2_chan_setup()
164 ch->cleanup_tq = taskqueue_create("dpaa2_ch cleanup", M_WAITOK, in dpaa2_chan_setup()
165 taskqueue_thread_enqueue, &ch->cleanup_tq); in dpaa2_chan_setup()
166 taskqueue_start_threads_cpuset(&ch->cleanup_tq, 1, PI_NET, in dpaa2_chan_setup()
167 &iosc->cpu_mask, "dpaa2_ch%d cleanup", ch->id); in dpaa2_chan_setup()
169 error = dpaa2_chan_setup_dma(dev, ch, sc->buf_align); in dpaa2_chan_setup()
175 mtx_init(&ch->xmit_mtx, "dpaa2_ch_xmit", NULL, MTX_DEF); in dpaa2_chan_setup()
177 ch->xmit_br = buf_ring_alloc(DPAA2_TX_BUFRING_SZ, M_DEVBUF, M_NOWAIT, in dpaa2_chan_setup()
178 &ch->xmit_mtx); in dpaa2_chan_setup()
179 if (ch->xmit_br == NULL) { in dpaa2_chan_setup()
185 DPAA2_BUF_INIT(&ch->store); in dpaa2_chan_setup()
188 ctx = &ch->ctx; in dpaa2_chan_setup()
191 ctx->fq_chan_id = ch->id; in dpaa2_chan_setup()
192 ctx->io_dev = ch->io_dev; in dpaa2_chan_setup()
193 ctx->channel = ch; in dpaa2_chan_setup()
194 error = DPAA2_SWP_CONF_WQ_CHANNEL(ch->io_dev, ctx); in dpaa2_chan_setup()
214 error = dpaa2_buf_seed_pool(dev, bpdev, ch, DPAA2_NI_BUFS_INIT, in dpaa2_chan_setup()
221 error = dpaa2_chan_alloc_storage(dev, ch, DPAA2_ETH_STORE_SIZE, in dpaa2_chan_setup()
228 ch->store_sz = DPAA2_ETH_STORE_FRAMES; in dpaa2_chan_setup()
232 error = dpaa2_chan_setup_fq(dev, ch, DPAA2_NI_QUEUE_TX_CONF); in dpaa2_chan_setup()
238 error = dpaa2_chan_setup_fq(dev, ch, DPAA2_NI_QUEUE_RX); in dpaa2_chan_setup()
247 "priorities=%d\n", ioinfo->id, coninfo->id, ch->id, in dpaa2_chan_setup()
251 *channel = ch; in dpaa2_chan_setup()
259 if (ch->store.vaddr != NULL) { in dpaa2_chan_setup()
260 bus_dmamem_free(ch->store.dmat, ch->store.vaddr, ch->store.dmap); in dpaa2_chan_setup()
262 if (ch->store.dmat != NULL) { in dpaa2_chan_setup()
263 bus_dma_tag_destroy(ch->store.dmat); in dpaa2_chan_setup()
265 ch->store.dmat = NULL; in dpaa2_chan_setup()
266 ch->store.vaddr = NULL; in dpaa2_chan_setup()
267 ch->store.paddr = 0; in dpaa2_chan_setup()
268 ch->store.nseg = 0; in dpaa2_chan_setup()
270 buf_ring_free(ch->xmit_br, M_DEVBUF); in dpaa2_chan_setup()
272 mtx_destroy(&ch->xmit_mtx); in dpaa2_chan_setup()
274 /* while (taskqueue_cancel(ch->cleanup_tq, &ch->cleanup_task, NULL)) { */ in dpaa2_chan_setup()
275 /* taskqueue_drain(ch->cleanup_tq, &ch->cleanup_task); */ in dpaa2_chan_setup()
277 /* taskqueue_free(ch->cleanup_tq); */ in dpaa2_chan_setup()
291 dpaa2_chan_setup_fq(device_t dev, struct dpaa2_channel *ch, in dpaa2_chan_setup_fq() argument
300 fq = &ch->txc_queue; in dpaa2_chan_setup_fq()
301 fq->chan = ch; in dpaa2_chan_setup_fq()
302 fq->flowid = ch->flowid; in dpaa2_chan_setup_fq()
313 fq = &ch->rx_queues[i]; in dpaa2_chan_setup_fq()
314 fq->chan = ch; in dpaa2_chan_setup_fq()
315 fq->flowid = ch->flowid; in dpaa2_chan_setup_fq()
319 ch->rxq_n++; in dpaa2_chan_setup_fq()
325 fq->chan = ch; in dpaa2_chan_setup_fq()
343 dpaa2_chan_next_frame(struct dpaa2_channel *ch, struct dpaa2_dq **dq) in dpaa2_chan_next_frame() argument
345 struct dpaa2_buf *buf = &ch->store; in dpaa2_chan_next_frame()
347 struct dpaa2_dq *msg = &msgs[ch->store_idx]; in dpaa2_chan_next_frame()
350 ch->store_idx++; in dpaa2_chan_next_frame()
354 ch->store_idx = 0; in dpaa2_chan_next_frame()
361 ch->store_idx = 0; in dpaa2_chan_next_frame()
372 dpaa2_chan_setup_dma(device_t dev, struct dpaa2_channel *ch, in dpaa2_chan_setup_dma() argument
377 mtx_init(&ch->dma_mtx, "dpaa2_ch_dma_mtx", NULL, MTX_DEF); in dpaa2_chan_setup_dma()
391 &ch->rx_dmat); in dpaa2_chan_setup_dma()
409 &ch->tx_dmat); in dpaa2_chan_setup_dma()
427 &ch->sgt_dmat); in dpaa2_chan_setup_dma()
436 bus_dma_tag_destroy(ch->tx_dmat); in dpaa2_chan_setup_dma()
438 bus_dma_tag_destroy(ch->rx_dmat); in dpaa2_chan_setup_dma()
440 mtx_destroy(&ch->dma_mtx); in dpaa2_chan_setup_dma()
441 ch->rx_dmat = NULL; in dpaa2_chan_setup_dma()
442 ch->tx_dmat = NULL; in dpaa2_chan_setup_dma()
443 ch->sgt_dmat = NULL; in dpaa2_chan_setup_dma()
452 dpaa2_chan_alloc_storage(device_t dev, struct dpaa2_channel *ch, bus_size_t size, in dpaa2_chan_alloc_storage() argument
455 struct dpaa2_buf *buf = &ch->store; in dpaa2_chan_alloc_storage()
520 struct dpaa2_channel *ch = (struct dpaa2_channel *)arg; in dpaa2_chan_bp_task() local
521 struct dpaa2_ni_softc *sc = device_get_softc(ch->ni_dev); in dpaa2_chan_bp_task()
533 error = DPAA2_SWP_QUERY_BP(ch->io_dev, bpsc->attr.bpid, &bpconf); in dpaa2_chan_bp_task()
542 mtx_assert(&ch->dma_mtx, MA_NOTOWNED); in dpaa2_chan_bp_task()
543 mtx_lock(&ch->dma_mtx); in dpaa2_chan_bp_task()
544 (void)dpaa2_buf_seed_pool(ch->ni_dev, bpdev, ch, buf_num, in dpaa2_chan_bp_task()
545 DPAA2_RX_BUF_SIZE, &ch->dma_mtx); in dpaa2_chan_bp_task()
546 mtx_unlock(&ch->dma_mtx); in dpaa2_chan_bp_task()