if_vx.c (104363) | if_vx.c (106937) |
---|---|
1/* 2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca> 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 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * | 1/* 2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca> 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 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * |
30 * $FreeBSD: head/sys/dev/vx/if_vx.c 104363 2002-10-02 09:09:25Z phk $ | 30 * $FreeBSD: head/sys/dev/vx/if_vx.c 106937 2002-11-14 23:54:55Z sam $ |
31 * 32 */ 33 34/* 35 * Created from if_ep.c driver by Fred Gray (fgray@rice.edu) to support 36 * the 3c590 family. 37 */ 38 --- 120 unchanged lines hidden (view full) --- 159 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 160 ifp->if_output = ether_output; 161 ifp->if_start = vxstart; 162 ifp->if_ioctl = vxioctl; 163 ifp->if_init = vxinit; 164 ifp->if_watchdog = vxwatchdog; 165 ifp->if_softc = sc; 166 | 31 * 32 */ 33 34/* 35 * Created from if_ep.c driver by Fred Gray (fgray@rice.edu) to support 36 * the 3c590 family. 37 */ 38 --- 120 unchanged lines hidden (view full) --- 159 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 160 ifp->if_output = ether_output; 161 ifp->if_start = vxstart; 162 ifp->if_ioctl = vxioctl; 163 ifp->if_init = vxinit; 164 ifp->if_watchdog = vxwatchdog; 165 ifp->if_softc = sc; 166 |
167 ether_ifattach(ifp, ETHER_BPF_SUPPORTED); | 167 ether_ifattach(ifp, sc->arpcom.ac_enaddr); |
168 169 sc->tx_start_thresh = 20; /* probably a good starting point. */ 170 171 vxstop(sc); 172 173 return 1; 174} 175 --- 260 unchanged lines hidden (view full) --- 436 IF_DEQUEUE(&ifp->if_snd, m); 437 if (m == NULL) /* not really needed */ 438 return; 439 440 VX_BUSY_WAIT; 441 CSR_WRITE_2(sc, VX_COMMAND, SET_TX_START_THRESH | 442 ((len / 4 + sc->tx_start_thresh) >> 2)); 443 | 168 169 sc->tx_start_thresh = 20; /* probably a good starting point. */ 170 171 vxstop(sc); 172 173 return 1; 174} 175 --- 260 unchanged lines hidden (view full) --- 436 IF_DEQUEUE(&ifp->if_snd, m); 437 if (m == NULL) /* not really needed */ 438 return; 439 440 VX_BUSY_WAIT; 441 CSR_WRITE_2(sc, VX_COMMAND, SET_TX_START_THRESH | 442 ((len / 4 + sc->tx_start_thresh) >> 2)); 443 |
444 if (sc->arpcom.ac_if.if_bpf) { 445 bpf_mtap(&sc->arpcom.ac_if, m); 446 } | 444 BPF_MTAP(&sc->arpcom.ac_if, m); |
447 448 /* 449 * Do the output at splhigh() so that an interrupt from another device 450 * won't cause a FIFO underrun. 451 */ 452 sh = splhigh(); 453 454 CSR_WRITE_4(sc, VX_W1_TX_PIO_WR_1, len | TX_INDICATE); --- 254 unchanged lines hidden (view full) --- 709 */ 710 711 if ((eh->ether_dhost[0] & 1) == 0 /* !mcast and !bcast */ 712 && bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) != 0) { 713 m_freem(m); 714 return; 715 } 716 | 445 446 /* 447 * Do the output at splhigh() so that an interrupt from another device 448 * won't cause a FIFO underrun. 449 */ 450 sh = splhigh(); 451 452 CSR_WRITE_4(sc, VX_W1_TX_PIO_WR_1, len | TX_INDICATE); --- 254 unchanged lines hidden (view full) --- 707 */ 708 709 if ((eh->ether_dhost[0] & 1) == 0 /* !mcast and !bcast */ 710 && bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) != 0) { 711 m_freem(m); 712 return; 713 } 714 |
717 m_adj(m, sizeof(struct ether_header)); 718 ether_input(ifp, eh, m); | 715 (*ifp->if_input)(ifp, m); |
719 720 /* 721 * In periods of high traffic we can actually receive enough 722 * packets so that the fifo overrun bit will be set at this point, 723 * even though we just read a packet. In this case we 724 * are not going to receive any more interrupts. We check for 725 * this condition and read again until the fifo is not full. 726 * We could simplify this test by not using vxstatus(), but --- 123 unchanged lines hidden (view full) --- 850{ 851 struct vx_softc *sc = ifp->if_softc; 852 struct ifreq *ifr = (struct ifreq *) data; 853 int s, error = 0; 854 855 s = splimp(); 856 857 switch (cmd) { | 716 717 /* 718 * In periods of high traffic we can actually receive enough 719 * packets so that the fifo overrun bit will be set at this point, 720 * even though we just read a packet. In this case we 721 * are not going to receive any more interrupts. We check for 722 * this condition and read again until the fifo is not full. 723 * We could simplify this test by not using vxstatus(), but --- 123 unchanged lines hidden (view full) --- 847{ 848 struct vx_softc *sc = ifp->if_softc; 849 struct ifreq *ifr = (struct ifreq *) data; 850 int s, error = 0; 851 852 s = splimp(); 853 854 switch (cmd) { |
858 case SIOCSIFADDR: 859 case SIOCGIFADDR: 860 ether_ioctl(ifp, cmd, data); 861 break; 862 | |
863 case SIOCSIFFLAGS: 864 if ((ifp->if_flags & IFF_UP) == 0 && 865 (ifp->if_flags & IFF_RUNNING) != 0) { 866 /* 867 * If interface is marked up and it is stopped, then 868 * start it. 869 */ 870 vxstop(sc); --- 34 unchanged lines hidden (view full) --- 905 * accordingly. 906 */ 907 vxreset(sc); 908 error = 0; 909 break; 910 911 912 default: | 855 case SIOCSIFFLAGS: 856 if ((ifp->if_flags & IFF_UP) == 0 && 857 (ifp->if_flags & IFF_RUNNING) != 0) { 858 /* 859 * If interface is marked up and it is stopped, then 860 * start it. 861 */ 862 vxstop(sc); --- 34 unchanged lines hidden (view full) --- 897 * accordingly. 898 */ 899 vxreset(sc); 900 error = 0; 901 break; 902 903 904 default: |
913 error = EINVAL; | 905 error = ether_ioctl(ifp, cmd, data); 906 break; |
914 } 915 916 splx(s); 917 918 return (error); 919} 920 921static void --- 115 unchanged lines hidden --- | 907 } 908 909 splx(s); 910 911 return (error); 912} 913 914static void --- 115 unchanged lines hidden --- |