if_plip.c (155921) | if_plip.c (165632) |
---|---|
1/*- 2 * Copyright (c) 1997 Poul-Henning Kamp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997 Poul-Henning Kamp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/ppbus/if_plip.c 155921 2006-02-22 18:16:26Z jhb $"); | 30__FBSDID("$FreeBSD: head/sys/dev/ppbus/if_plip.c 165632 2006-12-29 13:59:50Z jhb $"); |
31 32/* 33 * Parallel port TCP/IP interfaces added. I looked at the driver from 34 * MACH but this is a complete rewrite, and btw. incompatible, and it 35 * should perform better too. I have never run the MACH driver though. 36 * 37 * This driver sends two bytes (0x08, 0x00) in front of each packet, 38 * to allow us to distinguish another format later. --- 411 unchanged lines hidden (view full) --- 450 451 return (ctrecvl[cl] | ctrecvh[c]); 452} 453 454static void 455lptap(struct ifnet *ifp, struct mbuf *m) 456{ 457 u_int32_t af = AF_INET; | 31 32/* 33 * Parallel port TCP/IP interfaces added. I looked at the driver from 34 * MACH but this is a complete rewrite, and btw. incompatible, and it 35 * should perform better too. I have never run the MACH driver though. 36 * 37 * This driver sends two bytes (0x08, 0x00) in front of each packet, 38 * to allow us to distinguish another format later. --- 411 unchanged lines hidden (view full) --- 450 451 return (ctrecvl[cl] | ctrecvh[c]); 452} 453 454static void 455lptap(struct ifnet *ifp, struct mbuf *m) 456{ 457 u_int32_t af = AF_INET; |
458 BPF_MTAP2(ifp, &af, sizeof(af), m); | 458 bpf_mtap2(ifp, &af, sizeof(af), m); |
459} 460 461static void 462lp_intr (void *arg) 463{ 464 device_t dev = (device_t)arg; 465 device_t ppbus = device_get_parent(dev); 466 struct lp_data *sc = DEVTOSOFTC(dev); --- 42 unchanged lines hidden (view full) --- 509 510 sc->sc_iferrs = 0; 511 512 len -= CLPIPHDRLEN; 513 sc->sc_ifp->if_ipackets++; 514 sc->sc_ifp->if_ibytes += len; 515 top = m_devget(sc->sc_ifbuf + CLPIPHDRLEN, len, 0, sc->sc_ifp, 0); 516 if (top) { | 459} 460 461static void 462lp_intr (void *arg) 463{ 464 device_t dev = (device_t)arg; 465 device_t ppbus = device_get_parent(dev); 466 struct lp_data *sc = DEVTOSOFTC(dev); --- 42 unchanged lines hidden (view full) --- 509 510 sc->sc_iferrs = 0; 511 512 len -= CLPIPHDRLEN; 513 sc->sc_ifp->if_ipackets++; 514 sc->sc_ifp->if_ibytes += len; 515 top = m_devget(sc->sc_ifbuf + CLPIPHDRLEN, len, 0, sc->sc_ifp, 0); 516 if (top) { |
517 if (sc->sc_ifp->if_bpf) | 517 if (bpf_peers_present(sc->sc_ifp->if_bpf)) |
518 lptap(sc->sc_ifp, top); 519 netisr_queue(NETISR_IP, top); /* mbuf is free'd on failure. */ 520 } 521 goto done; 522 } 523 while ((ppb_rstr(ppbus) & LPIP_SHAKE)) { 524 len = sc->sc_ifp->if_mtu + LPIPHDRLEN; 525 bp = sc->sc_ifbuf; --- 28 unchanged lines hidden (view full) --- 554 555 sc->sc_iferrs = 0; 556 557 len -= LPIPHDRLEN; 558 sc->sc_ifp->if_ipackets++; 559 sc->sc_ifp->if_ibytes += len; 560 top = m_devget(sc->sc_ifbuf + LPIPHDRLEN, len, 0, sc->sc_ifp, 0); 561 if (top) { | 518 lptap(sc->sc_ifp, top); 519 netisr_queue(NETISR_IP, top); /* mbuf is free'd on failure. */ 520 } 521 goto done; 522 } 523 while ((ppb_rstr(ppbus) & LPIP_SHAKE)) { 524 len = sc->sc_ifp->if_mtu + LPIPHDRLEN; 525 bp = sc->sc_ifbuf; --- 28 unchanged lines hidden (view full) --- 554 555 sc->sc_iferrs = 0; 556 557 len -= LPIPHDRLEN; 558 sc->sc_ifp->if_ipackets++; 559 sc->sc_ifp->if_ibytes += len; 560 top = m_devget(sc->sc_ifbuf + LPIPHDRLEN, len, 0, sc->sc_ifp, 0); 561 if (top) { |
562 if (sc->sc_ifp->if_bpf) | 562 if (bpf_peers_present(sc->sc_ifp->if_bpf)) |
563 lptap(sc->sc_ifp, top); 564 netisr_queue(NETISR_IP, top); /* mbuf is free'd on failure. */ 565 } 566 } 567 goto done; 568 569 err: 570 ppb_wdtr(ppbus, 0); --- 118 unchanged lines hidden (view full) --- 689 690 nend: 691 if (err) { /* if we didn't timeout... */ 692 ifp->if_oerrors++; 693 lprintf("X"); 694 } else { 695 ifp->if_opackets++; 696 ifp->if_obytes += m->m_pkthdr.len; | 563 lptap(sc->sc_ifp, top); 564 netisr_queue(NETISR_IP, top); /* mbuf is free'd on failure. */ 565 } 566 } 567 goto done; 568 569 err: 570 ppb_wdtr(ppbus, 0); --- 118 unchanged lines hidden (view full) --- 689 690 nend: 691 if (err) { /* if we didn't timeout... */ 692 ifp->if_oerrors++; 693 lprintf("X"); 694 } else { 695 ifp->if_opackets++; 696 ifp->if_obytes += m->m_pkthdr.len; |
697 if (ifp->if_bpf) | 697 if (bpf_peers_present(ifp->if_bpf)) |
698 lptap(ifp, m); 699 } 700 701 m_freem(m); 702 703 if (!(ppb_rstr(ppbus) & CLPIP_SHAKE)) { 704 lprintf("^"); 705 lp_intr(dev); --- 28 unchanged lines hidden (view full) --- 734 ppb_wdtr(ppbus, txmitl[*cp] ^ 0x17); 735 736 if (err) { /* if we didn't timeout... */ 737 ifp->if_oerrors++; 738 lprintf("X"); 739 } else { 740 ifp->if_opackets++; 741 ifp->if_obytes += m->m_pkthdr.len; | 698 lptap(ifp, m); 699 } 700 701 m_freem(m); 702 703 if (!(ppb_rstr(ppbus) & CLPIP_SHAKE)) { 704 lprintf("^"); 705 lp_intr(dev); --- 28 unchanged lines hidden (view full) --- 734 ppb_wdtr(ppbus, txmitl[*cp] ^ 0x17); 735 736 if (err) { /* if we didn't timeout... */ 737 ifp->if_oerrors++; 738 lprintf("X"); 739 } else { 740 ifp->if_opackets++; 741 ifp->if_obytes += m->m_pkthdr.len; |
742 if (ifp->if_bpf) | 742 if (bpf_peers_present(ifp->if_bpf)) |
743 lptap(ifp, m); 744 } 745 746 m_freem(m); 747 748 if (ppb_rstr(ppbus) & LPIP_SHAKE) { 749 lprintf("^"); 750 lp_intr(dev); --- 23 unchanged lines hidden --- | 743 lptap(ifp, m); 744 } 745 746 m_freem(m); 747 748 if (ppb_rstr(ppbus) & LPIP_SHAKE) { 749 lprintf("^"); 750 lp_intr(dev); --- 23 unchanged lines hidden --- |