Lines Matching +full:bottom +full:- +full:speed
1 /*-
2 * SPDX-License-Identifier: BSD-4-Clause
4 * Copyright (c) 2002-2003
67 #define TX_MAX_QUEUE (FWMAXQUEUE - 1)
91 "Transmission speed");
107 fwe = ((struct fwe_eth_softc *)if_getsoftc(ifp))->fwe; in fwe_poll()
108 fc = fwe->fd.fc; in fwe_poll()
109 fc->poll(fc, (cmd == POLL_AND_CHECK_STATUS)?0:1, count); in fwe_poll()
147 mtx_init(&fwe->mtx, "fwe", NULL, MTX_DEF); in fwe_attach()
149 fwe->stream_ch = stream_ch; in fwe_attach()
150 fwe->dma_ch = -1; in fwe_attach()
152 fwe->fd.fc = device_get_ivars(dev); in fwe_attach()
154 tx_speed = fwe->fd.fc->speed; in fwe_attach()
156 fwe->fd.dev = dev; in fwe_attach()
157 fwe->fd.post_explore = NULL; in fwe_attach()
158 fwe->eth_softc.fwe = fwe; in fwe_attach()
160 fwe->pkt_hdr.mode.stream.tcode = FWTCODE_STREAM; in fwe_attach()
161 fwe->pkt_hdr.mode.stream.sy = 0; in fwe_attach()
162 fwe->pkt_hdr.mode.stream.chtag = fwe->stream_ch; in fwe_attach()
168 eui = &fwe->fd.fc->eui; in fwe_attach()
180 ifp = fwe->eth_softc.ifp = if_alloc(IFT_ETHER); in fwe_attach()
181 if_setsoftc(ifp, &fwe->eth_softc); in fwe_attach()
208 if_t ifp = fwe->eth_softc.ifp; in fwe_stop()
212 fc = fwe->fd.fc; in fwe_stop()
214 if (fwe->dma_ch >= 0) { in fwe_stop()
215 xferq = fc->ir[fwe->dma_ch]; in fwe_stop()
217 if (xferq->flag & FWXFERQ_RUNNING) in fwe_stop()
218 fc->irx_disable(fc, fwe->dma_ch); in fwe_stop()
219 xferq->flag &= in fwe_stop()
222 xferq->hand = NULL; in fwe_stop()
224 for (i = 0; i < xferq->bnchunk; i++) in fwe_stop()
225 m_freem(xferq->bulkxfer[i].mbuf); in fwe_stop()
226 free(xferq->bulkxfer, M_FWE); in fwe_stop()
228 for (xfer = STAILQ_FIRST(&fwe->xferlist); xfer != NULL; in fwe_stop()
233 STAILQ_INIT(&fwe->xferlist); in fwe_stop()
235 xferq->bulkxfer = NULL; in fwe_stop()
236 fwe->dma_ch = -1; in fwe_stop()
250 ifp = fwe->eth_softc.ifp; in fwe_detach()
263 mtx_destroy(&fwe->mtx); in fwe_detach()
270 struct fwe_softc *fwe = ((struct fwe_eth_softc *)arg)->fwe; in fwe_init()
272 if_t ifp = fwe->eth_softc.ifp; in fwe_init()
283 fc = fwe->fd.fc; in fwe_init()
284 if (fwe->dma_ch < 0) { in fwe_init()
285 fwe->dma_ch = fw_open_isodma(fc, /* tx */0); in fwe_init()
286 if (fwe->dma_ch < 0) in fwe_init()
288 xferq = fc->ir[fwe->dma_ch]; in fwe_init()
289 xferq->flag |= FWXFERQ_EXTBUF | in fwe_init()
291 fwe->stream_ch = stream_ch; in fwe_init()
292 fwe->pkt_hdr.mode.stream.chtag = fwe->stream_ch; in fwe_init()
293 xferq->flag &= ~0xff; in fwe_init()
294 xferq->flag |= fwe->stream_ch & 0xff; in fwe_init()
296 xferq->sc = (caddr_t) fwe; in fwe_init()
297 xferq->hand = fwe_as_input; in fwe_init()
298 xferq->bnchunk = rx_queue_len; in fwe_init()
299 xferq->bnpacket = 1; in fwe_init()
300 xferq->psize = MCLBYTES; in fwe_init()
301 xferq->queued = 0; in fwe_init()
302 xferq->buf = NULL; in fwe_init()
303 xferq->bulkxfer = (struct fw_bulkxfer *) malloc( in fwe_init()
304 sizeof(struct fw_bulkxfer) * xferq->bnchunk, in fwe_init()
306 STAILQ_INIT(&xferq->stvalid); in fwe_init()
307 STAILQ_INIT(&xferq->stfree); in fwe_init()
308 STAILQ_INIT(&xferq->stdma); in fwe_init()
309 xferq->stproc = NULL; in fwe_init()
310 for (i = 0; i < xferq->bnchunk; i++) { in fwe_init()
312 xferq->bulkxfer[i].mbuf = m; in fwe_init()
313 m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; in fwe_init()
314 STAILQ_INSERT_TAIL(&xferq->stfree, in fwe_init()
315 &xferq->bulkxfer[i], link); in fwe_init()
317 STAILQ_INIT(&fwe->xferlist); in fwe_init()
322 xfer->send.spd = tx_speed; in fwe_init()
323 xfer->fc = fwe->fd.fc; in fwe_init()
324 xfer->sc = (caddr_t)fwe; in fwe_init()
325 xfer->hand = fwe_output_callback; in fwe_init()
326 STAILQ_INSERT_TAIL(&fwe->xferlist, xfer, link); in fwe_init()
329 xferq = fc->ir[fwe->dma_ch]; in fwe_init()
333 if ((xferq->flag & FWXFERQ_RUNNING) == 0) in fwe_init()
334 fc->irx_enable(fc, fwe->dma_ch); in fwe_init()
349 struct fwe_softc *fwe = ((struct fwe_eth_softc *)if_getsoftc(ifp))->fwe; in fwe_ioctl()
358 fwe_init(&fwe->eth_softc); in fwe_ioctl()
374 snprintf(ifs->ascii, sizeof(ifs->ascii), in fwe_ioctl()
375 "\tch %d dma %d\n", fwe->stream_ch, fwe->dma_ch); in fwe_ioctl()
382 struct firewire_comm *fc = fwe->fd.fc; in fwe_ioctl()
384 if (ifr->ifr_reqcap & IFCAP_POLLING && in fwe_ioctl()
390 fc->set_intr(fc, 0); in fwe_ioctl()
394 if (!(ifr->ifr_reqcap & IFCAP_POLLING) && in fwe_ioctl()
398 fc->set_intr(fc, 1); in fwe_ioctl()
422 fwe = (struct fwe_softc *)xfer->sc; in fwe_output_callback()
423 ifp = fwe->eth_softc.ifp; in fwe_output_callback()
425 FWEDEBUG(ifp, "resp = %d\n", xfer->resp); in fwe_output_callback()
426 if (xfer->resp != 0) in fwe_output_callback()
428 m_freem(xfer->mbuf); in fwe_output_callback()
433 STAILQ_INSERT_TAIL(&fwe->xferlist, xfer, link); in fwe_output_callback()
445 struct fwe_softc *fwe = ((struct fwe_eth_softc *)if_getsoftc(ifp))->fwe; in fwe_start()
450 if (fwe->dma_ch < 0) { in fwe_start()
492 xferq = fwe->fd.fc->atq; in fwe_as_output()
493 while ((xferq->queued < xferq->maxq - 1) && in fwe_as_output()
496 xfer = STAILQ_FIRST(&fwe->xferlist); in fwe_as_output()
504 STAILQ_REMOVE_HEAD(&fwe->xferlist, link); in fwe_as_output()
510 STAILQ_INSERT_HEAD(&fwe->xferlist, xfer, link); in fwe_as_output()
518 fp = &xfer->send.hdr; in fwe_as_output()
519 *(uint32_t *)&xfer->send.hdr = *(int32_t *)&fwe->pkt_hdr; in fwe_as_output()
520 fp->mode.stream.len = m->m_pkthdr.len; in fwe_as_output()
521 xfer->mbuf = m; in fwe_as_output()
522 xfer->send.pay_len = m->m_pkthdr.len; in fwe_as_output()
524 if (fw_asyreq(fwe->fd.fc, -1, xfer) != 0) { in fwe_as_output()
539 xferq->start(fwe->fd.fc); in fwe_as_output()
555 fwe = (struct fwe_softc *)xferq->sc; in fwe_as_input()
556 ifp = fwe->eth_softc.ifp; in fwe_as_input()
558 /* We do not need a lock here because the bottom half is serialized */ in fwe_as_input()
559 while ((sxfer = STAILQ_FIRST(&xferq->stvalid)) != NULL) { in fwe_as_input()
560 STAILQ_REMOVE_HEAD(&xferq->stvalid, link); in fwe_as_input()
561 fp = mtod(sxfer->mbuf, struct fw_pkt *); in fwe_as_input()
562 if (fwe->fd.fc->irx_post != NULL) in fwe_as_input()
563 fwe->fd.fc->irx_post(fwe->fd.fc, fp->mode.ld); in fwe_as_input()
564 m = sxfer->mbuf; in fwe_as_input()
567 sxfer->mbuf = m0 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); in fwe_as_input()
569 m0->m_len = m0->m_pkthdr.len = m0->m_ext.ext_size; in fwe_as_input()
570 STAILQ_INSERT_TAIL(&xferq->stfree, sxfer, link); in fwe_as_input()
574 if (sxfer->resp != 0 || fp->mode.stream.len < in fwe_as_input()
581 m->m_data += HDR_LEN + ETHER_ALIGN; in fwe_as_input()
585 m->m_len = m->m_pkthdr.len = fp->mode.stream.len - ETHER_ALIGN; in fwe_as_input()
586 m->m_pkthdr.rcvif = ifp; in fwe_as_input()
605 if (STAILQ_FIRST(&xferq->stfree) != NULL) in fwe_as_input()
606 fwe->fd.fc->irx_enable(fwe->fd.fc, fwe->dma_ch); in fwe_as_input()