Lines Matching +full:frame +full:- +full:buffer
1 /*-
97 * @group dTSEC Frame Info routines.
104 if (sc->sc_fi_zone != NULL)
105 uma_zdestroy(sc->sc_fi_zone);
112 snprintf(sc->sc_fi_zname, sizeof(sc->sc_fi_zname), "%s: Frame Info",
113 device_get_nameunit(sc->sc_dev));
115 sc->sc_fi_zone = uma_zcreate(sc->sc_fi_zname,
127 fi = uma_zalloc(sc->sc_fi_zone, M_NOWAIT);
136 uma_zfree(sc->sc_fi_zone, fi);
155 params.baseAddr = sc->sc_fm_base + sc->sc_port_rx_hw_id;
156 params.h_Fm = sc->sc_fmh;
157 params.portType = dtsec_fm_port_rx_type(sc->sc_eth_dev_type);
158 params.portId = sc->sc_eth_id;
165 rx_params->errFqid = sc->sc_rx_fqid;
166 rx_params->dfltFqid = sc->sc_rx_fqid;
167 rx_params->liodnOffset = 0;
169 pool_params = &rx_params->extBufPools;
170 pool_params->numOfPoolsUsed = DTSEC_BPOOLS_USED;
171 pool_params->extBufPool->id = sc->sc_rx_bpid;
172 pool_params->extBufPool->size = FM_PORT_BUFFER_SIZE;
174 sc->sc_rxph = FM_PORT_Config(¶ms);
175 if (sc->sc_rxph == NULL) {
176 device_printf(sc->sc_dev, "couldn't configure FM Port RX.\n");
180 error = FM_PORT_Init(sc->sc_rxph);
182 device_printf(sc->sc_dev, "couldn't initialize FM Port RX.\n");
183 FM_PORT_Free(sc->sc_rxph);
188 device_printf(sc->sc_dev, "RX hw port 0x%02x initialized.\n",
189 sc->sc_port_rx_hw_id);
203 params.baseAddr = sc->sc_fm_base + sc->sc_port_tx_hw_id;
204 params.h_Fm = sc->sc_fmh;
205 params.portType = dtsec_fm_port_tx_type(sc->sc_eth_dev_type);
206 params.portId = sc->sc_eth_id;
213 tx_params->errFqid = sc->sc_tx_conf_fqid;
214 tx_params->dfltFqid = sc->sc_tx_conf_fqid;
215 tx_params->qmChannel = sc->sc_port_tx_qman_chan;
217 tx_params->opLiodnOffset = 0;
220 sc->sc_txph = FM_PORT_Config(¶ms);
221 if (sc->sc_txph == NULL) {
222 device_printf(sc->sc_dev, "couldn't configure FM Port TX.\n");
226 error = FM_PORT_Init(sc->sc_txph);
228 device_printf(sc->sc_dev, "couldn't initialize FM Port TX.\n");
229 FM_PORT_Free(sc->sc_txph);
234 device_printf(sc->sc_dev, "TX hw port 0x%02x initialized.\n",
235 sc->sc_port_tx_hw_id);
243 * @group dTSEC buffer pools routines.
247 dtsec_rm_pool_rx_put_buffer(t_Handle h_BufferPool, uint8_t *buffer,
253 uma_zfree(sc->sc_rx_zone, buffer);
262 uint8_t *buffer;
265 buffer = uma_zalloc(sc->sc_rx_zone, M_NOWAIT);
267 return (buffer);
282 count = bman_count(sc->sc_rx_pool);
286 bman_pool_fill(sc->sc_rx_pool, DTSEC_RM_POOL_RX_HIGH_MARK);
294 if (sc->sc_rx_pool != NULL)
295 bman_pool_destroy(sc->sc_rx_pool);
297 if (sc->sc_rx_zone != NULL)
298 uma_zdestroy(sc->sc_rx_zone);
308 snprintf(sc->sc_rx_zname, sizeof(sc->sc_rx_zname), "%s: RX Buffers",
309 device_get_nameunit(sc->sc_dev));
311 sc->sc_rx_zone = uma_zcreate(sc->sc_rx_zname, FM_PORT_BUFFER_SIZE, NULL,
312 NULL, NULL, NULL, FM_PORT_BUFFER_SIZE - 1, 0);
314 sc->sc_rx_pool = bman_pool_create(&sc->sc_rx_bpid, FM_PORT_BUFFER_SIZE,
319 if (sc->sc_rx_pool == NULL) {
320 device_printf(sc->sc_dev, "NULL rx pool somehow\n");
331 * @group dTSEC Frame Queue Range routines.
338 void *buffer;
340 buffer = m->m_ext.ext_arg1;
341 sc = m->m_ext.ext_arg2;
342 if (bman_count(sc->sc_rx_pool) <= DTSEC_RM_POOL_RX_MAX_SIZE)
343 bman_put_buffer(sc->sc_rx_pool, buffer);
345 dtsec_rm_pool_rx_put_buffer(sc, buffer, NULL);
350 uint32_t fqid_off, t_DpaaFD *frame)
359 frame_va = DPAA_FD_GET_ADDR(frame);
360 KASSERT(DPAA_FD_GET_FORMAT(frame) == e_DPAA_FD_FORMAT_TYPE_SHORT_SBSF,
361 ("%s(): Got unsupported frame format 0x%02X!", __func__,
362 DPAA_FD_GET_FORMAT(frame)));
364 KASSERT(DPAA_FD_GET_OFFSET(frame) == 0,
367 if (DPAA_FD_GET_STATUS(frame) != 0) {
368 device_printf(sc->sc_dev, "RX error: 0x%08X\n",
369 DPAA_FD_GET_STATUS(frame));
381 m->m_pkthdr.rcvif = sc->sc_ifnet;
382 m->m_len = DPAA_FD_GET_LENGTH(frame);
385 if_input(sc->sc_ifnet, m);
390 bman_put_buffer(sc->sc_rx_pool, frame_va);
399 uint32_t fqid_off, t_DpaaFD *frame)
408 if (DPAA_FD_GET_STATUS(frame) != 0)
409 device_printf(sc->sc_dev, "TX error: 0x%08X\n",
410 DPAA_FD_GET_STATUS(frame));
414 * of scatter-gather table.
416 sgt0 = DPAA_FD_GET_ADDR(frame);
419 /* Free transmitted frame */
420 m_freem(fi->fi_mbuf);
423 qlen = qman_fqr_get_counter(sc->sc_tx_conf_fqr, 0,
429 if (sc->sc_tx_fqr_full) {
430 sc->sc_tx_fqr_full = 0;
444 if (sc->sc_rx_fqr)
445 qman_fqr_free(sc->sc_rx_fqr);
454 /* Default Frame Queue */
458 device_printf(sc->sc_dev, "could not create default RX queue"
463 sc->sc_rx_fqr = fqr;
464 sc->sc_rx_fqid = qman_fqr_get_base_fqid(fqr);
468 device_printf(sc->sc_dev, "could not register RX callback\n");
480 if (sc->sc_tx_fqr)
481 qman_fqr_free(sc->sc_tx_fqr);
483 if (sc->sc_tx_conf_fqr)
484 qman_fqr_free(sc->sc_tx_conf_fqr);
493 /* TX Frame Queue */
494 fqr = qman_fqr_create(1, sc->sc_port_tx_qman_chan,
497 device_printf(sc->sc_dev, "could not create default TX queue"
502 sc->sc_tx_fqr = fqr;
504 /* TX Confirmation Frame Queue */
509 device_printf(sc->sc_dev, "could not create TX confirmation "
515 sc->sc_tx_conf_fqr = fqr;
516 sc->sc_tx_conf_fqid = qman_fqr_get_base_fqid(fqr);
520 device_printf(sc->sc_dev, "could not register TX confirmation "
548 if ((sc->sc_mii->mii_media_status & IFM_ACTIVE) == 0)
551 if ((if_getdrvflags(sc->sc_ifnet) & IFF_DRV_RUNNING) != IFF_DRV_RUNNING)
554 while (!if_sendq_empty(sc->sc_ifnet)) {
556 qlen = qman_fqr_get_counter(sc->sc_tx_fqr, 0,
560 sc->sc_tx_fqr_full = 1;
568 m0 = if_dequeue(sc->sc_ifnet);
578 fi->fi_mbuf = m0;
580 if (m->m_len == 0)
584 * First entry in scatter-gather table is used to keep
585 * pointer to frame info structure.
587 DPAA_SGTE_SET_ADDR(&fi->fi_sgt[i], (void *)fi);
588 DPAA_SGTE_SET_LENGTH(&fi->fi_sgt[i], 0);
590 DPAA_SGTE_SET_EXTENSION(&fi->fi_sgt[i], 0);
591 DPAA_SGTE_SET_FINAL(&fi->fi_sgt[i], 0);
592 DPAA_SGTE_SET_BPID(&fi->fi_sgt[i], 0);
593 DPAA_SGTE_SET_OFFSET(&fi->fi_sgt[i], 0);
596 dsize = m->m_len;
597 vaddr = (vm_offset_t)m->m_data;
599 ssize = PAGE_SIZE - (vaddr & PAGE_MASK);
600 if (m->m_len < ssize)
601 ssize = m->m_len;
603 DPAA_SGTE_SET_ADDR(&fi->fi_sgt[i],
605 DPAA_SGTE_SET_LENGTH(&fi->fi_sgt[i], ssize);
607 DPAA_SGTE_SET_EXTENSION(&fi->fi_sgt[i], 0);
608 DPAA_SGTE_SET_FINAL(&fi->fi_sgt[i], 0);
609 DPAA_SGTE_SET_BPID(&fi->fi_sgt[i], 0);
610 DPAA_SGTE_SET_OFFSET(&fi->fi_sgt[i], 0);
612 dsize -= ssize;
621 m = m->m_next;
631 DPAA_SGTE_SET_FINAL(&fi->fi_sgt[i-1], 1);
633 DPAA_FD_SET_ADDR(&fd, fi->fi_sgt);
644 if (qman_fqr_enqueue(sc->sc_tx_fqr, 0, &fd) != E_OK) {