commit 9564c8fa59ff08b359ceceec7d6722f4bf933cfd Author: Ryota Ozaki Date: Mon May 25 18:08:49 2015 +0900 Nuke ARCNET support diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi index dc05be2..80b9384 100644 --- a/distrib/sets/lists/comp/mi +++ b/distrib/sets/lists/comp/mi @@ -2556,7 +2556,7 @@ ./usr/include/net/dlt.h comp-c-include ./usr/include/net/ethertypes.h comp-c-include ./usr/include/net/if.h comp-c-include -./usr/include/net/if_arc.h comp-c-include +./usr/include/net/if_arc.h comp-c-include obsolete ./usr/include/net/if_arp.h comp-c-include ./usr/include/net/if_atm.h comp-c-include ./usr/include/net/if_bridgevar.h comp-c-include diff --git a/sys/arch/amiga/conf/DRACO b/sys/arch/amiga/conf/DRACO index 6c40824..0474eaf 100644 --- a/sys/arch/amiga/conf/DRACO +++ b/sys/arch/amiga/conf/DRACO @@ -295,10 +295,6 @@ es* at zbus0 # CEI A4066 EthernetPLUS qn* at zbus0 # Quicknet -# Arcnet -bah* at zbus0 # C=/Ameristar A2060 / 560 - - drsc0 at mainbus0 # DraCo scsi scsibus* at drsc0 diff --git a/sys/arch/amiga/conf/GENERIC b/sys/arch/amiga/conf/GENERIC index 59fed94..71e8631 100644 --- a/sys/arch/amiga/conf/GENERIC +++ b/sys/arch/amiga/conf/GENERIC @@ -388,9 +388,6 @@ wdc* at xsurfbus? # IDE on X-Surf clockport* at gencp? -# Arcnet -bah* at zbus0 # C=/Ameristar A2060 / 560 - # Greater Valley Product Bus gvpbus* at zbus0 diff --git a/sys/arch/amiga/conf/GENERIC.in b/sys/arch/amiga/conf/GENERIC.in index fc0ea6c..db3cbc5 100644 --- a/sys/arch/amiga/conf/GENERIC.in +++ b/sys/arch/amiga/conf/GENERIC.in @@ -471,9 +471,6 @@ wdc* at xsurfbus? # IDE on X-Surf clockport* at gencp? ')m4_dnl -# Arcnet -bah* at zbus0 # C=/Ameristar A2060 / 560 - m4_ifdef(`AMIGA_CONFIGURATION', `m4_dnl # Greater Valley Product Bus gvpbus* at zbus0 diff --git a/sys/arch/amiga/conf/INSTALL b/sys/arch/amiga/conf/INSTALL index 6f310b2..6a27b60 100644 --- a/sys/arch/amiga/conf/INSTALL +++ b/sys/arch/amiga/conf/INSTALL @@ -328,9 +328,6 @@ wdc* at xsurfbus? # IDE on X-Surf clockport* at gencp? -# Arcnet -bah* at zbus0 # C=/Ameristar A2060 / 560 - # Greater Valley Product Bus gvpbus* at zbus0 diff --git a/sys/arch/amiga/conf/MDINSTALL b/sys/arch/amiga/conf/MDINSTALL index 8e13463..16dc2c8 100644 --- a/sys/arch/amiga/conf/MDINSTALL +++ b/sys/arch/amiga/conf/MDINSTALL @@ -204,9 +204,6 @@ ed* at zbus0 # Hydra, ASDG LanRover es* at zbus0 # CEI A4066 EthernetPLUS qn* at zbus0 # Quicknet -# Arcnet -bah* at zbus0 # C=/Ameristar A2060 / 560 - # Greater Valley Product Bus gvpbus* at zbus0 diff --git a/sys/arch/amiga/conf/files.amiga b/sys/arch/amiga/conf/files.amiga index 80dfceb..441f086 100644 --- a/sys/arch/amiga/conf/files.amiga +++ b/sys/arch/amiga/conf/files.amiga @@ -255,10 +255,6 @@ device ed: ifnet, ether, arp attach ed at zbus with ed_zbus: dp8390nic file arch/amiga/dev/if_ed_zbus.c ed_zbus needs-flag -# C=/Ameristar A2060 / 560 -attach bah at zbus with bah_zbus -file arch/amiga/dev/if_bah_zbus.c bah_zbus - # CEI A4066 EthernetPLUS device es: ifnet, ether, arp attach es at zbus diff --git a/sys/arch/amiga/dev/if_bah_zbus.c b/sys/arch/amiga/dev/if_bah_zbus.c deleted file mode 100644 index 506be77..0000000 --- a/sys/arch/amiga/dev/if_bah_zbus.c +++ /dev/null @@ -1,152 +0,0 @@ -/* $NetBSD: if_bah_zbus.c,v 1.15 2012/10/27 17:17:29 chs Exp $ */ - -/*- - * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Ignatios Souvatzis. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef __m68k__ -#include "opt_m68k_arch.h" -#endif - -#include -__KERNEL_RCSID(0, "$NetBSD: if_bah_zbus.c,v 1.15 2012/10/27 17:17:29 chs Exp $"); - -/* - * Driver frontend for the Commodore Busines Machines and the - * Ameristar ARCnet card. - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include - -#include -#include - -#include - -/* - * A2060 software status per interface - */ -struct bah_zbus_softc { - struct bah_softc sc_bah; - struct bus_space_tag sc_bst; - struct isr sc_isr; -}; - -int bah_zbus_match(device_t, cfdata_t, void *); -void bah_zbus_attach(device_t, device_t, void *); -void bah_zbus_reset(struct bah_softc *, int); - -CFATTACH_DECL_NEW(bah_zbus, sizeof(struct bah_zbus_softc), - bah_zbus_match, bah_zbus_attach, NULL, NULL); - -int -bah_zbus_match(device_t parent, cfdata_t cf, void *aux) -{ - struct zbus_args *zap = aux; - - if ((zap->manid == 514 || zap->manid == 1053) && zap->prodid == 9) - return (1); - - return (0); -} - -void -bah_zbus_attach(device_t parent, device_t self, void *aux) -{ - struct bah_zbus_softc *bsc = device_private(self); - struct bah_softc *sc = &bsc->sc_bah; - struct zbus_args *zap = aux; - - sc->sc_dev = self; -#if (defined(BAH_DEBUG) && (BAH_DEBUG > 2)) - printf("\n%s: attach(0x%x, 0x%x, 0x%x)\n", - device_xname(self), parent, self, aux); -#endif - bsc->sc_bst.base = (bus_addr_t)zap->va; - bsc->sc_bst.absm = &amiga_bus_stride_2; - - sc->sc_bst_r = &bsc->sc_bst; - sc->sc_regs = bsc->sc_bst.base + 0x4000; - - sc->sc_bst_m = &bsc->sc_bst; - sc->sc_mem = bsc->sc_bst.base + 0x8000; - - sc->sc_reset = bah_zbus_reset; - - bah_attach_subr(sc); - - bsc->sc_isr.isr_intr = bahintr; - bsc->sc_isr.isr_arg = sc; - bsc->sc_isr.isr_ipl = 2; - add_isr(&bsc->sc_isr); -} - -void -bah_zbus_reset(struct bah_softc *sc, int onoff) -{ - struct bah_zbus_softc *bsc; - volatile u_int8_t *p; - - bsc = (struct bah_zbus_softc *)sc; - - p = (volatile u_int8_t *)bsc->sc_bst.base; - - p[0x0000] = 0; /* A2060 reset flipflop */ - p[0xc000] = 0; /* A560 reset flipflop */ - - if (!onoff) - return; - -#ifdef M68060 - /* make sure we flush the store buffer before the delay */ - (void)p[0x8000]; -#endif - DELAY(200); - - p[0x0000] = 0xff; - p[0xc000] = 0xff; - - return; -} diff --git a/sys/arch/amigappc/conf/GENERIC b/sys/arch/amigappc/conf/GENERIC index 0a33d2f..ec02a39 100644 --- a/sys/arch/amigappc/conf/GENERIC +++ b/sys/arch/amigappc/conf/GENERIC @@ -287,9 +287,6 @@ ed* at zbus0 # Hydra, ASDG LanRover es* at zbus0 # CEI A4066 EthernetPLUS qn* at zbus0 # Quicknet -# Arcnet -bah* at zbus0 # C=/Ameristar A2060 / 560 - # Greater Valley Product Bus gvpbus* at zbus0 diff --git a/sys/arch/amigappc/conf/NULL b/sys/arch/amigappc/conf/NULL index de733bc..c07d894 100644 --- a/sys/arch/amigappc/conf/NULL +++ b/sys/arch/amigappc/conf/NULL @@ -272,9 +272,6 @@ ite0 at grf0 # terminal emulators for grfs #es* at zbus0 # CEI A4066 EthernetPLUS #qn* at zbus0 # Quicknet -# Arcnet -#bah* at zbus0 # C=/Ameristar A2060 / 560 - # Greater Valley Product Bus #gvpbus* at zbus0 diff --git a/sys/arch/amigappc/conf/files.amigappc b/sys/arch/amigappc/conf/files.amigappc index b651812..4e6a1b4 100644 --- a/sys/arch/amigappc/conf/files.amigappc +++ b/sys/arch/amigappc/conf/files.amigappc @@ -232,10 +232,6 @@ device ed: ifnet, ether, arp attach ed at zbus with ed_zbus: dp8390nic file arch/amiga/dev/if_ed_zbus.c ed_zbus needs-flag -# C=/Ameristar A2060 / 560 -attach bah at zbus with bah_zbus -file arch/amiga/dev/if_bah_zbus.c bah_zbus - # CEI A4066 EthernetPLUS device es: ifnet, ether, arp attach es at zbus diff --git a/sys/conf/files b/sys/conf/files index bb80985..e057520 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -384,7 +384,6 @@ include "dev/videomode/files.videomode" # net device attributes - we have generic code for arc(net), ether(net), # fddi, token ring, atm and eco(net). # -define arcnet define atm define eco define ether @@ -886,11 +885,6 @@ file dev/ic/ug.c ug needs-flag device esh: hippi, ifnet file dev/ic/rrunner.c esh needs-flag -# SMC 90c26, SMC 90C56 (and 90C66 if in compat mode) chip driver -# -device bah: ifnet, arcnet, arp -file dev/ic/smc90cx6.c bah - # OPL2/OPL3 FM synth driver # device opl: midibus, midisyn diff --git a/sys/dev/ic/smc90cx6.c b/sys/dev/ic/smc90cx6.c deleted file mode 100644 index 9664e49..0000000 --- a/sys/dev/ic/smc90cx6.c +++ /dev/null @@ -1,985 +0,0 @@ -/* $NetBSD: smc90cx6.c,v 1.64 2012/10/27 17:18:22 chs Exp $ */ - -/*- - * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Ignatios Souvatzis. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Chip core driver for the SMC90c26 / SMC90c56 (and SMC90c66 in '56 - * compatibility mode) boards - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: smc90cx6.c,v 1.64 2012/10/27 17:18:22 chs Exp $"); - -/* #define BAHSOFTCOPY */ -#define BAHRETRANSMIT /**/ - -#include "opt_inet.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#ifdef INET -#include -#include -#include -#include -#include -#endif - -#include -#include - -#include -#include - -#include -#include - -/* these should be elsewhere */ - -#define ARC_MIN_LEN 1 -#define ARC_MIN_FORBID_LEN 254 -#define ARC_MAX_FORBID_LEN 256 -#define ARC_MAX_LEN 508 -#define ARC_ADDR_LEN 1 - -/* for watchdog timer. This should be more than enough. */ -#define ARCTIMEOUT (5*IFNET_SLOWHZ) - -/* - * This currently uses 2 bufs for tx, 2 for rx - * - * New rx protocol: - * - * rx has a fillcount variable. If fillcount > (NRXBUF-1), - * rx can be switched off from rx hard int. - * Else rx is restarted on the other receiver. - * rx soft int counts down. if it is == (NRXBUF-1), it restarts - * the receiver. - * To ensure packet ordering (we need that for 1201 later), we have a counter - * which is incremented modulo 256 on each receive and a per buffer - * variable, which is set to the counter on filling. The soft int can - * compare both values to determine the older packet. - * - * Transmit direction: - * - * bah_start checks tx_fillcount - * case 2: return - * - * else fill tx_act ^ 1 && inc tx_fillcount - * - * check tx_fillcount again. - * case 2: set IFF_OACTIVE to stop arc_output from filling us. - * case 1: start tx - * - * tint clears IFF_OCATIVE, decrements and checks tx_fillcount - * case 1: start tx on tx_act ^ 1, softcall bah_start - * case 0: softcall bah_start - * - * #define fill(i) get mbuf && copy mbuf to chip(i) - */ - -void bah_init(struct bah_softc *); -void bah_reset(struct bah_softc *); -void bah_stop(struct bah_softc *); -void bah_start(struct ifnet *); -int bahintr(void *); -int bah_ioctl(struct ifnet *, unsigned long, void *); -void bah_watchdog(struct ifnet *); -void bah_srint(void *vsc); -static void bah_tint(struct bah_softc *, int); -void bah_reconwatch(void *); - -/* short notation */ - -#define GETREG(off) bus_space_read_1(bst_r, regs, (off)) -#define PUTREG(off, v) bus_space_write_1(bst_r, regs, (off), (v)) -#define GETMEM(off) bus_space_read_1(bst_m, mem, (off)) -#define PUTMEM(off, v) bus_space_write_1(bst_m, mem, (off), (v)) - -void -bah_attach_subr(struct bah_softc *sc) -{ - struct ifnet *ifp = &sc->sc_arccom.ac_if; - int s; - u_int8_t linkaddress; - - bus_space_tag_t bst_r = sc->sc_bst_r; - bus_space_tag_t bst_m = sc->sc_bst_m; - bus_space_handle_t regs = sc->sc_regs; - bus_space_handle_t mem = sc->sc_mem; - -#if (defined(BAH_DEBUG) && (BAH_DEBUG > 2)) - printf("\n%s: attach(0x%x, 0x%x, 0x%x)\n", - device_xname(sc->sc_dev), parent, self, aux); -#endif - s = splhigh(); - - /* - * read the arcnet address from the board - */ - - (*sc->sc_reset)(sc, 1); - - do { - delay(200); - } while (!(GETREG(BAHSTAT) & BAH_POR)); - - linkaddress = GETMEM(BAHMACOFF); - - printf(": link addr 0x%02x(%d)\n", linkaddress, linkaddress); - - /* clear the int mask... */ - - sc->sc_intmask = 0; - PUTREG(BAHSTAT, 0); - - PUTREG(BAHCMD, BAH_CONF(CONF_LONG)); - PUTREG(BAHCMD, BAH_CLR(CLR_POR|CLR_RECONFIG)); - sc->sc_recontime = sc->sc_reconcount = 0; - - /* and reenable kernel int level */ - splx(s); - - /* - * set interface to stopped condition (reset) - */ - bah_stop(sc); - - strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); - ifp->if_softc = sc; - ifp->if_start = bah_start; - ifp->if_ioctl = bah_ioctl; - ifp->if_timer = 0; - ifp->if_watchdog = bah_watchdog; - IFQ_SET_READY(&ifp->if_snd); - - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS; - - ifp->if_mtu = ARCMTU; - - arc_ifattach(ifp, linkaddress); - -#ifdef BAHSOFTCOPY - sc->sc_rxcookie = softint_establish(SOFTINT_NET, bah_srint, sc); - sc->sc_txcookie = softint_establish(SOFTINT_NET, - (void (*)(void *))bah_start, ifp); -#endif - - callout_init(&sc->sc_recon_ch, 0); -} - -/* - * Initialize device - * - */ -void -bah_init(struct bah_softc *sc) -{ - struct ifnet *ifp; - int s; - - ifp = &sc->sc_arccom.ac_if; - - if ((ifp->if_flags & IFF_RUNNING) == 0) { - s = splnet(); - ifp->if_flags |= IFF_RUNNING; - bah_reset(sc); - bah_start(ifp); - splx(s); - } -} - -/* - * Reset the interface... - * - * this assumes that it is called inside a critical section... - * - */ -void -bah_reset(struct bah_softc *sc) -{ - struct ifnet *ifp; - uint8_t linkaddress; - - bus_space_tag_t bst_r = sc->sc_bst_r; - bus_space_tag_t bst_m = sc->sc_bst_m; - bus_space_handle_t regs = sc->sc_regs; - bus_space_handle_t mem = sc->sc_mem; - - ifp = &sc->sc_arccom.ac_if; - -#ifdef BAH_DEBUG - printf("%s: reset\n", device_xname(sc->sc_dev)); -#endif - /* stop and restart hardware */ - - (*sc->sc_reset)(sc, 1); - do { - DELAY(200); - } while (!(GETREG(BAHSTAT) & BAH_POR)); - - linkaddress = GETMEM(BAHMACOFF); - -#if defined(BAH_DEBUG) && (BAH_DEBUG > 2) - printf("%s: reset: card reset, link addr = 0x%02x (%ld)\n", - device_xname(sc->sc_dev), linkaddress, linkaddress); -#endif - - /* tell the routing level about the (possibly changed) link address */ - if_set_sadl(ifp, &linkaddress, sizeof(linkaddress), false); - - /* POR is NMI, but we need it below: */ - sc->sc_intmask = BAH_RECON|BAH_POR; - PUTREG(BAHSTAT, sc->sc_intmask); - PUTREG(BAHCMD, BAH_CONF(CONF_LONG)); - -#ifdef BAH_DEBUG - printf("%s: reset: chip configured, status=0x%02x\n", - device_xname(sc->sc_dev), GETREG(BAHSTAT)); -#endif - PUTREG(BAHCMD, BAH_CLR(CLR_POR|CLR_RECONFIG)); - -#ifdef BAH_DEBUG - printf("%s: reset: bits cleared, status=0x%02x\n", - device_xname(sc->sc_dev), GETREG(BAHSTAT)); -#endif - - sc->sc_reconcount_excessive = ARC_EXCESSIVE_RECONS; - - /* start receiver */ - - sc->sc_intmask |= BAH_RI; - sc->sc_rx_fillcount = 0; - sc->sc_rx_act = 2; - - PUTREG(BAHCMD, BAH_RXBC(2)); - PUTREG(BAHSTAT, sc->sc_intmask); - -#ifdef BAH_DEBUG - printf("%s: reset: started receiver, status=0x%02x\n", - device_xname(sc->sc_dev), GETREG(BAHSTAT)); -#endif - - /* and init transmitter status */ - sc->sc_tx_act = 0; - sc->sc_tx_fillcount = 0; - - ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; - - bah_start(ifp); -} - -/* - * Take interface offline - */ -void -bah_stop(struct bah_softc *sc) -{ - bus_space_tag_t bst_r = sc->sc_bst_r; - bus_space_handle_t regs = sc->sc_regs; - - /* Stop the interrupts */ - PUTREG(BAHSTAT, 0); - - /* Stop the interface */ - (*sc->sc_reset)(sc, 0); - - /* Stop watchdog timer */ - sc->sc_arccom.ac_if.if_timer = 0; -} - -/* - * Start output on interface. Get another datagram to send - * off the interface queue, and copy it to the - * interface before starting the output - * - * this assumes that it is called inside a critical section... - * XXX hm... does it still? - * - */ -void -bah_start(struct ifnet *ifp) -{ - struct bah_softc *sc = ifp->if_softc; - struct mbuf *m,*mp; - - bus_space_tag_t bst_r = sc->sc_bst_r; - bus_space_handle_t regs = sc->sc_regs; - bus_space_tag_t bst_m = sc->sc_bst_m; - bus_space_handle_t mem = sc->sc_mem; - - int bah_ram_ptr; - int len, tlen, offset, s, buffer; -#ifdef BAHTIMINGS - u_long copystart, lencopy, perbyte; -#endif - -#if defined(BAH_DEBUG) && (BAH_DEBUG > 3) - printf("%s: start(0x%x)\n", device_xname(sc->sc_dev), ifp); -#endif - - if ((ifp->if_flags & IFF_RUNNING) == 0) - return; - - s = splnet(); - - if (sc->sc_tx_fillcount >= 2) { - splx(s); - return; - } - - IFQ_DEQUEUE(&ifp->if_snd, m); - buffer = sc->sc_tx_act ^ 1; - - splx(s); - - if (m == 0) - return; - - /* - * If bpf is listening on this interface, let it - * see the packet before we commit it to the wire - * - * (can't give the copy in A2060 card RAM to bpf, because - * that RAM is just accessed as on every other byte) - */ - bpf_mtap(ifp, m); - -#ifdef BAH_DEBUG - if (m->m_len < ARC_HDRLEN) - m = m_pullup(m, ARC_HDRLEN);/* gcc does structure padding */ - printf("%s: start: filling %ld from %ld to %ld type %ld\n", - device_xname(sc->sc_dev), buffer, mtod(m, u_char *)[0], - mtod(m, u_char *)[1], mtod(m, u_char *)[2]); -#else - if (m->m_len < 2) - m = m_pullup(m, 2); -#endif - bah_ram_ptr = buffer*512; - - if (m == 0) - return; - - /* write the addresses to RAM and throw them away */ - - /* - * Hardware does this: Yet Another Microsecond Saved. - * (btw, timing code says usually 2 microseconds) - * PUTMEM(bah_ram_ptr + 0, mtod(m, u_char *)[0]); - */ - - PUTMEM(bah_ram_ptr + 1, mtod(m, u_char *)[1]); - m_adj(m, 2); - - /* get total length left at this point */ - tlen = m->m_pkthdr.len; - if (tlen < ARC_MIN_FORBID_LEN) { - offset = 256 - tlen; - PUTMEM(bah_ram_ptr + 2, offset); - } else { - PUTMEM(bah_ram_ptr + 2, 0); - if (tlen <= ARC_MAX_FORBID_LEN) - offset = 255; /* !!! */ - else { - if (tlen > ARC_MAX_LEN) - tlen = ARC_MAX_LEN; - offset = 512 - tlen; - } - PUTMEM(bah_ram_ptr + 3, offset); - - } - bah_ram_ptr += offset; - - /* lets loop through the mbuf chain */ - - for (mp = m; mp; mp = mp->m_next) { - if ((len = mp->m_len)) { /* YAMS */ - bus_space_write_region_1(bst_m, mem, bah_ram_ptr, - mtod(mp, void *), len); - - bah_ram_ptr += len; - } - } - - sc->sc_broadcast[buffer] = (m->m_flags & M_BCAST) != 0; - sc->sc_retransmits[buffer] = (m->m_flags & M_BCAST) ? 1 : 5; - - /* actually transmit the packet */ - s = splnet(); - - if (++sc->sc_tx_fillcount > 1) { - /* - * We are filled up to the rim. No more bufs for the moment, - * please. - */ - ifp->if_flags |= IFF_OACTIVE; - } else { -#ifdef BAH_DEBUG - printf("%s: start: starting transmitter on buffer %d\n", - device_xname(sc->sc_dev), buffer); -#endif - /* Transmitter was off, start it */ - sc->sc_tx_act = buffer; - - /* - * We still can accept another buf, so don't: - * ifp->if_flags |= IFF_OACTIVE; - */ - sc->sc_intmask |= BAH_TA; - PUTREG(BAHCMD, BAH_TX(buffer)); - PUTREG(BAHSTAT, sc->sc_intmask); - - sc->sc_arccom.ac_if.if_timer = ARCTIMEOUT; - } - splx(s); - m_freem(m); - - /* - * After 10 times reading the docs, I realized - * that in the case the receiver NAKs the buffer request, - * the hardware retries till shutdown. - * This is integrated now in the code above. - */ - - return; -} - -/* - * Arcnet interface receiver soft interrupt: - * get the stuff out of any filled buffer we find. - */ -void -bah_srint(void *vsc) -{ - struct bah_softc *sc = (struct bah_softc *)vsc; - int buffer, len, len1, amount, offset, s, type; - int bah_ram_ptr; - struct mbuf *m, *dst, *head; - struct arc_header *ah; - struct ifnet *ifp; - - bus_space_tag_t bst_r = sc->sc_bst_r; - bus_space_tag_t bst_m = sc->sc_bst_m; - bus_space_handle_t regs = sc->sc_regs; - bus_space_handle_t mem = sc->sc_mem; - - ifp = &sc->sc_arccom.ac_if; - head = 0; - - s = splnet(); - buffer = sc->sc_rx_act ^ 1; - splx(s); - - /* Allocate header mbuf */ - MGETHDR(m, M_DONTWAIT, MT_DATA); - - if (m == 0) { - /* - * in case s.th. goes wrong with mem, drop it - * to make sure the receiver can be started again - * count it as input error (we dont have any other - * detectable) - */ - ifp->if_ierrors++; - goto cleanup; - } - - m->m_pkthdr.rcvif = ifp; - - /* - * Align so that IP packet will be longword aligned. Here we - * assume that m_data of new packet is longword aligned. - * When implementing PHDS, we might have to change it to 2, - * (2*sizeof(ulong) - ARC_HDRNEWLEN)), packet type dependent. - */ - - bah_ram_ptr = buffer*512; - offset = GETMEM(bah_ram_ptr + 2); - if (offset) - len = 256 - offset; - else { - offset = GETMEM(bah_ram_ptr + 3); - len = 512 - offset; - } - if (len+2 >= MINCLSIZE) - MCLGET(m, M_DONTWAIT); - - if (m == 0) { - ifp->if_ierrors++; - goto cleanup; - } - - type = GETMEM(bah_ram_ptr + offset); - m->m_data += 1 + arc_isphds(type); - - head = m; - ah = mtod(head, struct arc_header *); - - ah->arc_shost = GETMEM(bah_ram_ptr + 0); - ah->arc_dhost = GETMEM(bah_ram_ptr + 1); - - m->m_pkthdr.len = len+2; /* whole packet length */ - m->m_len = 2; /* mbuf filled with ARCnet addresses */ - bah_ram_ptr += offset; /* ram buffer continues there */ - - while (len > 0) { - - len1 = len; - amount = M_TRAILINGSPACE(m); - - if (amount == 0) { - dst = m; - MGET(m, M_DONTWAIT, MT_DATA); - - if (m == 0) { - ifp->if_ierrors++; - goto cleanup; - } - - if (len1 >= MINCLSIZE) - MCLGET(m, M_DONTWAIT); - - m->m_len = 0; - dst->m_next = m; - amount = M_TRAILINGSPACE(m); - } - - if (amount < len1) - len1 = amount; - - bus_space_read_region_1(bst_m, mem, bah_ram_ptr, - mtod(m, u_char *) + m->m_len, len1); - - m->m_len += len1; - bah_ram_ptr += len1; - len -= len1; - } - - bpf_mtap(ifp, head); - - (*sc->sc_arccom.ac_if.if_input)(&sc->sc_arccom.ac_if, head); - - head = NULL; - ifp->if_ipackets++; - -cleanup: - - if (head != NULL) - m_freem(head); - - /* mark buffer as invalid by source id 0 */ - bus_space_write_1(bst_m, mem, buffer*512, 0); - s = splnet(); - - if (--sc->sc_rx_fillcount == 2 - 1) { - - /* was off, restart it on buffer just emptied */ - sc->sc_rx_act = buffer; - sc->sc_intmask |= BAH_RI; - - /* this also clears the RI flag interrupt: */ - PUTREG(BAHCMD, BAH_RXBC(buffer)); - PUTREG(BAHSTAT, sc->sc_intmask); - -#ifdef BAH_DEBUG - printf("%s: srint: restarted rx on buf %ld\n", - device_xname(sc->sc_dev), buffer); -#endif - } - splx(s); -} - -inline static void -bah_tint(struct bah_softc *sc, int isr) -{ - struct ifnet *ifp; - - bus_space_tag_t bst_r = sc->sc_bst_r; - bus_space_handle_t regs = sc->sc_regs; - - - int buffer; -#ifdef BAHTIMINGS - int clknow; -#endif - - ifp = &(sc->sc_arccom.ac_if); - buffer = sc->sc_tx_act; - - /* - * retransmit code: - * Normal situations first for fast path: - * If acknowledgement received ok or broadcast, we're ok. - * else if - */ - - if (isr & BAH_TMA || sc->sc_broadcast[buffer]) - sc->sc_arccom.ac_if.if_opackets++; -#ifdef BAHRETRANSMIT - else if (ifp->if_flags & IFF_LINK2 && ifp->if_timer > 0 - && --sc->sc_retransmits[buffer] > 0) { - /* retransmit same buffer */ - PUTREG(BAHCMD, BAH_TX(buffer)); - return; - } -#endif - else - ifp->if_oerrors++; - - - /* We know we can accept another buffer at this point. */ - ifp->if_flags &= ~IFF_OACTIVE; - - if (--sc->sc_tx_fillcount > 0) { - - /* - * start tx on other buffer. - * This also clears the int flag - */ - buffer ^= 1; - sc->sc_tx_act = buffer; - - /* - * already given: - * sc->sc_intmask |= BAH_TA; - * PUTREG(BAHSTAT, sc->sc_intmask); - */ - PUTREG(BAHCMD, BAH_TX(buffer)); - /* init watchdog timer */ - ifp->if_timer = ARCTIMEOUT; - -#if defined(BAH_DEBUG) && (BAH_DEBUG > 1) - printf("%s: tint: starting tx on buffer %d, status 0x%02x\n", - device_xname(sc->sc_dev), buffer, GETREG(BAHSTAT)); -#endif - } else { - /* have to disable TX interrupt */ - sc->sc_intmask &= ~BAH_TA; - PUTREG(BAHSTAT, sc->sc_intmask); - /* ... and watchdog timer */ - ifp->if_timer = 0; - -#ifdef BAH_DEBUG - printf("%s: tint: no more buffers to send, status 0x%02x\n", - device_xname(sc->sc_dev), GETREG(BAHSTAT)); -#endif - } - - /* XXXX TODO */ -#ifdef BAHSOFTCOPY - /* schedule soft int to fill a new buffer for us */ - softint_schedule(sc->sc_txcookie); -#else - /* call it directly */ - bah_start(ifp); -#endif -} - -/* - * Our interrupt routine - */ -int -bahintr(void *arg) -{ - struct bah_softc *sc = arg; - - bus_space_tag_t bst_r = sc->sc_bst_r; - bus_space_tag_t bst_m = sc->sc_bst_m; - bus_space_handle_t regs = sc->sc_regs; - bus_space_handle_t mem = sc->sc_mem; - - u_char isr, maskedisr; - int buffer; - u_long newsec; - - isr = GETREG(BAHSTAT); - maskedisr = isr & sc->sc_intmask; - if (!maskedisr) - return (0); - do { - -#if defined(BAH_DEBUG) && (BAH_DEBUG>1) - printf("%s: intr: status 0x%02x, intmask 0x%02x\n", - device_xname(sc->sc_dev), isr, sc->sc_intmask); -#endif - - if (maskedisr & BAH_POR) { - /* - * XXX We should never see this. Don't bother to store - * the address. - * sc->sc_arccom.ac_anaddr = GETMEM(BAHMACOFF); - */ - PUTREG(BAHCMD, BAH_CLR(CLR_POR)); - log(LOG_WARNING, - "%s: intr: got spurious power on reset int\n", - device_xname(sc->sc_dev)); - } - - if (maskedisr & BAH_RECON) { - /* - * we dont need to: - * PUTREG(BAHCMD, BAH_CONF(CONF_LONG)); - */ - PUTREG(BAHCMD, BAH_CLR(CLR_RECONFIG)); - sc->sc_arccom.ac_if.if_collisions++; - - /* - * If less than 2 seconds per reconfig: - * If ARC_EXCESSIVE_RECONFIGS - * since last burst, complain and set threshold for - * warnings to ARC_EXCESSIVE_RECONS_REWARN. - * - * This allows for, e.g., new stations on the cable, or - * cable switching as long as it is over after - * (normally) 16 seconds. - * - * XXX TODO: check timeout bits in status word and - * double time if necessary. - */ - - callout_stop(&sc->sc_recon_ch); - newsec = time_second; - if ((newsec - sc->sc_recontime <= 2) && - (++sc->sc_reconcount == ARC_EXCESSIVE_RECONS)) { - log(LOG_WARNING, - "%s: excessive token losses, " - "cable problem?\n", device_xname(sc->sc_dev)); - } - sc->sc_recontime = newsec; - callout_reset(&sc->sc_recon_ch, 15 * hz, - bah_reconwatch, (void *)sc); - } - - if (maskedisr & BAH_RI) { -#if defined(BAH_DEBUG) && (BAH_DEBUG > 1) - printf("%s: intr: hard rint, act %ld\n", - device_xname(sc->sc_dev), sc->sc_rx_act); -#endif - - buffer = sc->sc_rx_act; - /* look if buffer is marked invalid: */ - if (GETMEM(buffer*512) == 0) { - /* - * invalid marked buffer (or illegally - * configured sender) - */ - log(LOG_WARNING, - "%s: spurious RX interrupt or sender 0 " - " (ignored)\n", device_xname(sc->sc_dev)); - /* - * restart receiver on same buffer. - * XXX maybe better reset interface? - */ - PUTREG(BAHCMD, BAH_RXBC(buffer)); - } else { - if (++sc->sc_rx_fillcount > 1) { - sc->sc_intmask &= ~BAH_RI; - PUTREG(BAHSTAT, sc->sc_intmask); - } else { - buffer ^= 1; - sc->sc_rx_act = buffer; - - /* - * Start receiver on other receive - * buffer. This also clears the RI - * interrupt flag. - */ - PUTREG(BAHCMD, BAH_RXBC(buffer)); - /* in RX intr, so mask is ok for RX */ - -#ifdef BAH_DEBUG - printf("%s: strt rx for buf %ld, " - "stat 0x%02x\n", - device_xname(sc->sc_dev), sc->sc_rx_act, - GETREG(BAHSTAT)); -#endif - } - -#ifdef BAHSOFTCOPY - /* - * this one starts a soft int to copy out - * of the hw - */ - softint_schedule(sc->sc_rxcookie); -#else - /* this one does the copy here */ - bah_srint(sc); -#endif - } - } - if (maskedisr & BAH_TA) { - bah_tint(sc, isr); - } - isr = GETREG(BAHSTAT); - maskedisr = isr & sc->sc_intmask; - } while (maskedisr); - - return (1); -} - -void -bah_reconwatch(void *arg) -{ - struct bah_softc *sc = arg; - - if (sc->sc_reconcount >= ARC_EXCESSIVE_RECONS) { - sc->sc_reconcount = 0; - log(LOG_WARNING, "%s: token valid again.\n", - device_xname(sc->sc_dev)); - } - sc->sc_reconcount = 0; -} - - -/* - * Process an ioctl request. - * This code needs some work - it looks pretty ugly. - */ -int -bah_ioctl(struct ifnet *ifp, u_long cmd, void *data) -{ - struct bah_softc *sc; - struct ifaddr *ifa; - struct ifreq *ifr; - int s, error; - - error = 0; - sc = ifp->if_softc; - ifa = (struct ifaddr *)data; - ifr = (struct ifreq *)data; - s = splnet(); - -#if defined(BAH_DEBUG) && (BAH_DEBUG > 2) - printf("%s: ioctl() called, cmd = 0x%x\n", - device_xname(sc->sc_dev), cmd); -#endif - - switch (cmd) { - case SIOCINITIFADDR: - ifp->if_flags |= IFF_UP; - bah_init(sc); - switch (ifa->ifa_addr->sa_family) { -#ifdef INET - case AF_INET: - arp_ifinit(ifp, ifa); - break; -#endif - default: - break; - } - - case SIOCSIFFLAGS: - if ((error = ifioctl_common(ifp, cmd, data)) != 0) - break; - /* XXX re-use ether_ioctl() */ - switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) { - case IFF_RUNNING: - /* - * If interface is marked down and it is running, - * then stop it. - */ - bah_stop(sc); - ifp->if_flags &= ~IFF_RUNNING; - break; - case IFF_UP: - /* - * If interface is marked up and it is stopped, then - * start it. - */ - bah_init(sc); - break; - } - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - switch (ifreq_getaddr(cmd, ifr)->sa_family) { - case AF_INET: - case AF_INET6: - error = 0; - break; - default: - error = EAFNOSUPPORT; - break; - } - break; - - default: - error = ether_ioctl(ifp, cmd, data); - } - - splx(s); - return (error); -} - -/* - * watchdog routine for transmitter. - * - * We need this, because else a receiver whose hardware is alive, but whose - * software has not enabled the Receiver, would make our hardware wait forever - * Discovered this after 20 times reading the docs. - * - * Only thing we do is disable transmitter. We'll get an transmit timeout, - * and the int handler will have to decide not to retransmit (in case - * retransmission is implemented). - * - * This one assumes being called inside splnet() - */ - -void -bah_watchdog(struct ifnet *ifp) -{ - struct bah_softc *sc = ifp->if_softc; - - bus_space_tag_t bst_r = sc->sc_bst_r; - bus_space_handle_t regs = sc->sc_regs; - - PUTREG(BAHCMD, BAH_TXDIS); - return; -} - diff --git a/sys/dev/ic/smc90cx6reg.h b/sys/dev/ic/smc90cx6reg.h deleted file mode 100644 index 4c168d8..0000000 --- a/sys/dev/ic/smc90cx6reg.h +++ /dev/null @@ -1,80 +0,0 @@ -/* $NetBSD: smc90cx6reg.h,v 1.10 2008/04/28 20:23:51 martin Exp $ */ - -/*- - * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Ignatios Souvatzis. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * chip offsets and bits for the SMC Arcnet chipset. - */ - -#ifndef _SMC90CXVAR_H_ -#define _SMC90CXVAR_H_ - -/* register offsets */ - -#define BAHSTAT 0 -#define BAHCMD 1 - -/* memory offsets */ -#define BAHCHECKBYTE 0 -#define BAHMACOFF 1 - -#define BAH_TXDIS 0x01 -#define BAH_RXDIS 0x02 -#define BAH_TX(x) (0x03 | ((x)<<3)) -#define BAH_RX(x) (0x04 | ((x)<<3)) -#define BAH_RXBC(x) (0x84 | ((x)<<3)) - -#define BAH_CONF(x) (0x05 | (x)) -#define CLR_POR 0x08 -#define CLR_RECONFIG 0x10 - -#define BAH_CLR(x) (0x06 | (x)) -#define CONF_LONG 0x08 -#define CONF_SHORT 0x00 - -/* - * These are not in the COM90C65 docs. Derived from the arcnet.asm - * packet driver by Philippe Prindeville and Russel Nelson. - */ - -#define BAH_LDTST(x) (0x07 | (x)) -#define TEST_ON 0x08 -#define TEST_OFF 0x00 - -#define BAH_TA 1 /* int mask also */ -#define BAH_TMA 2 -#define BAH_RECON 4 /* int mask also */ -#define BAH_TEST 8 /* not in the COM90C65 docs (see above) */ -#define BAH_POR 0x10 /* non maskable interrupt */ -#define BAH_ET1 0x20 /* timeout value bits, normally 1 */ -#define BAH_ET2 0x40 /* timeout value bits, normally 1 */ -#define BAH_RI 0x80 /* int mask also */ - -#endif diff --git a/sys/dev/ic/smc90cx6var.h b/sys/dev/ic/smc90cx6var.h deleted file mode 100644 index 94af627..0000000 --- a/sys/dev/ic/smc90cx6var.h +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: smc90cx6var.h,v 1.11 2012/10/27 17:18:22 chs Exp $ */ - -/*- - * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Ignatios Souvatzis. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * BAH (SMC 8bit ARCnet chipset) k/dpi - * - * The SMC 8bit ARCnet chip family uses a register and a memory window, which - * we get passed via bus_space_tags and bus_space_handles. - * - * As the reset functionality differs between the Amiga boards (using the - * 90c26 chip) and middle-aged ISA boards (using the 90c56 chip), we have - * a sc_reset callback function in the softc, which does a stop function - * (reset and leave dead) or a reset function depending on whether the 2nd - * parameter is 0 or 1. - */ - -#ifndef _SMC90CX6VAR_H_ -#define _SMC90CX6VAR_H_ - -#include - -struct bah_softc { - device_t sc_dev; - struct arccom sc_arccom; /* Common arcnet structures */ - bus_space_tag_t sc_bst_r, sc_bst_m; - bus_space_handle_t sc_regs, sc_mem; - void (*sc_reset)(struct bah_softc *, int); - void *sc_rxcookie; /* softcallback cookies */ - void *sc_txcookie; - struct callout sc_recon_ch; - u_long sc_recontime; /* seconds only, I'm lazy */ - u_long sc_reconcount; /* for the above */ - u_long sc_reconcount_excessive; /* for the above */ -#define ARC_EXCESSIVE_RECONS 20 -#define ARC_EXCESSIVE_RECONS_REWARN 400 - u_char sc_intmask; - u_char sc_rx_act; /* 2..3 */ - u_char sc_tx_act; /* 0..1 */ - u_char sc_rx_fillcount; - u_char sc_tx_fillcount; - u_char sc_broadcast[2]; /* is it a broadcast packet? */ - u_char sc_retransmits[2]; /* unused at the moment */ -}; - -void bah_attach_subr(struct bah_softc *); -int bahintr(void *); - -#endif diff --git a/sys/net/Makefile b/sys/net/Makefile index 7ba90fa..9c73376 100644 --- a/sys/net/Makefile +++ b/sys/net/Makefile @@ -2,7 +2,7 @@ INCSDIR= /usr/include/net -INCS= bpf.h bpfjit.h bpfdesc.h dlt.h ethertypes.h if.h if_arc.h if_arp.h \ +INCS= bpf.h bpfjit.h bpfdesc.h dlt.h ethertypes.h if.h if_arp.h \ if_atm.h if_bridgevar.h if_dl.h if_ether.h if_etherip.h if_fddi.h if_gif.h \ if_gre.h if_hippi.h if_ieee1394.h if_llc.h if_media.h if_mpls.h \ if_pflog.h if_ppp.h if_pppoe.h if_sppp.h if_srt.h if_stf.h \ diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 9f73911..2d77bfd 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -82,7 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.190 2014/12/29 13:38:13 ozaki-r Exp $"); #include #include -#include #include #include @@ -254,12 +253,6 @@ bpf_movein(struct uio *uio, int linktype, uint64_t mtu, struct mbuf **mp, align = 2; break; - case DLT_ARCNET: - sockp->sa_family = AF_UNSPEC; - hlen = ARC_HDRLEN; - align = 5; - break; - case DLT_FDDI: sockp->sa_family = AF_LINK; /* XXX 4(FORMAC)+6(dst)+6(src) */ diff --git a/sys/net/if_arc.h b/sys/net/if_arc.h deleted file mode 100644 index 31f2e6a..0000000 --- a/sys/net/if_arc.h +++ /dev/null @@ -1,126 +0,0 @@ -/* $NetBSD: if_arc.h,v 1.22 2008/02/20 17:05:52 matt Exp $ */ - -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp - * @(#)if_ether.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NET_IF_ARC_H_ -#define _NET_IF_ARC_H_ - -/* - * Arcnet address - 1 octets - * don't know who uses this. - */ -struct arc_addr { - uint8_t arc_addr_octet[1]; -} __packed; - -/* - * Structure of a 2.5MB/s Arcnet header. - * as given to interface code. - */ -struct arc_header { - uint8_t arc_shost; - uint8_t arc_dhost; - uint8_t arc_type; - /* - * only present for newstyle encoding with LL fragmentation. - * Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead. - */ - uint8_t arc_flag; - uint16_t arc_seqid; - - /* - * only present in exception packets (arc_flag == 0xff) - */ - uint8_t arc_type2; /* same as arc_type */ - uint8_t arc_flag2; /* real flag value */ - uint16_t arc_seqid2; /* real seqid value */ -} __packed; - -#define ARC_ADDR_LEN 1 - -#define ARC_HDRLEN 3 -#define ARC_HDRNEWLEN 6 -#define ARC_HDRNEWLEN_EXC 10 - -/* these lengths are data link layer length - 2*ARC_ADDR_LEN */ -#define ARC_MIN_LEN 1 -#define ARC_MIN_FORBID_LEN 254 -#define ARC_MAX_FORBID_LEN 256 -#define ARC_MAX_LEN 508 - - -/* RFC 1051 */ -#define ARCTYPE_IP_OLD 240 /* IP protocol */ -#define ARCTYPE_ARP_OLD 241 /* address resolution protocol */ - -/* RFC 1201 */ -#define ARCTYPE_IP 212 /* IP protocol */ -#define ARCTYPE_ARP 213 /* address resolution protocol */ -#define ARCTYPE_REVARP 214 /* reverse addr resolution protocol */ - -#define ARCTYPE_ATALK 221 /* Appletalk */ -#define ARCTYPE_BANIAN 247 /* Banyan Vines */ -#define ARCTYPE_IPX 250 /* Novell IPX */ - -#define ARCTYPE_INET6 0xc4 /* IPng */ -#define ARCTYPE_DIAGNOSE 0x80 /* as per ANSI/ATA 878.1 */ - -#define ARCMTU 507 -#define ARCMIN 0 - -#define ARC_PHDS_MAXMTU 60480 - -struct arccom { - struct ifnet ac_if; /* network-visible interface */ - - uint16_t ac_seqid; /* seq. id used by PHDS encap. */ - - struct ac_frag { - uint8_t af_maxflag; /* from first packet */ - uint8_t af_lastseen; /* last split flag seen */ - uint16_t af_seqid; - struct mbuf *af_packet; - } ac_fragtab[256]; /* indexed by sender ll address */ - -}; - -#ifdef _KERNEL -extern uint8_t arcbroadcastaddr; -extern int arc_ipmtu; /* XXX new ip only, no RFC 1051! */ - -void arc_ifattach(struct ifnet *, uint8_t); -char *arc_sprintf(uint8_t *); -int arc_isphds(uint8_t); -#endif - -#endif /* !_NET_IF_ARC_H_ */ diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c deleted file mode 100644 index b5aab2a..0000000 --- a/sys/net/if_arcsubr.c +++ /dev/null @@ -1,662 +0,0 @@ -/* $NetBSD: if_arcsubr.c,v 1.66 2014/06/05 23:48:16 rmind Exp $ */ - -/* - * Copyright (c) 1994, 1995 Ignatios Souvatzis - * Copyright (c) 1982, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: if_ethersubr.c,v 1.9 1994/06/29 06:36:11 cgd Exp - * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 - * - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.66 2014/06/05 23:48:16 rmind Exp $"); - -#include "opt_inet.h" - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifdef INET -#include -#include -#include -#endif - -#ifdef INET6 -#ifndef INET -#include -#endif -#include -#include -#endif - -#define ARCNET_ALLOW_BROKEN_ARP - -#ifndef ARC_IPMTU -#define ARC_IPMTU 1500 -#endif - -static struct mbuf *arc_defrag(struct ifnet *, struct mbuf *); - -/* - * RC1201 requires us to have this configurable. We have it only per - * machine at the moment... there is no generic "set mtu" ioctl, AFAICS. - * Anyway, it is possible to binpatch this or set it per kernel config - * option. - */ -#if ARC_IPMTU > 60480 -ERROR: The arc_ipmtu is ARC_IPMTU, but must not exceed 60480. -#endif -int arc_ipmtu = ARC_IPMTU; -uint8_t arcbroadcastaddr = 0; - -#define senderr(e) { error = (e); goto bad;} - -static int arc_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); -static void arc_input(struct ifnet *, struct mbuf *); - -/* - * ARCnet output routine. - * Encapsulate a packet of type family for the local net. - * Assumes that ifp is actually pointer to arccom structure. - */ -static int -arc_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, - struct rtentry *rt0) -{ - struct mbuf *m, *m1, *mcopy; - struct rtentry *rt; - struct arccom *ac; - const struct arc_header *cah; - struct arc_header *ah; - struct arphdr *arph; - int error, newencoding; - uint8_t atype, adst, myself; - int tfrags, sflag, fsflag, rsflag; - ALTQ_DECL(struct altq_pktattr pktattr;) - - if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) - return (ENETDOWN); /* m, m1 aren't initialized yet */ - - error = newencoding = 0; - ac = (struct arccom *)ifp; - m = m0; - mcopy = m1 = NULL; - - myself = *CLLADDR(ifp->if_sadl); - - if ((rt = rt0)) { - if ((rt->rt_flags & RTF_UP) == 0) { - if ((rt0 = rt = rtalloc1(dst, 1))) - rt->rt_refcnt--; - else - senderr(EHOSTUNREACH); - } - if (rt->rt_flags & RTF_GATEWAY) { - if (rt->rt_gwroute == 0) - goto lookup; - if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) { - rtfree(rt); rt = rt0; - lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1); - if ((rt = rt->rt_gwroute) == 0) - senderr(EHOSTUNREACH); - } - } - if (rt->rt_flags & RTF_REJECT) - if (rt->rt_rmx.rmx_expire == 0 || - time_second < rt->rt_rmx.rmx_expire) - senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); - } - - /* - * if the queueing discipline needs packet classification, - * do it before prepending link headers. - */ - IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr); - - switch (dst->sa_family) { -#ifdef INET - case AF_INET: - - /* - * For now, use the simple IP addr -> ARCnet addr mapping - */ - if (m->m_flags & (M_BCAST|M_MCAST)) - adst = arcbroadcastaddr; /* ARCnet broadcast address */ - else if (ifp->if_flags & IFF_NOARP) - adst = ntohl(satocsin(dst)->sin_addr.s_addr) & 0xFF; - else if (!arpresolve(ifp, rt, m, dst, &adst)) - return 0; /* not resolved yet */ - - /* If broadcasting on a simplex interface, loopback a copy */ - if ((m->m_flags & (M_BCAST|M_MCAST)) && - (ifp->if_flags & IFF_SIMPLEX)) - mcopy = m_copy(m, 0, (int)M_COPYALL); - if (ifp->if_flags & IFF_LINK0) { - atype = ARCTYPE_IP; - newencoding = 1; - } else { - atype = ARCTYPE_IP_OLD; - newencoding = 0; - } - break; - - case AF_ARP: - arph = mtod(m, struct arphdr *); - if (m->m_flags & M_BCAST) - adst = arcbroadcastaddr; - else { - uint8_t *tha = ar_tha(arph); - if (tha == NULL) - return 0; - adst = *tha; - } - - arph->ar_hrd = htons(ARPHRD_ARCNET); - - switch (ntohs(arph->ar_op)) { - case ARPOP_REVREQUEST: - case ARPOP_REVREPLY: - if (!(ifp->if_flags & IFF_LINK0)) { - printf("%s: can't handle af%d\n", - ifp->if_xname, dst->sa_family); - senderr(EAFNOSUPPORT); - } - - atype = htons(ARCTYPE_REVARP); - newencoding = 1; - break; - - case ARPOP_REQUEST: - case ARPOP_REPLY: - default: - if (ifp->if_flags & IFF_LINK0) { - atype = htons(ARCTYPE_ARP); - newencoding = 1; - } else { - atype = htons(ARCTYPE_ARP_OLD); - newencoding = 0; - } - } -#ifdef ARCNET_ALLOW_BROKEN_ARP - /* - * XXX It's not clear per RFC826 if this is needed, but - * "assigned numbers" say this is wrong. - * However, e.g., AmiTCP 3.0Beta used it... we make this - * switchable for emergency cases. Not perfect, but... - */ - if (ifp->if_flags & IFF_LINK2) - arph->ar_pro = atype - 1; -#endif - break; -#endif -#ifdef INET6 - case AF_INET6: - if (!nd6_storelladdr(ifp, rt, m, dst, &adst, sizeof(adst))) - return (0); /* it must be impossible, but... */ - atype = htons(ARCTYPE_INET6); - newencoding = 1; - break; -#endif - - case AF_UNSPEC: - cah = (const struct arc_header *)dst->sa_data; - adst = cah->arc_dhost; - atype = cah->arc_type; - break; - - default: - printf("%s: can't handle af%d\n", ifp->if_xname, - dst->sa_family); - senderr(EAFNOSUPPORT); - } - - if (mcopy) - (void) looutput(ifp, mcopy, dst, rt); - - /* - * Add local net header. If no space in first mbuf, - * allocate another. - * - * For ARCnet, this is just symbolic. The header changes - * form and position on its way into the hardware and out of - * the wire. At this point, it contains source, destination and - * packet type. - */ - if (newencoding) { - ++ac->ac_seqid; /* make the seqid unique */ - - tfrags = (m->m_pkthdr.len + 503) / 504; - fsflag = 2 * tfrags - 3; - sflag = 0; - rsflag = fsflag; - - while (sflag < fsflag) { - /* we CAN'T have short packets here */ - m1 = m_split(m, 504, M_DONTWAIT); - if (m1 == 0) - senderr(ENOBUFS); - - M_PREPEND(m, ARC_HDRNEWLEN, M_DONTWAIT); - if (m == 0) - senderr(ENOBUFS); - ah = mtod(m, struct arc_header *); - ah->arc_type = atype; - ah->arc_dhost = adst; - ah->arc_shost = myself; - ah->arc_flag = rsflag; - ah->arc_seqid = ac->ac_seqid; - - if ((error = ifq_enqueue(ifp, m ALTQ_COMMA - ALTQ_DECL(&pktattr))) != 0) - return (error); - - m = m1; - sflag += 2; - rsflag = sflag; - } - m1 = NULL; - - - /* here we can have small, especially forbidden packets */ - - if ((m->m_pkthdr.len >= - ARC_MIN_FORBID_LEN - ARC_HDRNEWLEN + 2) && - (m->m_pkthdr.len <= - ARC_MAX_FORBID_LEN - ARC_HDRNEWLEN + 2)) { - - M_PREPEND(m, ARC_HDRNEWLEN_EXC, M_DONTWAIT); - if (m == 0) - senderr(ENOBUFS); - ah = mtod(m, struct arc_header *); - ah->arc_flag = 0xFF; - ah->arc_seqid = 0xFFFF; - ah->arc_type2 = atype; - ah->arc_flag2 = sflag; - ah->arc_seqid2 = ac->ac_seqid; - } else { - M_PREPEND(m, ARC_HDRNEWLEN, M_DONTWAIT); - if (m == 0) - senderr(ENOBUFS); - ah = mtod(m, struct arc_header *); - ah->arc_flag = sflag; - ah->arc_seqid = ac->ac_seqid; - } - - ah->arc_dhost = adst; - ah->arc_shost = myself; - ah->arc_type = atype; - } else { - M_PREPEND(m, ARC_HDRLEN, M_DONTWAIT); - if (m == 0) - senderr(ENOBUFS); - ah = mtod(m, struct arc_header *); - ah->arc_type = atype; - ah->arc_dhost = adst; - ah->arc_shost = myself; - } - - return ifq_enqueue(ifp, m ALTQ_COMMA ALTQ_DECL(&pktattr)); - -bad: - if (m1) - m_freem(m1); - if (m) - m_freem(m); - return (error); -} - -/* - * Defragmenter. Returns mbuf if last packet found, else - * NULL. frees imcoming mbuf as necessary. - */ - -static struct mbuf * -arc_defrag(struct ifnet *ifp, struct mbuf *m) -{ - struct arc_header *ah, *ah1; - struct arccom *ac; - struct ac_frag *af; - struct mbuf *m1; - const char *s; - int newflen; - u_char src, dst, typ; - - ac = (struct arccom *)ifp; - - if (m->m_len < ARC_HDRNEWLEN) { - m = m_pullup(m, ARC_HDRNEWLEN); - if (m == NULL) { - ++ifp->if_ierrors; - return NULL; - } - } - - ah = mtod(m, struct arc_header *); - typ = ah->arc_type; - - if (!arc_isphds(typ)) - return m; - - src = ah->arc_shost; - dst = ah->arc_dhost; - - if (ah->arc_flag == 0xff) { - m_adj(m, 4); - - if (m->m_len < ARC_HDRNEWLEN) { - m = m_pullup(m, ARC_HDRNEWLEN); - if (m == NULL) { - ++ifp->if_ierrors; - return NULL; - } - } - - ah = mtod(m, struct arc_header *); - } - - af = &ac->ac_fragtab[src]; - m1 = af->af_packet; - s = "debug code error"; - - if (ah->arc_flag & 1) { - /* - * first fragment. We always initialize, which is - * about the right thing to do, as we only want to - * accept one fragmented packet per src at a time. - */ - if (m1 != NULL) - m_freem(m1); - - af->af_packet = m; - m1 = m; - af->af_maxflag = ah->arc_flag; - af->af_lastseen = 0; - af->af_seqid = ah->arc_seqid; - - return NULL; - /* notreached */ - } else { - /* check for unfragmented packet */ - if (ah->arc_flag == 0) - return m; - - /* do we have a first packet from that src? */ - if (m1 == NULL) { - s = "no first frag"; - goto outofseq; - } - - ah1 = mtod(m1, struct arc_header *); - - if (ah->arc_seqid != ah1->arc_seqid) { - s = "seqid differs"; - goto outofseq; - } - - if (typ != ah1->arc_type) { - s = "type differs"; - goto outofseq; - } - - if (dst != ah1->arc_dhost) { - s = "dest host differs"; - goto outofseq; - } - - /* typ, seqid and dst are ok here. */ - - if (ah->arc_flag == af->af_lastseen) { - m_freem(m); - return NULL; - } - - if (ah->arc_flag == af->af_lastseen + 2) { - /* ok, this is next fragment */ - af->af_lastseen = ah->arc_flag; - m_adj(m, ARC_HDRNEWLEN); - - /* - * m_cat might free the first mbuf (with pkthdr) - * in 2nd chain; therefore: - */ - - newflen = m->m_pkthdr.len; - - m_cat(m1, m); - - m1->m_pkthdr.len += newflen; - - /* is it the last one? */ - if (af->af_lastseen > af->af_maxflag) { - af->af_packet = NULL; - return (m1); - } else - return NULL; - } - s = "other reason"; - /* if all else fails, it is out of sequence, too */ - } -outofseq: - if (m1) { - m_freem(m1); - af->af_packet = NULL; - } - - if (m) - m_freem(m); - - log(LOG_INFO,"%s: got out of seq. packet: %s\n", - ifp->if_xname, s); - - return NULL; -} - -/* - * return 1 if Packet Header Definition Standard, else 0. - * For now: old IP, old ARP aren't obviously. Lacking correct information, - * we guess that besides new IP and new ARP also IPX and APPLETALK are PHDS. - * (Apple and Novell corporations were involved, among others, in PHDS work). - * Easiest is to assume that everybody else uses that, too. - */ -int -arc_isphds(uint8_t type) -{ - return (type != ARCTYPE_IP_OLD && - type != ARCTYPE_ARP_OLD && - type != ARCTYPE_DIAGNOSE); -} - -/* - * Process a received Arcnet packet; - * the packet is in the mbuf chain m with - * the ARCnet header. - */ -static void -arc_input(struct ifnet *ifp, struct mbuf *m) -{ - pktqueue_t *pktq = NULL; - struct arc_header *ah; - struct ifqueue *inq; - uint8_t atype; - int isr = 0; - int s; - - if ((ifp->if_flags & IFF_UP) == 0) { - m_freem(m); - return; - } - - /* possibly defragment: */ - m = arc_defrag(ifp, m); - if (m == NULL) - return; - - ah = mtod(m, struct arc_header *); - - ifp->if_ibytes += m->m_pkthdr.len; - - if (arcbroadcastaddr == ah->arc_dhost) { - m->m_flags |= M_BCAST|M_MCAST; - ifp->if_imcasts++; - } - - atype = ah->arc_type; - switch (atype) { -#ifdef INET - case ARCTYPE_IP: - m_adj(m, ARC_HDRNEWLEN); - pktq = ip_pktq; - break; - - case ARCTYPE_IP_OLD: - m_adj(m, ARC_HDRLEN); - pktq = ip_pktq; - break; - - case ARCTYPE_ARP: - m_adj(m, ARC_HDRNEWLEN); - isr = NETISR_ARP; - inq = &arpintrq; -#ifdef ARCNET_ALLOW_BROKEN_ARP - mtod(m, struct arphdr *)->ar_pro = htons(ETHERTYPE_IP); -#endif - break; - - case ARCTYPE_ARP_OLD: - m_adj(m, ARC_HDRLEN); - isr = NETISR_ARP; - inq = &arpintrq; -#ifdef ARCNET_ALLOW_BROKEN_ARP - mtod(m, struct arphdr *)->ar_pro = htons(ETHERTYPE_IP); -#endif - break; -#endif -#ifdef INET6 - case ARCTYPE_INET6: - m_adj(m, ARC_HDRNEWLEN); - pktq = ip6_pktq; - break; -#endif - default: - m_freem(m); - return; - } - - s = splnet(); - if (__predict_true(pktq)) { - if (__predict_false(!pktq_enqueue(pktq, m, 0))) { - m_freem(m); - } - splx(s); - return; - } - if (IF_QFULL(inq)) { - IF_DROP(inq); - m_freem(m); - } else { - IF_ENQUEUE(inq, m); - schednetisr(isr); - } - splx(s); -} - -/* - * Convert Arcnet address to printable (loggable) representation. - */ -char * -arc_sprintf(uint8_t *ap) -{ - static char arcbuf[3]; - char *cp = arcbuf; - - *cp++ = hexdigits[*ap >> 4]; - *cp++ = hexdigits[*ap++ & 0xf]; - *cp = 0; - return (arcbuf); -} - -/* - * Perform common duties while attaching to interface list - */ -void -arc_ifattach(struct ifnet *ifp, uint8_t lla) -{ - struct arccom *ac; - - ifp->if_type = IFT_ARCNET; - ifp->if_addrlen = 1; - ifp->if_hdrlen = ARC_HDRLEN; - ifp->if_dlt = DLT_ARCNET; - if (ifp->if_flags & IFF_BROADCAST) - ifp->if_flags |= IFF_MULTICAST|IFF_ALLMULTI; - if (ifp->if_flags & IFF_LINK0 && arc_ipmtu > ARC_PHDS_MAXMTU) - log(LOG_ERR, - "%s: arc_ipmtu is %d, but must not exceed %d\n", - ifp->if_xname, arc_ipmtu, ARC_PHDS_MAXMTU); - - ifp->if_output = arc_output; - ifp->if_input = arc_input; - ac = (struct arccom *)ifp; - ac->ac_seqid = (time_second) & 0xFFFF; /* try to make seqid unique */ - if (lla == 0) { - /* XXX this message isn't entirely clear, to me -- cgd */ - log(LOG_ERR,"%s: link address 0 reserved for broadcasts. Please change it and ifconfig %s down up\n", - ifp->if_xname, ifp->if_xname); - } - if_attach(ifp); - if_set_sadl(ifp, &lla, sizeof(lla), true); - - ifp->if_broadcastaddr = &arcbroadcastaddr; - - bpf_attach(ifp, DLT_ARCNET, ARC_HDRLEN); -} diff --git a/sys/netinet/if_arp.c b/sys/netinet/if_arp.c index 3679d09..a914bf2 100644 --- a/sys/netinet/if_arp.c +++ b/sys/netinet/if_arp.c @@ -114,9 +114,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.169 2015/05/22 07:44:46 ozaki-r Exp $") #include #include "arcnet.h" -#if NARCNET > 0 -#include -#endif #include "fddi.h" #if NFDDI > 0 #include @@ -555,20 +552,6 @@ arp_rtrequest(int req, struct rtentry *rt, const struct rt_addrinfo *info) rt->rt_rmx.rmx_mtu = FDDIIPMTU; break; #endif -#if NARCNET > 0 - case IFT_ARCNET: - { - int arcipifmtu; - - if (ifp->if_flags & IFF_LINK0) - arcipifmtu = arc_ipmtu; - else - arcipifmtu = ARCMTU; - if (ifp->if_mtu > arcipifmtu) - rt->rt_rmx.rmx_mtu = arcipifmtu; - break; - } -#endif } return; } @@ -603,23 +586,6 @@ arp_rtrequest(int req, struct rtentry *rt, const struct rt_addrinfo *info) rt->rt_rmx.rmx_mtu = FDDIIPMTU; break; #endif -#if NARCNET > 0 - case IFT_ARCNET: - { - int arcipifmtu; - if (ifp->if_flags & IFF_LINK0) - arcipifmtu = arc_ipmtu; - else - arcipifmtu = ARCMTU; - - if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0 && - (rt->rt_rmx.rmx_mtu > arcipifmtu || - (rt->rt_rmx.rmx_mtu == 0 && - ifp->if_mtu > arcipifmtu))) - rt->rt_rmx.rmx_mtu = arcipifmtu; - break; - } -#endif } if (rt->rt_flags & RTF_CLONING) break; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 49cd7e7..57510c3 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2154,7 +2154,6 @@ in6_if2idlen(struct ifnet *ifp) case IFT_FDDI: /* RFC2467 */ case IFT_ISO88025: /* RFC2470 (IPv6 over Token Ring) */ case IFT_PPP: /* RFC2472 */ - case IFT_ARCNET: /* RFC2497 */ case IFT_FRELAY: /* RFC2590 */ case IFT_IEEE1394: /* RFC3146 */ case IFT_GIF: /* draft-ietf-v6ops-mech-v2-07 */ diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index cca2481..eba760b 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -393,22 +393,6 @@ in6_get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6) } break; - case IFT_ARCNET: - if (addrlen != 1) - return -1; - if (!addr[0]) - return -1; - - memset(&in6->s6_addr[8], 0, 8); - in6->s6_addr[15] = addr[0]; - - /* - * due to insufficient bitwidth, we mark it local. - */ - in6->s6_addr[8] &= ~EUI64_GBIT; /* g bit to "individual" */ - in6->s6_addr[8] |= EUI64_UBIT; /* u bit to "local" */ - break; - case IFT_GIF: #ifdef IFT_STF case IFT_STF: diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index ed7ac91..6835a61 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -61,7 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.162 2015/04/30 10:00:04 ozaki-r Exp $"); #include #include #include -#include #include #include @@ -227,9 +226,6 @@ nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi) omaxmtu = ndi->maxmtu; switch (ifp->if_type) { - case IFT_ARCNET: - ndi->maxmtu = MIN(ARC_PHDS_MAXMTU, ifp->if_mtu); /* RFC2497 */ - break; case IFT_FDDI: ndi->maxmtu = MIN(FDDIIPMTU, ifp->if_mtu); break; @@ -2361,7 +2357,6 @@ nd6_need_cache(struct ifnet *ifp) * - unidirectional tunnels needs no ND */ switch (ifp->if_type) { - case IFT_ARCNET: case IFT_ETHER: case IFT_FDDI: case IFT_IEEE1394: @@ -2393,9 +2388,6 @@ nd6_storelladdr(const struct ifnet *ifp, const struct rtentry *rt, memcpy(lldst, ifp->if_broadcastaddr, MIN(dstsize, ifp->if_addrlen)); return 1; - case IFT_ARCNET: - *lldst = 0; - return 1; default: m_freem(m); return 0; diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 1bb49e5..a699c6f 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1010,7 +1010,6 @@ const void * nd6_ifptomac(const struct ifnet *ifp) { switch (ifp->if_type) { - case IFT_ARCNET: case IFT_ETHER: case IFT_FDDI: case IFT_IEEE1394: