Lines Matching +full:hi +full:- +full:speed

1 /*-
2 * SPDX-License-Identifier: BSD-4-Clause
6 * Copyright (c) 2002-2003
79 #define TX_MAX_QUEUE (FWMAXQUEUE - 1)
118 fwip = ((struct fwip_eth_softc *)if_getsoftc(ifp))->fwip; in fwip_poll()
119 fc = fwip->fd.fc; in fwip_poll()
120 fc->poll(fc, (cmd == POLL_AND_CHECK_STATUS)?0:1, count); in fwip_poll()
155 ifp = fwip->fw_softc.fwip_ifp = if_alloc(IFT_IEEE1394); in fwip_attach()
157 mtx_init(&fwip->mtx, "fwip", NULL, MTX_DEF); in fwip_attach()
159 fwip->dma_ch = -1; in fwip_attach()
161 fwip->fd.fc = device_get_ivars(dev); in fwip_attach()
163 tx_speed = fwip->fd.fc->speed; in fwip_attach()
165 fwip->fd.dev = dev; in fwip_attach()
166 fwip->fd.post_explore = NULL; in fwip_attach()
167 fwip->fd.post_busreset = fwip_post_busreset; in fwip_attach()
168 fwip->fw_softc.fwip = fwip; in fwip_attach()
169 TASK_INIT(&fwip->start_send, 0, fwip_start_send, fwip); in fwip_attach()
174 hwaddr = &IFP2FWC(fwip->fw_softc.fwip_ifp)->fc_hwaddr; in fwip_attach()
175 hwaddr->sender_unique_ID_hi = htonl(fwip->fd.fc->eui.hi); in fwip_attach()
176 hwaddr->sender_unique_ID_lo = htonl(fwip->fd.fc->eui.lo); in fwip_attach()
177 hwaddr->sender_max_rec = fwip->fd.fc->maxrec; in fwip_attach()
178 hwaddr->sspd = fwip->fd.fc->speed; in fwip_attach()
179 hwaddr->sender_unicast_FIFO_hi = htons((uint16_t)(INET_FIFO >> 32)); in fwip_attach()
180 hwaddr->sender_unicast_FIFO_lo = htonl((uint32_t)INET_FIFO); in fwip_attach()
183 if_setsoftc(ifp, &fwip->fw_softc); in fwip_attach()
208 if_t ifp = fwip->fw_softc.fwip_ifp; in fwip_stop()
212 fc = fwip->fd.fc; in fwip_stop()
214 if (fwip->dma_ch >= 0) { in fwip_stop()
215 xferq = fc->ir[fwip->dma_ch]; in fwip_stop()
217 if (xferq->flag & FWXFERQ_RUNNING) in fwip_stop()
218 fc->irx_disable(fc, fwip->dma_ch); in fwip_stop()
219 xferq->flag &= in fwip_stop()
222 xferq->hand = NULL; in fwip_stop()
224 for (i = 0; i < xferq->bnchunk; i++) in fwip_stop()
225 m_freem(xferq->bulkxfer[i].mbuf); in fwip_stop()
226 free(xferq->bulkxfer, M_FWIP); in fwip_stop()
228 fw_bindremove(fc, &fwip->fwb); in fwip_stop()
229 for (xfer = STAILQ_FIRST(&fwip->fwb.xferlist); xfer != NULL; in fwip_stop()
235 for (xfer = STAILQ_FIRST(&fwip->xferlist); xfer != NULL; in fwip_stop()
240 STAILQ_INIT(&fwip->xferlist); in fwip_stop()
242 xferq->bulkxfer = NULL; in fwip_stop()
243 fwip->dma_ch = -1; in fwip_stop()
257 ifp = fwip->fw_softc.fwip_ifp; in fwip_detach()
269 mtx_destroy(&fwip->mtx); in fwip_detach()
278 struct fwip_softc *fwip = ((struct fwip_eth_softc *)arg)->fwip; in fwip_init()
280 if_t ifp = fwip->fw_softc.fwip_ifp; in fwip_init()
288 fc = fwip->fd.fc; in fwip_init()
290 if (fwip->dma_ch < 0) { in fwip_init()
291 fwip->dma_ch = fw_open_isodma(fc, /* tx */0); in fwip_init()
292 if (fwip->dma_ch < 0) in fwip_init()
294 xferq = fc->ir[fwip->dma_ch]; in fwip_init()
295 xferq->flag |= FWXFERQ_EXTBUF | in fwip_init()
297 xferq->flag &= ~0xff; in fwip_init()
298 xferq->flag |= broadcast_channel & 0xff; in fwip_init()
300 xferq->sc = (caddr_t) fwip; in fwip_init()
301 xferq->hand = fwip_stream_input; in fwip_init()
302 xferq->bnchunk = rx_queue_len; in fwip_init()
303 xferq->bnpacket = 1; in fwip_init()
304 xferq->psize = MCLBYTES; in fwip_init()
305 xferq->queued = 0; in fwip_init()
306 xferq->buf = NULL; in fwip_init()
307 xferq->bulkxfer = malloc( in fwip_init()
308 sizeof(struct fw_bulkxfer) * xferq->bnchunk, in fwip_init()
310 STAILQ_INIT(&xferq->stvalid); in fwip_init()
311 STAILQ_INIT(&xferq->stfree); in fwip_init()
312 STAILQ_INIT(&xferq->stdma); in fwip_init()
313 xferq->stproc = NULL; in fwip_init()
314 for (i = 0; i < xferq->bnchunk; i++) { in fwip_init()
316 xferq->bulkxfer[i].mbuf = m; in fwip_init()
317 m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; in fwip_init()
318 STAILQ_INSERT_TAIL(&xferq->stfree, in fwip_init()
319 &xferq->bulkxfer[i], link); in fwip_init()
322 fwip->fwb.start = INET_FIFO; in fwip_init()
323 fwip->fwb.end = INET_FIFO + 16384; /* S3200 packet size */ in fwip_init()
325 /* pre-allocate xfer */ in fwip_init()
326 STAILQ_INIT(&fwip->fwb.xferlist); in fwip_init()
332 xfer->recv.payload = mtod(m, uint32_t *); in fwip_init()
333 xfer->recv.pay_len = MCLBYTES; in fwip_init()
334 xfer->hand = fwip_unicast_input; in fwip_init()
335 xfer->fc = fc; in fwip_init()
336 xfer->sc = (caddr_t)fwip; in fwip_init()
337 xfer->mbuf = m; in fwip_init()
338 STAILQ_INSERT_TAIL(&fwip->fwb.xferlist, xfer, link); in fwip_init()
340 fw_bindadd(fc, &fwip->fwb); in fwip_init()
342 STAILQ_INIT(&fwip->xferlist); in fwip_init()
347 xfer->send.spd = tx_speed; in fwip_init()
348 xfer->fc = fwip->fd.fc; in fwip_init()
349 xfer->sc = (caddr_t)fwip; in fwip_init()
350 xfer->hand = fwip_output_callback; in fwip_init()
351 STAILQ_INSERT_TAIL(&fwip->xferlist, xfer, link); in fwip_init()
354 xferq = fc->ir[fwip->dma_ch]; in fwip_init()
356 fwip->last_dest.hi = 0; in fwip_init()
357 fwip->last_dest.lo = 0; in fwip_init()
360 if ((xferq->flag & FWXFERQ_RUNNING) == 0) in fwip_init()
361 fc->irx_enable(fc, fwip->dma_ch); in fwip_init()
375 struct fwip_softc *fwip = ((struct fwip_eth_softc *)if_getsoftc(ifp))->fwip; in fwip_ioctl()
383 fwip_init(&fwip->fw_softc); in fwip_ioctl()
397 struct firewire_comm *fc = fwip->fd.fc; in fwip_ioctl()
399 if (ifr->ifr_reqcap & IFCAP_POLLING && in fwip_ioctl()
405 fc->set_intr(fc, 0); in fwip_ioctl()
409 if (!(ifr->ifr_reqcap & IFCAP_POLLING) && in fwip_ioctl()
413 fc->set_intr(fc, 1); in fwip_ioctl()
437 src = fwip->fd.fc->crom_src; in fwip_post_busreset()
438 root = fwip->fd.fc->crom_root; in fwip_post_busreset()
441 bzero(&fwip->unit4, sizeof(struct crom_chunk)); in fwip_post_busreset()
442 crom_add_chunk(src, root, &fwip->unit4, CROM_UDIR); in fwip_post_busreset()
443 crom_add_entry(&fwip->unit4, CSRKEY_SPEC, CSRVAL_IETF); in fwip_post_busreset()
444 crom_add_simple_text(src, &fwip->unit4, &fwip->spec4, "IANA"); in fwip_post_busreset()
445 crom_add_entry(&fwip->unit4, CSRKEY_VER, 1); in fwip_post_busreset()
446 crom_add_simple_text(src, &fwip->unit4, &fwip->ver4, "IPv4"); in fwip_post_busreset()
449 bzero(&fwip->unit6, sizeof(struct crom_chunk)); in fwip_post_busreset()
450 crom_add_chunk(src, root, &fwip->unit6, CROM_UDIR); in fwip_post_busreset()
451 crom_add_entry(&fwip->unit6, CSRKEY_SPEC, CSRVAL_IETF); in fwip_post_busreset()
452 crom_add_simple_text(src, &fwip->unit6, &fwip->spec6, "IANA"); in fwip_post_busreset()
453 crom_add_entry(&fwip->unit6, CSRKEY_VER, 2); in fwip_post_busreset()
454 crom_add_simple_text(src, &fwip->unit6, &fwip->ver6, "IPv6"); in fwip_post_busreset()
456 fwip->last_dest.hi = 0; in fwip_post_busreset()
457 fwip->last_dest.lo = 0; in fwip_post_busreset()
458 firewire_busreset(fwip->fw_softc.fwip_ifp); in fwip_post_busreset()
468 fwip = (struct fwip_softc *)xfer->sc; in fwip_output_callback()
469 ifp = fwip->fw_softc.fwip_ifp; in fwip_output_callback()
471 FWIPDEBUG(ifp, "resp = %d\n", xfer->resp); in fwip_output_callback()
472 if (xfer->resp != 0) in fwip_output_callback()
474 m_freem(xfer->mbuf); in fwip_output_callback()
479 STAILQ_INSERT_TAIL(&fwip->xferlist, xfer, link); in fwip_output_callback()
492 struct fwip_softc *fwip = ((struct fwip_eth_softc *)if_getsoftc(ifp))->fwip; in fwip_start()
497 if (fwip->dma_ch < 0) { in fwip_start()
528 struct firewire_comm *fc = fwip->fd.fc; in fwip_async_output()
540 xferq = fc->atq; in fwip_async_output()
541 while ((xferq->queued < xferq->maxq - 1) && in fwip_async_output()
544 xfer = STAILQ_FIRST(&fwip->xferlist); in fwip_async_output()
552 STAILQ_REMOVE_HEAD(&fwip->xferlist, link); in fwip_async_output()
558 STAILQ_INSERT_HEAD(&fwip->xferlist, xfer, link); in fwip_async_output()
564 * Dig out the link-level address which in fwip_async_output()
566 * discovery. If we don't have a link-level address, in fwip_async_output()
577 * We don't do any bpf stuff here - the generic code in fwip_async_output()
579 * it adds the link-level encapsulation. in fwip_async_output()
584 * error case below - fwip_output_callback will free in fwip_async_output()
587 xfer->mbuf = m; in fwip_async_output()
593 fp = &xfer->send.hdr; in fwip_async_output()
594 nodeid = FWLOCALBUS | fc->nodeid; in fwip_async_output()
595 if ((m->m_flags & M_BCAST) || !destfw) { in fwip_async_output()
600 * slowest possible speed. in fwip_async_output()
606 fp->mode.stream.len = m->m_pkthdr.len; in fwip_async_output()
607 fp->mode.stream.chtag = broadcast_channel; in fwip_async_output()
608 fp->mode.stream.tcode = FWTCODE_STREAM; in fwip_async_output()
609 fp->mode.stream.sy = 0; in fwip_async_output()
610 xfer->send.spd = 0; in fwip_async_output()
627 eui.hi = ntohl(destfw->sender_unique_ID_hi); in fwip_async_output()
628 eui.lo = ntohl(destfw->sender_unique_ID_lo); in fwip_async_output()
629 if (fwip->last_dest.hi != eui.hi || in fwip_async_output()
630 fwip->last_dest.lo != eui.lo) { in fwip_async_output()
640 fwip->last_hdr.mode.wreqb.dst = FWLOCALBUS | fd->dst; in fwip_async_output()
641 fwip->last_hdr.mode.wreqb.tlrt = 0; in fwip_async_output()
642 fwip->last_hdr.mode.wreqb.tcode = FWTCODE_WREQB; in fwip_async_output()
643 fwip->last_hdr.mode.wreqb.pri = 0; in fwip_async_output()
644 fwip->last_hdr.mode.wreqb.src = nodeid; in fwip_async_output()
645 fwip->last_hdr.mode.wreqb.dest_hi = in fwip_async_output()
646 ntohs(destfw->sender_unicast_FIFO_hi); in fwip_async_output()
647 fwip->last_hdr.mode.wreqb.dest_lo = in fwip_async_output()
648 ntohl(destfw->sender_unicast_FIFO_lo); in fwip_async_output()
649 fwip->last_hdr.mode.wreqb.extcode = 0; in fwip_async_output()
650 fwip->last_dest = eui; in fwip_async_output()
653 fp->mode.wreqb = fwip->last_hdr.mode.wreqb; in fwip_async_output()
654 fp->mode.wreqb.len = m->m_pkthdr.len; in fwip_async_output()
655 xfer->send.spd = min(destfw->sspd, fc->speed); in fwip_async_output()
658 xfer->send.pay_len = m->m_pkthdr.len; in fwip_async_output()
660 error = fw_asyreq(fc, -1, xfer); in fwip_async_output()
663 * We ran out of tlabels - requeue the packet in fwip_async_output()
666 xfer->mbuf = 0; in fwip_async_output()
668 STAILQ_INSERT_TAIL(&fwip->xferlist, xfer, link); in fwip_async_output()
689 xferq->start(fc); in fwip_async_output()
697 fwip->fd.fc->atq->start(fwip->fd.fc); in fwip_start_send()
714 fwip = (struct fwip_softc *)xferq->sc; in fwip_stream_input()
715 ifp = fwip->fw_softc.fwip_ifp; in fwip_stream_input()
718 while ((sxfer = STAILQ_FIRST(&xferq->stvalid)) != NULL) { in fwip_stream_input()
719 STAILQ_REMOVE_HEAD(&xferq->stvalid, link); in fwip_stream_input()
720 fp = mtod(sxfer->mbuf, struct fw_pkt *); in fwip_stream_input()
721 if (fwip->fd.fc->irx_post != NULL) in fwip_stream_input()
722 fwip->fd.fc->irx_post(fwip->fd.fc, fp->mode.ld); in fwip_stream_input()
723 m = sxfer->mbuf; in fwip_stream_input()
726 sxfer->mbuf = m0 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); in fwip_stream_input()
728 m0->m_len = m0->m_pkthdr.len = m0->m_ext.ext_size; in fwip_stream_input()
729 STAILQ_INSERT_TAIL(&xferq->stfree, sxfer, link); in fwip_stream_input()
734 * We must have a GASP header - leave the in fwip_stream_input()
740 if (sxfer->resp != 0 || fp->mode.stream.len < in fwip_stream_input()
746 m->m_len = m->m_pkthdr.len = fp->mode.stream.len in fwip_stream_input()
747 + sizeof(fp->mode.stream); in fwip_stream_input()
754 if (fp->mode.stream.chtag == broadcast_channel) in fwip_stream_input()
755 m->m_flags |= M_BCAST; in fwip_stream_input()
757 m->m_flags |= M_MCAST; in fwip_stream_input()
785 fd = fw_noderesolve_nodeid(fwip->fd.fc, in fwip_stream_input()
788 p[0] = htonl(fd->eui.hi); in fwip_stream_input()
789 p[1] = htonl(fd->eui.lo); in fwip_stream_input()
802 m->m_pkthdr.rcvif = ifp; in fwip_stream_input()
807 if (STAILQ_FIRST(&xferq->stfree) != NULL) in fwip_stream_input()
808 fwip->fd.fc->irx_enable(fwip->fd.fc, fwip->dma_ch); in fwip_stream_input()
821 xfer->mbuf = m; in fwip_unicast_input_recycle()
822 xfer->recv.payload = mtod(m, uint32_t *); in fwip_unicast_input_recycle()
823 xfer->recv.pay_len = MCLBYTES; in fwip_unicast_input_recycle()
824 xfer->mbuf = m; in fwip_unicast_input_recycle()
825 STAILQ_INSERT_TAIL(&fwip->fwb.xferlist, xfer, link); in fwip_unicast_input_recycle()
841 fwip = (struct fwip_softc *)xfer->sc; in fwip_unicast_input()
842 ifp = fwip->fw_softc.fwip_ifp; in fwip_unicast_input()
843 m = xfer->mbuf; in fwip_unicast_input()
844 xfer->mbuf = 0; in fwip_unicast_input()
845 fp = &xfer->recv.hdr; in fwip_unicast_input()
848 * Check the fifo address - we only accept addresses of in fwip_unicast_input()
851 address = ((uint64_t)fp->mode.wreqb.dest_hi << 32) in fwip_unicast_input()
852 | fp->mode.wreqb.dest_lo; in fwip_unicast_input()
853 if (fp->mode.wreqb.tcode != FWTCODE_WREQB) { in fwip_unicast_input()
887 fd = fw_noderesolve_nodeid(fwip->fd.fc, in fwip_unicast_input()
888 fp->mode.wreqb.src & 0x3f); in fwip_unicast_input()
890 p[0] = htonl(fd->eui.hi); in fwip_unicast_input()
891 p[1] = htonl(fd->eui.lo); in fwip_unicast_input()
902 * ifp->if_input so that we can pass the source nodeid as an in fwip_unicast_input()
903 * argument to facilitate link-level fragment reassembly. in fwip_unicast_input()
905 m->m_len = m->m_pkthdr.len = fp->mode.wreqb.len; in fwip_unicast_input()
906 m->m_pkthdr.rcvif = ifp; in fwip_unicast_input()
907 firewire_input(ifp, m, fp->mode.wreqb.src); in fwip_unicast_input()