Deleted Added
full compact
if_sn.c (104257) if_sn.c (106937)
1/*
2 * Copyright (c) 1996 Gardner Buchanan <gbuchanan@shl.com>
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

--- 14 unchanged lines hidden (view full) ---

23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
1/*
2 * Copyright (c) 1996 Gardner Buchanan <gbuchanan@shl.com>
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

--- 14 unchanged lines hidden (view full) ---

23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $FreeBSD: head/sys/dev/sn/if_sn.c 104257 2002-10-01 00:56:39Z brooks $
31 * $FreeBSD: head/sys/dev/sn/if_sn.c 106937 2002-11-14 23:54:55Z sam $
32 */
33
34/*
35 * This is a driver for SMC's 9000 series of Ethernet adapters.
36 *
37 * This FreeBSD driver is derived from the smc9194 Linux driver by
38 * Erik Stahlman and is Copyright (C) 1996 by Erik Stahlman.
39 * This driver also shamelessly borrows from the FreeBSD ep driver

--- 175 unchanged lines hidden (view full) ---

215 ifp->if_output = ether_output;
216 ifp->if_start = snstart;
217 ifp->if_ioctl = snioctl;
218 ifp->if_watchdog = snwatchdog;
219 ifp->if_init = sninit;
220 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
221 ifp->if_timer = 0;
222
32 */
33
34/*
35 * This is a driver for SMC's 9000 series of Ethernet adapters.
36 *
37 * This FreeBSD driver is derived from the smc9194 Linux driver by
38 * Erik Stahlman and is Copyright (C) 1996 by Erik Stahlman.
39 * This driver also shamelessly borrows from the FreeBSD ep driver

--- 175 unchanged lines hidden (view full) ---

215 ifp->if_output = ether_output;
216 ifp->if_start = snstart;
217 ifp->if_ioctl = snioctl;
218 ifp->if_watchdog = snwatchdog;
219 ifp->if_init = sninit;
220 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
221 ifp->if_timer = 0;
222
223 ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
223 ether_ifattach(ifp, sc->arpcom.ac_enaddr);
224
225 /*
226 * Fill the hardware address into ifa_addr if we find an AF_LINK
227 * entry. We need to do this so bpf's can get the hardware addr of
228 * this card. netstat likes this too!
229 */
230 ifa = TAILQ_FIRST(&ifp->if_addrhead);
231 while ((ifa != 0) && (ifa->ifa_addr != 0) &&

--- 13 unchanged lines hidden (view full) ---

245
246
247int
248sn_detach(device_t dev)
249{
250 struct sn_softc *sc = device_get_softc(dev);
251
252 sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
224
225 /*
226 * Fill the hardware address into ifa_addr if we find an AF_LINK
227 * entry. We need to do this so bpf's can get the hardware addr of
228 * this card. netstat likes this too!
229 */
230 ifa = TAILQ_FIRST(&ifp->if_addrhead);
231 while ((ifa != 0) && (ifa->ifa_addr != 0) &&

--- 13 unchanged lines hidden (view full) ---

245
246
247int
248sn_detach(device_t dev)
249{
250 struct sn_softc *sc = device_get_softc(dev);
251
252 sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
253 ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
253 ether_ifdetach(&sc->arpcom.ac_if);
254 sn_deactivate(dev);
255 return 0;
256}
257
258/*
259 * Reset and initialize the chip
260 */
261void

--- 286 unchanged lines hidden (view full) ---

548 outb(BASE + INTR_MASK_REG_B, mask);
549 sc->intr_mask = mask;
550
551 outw(BASE + MMU_CMD_REG_W, MMUCR_ENQUEUE);
552
553 sc->arpcom.ac_if.if_flags |= IFF_OACTIVE;
554 sc->arpcom.ac_if.if_timer = 1;
555
254 sn_deactivate(dev);
255 return 0;
256}
257
258/*
259 * Reset and initialize the chip
260 */
261void

--- 286 unchanged lines hidden (view full) ---

548 outb(BASE + INTR_MASK_REG_B, mask);
549 sc->intr_mask = mask;
550
551 outw(BASE + MMU_CMD_REG_W, MMUCR_ENQUEUE);
552
553 sc->arpcom.ac_if.if_flags |= IFF_OACTIVE;
554 sc->arpcom.ac_if.if_timer = 1;
555
556 if (ifp->if_bpf) {
557 bpf_mtap(ifp, top);
558 }
556 BPF_MTAP(ifp, top);
559
560 sc->arpcom.ac_if.if_opackets++;
561 m_freem(top);
562
563
564readcheck:
565
566 /*

--- 178 unchanged lines hidden (view full) ---

745 * Enable the interrupts and let the chipset deal with it Also set a
746 * watchdog in case we miss the interrupt.
747 */
748 mask = inb(BASE + INTR_MASK_REG_B) | (IM_TX_INT | IM_TX_EMPTY_INT);
749 outb(BASE + INTR_MASK_REG_B, mask);
750 sc->intr_mask = mask;
751 outw(BASE + MMU_CMD_REG_W, MMUCR_ENQUEUE);
752
557
558 sc->arpcom.ac_if.if_opackets++;
559 m_freem(top);
560
561
562readcheck:
563
564 /*

--- 178 unchanged lines hidden (view full) ---

743 * Enable the interrupts and let the chipset deal with it Also set a
744 * watchdog in case we miss the interrupt.
745 */
746 mask = inb(BASE + INTR_MASK_REG_B) | (IM_TX_INT | IM_TX_EMPTY_INT);
747 outb(BASE + INTR_MASK_REG_B, mask);
748 sc->intr_mask = mask;
749 outw(BASE + MMU_CMD_REG_W, MMUCR_ENQUEUE);
750
753 if (ifp->if_bpf) {
754 bpf_mtap(ifp, top);
755 }
751 BPF_MTAP(ifp, top);
756
757 sc->arpcom.ac_if.if_opackets++;
758 m_freem(top);
759
760try_start:
761
762 /*
763 * Now pass control to snstart() to queue any additional packets

--- 330 unchanged lines hidden (view full) ---

1094 data += packet_length & ~1;
1095 *data = inb(BASE + DATA_REG_B);
1096 }
1097 ++sc->arpcom.ac_if.if_ipackets;
1098
1099 /*
1100 * Remove link layer addresses and whatnot.
1101 */
752
753 sc->arpcom.ac_if.if_opackets++;
754 m_freem(top);
755
756try_start:
757
758 /*
759 * Now pass control to snstart() to queue any additional packets

--- 330 unchanged lines hidden (view full) ---

1090 data += packet_length & ~1;
1091 *data = inb(BASE + DATA_REG_B);
1092 }
1093 ++sc->arpcom.ac_if.if_ipackets;
1094
1095 /*
1096 * Remove link layer addresses and whatnot.
1097 */
1102 m->m_pkthdr.len = m->m_len = packet_length - sizeof(struct ether_header);
1103 m->m_data += sizeof(struct ether_header);
1098 m->m_pkthdr.len = m->m_len = packet_length;
1104
1099
1105 ether_input(&sc->arpcom.ac_if, eh, m);
1100 (*ifp->if_input)(ifp, m);
1106
1107out:
1108
1109 /*
1110 * Error or good, tell the card to get rid of this packet Wait for
1111 * the MMU to be un-busy.
1112 */
1113 SMC_SELECT_BANK(2);

--- 21 unchanged lines hidden (view full) ---

1135snioctl(register struct ifnet *ifp, u_long cmd, caddr_t data)
1136{
1137 struct sn_softc *sc = ifp->if_softc;
1138 int s, error = 0;
1139
1140 s = splimp();
1141
1142 switch (cmd) {
1101
1102out:
1103
1104 /*
1105 * Error or good, tell the card to get rid of this packet Wait for
1106 * the MMU to be un-busy.
1107 */
1108 SMC_SELECT_BANK(2);

--- 21 unchanged lines hidden (view full) ---

1130snioctl(register struct ifnet *ifp, u_long cmd, caddr_t data)
1131{
1132 struct sn_softc *sc = ifp->if_softc;
1133 int s, error = 0;
1134
1135 s = splimp();
1136
1137 switch (cmd) {
1143 case SIOCSIFADDR:
1144 case SIOCGIFADDR:
1145 case SIOCSIFMTU:
1146 error = ether_ioctl(ifp, cmd, data);
1147 break;
1148
1149 case SIOCSIFFLAGS:
1150 if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
1151 ifp->if_flags &= ~IFF_RUNNING;
1152 snstop(sc);
1153 break;
1154 } else {
1155 /* reinitialize card on any parameter change */
1156 sninit(sc);

--- 15 unchanged lines hidden (view full) ---

1172 break;
1173 case SIOCDELMULTI:
1174 /* update multicast filter list. */
1175 sn_setmcast(sc);
1176 error = 0;
1177 break;
1178 default:
1179 error = EINVAL;
1138 case SIOCSIFFLAGS:
1139 if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
1140 ifp->if_flags &= ~IFF_RUNNING;
1141 snstop(sc);
1142 break;
1143 } else {
1144 /* reinitialize card on any parameter change */
1145 sninit(sc);

--- 15 unchanged lines hidden (view full) ---

1161 break;
1162 case SIOCDELMULTI:
1163 /* update multicast filter list. */
1164 sn_setmcast(sc);
1165 error = 0;
1166 break;
1167 default:
1168 error = EINVAL;
1169 error = ether_ioctl(ifp, cmd, data);
1170 break;
1180 }
1181
1182 splx(s);
1183
1184 return (error);
1185}
1186
1187void

--- 300 unchanged lines hidden ---
1171 }
1172
1173 splx(s);
1174
1175 return (error);
1176}
1177
1178void

--- 300 unchanged lines hidden ---