summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/conf/GENERIC4
-rw-r--r--sys/arch/landisk/conf/GENERIC4
-rw-r--r--sys/arch/landisk/conf/RAMDISK4
-rw-r--r--sys/conf/files8
-rw-r--r--sys/dev/usb/files.usb8
-rw-r--r--sys/dev/usb/ueagle.c1466
-rw-r--r--sys/dev/usb/ueaglereg.h124
-rw-r--r--sys/dev/usb/ueaglevar.h189
-rw-r--r--sys/kern/uipc_domain.c5
-rw-r--r--sys/net/if.c5
-rw-r--r--sys/net/if_atm.h102
-rw-r--r--sys/net/if_atmsubr.c371
-rw-r--r--sys/net/netisr.c4
-rw-r--r--sys/net/netisr.h4
-rw-r--r--sys/netinet/if_atm.c278
-rw-r--r--sys/netinet/if_atm.h41
-rw-r--r--sys/netnatm/natm.c443
-rw-r--r--sys/netnatm/natm.h133
-rw-r--r--sys/netnatm/natm_pcb.c189
-rw-r--r--sys/netnatm/natm_proto.c113
20 files changed, 8 insertions, 3487 deletions
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index 2361f6d976e..91f22e4f01e 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.750 2013/08/15 15:01:48 edd Exp $
+# $OpenBSD: GENERIC,v 1.751 2013/08/20 09:14:13 mpi Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -298,8 +298,6 @@ upgt* at uhub? # Conexant/Intersil PrismGT SoftMAC USB
urtw* at uhub? # RealTek 8187
rsu* at uhub? # RealTek RTL8188SU/RTL8191SU/RTL8192SU
urtwn* at uhub? # RealTek RTL8188CU/RTL8192CU
-#option NATM
-#ueagle* at uhub? # Analog Devices Eagle ADSL
udcf* at uhub? # Gude Expert mouseCLOCK
umbg* at uhub? # Meinberg Funkuhren USB5131
uthum* at uhidev? # TEMPerHUM sensor
diff --git a/sys/arch/landisk/conf/GENERIC b/sys/arch/landisk/conf/GENERIC
index 0ff6a15af55..426fbbf6845 100644
--- a/sys/arch/landisk/conf/GENERIC
+++ b/sys/arch/landisk/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.37 2012/09/27 14:01:35 jsg Exp $
+# $OpenBSD: GENERIC,v 1.38 2013/08/20 09:14:14 mpi Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -152,8 +152,6 @@ run* at uhub? # Ralink RT2700U/RT2800U/RT3000U
rsu* at uhub? # Realtek RTL8188SU/RTL8191SU/RTL8192SU
urtwn* at uhub? # Realtek RTL8188CU/RTL8192CU
zyd* at uhub? # Zydas ZD1211
-#option NATM
-#ueagle* at uhub? # Analog Devices Eagle ADSL
udcf* at uhub? # Gude Expert mouseCLOCK
uthum* at uhidev? # TEMPerHUM sensor
utwitch* at uhidev? # YUREX BBU sensor
diff --git a/sys/arch/landisk/conf/RAMDISK b/sys/arch/landisk/conf/RAMDISK
index 0ccbed6b3ba..60354f1f6eb 100644
--- a/sys/arch/landisk/conf/RAMDISK
+++ b/sys/arch/landisk/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.17 2012/09/27 14:01:35 jsg Exp $
+# $OpenBSD: RAMDISK,v 1.18 2013/08/20 09:14:15 mpi Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -109,8 +109,6 @@ ugen* at uhub? # USB Generic driver
ural* at uhub? # Ralink RT2500USB
rum* at uhub? # Ralink RT2501USB/RT2601USB
zyd* at uhub? # Zydas ZD1211
-#option NATM
-#ueagle* at uhub? # Analog Devices Eagle ADSL
#udcf* at uhub? # Gude Expert mouseCLOCK
#uow* at uhub? # Maxim/Dallas DS2490 1-Wire adapter
#onewire* at uow?
diff --git a/sys/conf/files b/sys/conf/files
index 012b2731d06..ea34117e4d5 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.551 2013/08/13 05:52:22 guenther Exp $
+# $OpenBSD: files,v 1.552 2013/08/20 09:14:15 mpi Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -63,7 +63,6 @@ define onewire_bitbang
# net device attributes - we have generic code for ether(net),
# and fddi.
-define atm
define crypto
define systrace
define ether
@@ -758,7 +757,6 @@ file ntfs/ntfs_vnops.c ntfs
file net/bpf.c bpfilter needs-count
file net/bpf_filter.c bpfilter
file net/if.c
-file net/if_atmsubr.c atm needs-flag
file net/if_ethersubr.c ether | inet | fddi needs-flag
file net/if_fddisubr.c fddi
file net/if_spppsubr.c sppp
@@ -806,7 +804,6 @@ file net80211/ieee80211_pae_output.c wlan
file net80211/ieee80211_proto.c wlan
file net80211/ieee80211_rssadapt.c wlan
file net80211/ieee80211_regdomain.c wlan
-file netinet/if_atm.c atm
file netinet/if_ether.c ether | inet
file netinet/igmp.c inet
file netinet/in.c inet
@@ -885,9 +882,6 @@ file netmpls/mpls_output.c mpls
file netmpls/mpls_proto.c mpls
file netmpls/mpls_raw.c mpls
file netmpls/mpls_shim.c mpls
-file netnatm/natm_pcb.c natm
-file netnatm/natm_proto.c natm
-file netnatm/natm.c natm
file nfs/krpc_subr.c nfsclient
#file nfs/nfs_aiod.c nfsclient
file nfs/nfs_bio.c nfsclient
diff --git a/sys/dev/usb/files.usb b/sys/dev/usb/files.usb
index 72363b4978e..e210db08fd6 100644
--- a/sys/dev/usb/files.usb
+++ b/sys/dev/usb/files.usb
@@ -1,4 +1,4 @@
-# $OpenBSD: files.usb,v 1.106 2013/08/15 15:01:48 edd Exp $
+# $OpenBSD: files.usb,v 1.107 2013/08/20 09:14:17 mpi Exp $
# $NetBSD: files.usb,v 1.16 2000/02/14 20:29:54 augustss Exp $
#
# Config file and device description for machine-independent USB code.
@@ -384,12 +384,6 @@ device otus: ether, ifnet, ifmedia, wlan, firmload
attach otus at uhub
file dev/usb/if_otus.c otus
-# Analog Devices Eagle driver
-device ueagle: atm, ifnet, ezload, firmload
-attach ueagle at uhub
-file dev/usb/ueagle.c ueagle
-
-
# USB logical device
device usbf {}
attach usbf at usbdev
diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c
deleted file mode 100644
index d12fe974811..00000000000
--- a/sys/dev/usb/ueagle.c
+++ /dev/null
@@ -1,1466 +0,0 @@
-/* $OpenBSD: ueagle.c,v 1.38 2013/04/15 09:23:02 mglocker Exp $ */
-
-/*-
- * Copyright (c) 2003-2006
- * Damien Bergamini <damien.bergamini@free.fr>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*-
- * Driver for Analog Devices Eagle chipset.
- * http://www.analog.com/
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/kernel.h>
-#include <sys/kthread.h>
-#include <sys/socket.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_atm.h>
-#include <net/if_media.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_atm.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdi_util.h>
-#include <dev/usb/ezload.h>
-#include <dev/usb/usbdevs.h>
-
-#include <dev/usb/ueaglereg.h>
-#include <dev/usb/ueaglevar.h>
-
-#ifdef USB_DEBUG
-#define DPRINTF(x) do { if (ueagledebug > 0) printf x; } while (0)
-#define DPRINTFN(n, x) do { if (ueagledebug >= (n)) printf x; } while (0)
-int ueagledebug = 0;
-#else
-#define DPRINTF(x)
-#define DPRINTFN(n, x)
-#endif
-
-/* various supported device vendors/products */
-static const struct ueagle_type {
- struct usb_devno dev;
- const char *fw;
-} ueagle_devs[] = {
- { { USB_VENDOR_ANALOG, USB_PRODUCT_ANALOG_EAGLEI }, NULL },
- { { USB_VENDOR_ANALOG, USB_PRODUCT_ANALOG_EAGLEI_NF }, "ueagleI" },
- { { USB_VENDOR_ANALOG, USB_PRODUCT_ANALOG_EAGLEII }, NULL },
- { { USB_VENDOR_ANALOG, USB_PRODUCT_ANALOG_EAGLEII_NF }, "ueagleII" },
- { { USB_VENDOR_ANALOG, USB_PRODUCT_ANALOG_EAGLEIIC }, NULL },
- { { USB_VENDOR_ANALOG, USB_PRODUCT_ANALOG_EAGLEIIC_NF }, "ueagleII" },
- { { USB_VENDOR_ANALOG, USB_PRODUCT_ANALOG_EAGLEIII }, NULL },
- { { USB_VENDOR_ANALOG, USB_PRODUCT_ANALOG_EAGLEIII_NF }, "ueagleIII" },
- { { USB_VENDOR_USR, USB_PRODUCT_USR_HEINEKEN_A }, NULL },
- { { USB_VENDOR_USR, USB_PRODUCT_USR_HEINEKEN_A_NF }, "ueagleI" },
- { { USB_VENDOR_USR, USB_PRODUCT_USR_HEINEKEN_B }, NULL },
- { { USB_VENDOR_USR, USB_PRODUCT_USR_HEINEKEN_B_NF }, "ueagleI" },
- { { USB_VENDOR_USR, USB_PRODUCT_USR_MILLER_A }, NULL },
- { { USB_VENDOR_USR, USB_PRODUCT_USR_MILLER_A_NF }, "ueagleI" },
- { { USB_VENDOR_USR, USB_PRODUCT_USR_MILLER_B }, NULL },
- { { USB_VENDOR_USR, USB_PRODUCT_USR_MILLER_B_NF }, "ueagleI" }
-};
-#define ueagle_lookup(v, p) \
- ((struct ueagle_type *)usb_lookup(ueagle_devs, v, p))
-
-void ueagle_attachhook(void *);
-int ueagle_getesi(struct ueagle_softc *, uint8_t *);
-void ueagle_loadpage(void *);
-void ueagle_request(struct ueagle_softc *, uint16_t, uint16_t,
- void *, int);
-#ifdef USB_DEBUG
-void ueagle_dump_cmv(struct ueagle_softc *, struct ueagle_cmv *);
-#endif
-int ueagle_cr(struct ueagle_softc *, uint32_t, uint16_t,
- uint32_t *);
-int ueagle_cw(struct ueagle_softc *, uint32_t, uint16_t, uint32_t);
-int ueagle_stat(struct ueagle_softc *);
-void ueagle_stat_thread(void *);
-int ueagle_boot(struct ueagle_softc *);
-void ueagle_swap_intr(struct ueagle_softc *, struct ueagle_swap *);
-void ueagle_cmv_intr(struct ueagle_softc *, struct ueagle_cmv *);
-void ueagle_intr(struct usbd_xfer *, void *, usbd_status);
-uint32_t ueagle_crc_update(uint32_t, uint8_t *, int);
-void ueagle_push_cell(struct ueagle_softc *, uint8_t *);
-void ueagle_rxeof(struct usbd_xfer *, void *, usbd_status);
-void ueagle_txeof(struct usbd_xfer *, void *, usbd_status);
-int ueagle_encap(struct ueagle_softc *, struct mbuf *);
-void ueagle_start(struct ifnet *);
-int ueagle_open_vcc(struct ueagle_softc *,
- struct atm_pseudoioctl *);
-int ueagle_close_vcc(struct ueagle_softc *,
- struct atm_pseudoioctl *);
-int ueagle_ioctl(struct ifnet *, u_long, caddr_t);
-int ueagle_open_pipes(struct ueagle_softc *);
-void ueagle_close_pipes(struct ueagle_softc *);
-int ueagle_init(struct ifnet *);
-void ueagle_stop(struct ifnet *, int);
-
-int ueagle_match(struct device *, void *, void *);
-void ueagle_attach(struct device *, struct device *, void *);
-int ueagle_detach(struct device *, int);
-int ueagle_activate(struct device *, int);
-
-struct cfdriver ueagle_cd = {
- NULL, "ueagle", DV_DULL
-};
-
-const struct cfattach ueagle_ca = {
- sizeof(struct ueagle_softc),
- ueagle_match,
- ueagle_attach,
- ueagle_detach,
- ueagle_activate,
-};
-
-int
-ueagle_match(struct device *parent, void *match, void *aux)
-{
- struct usb_attach_arg *uaa = aux;
-
- if (uaa->iface != NULL)
- return UMATCH_NONE;
-
- return (ueagle_lookup(uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
-}
-
-void
-ueagle_attachhook(void *xsc)
-{
- char *firmwares[2];
- struct ueagle_softc *sc = xsc;
-
- firmwares[0] = (char *)sc->fw;
- firmwares[1] = NULL;
-
- if (ezload_downloads_and_reset(sc->sc_udev, firmwares) != 0) {
- printf("%s: could not download firmware\n",
- sc->sc_dev.dv_xname);
- return;
- }
-}
-
-void
-ueagle_attach(struct device *parent, struct device *self, void *aux)
-{
- struct ueagle_softc *sc = (struct ueagle_softc *)self;
- struct usb_attach_arg *uaa = aux;
- struct ifnet *ifp = &sc->sc_if;
- uint8_t addr[ETHER_ADDR_LEN];
-
- sc->sc_udev = uaa->device;
-
- /*
- * Pre-firmware modems must be flashed and reset first. They will
- * automatically detach themselves from the bus and reattach later
- * with a new product Id.
- */
- sc->fw = ueagle_lookup(uaa->vendor, uaa->product)->fw;
- if (sc->fw != NULL) {
- if (rootvp == NULL)
- mountroothook_establish(ueagle_attachhook, sc);
- else
- ueagle_attachhook(sc);
-
- /* processing of pre-firmware modems ends here */
- return;
- }
-
- if (usbd_set_config_no(sc->sc_udev, UEAGLE_CONFIG_NO, 0) != 0) {
- printf("%s: could not set configuration no\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- if (ueagle_getesi(sc, addr) != 0) {
- printf("%s: could not read end system identifier\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- printf("%s: address: %02x:%02x:%02x:%02x:%02x:%02x\n",
- sc->sc_dev.dv_xname, addr[0], addr[1], addr[2], addr[3],
- addr[4], addr[5]);
-
- usb_init_task(&sc->sc_swap_task, ueagle_loadpage, sc,
- USB_TASK_TYPE_GENERIC);
-
- ifp->if_softc = sc;
- ifp->if_flags = IFF_SIMPLEX;
- ifp->if_ioctl = ueagle_ioctl;
- ifp->if_start = ueagle_start;
- IFQ_SET_READY(&ifp->if_snd);
- memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
-
- if_attach(ifp);
- atm_ifattach(ifp);
-
- /* override default MTU value (9180 is too large for us) */
- ifp->if_mtu = UEAGLE_IFMTU;
-
-#if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_RAW, 0);
-#endif
-}
-
-int
-ueagle_detach(struct device *self, int flags)
-{
- struct ueagle_softc *sc = (struct ueagle_softc *)self;
- struct ifnet *ifp = &sc->sc_if;
-
- if (sc->fw != NULL)
- return 0; /* shortcut for pre-firmware devices */
-
- ueagle_stop(ifp, 1);
-
- /* wait for stat thread to exit properly */
- if (sc->stat_thread != NULL) {
- DPRINTFN(3, ("%s: waiting for stat thread to exit\n",
- sc->sc_dev.dv_xname));
-
- tsleep(sc->stat_thread, PZERO, "ueaglestat", 0);
-
- DPRINTFN(3, ("%s: stat thread exited properly\n",
- sc->sc_dev.dv_xname));
- }
-
- if (ifp->if_softc != NULL)
- if_detach(ifp);
-
- return 0;
-}
-
-/*
- * Retrieve the device End System Identifier (MAC address).
- */
-int
-ueagle_getesi(struct ueagle_softc *sc, uint8_t *addr)
-{
- usb_string_descriptor_t us;
- usbd_status error;
- uint16_t c;
- int i, len;
-
- error = usbd_get_string_desc(sc->sc_udev, UEAGLE_ESISTR, 0, &us, &len);
- if (error != 0)
- return error;
-
- if (us.bLength < (6 + 1) * 2)
- return 1;
-
- for (i = 0; i < 6 * 2; i++) {
- if ((c = UGETW(us.bString[i])) & 0xff00)
- return 1; /* not 8-bit clean */
-
- if (i & 1)
- addr[i / 2] <<= 4;
- else
- addr[i / 2] = 0;
-
- if (c >= '0' && c <= '9')
- addr[i / 2] |= c - '0';
- else if (c >= 'a' && c <= 'f')
- addr[i / 2] |= c - 'a' + 10;
- else if (c >= 'A' && c <= 'F')
- addr[i / 2] |= c - 'A' + 10;
- else
- return 1;
- }
-
- return 0;
-}
-
-void
-ueagle_loadpage(void *xsc)
-{
- struct ueagle_softc *sc = xsc;
- struct usbd_xfer *xfer;
- struct ueagle_block_info bi;
- uint16_t pageno = sc->pageno;
- uint16_t ovl = sc->ovl;
- uint8_t pagecount, blockcount;
- uint16_t blockaddr, blocksize;
- uint32_t pageoffset;
- uint8_t *p;
- int i;
-
- if (usbd_is_dying(sc->sc_udev))
- return;
-
- p = sc->dsp;
- pagecount = *p++;
-
- if (pageno >= pagecount) {
- printf("%s: invalid page number %u requested\n",
- sc->sc_dev.dv_xname, pageno);
- return;
- }
-
- p += 4 * pageno;
- pageoffset = UGETDW(p);
- if (pageoffset == 0)
- return;
-
- p = sc->dsp + pageoffset;
- blockcount = *p++;
-
- DPRINTF(("%s: sending %u blocks for fw page %u\n",
- sc->sc_dev.dv_xname, blockcount, pageno));
-
- if ((xfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) {
- printf("%s: could not allocate xfer\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- USETW(bi.wHdr, UEAGLE_BLOCK_INFO_HDR);
- USETW(bi.wOvl, ovl);
- USETW(bi.wOvlOffset, ovl | 0x8000);
-
- for (i = 0; i < blockcount; i++) {
- blockaddr = UGETW(p); p += 2;
- blocksize = UGETW(p); p += 2;
-
- USETW(bi.wSize, blocksize);
- USETW(bi.wAddress, blockaddr);
- USETW(bi.wLast, (i == blockcount - 1) ? 1 : 0);
-
- /* send block info through the IDMA pipe */
- usbd_setup_xfer(xfer, sc->pipeh_idma, sc, &bi, sizeof bi,
- USBD_SYNCHRONOUS, UEAGLE_IDMA_TIMEOUT, NULL);
- if (usbd_transfer(xfer) != 0) {
- printf("%s: could not transfer block info\n",
- sc->sc_dev.dv_xname);
- break;
- }
-
- /* send block data through the IDMA pipe */
- usbd_setup_xfer(xfer, sc->pipeh_idma, sc, p, blocksize,
- USBD_SYNCHRONOUS, UEAGLE_IDMA_TIMEOUT, NULL);
- if (usbd_transfer(xfer) != 0) {
- printf("%s: could not transfer block data\n",
- sc->sc_dev.dv_xname);
- break;
- }
-
- p += blocksize;
- }
-
- usbd_free_xfer(xfer);
-}
-
-void
-ueagle_request(struct ueagle_softc *sc, uint16_t val, uint16_t index,
- void *data, int len)
-{
- usb_device_request_t req;
- usbd_status error;
-
- req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
- req.bRequest = UEAGLE_REQUEST;
- USETW(req.wValue, val);
- USETW(req.wIndex, index);
- USETW(req.wLength, len);
-
- error = usbd_do_request_async(sc->sc_udev, &req, data);
- if (error != USBD_NORMAL_COMPLETION && error != USBD_IN_PROGRESS)
- printf("%s: could not send request\n", sc->sc_dev.dv_xname);
-}
-
-#ifdef USB_DEBUG
-void
-ueagle_dump_cmv(struct ueagle_softc *sc, struct ueagle_cmv *cmv)
-{
- printf(" Preamble: 0x%04x\n", UGETW(cmv->wPreamble));
- printf(" Destination: %s (0x%02x)\n",
- (cmv->bDst == UEAGLE_HOST) ? "Host" : "Modem", cmv->bDst);
- printf(" Type: %u\n", cmv->bFunction >> 4);
- printf(" Subtype: %u\n", cmv->bFunction & 0xf);
- printf(" Index: %u\n", UGETW(cmv->wIndex));
- printf(" Address: %c%c%c%c.%u\n",
- cmv->dwSymbolicAddress[1], cmv->dwSymbolicAddress[0],
- cmv->dwSymbolicAddress[3], cmv->dwSymbolicAddress[2],
- UGETW(cmv->wOffsetAddress));
- printf(" Data: 0x%08x\n", UGETDATA(cmv->dwData));
-}
-#endif
-
-int
-ueagle_cr(struct ueagle_softc *sc, uint32_t address, uint16_t offset,
- uint32_t *data)
-{
- struct ueagle_cmv cmv;
- usbd_status error;
- int s;
-
- USETW(cmv.wPreamble, UEAGLE_CMV_PREAMBLE);
- cmv.bDst = UEAGLE_MODEM;
- cmv.bFunction = UEAGLE_CR;
- USETW(cmv.wIndex, sc->index);
- USETW(cmv.wOffsetAddress, offset);
- USETDW(cmv.dwSymbolicAddress, address);
- USETDATA(cmv.dwData, 0);
-
-#ifdef USB_DEBUG
- if (ueagledebug >= 15) {
- printf("%s: reading CMV\n", sc->sc_dev.dv_xname);
- ueagle_dump_cmv(sc, &cmv);
- }
-#endif
-
- s = splusb();
-
- ueagle_request(sc, UEAGLE_SETBLOCK, UEAGLE_MPTXSTART, &cmv, sizeof cmv);
-
- /* wait at most 2 seconds for an answer */
- error = tsleep(UEAGLE_COND_CMV(sc), PZERO, "cmv", 2 * hz);
- if (error != 0) {
- printf("%s: timeout waiting for CMV ack\n",
- sc->sc_dev.dv_xname);
- splx(s);
- return error;
- }
-
- *data = sc->data;
- splx(s);
-
- return 0;
-}
-
-int
-ueagle_cw(struct ueagle_softc *sc, uint32_t address, uint16_t offset,
- uint32_t data)
-{
- struct ueagle_cmv cmv;
- usbd_status error;
- int s;
-
- USETW(cmv.wPreamble, UEAGLE_CMV_PREAMBLE);
- cmv.bDst = UEAGLE_MODEM;
- cmv.bFunction = UEAGLE_CW;
- USETW(cmv.wIndex, sc->index);
- USETW(cmv.wOffsetAddress, offset);
- USETDW(cmv.dwSymbolicAddress, address);
- USETDATA(cmv.dwData, data);
-
-#ifdef USB_DEBUG
- if (ueagledebug >= 15) {
- printf("%s: writing CMV\n", sc->sc_dev.dv_xname);
- ueagle_dump_cmv(sc, &cmv);
- }
-#endif
-
- s = splusb();
-
- ueagle_request(sc, UEAGLE_SETBLOCK, UEAGLE_MPTXSTART, &cmv, sizeof cmv);
-
- /* wait at most 2 seconds for an answer */
- error = tsleep(UEAGLE_COND_CMV(sc), PZERO, "cmv", 2 * hz);
- if (error != 0) {
- printf("%s: timeout waiting for CMV ack\n",
- sc->sc_dev.dv_xname);
- splx(s);
- return error;
- }
-
- splx(s);
-
- return 0;
-}
-
-int
-ueagle_stat(struct ueagle_softc *sc)
-{
- struct ifnet *ifp = &sc->sc_if;
- uint32_t data;
- usbd_status error;
-#define CR(sc, address, offset, data) do { \
- if ((error = ueagle_cr(sc, address, offset, data)) != 0) \
- return error; \
-} while (0)
-
- CR(sc, UEAGLE_CMV_STAT, 0, &sc->stats.phy.status);
- switch ((sc->stats.phy.status >> 8) & 0xf) {
- case 0: /* idle */
- DPRINTFN(3, ("%s: waiting for synchronization\n",
- sc->sc_dev.dv_xname));
- return ueagle_cw(sc, UEAGLE_CMV_CNTL, 0, 2);
-
- case 1: /* initialization */
- DPRINTFN(3, ("%s: initializing\n", sc->sc_dev.dv_xname));
- return ueagle_cw(sc, UEAGLE_CMV_CNTL, 0, 2);
-
- case 2: /* operational */
- DPRINTFN(4, ("%s: operational\n", sc->sc_dev.dv_xname));
- break;
-
- default: /* fail ... */
- DPRINTFN(3, ("%s: synchronization failed\n",
- sc->sc_dev.dv_xname));
- ueagle_init(ifp);
- return 1;
- }
-
- CR(sc, UEAGLE_CMV_DIAG, 1, &sc->stats.phy.flags);
- if (sc->stats.phy.flags & 0x10) {
- DPRINTF(("%s: delineation LOSS\n", sc->sc_dev.dv_xname));
- sc->stats.phy.status = 0;
- ueagle_init(ifp);
- return 1;
- }
-
- CR(sc, UEAGLE_CMV_RATE, 0, &data);
- sc->stats.phy.dsrate = ((data >> 16) & 0x1ff) * 32;
- sc->stats.phy.usrate = (data & 0xff) * 32;
-
- CR(sc, UEAGLE_CMV_DIAG, 23, &data);
- sc->stats.phy.attenuation = (data & 0xff) / 2;
-
- CR(sc, UEAGLE_CMV_DIAG, 3, &sc->stats.atm.cells_crc_errors);
- CR(sc, UEAGLE_CMV_DIAG, 22, &sc->stats.phy.dserror);
- CR(sc, UEAGLE_CMV_DIAG, 25, &sc->stats.phy.dsmargin);
- CR(sc, UEAGLE_CMV_DIAG, 46, &sc->stats.phy.userror);
- CR(sc, UEAGLE_CMV_DIAG, 49, &sc->stats.phy.usmargin);
- CR(sc, UEAGLE_CMV_DIAG, 51, &sc->stats.phy.rxflow);
- CR(sc, UEAGLE_CMV_DIAG, 52, &sc->stats.phy.txflow);
- CR(sc, UEAGLE_CMV_DIAG, 54, &sc->stats.phy.dsunc);
- CR(sc, UEAGLE_CMV_DIAG, 58, &sc->stats.phy.usunc);
- CR(sc, UEAGLE_CMV_INFO, 8, &sc->stats.phy.vidco);
- CR(sc, UEAGLE_CMV_INFO, 14, &sc->stats.phy.vidcpe);
-
- if (sc->pipeh_tx != NULL)
- return 0;
-
- return ueagle_open_pipes(sc);
-#undef CR
-}
-
-void
-ueagle_stat_thread(void *arg)
-{
- struct ueagle_softc *sc = arg;
-
- for (;;) {
- if (ueagle_stat(sc) != 0)
- break;
-
- usbd_delay_ms(sc->sc_udev, 5000);
- if (usbd_is_dying(sc->sc_udev))
- break;
- }
-
- wakeup(sc->stat_thread);
-
- kthread_exit(0);
-}
-
-int
-ueagle_boot(struct ueagle_softc *sc)
-{
- uint16_t zero = 0; /* ;-) */
- usbd_status error;
-#define CW(sc, address, offset, data) do { \
- if ((error = ueagle_cw(sc, address, offset, data)) != 0) \
- return error; \
-} while (0)
-
- ueagle_request(sc, UEAGLE_SETMODE, UEAGLE_BOOTIDMA, NULL, 0);
- ueagle_request(sc, UEAGLE_SETMODE, UEAGLE_STARTRESET, NULL, 0);
-
- usbd_delay_ms(sc->sc_udev, 200);
-
- ueagle_request(sc, UEAGLE_SETMODE, UEAGLE_ENDRESET, NULL, 0);
- ueagle_request(sc, UEAGLE_SET2183DATA, UEAGLE_MPTXMAILBOX, &zero, 2);
- ueagle_request(sc, UEAGLE_SET2183DATA, UEAGLE_MPRXMAILBOX, &zero, 2);
- ueagle_request(sc, UEAGLE_SET2183DATA, UEAGLE_SWAPMAILBOX, &zero, 2);
-
- usbd_delay_ms(sc->sc_udev, 1000);
-
- sc->pageno = 0;
- sc->ovl = 0;
- ueagle_loadpage(sc);
-
- /* wait until modem reaches operational state */
- error = tsleep(UEAGLE_COND_READY(sc), PZERO | PCATCH, "boot", 10 * hz);
- if (error != 0) {
- printf("%s: timeout waiting for operational state\n",
- sc->sc_dev.dv_xname);
- return error;
- }
-
- CW(sc, UEAGLE_CMV_CNTL, 0, 1);
-
- /* send configuration options */
- CW(sc, UEAGLE_CMV_OPTN, 0, UEAGLE_OPTN0);
- CW(sc, UEAGLE_CMV_OPTN, 2, UEAGLE_OPTN2);
- CW(sc, UEAGLE_CMV_OPTN, 7, UEAGLE_OPTN7);
-
- /* continue with synchronization */
- CW(sc, UEAGLE_CMV_CNTL, 0, 2);
-
- return kthread_create(ueagle_stat_thread, sc, &sc->stat_thread,
- sc->sc_dev.dv_xname);
-#undef CW
-}
-
-void
-ueagle_swap_intr(struct ueagle_softc *sc, struct ueagle_swap *swap)
-{
-#define rotbr(v, n) ((v) >> (n) | (v) << (8 - (n)))
- sc->pageno = swap->bPageNo;
- sc->ovl = rotbr(swap->bOvl, 4);
-
- usb_add_task(sc->sc_udev, &sc->sc_swap_task);
-#undef rotbr
-}
-
-/*
- * This function handles spontaneous CMVs and CMV acknowledgements sent by the
- * modem on the interrupt pipe.
- */
-void
-ueagle_cmv_intr(struct ueagle_softc *sc, struct ueagle_cmv *cmv)
-{
-#ifdef USB_DEBUG
- if (ueagledebug >= 15) {
- printf("%s: receiving CMV\n", sc->sc_dev.dv_xname);
- ueagle_dump_cmv(sc, cmv);
- }
-#endif
-
- if (UGETW(cmv->wPreamble) != UEAGLE_CMV_PREAMBLE) {
- printf("%s: received CMV with invalid preamble\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- if (cmv->bDst != UEAGLE_HOST) {
- printf("%s: received CMV with bad direction\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /* synchronize our current CMV index with the modem */
- sc->index = UGETW(cmv->wIndex) + 1;
-
- switch (cmv->bFunction) {
- case UEAGLE_MODEMREADY:
- wakeup(UEAGLE_COND_READY(sc));
- break;
-
- case UEAGLE_CR_ACK:
- sc->data = UGETDATA(cmv->dwData);
- /* FALLTHROUGH */
- case UEAGLE_CW_ACK:
- wakeup(UEAGLE_COND_CMV(sc));
- break;
- }
-}
-
-void
-ueagle_intr(struct usbd_xfer *xfer, void *priv, usbd_status status)
-{
- struct ueagle_softc *sc = priv;
- struct ueagle_intr *intr;
-
- if (status != USBD_NORMAL_COMPLETION) {
- if (status == USBD_NOT_STARTED || status == USBD_CANCELLED)
- return;
-
- DPRINTF(("%s: abnormal interrupt status: %s\n",
- sc->sc_dev.dv_xname, usbd_errstr(status)));
-
- usbd_clear_endpoint_stall_async(sc->pipeh_intr);
- return;
- }
-
- intr = (struct ueagle_intr *)sc->ibuf;
- switch (UGETW(intr->wInterrupt)) {
- case UEAGLE_INTR_SWAP:
- ueagle_swap_intr(sc, (struct ueagle_swap *)(intr + 1));
- break;
-
- case UEAGLE_INTR_CMV:
- ueagle_cmv_intr(sc, (struct ueagle_cmv *)(intr + 1));
- break;
-
- default:
- printf("%s: caught unknown interrupt\n",
- sc->sc_dev.dv_xname);
- }
-}
-
-static const uint32_t ueagle_crc32_table[256] = {
- 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc,
- 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f,
- 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a,
- 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,
- 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8,
- 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
- 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e,
- 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,
- 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84,
- 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027,
- 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022,
- 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
- 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077,
- 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c,
- 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1,
- 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,
- 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb,
- 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
- 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d,
- 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,
- 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f,
- 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044,
- 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689,
- 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
- 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683,
- 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59,
- 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c,
- 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,
- 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e,
- 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
- 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48,
- 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,
- 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2,
- 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601,
- 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604,
- 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
- 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6,
- 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad,
- 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7,
- 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,
- 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd,
- 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
- 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b,
- 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,
- 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679,
- 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12,
- 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af,
- 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
- 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5,
- 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06,
- 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03,
- 0xb1f740b4
-};
-
-uint32_t
-ueagle_crc_update(uint32_t crc, uint8_t *buf, int len)
-{
- for (; len != 0; len--, buf++)
- crc = ueagle_crc32_table[(crc >> 24) ^ *buf] ^ (crc << 8);
-
- return crc;
-}
-
-/*
- * Reassembly part of the software ATM AAL5 SAR.
- */
-void
-ueagle_push_cell(struct ueagle_softc *sc, uint8_t *cell)
-{
- struct ueagle_vcc *vcc = &sc->vcc;
- struct ifnet *ifp;
- struct mbuf *m;
- uint32_t crc;
- uint16_t pdulen, totlen;
- int s;
-
- sc->stats.atm.cells_received++;
-
- if (!(vcc->flags & UEAGLE_VCC_ACTIVE) ||
- ATM_CH_GETVPI(cell) != vcc->vpi ||
- ATM_CH_GETVCI(cell) != vcc->vci) {
- sc->stats.atm.vcc_no_conn++;
- return;
- }
-
- if (vcc->flags & UEAGLE_VCC_DROP) {
- if (ATM_CH_ISLASTCELL(cell)) {
- vcc->flags &= ~UEAGLE_VCC_DROP;
- sc->stats.atm.cspdus_dropped++;
- }
-
- sc->stats.atm.cells_dropped++;
- return;
- }
-
- if (vcc->m == NULL) {
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == NULL) {
- vcc->flags |= UEAGLE_VCC_DROP;
- return;
- }
-
- MCLGET(m, M_DONTWAIT);
- if (!(m->m_flags & M_EXT)) {
- vcc->flags |= UEAGLE_VCC_DROP;
- m_freem(m);
- return;
- }
-
- vcc->m = m;
- vcc->dst = mtod(m, uint8_t *);
- vcc->limit = vcc->dst + MCLBYTES - ATM_CELL_PAYLOAD_SIZE;
- }
-
- if (vcc->dst > vcc->limit) {
- vcc->flags |= UEAGLE_VCC_DROP;
- sc->stats.atm.cells_dropped++;
- goto fail;
- }
-
- memcpy(vcc->dst, cell + ATM_CELL_HEADER_SIZE, ATM_CELL_PAYLOAD_SIZE);
- vcc->dst += ATM_CELL_PAYLOAD_SIZE;
-
- if (!ATM_CH_ISLASTCELL(cell))
- return;
-
- /*
- * Handle the last cell of the AAL5 CPCS-PDU.
- */
- m = vcc->m;
-
- totlen = vcc->dst - mtod(m, uint8_t *);
- pdulen = AAL5_TR_GETPDULEN(cell);
-
- if (totlen < pdulen + AAL5_TRAILER_SIZE) {
- sc->stats.atm.cspdus_dropped++;
- goto fail;
- }
-
- if (totlen >= pdulen + ATM_CELL_PAYLOAD_SIZE + AAL5_TRAILER_SIZE) {
- sc->stats.atm.cspdus_dropped++;
- goto fail;
- }
-
- crc = ueagle_crc_update(CRC_INITIAL, mtod(m, uint8_t *), totlen);
- if (crc != CRC_MAGIC) {
- sc->stats.atm.cspdus_crc_errors++;
- goto fail;
- }
-
- /* finalize mbuf */
- ifp = &sc->sc_if;
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = m->m_len = pdulen;
-
- sc->stats.atm.cspdus_received++;
-
- s = splnet();
-
-#if NBPFILTER > 0
- if (ifp->if_bpf != NULL)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
- /* send the AAL5 CPCS-PDU to the ATM layer */
- ifp->if_ipackets++;
- atm_input(ifp, &vcc->aph, m, vcc->rxhand);
- vcc->m = NULL;
-
- splx(s);
-
- return;
-
-fail: m_freem(vcc->m);
- vcc->m = NULL;
-}
-
-void
-ueagle_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
-{
- struct ueagle_isoreq *req = priv;
- struct ueagle_softc *sc = req->sc;
- uint32_t count;
- uint8_t *p;
- int i;
-
- if (status == USBD_CANCELLED)
- return;
-
- for (i = 0; i < UEAGLE_NISOFRMS; i++) {
- count = req->frlengths[i];
- p = req->offsets[i];
-
- while (count >= ATM_CELL_SIZE) {
- ueagle_push_cell(sc, p);
- p += ATM_CELL_SIZE;
- count -= ATM_CELL_SIZE;
- }
-#ifdef DIAGNOSTIC
- if (count > 0) {
- printf("%s: truncated cell (%u bytes)\n",
- sc->sc_dev.dv_xname, count);
- }
-#endif
- req->frlengths[i] = sc->isize;
- }
-
- usbd_setup_isoc_xfer(req->xfer, sc->pipeh_rx, req, req->frlengths,
- UEAGLE_NISOFRMS, USBD_NO_COPY, ueagle_rxeof);
- usbd_transfer(xfer);
-}
-
-void
-ueagle_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
-{
- struct ueagle_txreq *req = priv;
- struct ueagle_softc *sc = req->sc;
- struct ifnet *ifp = &sc->sc_if;
- int s;
-
- if (status != USBD_NORMAL_COMPLETION) {
- if (status == USBD_NOT_STARTED || status == USBD_CANCELLED)
- return;
-
- printf("%s: could not transmit buffer: %s\n",
- sc->sc_dev.dv_xname, usbd_errstr(status));
-
- if (status == USBD_STALLED)
- usbd_clear_endpoint_stall_async(sc->pipeh_tx);
-
- ifp->if_oerrors++;
- return;
- }
-
- s = splnet();
-
- ifp->if_opackets++;
- ifp->if_flags &= ~IFF_OACTIVE;
- ueagle_start(ifp);
-
- splx(s);
-}
-
-/*
- * Segmentation part of the software ATM AAL5 SAR.
- */
-int
-ueagle_encap(struct ueagle_softc *sc, struct mbuf *m0)
-{
- struct ueagle_vcc *vcc = &sc->vcc;
- struct ueagle_txreq *req;
- struct mbuf *m;
- uint8_t *src, *dst;
- uint32_t crc;
- int n, cellleft, mleft;
- usbd_status error;
-
- req = &sc->txreqs[0];
-
- m_adj(m0, sizeof (struct atm_pseudohdr));
-
- dst = req->buf;
- cellleft = 0;
- crc = CRC_INITIAL;
-
- for (m = m0; m != NULL; m = m->m_next) {
- src = mtod(m, uint8_t *);
- mleft = m->m_len;
-
- crc = ueagle_crc_update(crc, src, mleft);
-
- if (cellleft != 0) {
- n = min(mleft, cellleft);
-
- memcpy(dst, src, n);
- dst += n;
- src += n;
- cellleft -= n;
- mleft -= n;
- }
-
- while (mleft >= ATM_CELL_PAYLOAD_SIZE) {
- memcpy(dst, vcc->ch, ATM_CELL_HEADER_SIZE);
- dst += ATM_CELL_HEADER_SIZE;
- memcpy(dst, src, ATM_CELL_PAYLOAD_SIZE);
- dst += ATM_CELL_PAYLOAD_SIZE;
- src += ATM_CELL_PAYLOAD_SIZE;
- mleft -= ATM_CELL_PAYLOAD_SIZE;
- sc->stats.atm.cells_transmitted++;
- }
-
- if (mleft != 0) {
- memcpy(dst, vcc->ch, ATM_CELL_HEADER_SIZE);
- dst += ATM_CELL_HEADER_SIZE;
- memcpy(dst, src, mleft);
- dst += mleft;
- cellleft = ATM_CELL_PAYLOAD_SIZE - mleft;
- sc->stats.atm.cells_transmitted++;
- }
- }
-
- /*
- * If there is not enough space to put the AAL5 trailer into this cell,
- * pad the content of this cell with zeros and create a new cell which
- * will contain no data except the AAL5 trailer itself.
- */
- if (cellleft < AAL5_TRAILER_SIZE) {
- memset(dst, 0, cellleft);
- crc = ueagle_crc_update(crc, dst, cellleft);
- dst += cellleft;
-
- memcpy(dst, vcc->ch, ATM_CELL_HEADER_SIZE);
- dst += ATM_CELL_HEADER_SIZE;
- cellleft = ATM_CELL_PAYLOAD_SIZE;
- sc->stats.atm.cells_transmitted++;
- }
-
- /*
- * Fill the AAL5 CPCS-PDU trailer.
- */
- memset(dst, 0, cellleft - AAL5_TRAILER_SIZE);
-
- /* src now points to the beginning of the last cell */
- src = dst + cellleft - ATM_CELL_SIZE;
- ATM_CH_SETPTFLAGS(src, 1);
-
- AAL5_TR_SETCPSUU(src, 0);
- AAL5_TR_SETCPI(src, 0);
- AAL5_TR_SETPDULEN(src, m0->m_pkthdr.len);
-
- crc = ~ueagle_crc_update(crc, dst, cellleft - 4);
- AAL5_TR_SETCRC(src, crc);
-
- usbd_setup_xfer(req->xfer, sc->pipeh_tx, req, req->buf,
- dst + cellleft - req->buf, USBD_FORCE_SHORT_XFER | USBD_NO_COPY,
- UEAGLE_TX_TIMEOUT, ueagle_txeof);
-
- error = usbd_transfer(req->xfer);
- if (error != USBD_NORMAL_COMPLETION && error != USBD_IN_PROGRESS)
- return error;
-
- sc->stats.atm.cspdus_transmitted++;
-
- return 0;
-}
-
-void
-ueagle_start(struct ifnet *ifp)
-{
- struct ueagle_softc *sc = ifp->if_softc;
- struct mbuf *m0;
-
- /* nothing goes out until modem is synchronized and VCC is opened */
- if (!(sc->vcc.flags & UEAGLE_VCC_ACTIVE))
- return;
-
- if (sc->pipeh_tx == NULL)
- return;
-
- IFQ_POLL(&ifp->if_snd, m0);
- if (m0 == NULL)
- return;
- IFQ_DEQUEUE(&ifp->if_snd, m0);
-
- if (ueagle_encap(sc, m0) != 0) {
- m_freem(m0);
- return;
- }
-
-#if NBPFILTER > 0
- if (ifp->if_bpf != NULL)
- bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT);
-#endif
-
- m_freem(m0);
-
- ifp->if_flags |= IFF_OACTIVE;
-}
-
-int
-ueagle_open_vcc(struct ueagle_softc *sc, struct atm_pseudoioctl *api)
-{
- struct ueagle_vcc *vcc = &sc->vcc;
-
- DPRINTF(("%s: opening ATM VCC\n", sc->sc_dev.dv_xname));
-
- vcc->vpi = ATM_PH_VPI(&api->aph);
- vcc->vci = ATM_PH_VCI(&api->aph);
- vcc->rxhand = api->rxhand;
- vcc->m = NULL;
- vcc->aph = api->aph;
- vcc->flags = UEAGLE_VCC_ACTIVE;
-
- /* pre-calculate cell headers (HEC field is set by hardware) */
- ATM_CH_FILL(vcc->ch, 0, vcc->vpi, vcc->vci, 0, 0, 0);
-
- return 0;
-}
-
-int
-ueagle_close_vcc(struct ueagle_softc *sc, struct atm_pseudoioctl *api)
-{
- DPRINTF(("%s: closing ATM VCC\n", sc->sc_dev.dv_xname));
-
- sc->vcc.flags &= ~UEAGLE_VCC_ACTIVE;
-
- return 0;
-}
-
-int
-ueagle_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
-{
- struct ueagle_softc *sc = ifp->if_softc;
- struct atm_pseudoioctl *api;
- struct ifaddr *ifa;
- struct ifreq *ifr;
- int s, error = 0;
-
- s = splnet();
-
- switch (cmd) {
- case SIOCSIFADDR:
- ifa = (struct ifaddr *)data;
- ifp->if_flags |= IFF_UP;
-
- ueagle_init(ifp);
-#ifdef INET
- ifa->ifa_rtrequest = atm_rtrequest;
-#endif
- break;
-
- case SIOCSIFFLAGS:
- if (ifp->if_flags & IFF_UP) {
- if (!(ifp->if_flags & IFF_RUNNING))
- ueagle_init(ifp);
- } else {
- if (ifp->if_flags & IFF_RUNNING)
- ueagle_stop(ifp, 1);
- }
- break;
-
- case SIOCSIFMTU:
- ifr = (struct ifreq *)data;
-
- if (ifr->ifr_mtu > UEAGLE_IFMTU)
- error = EINVAL;
- else
- ifp->if_mtu = ifr->ifr_mtu;
- break;
-
- case SIOCATMENA:
- api = (struct atm_pseudoioctl *)data;
- error = ueagle_open_vcc(sc, api);
- break;
-
- case SIOCATMDIS:
- api = (struct atm_pseudoioctl *)data;
- error = ueagle_close_vcc(sc, api);
- break;
-
- default:
- error = EINVAL;
- }
-
- splx(s);
-
- return error;
-}
-
-int
-ueagle_open_pipes(struct ueagle_softc *sc)
-{
- usb_endpoint_descriptor_t *edesc;
- struct usbd_interface *iface;
- struct ueagle_txreq *txreq;
- struct ueagle_isoreq *isoreq;
- usbd_status error;
- uint8_t *buf;
- int i, j;
-
- error = usbd_device2interface_handle(sc->sc_udev, UEAGLE_US_IFACE_NO,
- &iface);
- if (error != 0) {
- printf("%s: could not get tx interface handle\n",
- sc->sc_dev.dv_xname);
- goto fail;
- }
-
- error = usbd_open_pipe(iface, UEAGLE_TX_PIPE, USBD_EXCLUSIVE_USE,
- &sc->pipeh_tx);
- if (error != 0) {
- printf("%s: could not open tx pipe\n", sc->sc_dev.dv_xname);
- goto fail;
- }
-
- for (i = 0; i < UEAGLE_TX_LIST_CNT; i++) {
- txreq = &sc->txreqs[i];
-
- txreq->sc = sc;
-
- txreq->xfer = usbd_alloc_xfer(sc->sc_udev);
- if (txreq->xfer == NULL) {
- printf("%s: could not allocate tx xfer\n",
- sc->sc_dev.dv_xname);
- error = ENOMEM;
- goto fail;
- }
-
- txreq->buf = usbd_alloc_buffer(txreq->xfer, UEAGLE_TXBUFLEN);
- if (txreq->buf == NULL) {
- printf("%s: could not allocate tx buffer\n",
- sc->sc_dev.dv_xname);
- error = ENOMEM;
- goto fail;
- }
- }
-
- error = usbd_device2interface_handle(sc->sc_udev, UEAGLE_DS_IFACE_NO,
- &iface);
- if (error != 0) {
- printf("%s: could not get rx interface handle\n",
- sc->sc_dev.dv_xname);
- goto fail;
- }
-
- /* XXX: alternative interface number sould depend on downrate */
- error = usbd_set_interface(iface, 8);
- if (error != 0) {
- printf("%s: could not set rx alternative interface\n",
- sc->sc_dev.dv_xname);
- goto fail;
- }
-
- edesc = usbd_get_endpoint_descriptor(iface, UEAGLE_RX_PIPE);
- if (edesc == NULL) {
- printf("%s: could not get rx endpoint descriptor\n",
- sc->sc_dev.dv_xname);
- error = EIO;
- goto fail;
- }
-
- sc->isize = UGETW(edesc->wMaxPacketSize);
-
- error = usbd_open_pipe(iface, UEAGLE_RX_PIPE, USBD_EXCLUSIVE_USE,
- &sc->pipeh_rx);
- if (error != 0) {
- printf("%s: could not open rx pipe\n", sc->sc_dev.dv_xname);
- goto fail;
- }
-
- for (i = 0; i < UEAGLE_NISOREQS; i++) {
- isoreq = &sc->isoreqs[i];
-
- isoreq->sc = sc;
-
- isoreq->xfer = usbd_alloc_xfer(sc->sc_udev);
- if (isoreq->xfer == NULL) {
- printf("%s: could not allocate rx xfer\n",
- sc->sc_dev.dv_xname);
- error = ENOMEM;
- goto fail;
- }
-
- buf = usbd_alloc_buffer(isoreq->xfer,
- sc->isize * UEAGLE_NISOFRMS);
- if (buf == NULL) {
- printf("%s: could not allocate rx buffer\n",
- sc->sc_dev.dv_xname);
- error = ENOMEM;
- goto fail;
- }
-
- for (j = 0; j < UEAGLE_NISOFRMS; j++) {
- isoreq->frlengths[j] = sc->isize;
- isoreq->offsets[j] = buf + j * sc->isize;
- }
-
- usbd_setup_isoc_xfer(isoreq->xfer, sc->pipeh_rx, isoreq,
- isoreq->frlengths, UEAGLE_NISOFRMS, USBD_NO_COPY,
- ueagle_rxeof);
- usbd_transfer(isoreq->xfer);
- }
-
- ueagle_request(sc, UEAGLE_SETMODE, UEAGLE_LOOPBACKOFF, NULL, 0);
-
- return 0;
-
-fail: ueagle_close_pipes(sc);
- return error;
-}
-
-void
-ueagle_close_pipes(struct ueagle_softc *sc)
-{
- int i;
-
- ueagle_request(sc, UEAGLE_SETMODE, UEAGLE_LOOPBACKON, NULL, 0);
-
- /* free Tx resources */
- if (sc->pipeh_tx != NULL) {
- usbd_abort_pipe(sc->pipeh_tx);
- usbd_close_pipe(sc->pipeh_tx);
- sc->pipeh_tx = NULL;
- }
-
- for (i = 0; i < UEAGLE_TX_LIST_CNT; i++) {
- if (sc->txreqs[i].xfer != NULL) {
- usbd_free_xfer(sc->txreqs[i].xfer);
- sc->txreqs[i].xfer = NULL;
- }
- }
-
- /* free Rx resources */
- if (sc->pipeh_rx != NULL) {
- usbd_abort_pipe(sc->pipeh_rx);
- usbd_close_pipe(sc->pipeh_rx);
- sc->pipeh_rx = NULL;
- }
-
- for (i = 0; i < UEAGLE_NISOREQS; i++) {
- if (sc->isoreqs[i].xfer != NULL) {
- usbd_free_xfer(sc->isoreqs[i].xfer);
- sc->isoreqs[i].xfer = NULL;
- }
- }
-}
-
-int
-ueagle_init(struct ifnet *ifp)
-{
- struct ueagle_softc *sc = ifp->if_softc;
- struct usbd_interface *iface;
- usbd_status error;
- size_t len;
-
- ueagle_stop(ifp, 0);
-
- error = usbd_device2interface_handle(sc->sc_udev, UEAGLE_US_IFACE_NO,
- &iface);
- if (error != 0) {
- printf("%s: could not get idma interface handle\n",
- sc->sc_dev.dv_xname);
- goto fail;
- }
-
- error = usbd_open_pipe(iface, UEAGLE_IDMA_PIPE, USBD_EXCLUSIVE_USE,
- &sc->pipeh_idma);
- if (error != 0) {
- printf("%s: could not open idma pipe\n",
- sc->sc_dev.dv_xname);
- goto fail;
- }
-
- error = usbd_device2interface_handle(sc->sc_udev, UEAGLE_INTR_IFACE_NO,
- &iface);
- if (error != 0) {
- printf("%s: could not get interrupt interface handle\n",
- sc->sc_dev.dv_xname);
- goto fail;
- }
-
- error = loadfirmware("ueagle-dsp", &sc->dsp, &len);
- if (error != 0) {
- printf("%s: could not load firmware\n", sc->sc_dev.dv_xname);
- goto fail;
- }
-
- error = usbd_open_pipe_intr(iface, UEAGLE_INTR_PIPE, USBD_SHORT_XFER_OK,
- &sc->pipeh_intr, sc, sc->ibuf, UEAGLE_INTR_MAXSIZE, ueagle_intr,
- UEAGLE_INTR_INTERVAL);
- if (error != 0) {
- printf("%s: could not open interrupt pipe\n",
- sc->sc_dev.dv_xname);
- goto fail;
- }
-
- error = ueagle_boot(sc);
- if (error != 0) {
- printf("%s: could not boot modem\n", sc->sc_dev.dv_xname);
- goto fail;
- }
-
- /*
- * Opening of tx and rx pipes if deferred after synchronization is
- * established.
- */
-
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- return 0;
-
-fail: ueagle_stop(ifp, 1);
- return error;
-}
-
-void
-ueagle_stop(struct ifnet *ifp, int disable)
-{
- struct ueagle_softc *sc = ifp->if_softc;
-
- /* stop any pending task */
- usb_rem_task(sc->sc_udev, &sc->sc_swap_task);
-
- /* free Tx and Rx resources */
- ueagle_close_pipes(sc);
-
- /* free firmware */
- if (sc->dsp != NULL) {
- free(sc->dsp, M_DEVBUF);
- sc->dsp = NULL;
- }
-
- /* free interrupt resources */
- if (sc->pipeh_intr != NULL) {
- usbd_abort_pipe(sc->pipeh_intr);
- usbd_close_pipe(sc->pipeh_intr);
- sc->pipeh_intr = NULL;
- }
-
- /* free IDMA resources */
- if (sc->pipeh_idma != NULL) {
- usbd_abort_pipe(sc->pipeh_idma);
- usbd_close_pipe(sc->pipeh_idma);
- sc->pipeh_idma = NULL;
- }
-
- /* reset statistics */
- memset(&sc->stats, 0, sizeof (struct ueagle_stats));
-
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-}
-
-int
-ueagle_activate(struct device *self, int act)
-{
- struct ueagle_softc *sc = (struct ueagle_softc *)self;
-
- switch (act) {
- case DVACT_DEACTIVATE:
- usbd_deactivate(sc->sc_udev);
- break;
- }
-
- return 0;
-}
diff --git a/sys/dev/usb/ueaglereg.h b/sys/dev/usb/ueaglereg.h
deleted file mode 100644
index 8b3efbc153a..00000000000
--- a/sys/dev/usb/ueaglereg.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* $OpenBSD: ueaglereg.h,v 1.3 2007/06/09 11:06:53 mbalmer Exp $ */
-
-/*-
- * Copyright (c) 2003-2005
- * Damien Bergamini <damien.bergamini@free.fr>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* OPTN: default values from analog devices */
-#ifndef UEAGLE_OPTN0
-#define UEAGLE_OPTN0 0x80020066
-#endif
-#ifndef UEAGLE_OPTN2
-#define UEAGLE_OPTN2 0x23700000
-#endif
-#ifndef UEAGLE_OPTN7
-#define UEAGLE_OPTN7 0x02cd8044
-#endif
-
-#define UEAGLE_CONFIG_NO 1
-
-#define UEAGLE_INTR_IFACE_NO 0
-#define UEAGLE_US_IFACE_NO 1
-#define UEAGLE_DS_IFACE_NO 2
-
-#define UEAGLE_ESISTR 4
-
-#define UEAGLE_TX_PIPE 0x02
-#define UEAGLE_IDMA_PIPE 0x04
-#define UEAGLE_INTR_PIPE 0x84
-#define UEAGLE_RX_PIPE 0x88
-
-#define UEAGLE_REQUEST 0
-
-#define UEAGLE_SETBLOCK 0x0001
-#define UEAGLE_SETMODE 0x0003
-#define UEAGLE_SET2183DATA 0x0004
-
-#define UEAGLE_LOOPBACKOFF 0x0002
-#define UEAGLE_LOOPBACKON 0x0003
-#define UEAGLE_BOOTIDMA 0x0006
-#define UEAGLE_STARTRESET 0x0007
-#define UEAGLE_ENDRESET 0x0008
-#define UEAGLE_SWAPMAILBOX 0x7fcd
-#define UEAGLE_MPTXSTART 0x7fce
-#define UEAGLE_MPTXMAILBOX 0x7fd6
-#define UEAGLE_MPRXMAILBOX 0x7fdf
-
-/* block within a firmware page */
-struct ueagle_block_info {
- uWord wHdr;
-#define UEAGLE_BLOCK_INFO_HDR 0xabcd
-
- uWord wAddress;
- uWord wSize;
- uWord wOvlOffset;
- uWord wOvl; /* overlay */
- uWord wLast;
-} __packed;
-
-/* CMV (Configuration and Management Variable) */
-struct ueagle_cmv {
- uWord wPreamble;
-#define UEAGLE_CMV_PREAMBLE 0x535c
-
- uByte bDst;
-#define UEAGLE_HOST 0x01
-#define UEAGLE_MODEM 0x10
-
- uByte bFunction;
-#define UEAGLE_CR 0x10
-#define UEAGLE_CW 0x11
-#define UEAGLE_CR_ACK 0x12
-#define UEAGLE_CW_ACK 0x13
-#define UEAGLE_MODEMREADY 0x71
-
- uWord wIndex;
- uDWord dwSymbolicAddress;
-#define UEAGLE_MAKESA(a, b, c, d) ((c) << 24 | (d) << 16 | (a) << 8 | (b))
-#define UEAGLE_CMV_CNTL UEAGLE_MAKESA('C', 'N', 'T', 'L')
-#define UEAGLE_CMV_DIAG UEAGLE_MAKESA('D', 'I', 'A', 'G')
-#define UEAGLE_CMV_INFO UEAGLE_MAKESA('I', 'N', 'F', 'O')
-#define UEAGLE_CMV_OPTN UEAGLE_MAKESA('O', 'P', 'T', 'N')
-#define UEAGLE_CMV_RATE UEAGLE_MAKESA('R', 'A', 'T', 'E')
-#define UEAGLE_CMV_STAT UEAGLE_MAKESA('S', 'T', 'A', 'T')
-
- uWord wOffsetAddress;
- uDWord dwData;
-#define UGETDATA(w) ((w)[2] | (w)[3] << 8 | (w)[0] << 16 | (w)[1] << 24)
-#define USETDATA(w, v) \
- ((w)[2] = (uint8_t)(v), \
- (w)[3] = (uint8_t)((v) >> 8), \
- (w)[0] = (uint8_t)((v) >> 16), \
- (w)[1] = (uint8_t)((v) >> 24))
-} __packed;
-
-struct ueagle_swap {
- uByte bPageNo;
- uByte bOvl; /* overlay */
-} __packed;
-
-struct ueagle_intr {
- uByte bType;
- uByte bNotification;
- uWord wValue;
- uWord wIndex;
- uWord wLength;
- uWord wInterrupt;
-#define UEAGLE_INTR_SWAP 1
-#define UEAGLE_INTR_CMV 2
-} __packed;
-
-#define UEAGLE_INTR_MAXSIZE 28
diff --git a/sys/dev/usb/ueaglevar.h b/sys/dev/usb/ueaglevar.h
deleted file mode 100644
index 73ec0d7270b..00000000000
--- a/sys/dev/usb/ueaglevar.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* $OpenBSD: ueaglevar.h,v 1.4 2013/04/15 09:23:02 mglocker Exp $ */
-
-/*-
- * Copyright (c) 2003-2005
- * Damien Bergamini <damien.bergamini@free.fr>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#define UEAGLE_NISOREQS 6
-#define UEAGLE_NISOFRMS 4
-
-#ifndef UEAGLE_INTR_INTERVAL
-#define UEAGLE_INTR_INTERVAL 10 /* ms */
-#endif
-
-#define UEAGLE_TX_LIST_CNT 1
-
-#define UEAGLE_IDMA_TIMEOUT 1000
-#define UEAGLE_TX_TIMEOUT 10000
-
-#define CRC_INITIAL 0xffffffff
-#define CRC_MAGIC 0xc704dd7b
-
-#define ATM_CELL_SIZE 53
-#define ATM_CELL_HEADER_SIZE 5
-#define ATM_CELL_PAYLOAD_SIZE (ATM_CELL_SIZE - ATM_CELL_HEADER_SIZE)
-
-#define AAL5_TRAILER_SIZE 8
-
-/*-
- * ATM cell header:
- *
- * 0 4 8
- * +-----------------+-----------------+
- * | GFC | VPI |
- * +-----------------+-----------------+
- * | VPI | VCI |
- * +-----------------+-----------------+
- * | VCI |
- * +-----------------+-----------+-----+
- * | VCI | PT (3) | CLP |
- * +-----------------+-----------+-----+
- * | HEC |
- * +-----------------------------------+
- */
-#define ATM_CH_FILL(x, gfc, vpi, vci, pt, clp, hec) do { \
- (x)[0] = ((gfc) & 0xf) << 4 | ((vpi) & 0xf0) >> 4; \
- (x)[1] = ((vpi) & 0xf) << 4 | ((vci) & 0xf000) >> 12; \
- (x)[2] = ((vci) & 0xff0) >> 4; \
- (x)[3] = ((vci) & 0xf) << 4 | ((pt) & 0x7) << 1 | ((clp) & 0x1);\
- (x)[4] = (uint8_t)(hec); \
-} while (/* CONSTCOND */0)
-
-#define ATM_CH_SETPTFLAGS(x, v) ((x)[3] |= ((v) & 0x7) << 1)
-#define ATM_CH_GETPTFLAGS(x) (((x)[3] >> 1) & 0x7)
-#define ATM_CH_GETVPI(x) ((x)[0] << 4 | (x)[1] >> 4)
-#define ATM_CH_GETVCI(x) \
- (((x)[1] & 0xf) << 12 | (x)[2] << 4 | ((x)[3] & 0xf0) >> 4)
-
-/* optimized shortcut for (ATM_CH_GETPTFLAGS(x) & 1) */
-#define ATM_CH_ISLASTCELL(x) ((x)[3] & 0x2)
-
-#define AAL5_TR_SETCPSUU(x, v) ((x)[45] = (uint8_t)(v))
-#define AAL5_TR_SETCPI(x, v) ((x)[46] = (uint8_t)(v))
-#define AAL5_TR_SETPDULEN(x, v) do { \
- (x)[47] = (uint8_t)((v) >> 8); \
- (x)[48] = (uint8_t)(v); \
-} while (/* CONSTCOND */0)
-
-#define AAL5_TR_GETPDULEN(x) (uint16_t)((x)[47] << 8 | (x)[48])
-#define AAL5_TR_SETCRC(x, v) do { \
- (x)[49] = (uint8_t)((v) >> 24); \
- (x)[50] = (uint8_t)((v) >> 16); \
- (x)[51] = (uint8_t)((v) >> 8); \
- (x)[52] = (uint8_t)(v); \
-} while (/* CONSTCOND */0)
-
-#define UEAGLE_IFMTU 1500
-#define UEAGLE_TXBUFLEN \
- (((UEAGLE_IFMTU / ATM_CELL_PAYLOAD_SIZE) + 2) * ATM_CELL_SIZE)
-
-struct ueagle_vcc {
- uint16_t vci;
- uint8_t vpi;
- uint8_t ch[ATM_CELL_HEADER_SIZE];
- void *rxhand;
- struct mbuf *m;
- uint8_t *dst;
- uint8_t *limit;
- struct atm_pseudohdr aph;
- int flags;
-#define UEAGLE_VCC_ACTIVE (1 << 0)
-#define UEAGLE_VCC_DROP (1 << 1)
-};
-
-struct ueagle_softc;
-
-struct ueagle_isoreq {
- struct ueagle_softc *sc;
- struct usbd_xfer *xfer;
- uint16_t frlengths[UEAGLE_NISOFRMS];
- uint8_t *offsets[UEAGLE_NISOFRMS];
-};
-
-struct ueagle_txreq {
- struct ueagle_softc *sc;
- struct usbd_xfer *xfer;
- uint8_t *buf;
-};
-
-struct ueagle_stats {
- struct {
- uint32_t status;
- uint32_t flags;
- uint32_t vidcpe;
- uint32_t vidco;
- uint32_t dsrate;
- uint32_t usrate;
- uint32_t dserror;
- uint32_t userror;
- uint32_t dsunc;
- uint32_t usunc;
- uint32_t txflow;
- uint32_t rxflow;
- uint32_t attenuation;
- uint32_t dsmargin;
- uint32_t usmargin;
- } phy;
-
- struct {
- uint32_t cells_transmitted;
- uint32_t cells_received;
- uint32_t cells_crc_errors;
- uint32_t cells_dropped;
- uint32_t vcc_no_conn;
- uint32_t cspdus_transmitted;
- uint32_t cspdus_received;
- uint32_t cspdus_crc_errors;
- uint32_t cspdus_dropped;
- } atm;
-};
-
-#define UEAGLE_COND_CMV(sc) ((char *)(sc) + 1)
-#define UEAGLE_COND_READY(sc) ((char *)(sc) + 2)
-#define UEAGLE_COND_SYNC(sc) ((char *)(sc) + 3)
-
-struct ueagle_softc {
- struct device sc_dev;
- struct ifnet sc_if;
-
- struct usbd_device *sc_udev;
-
- struct proc *stat_thread;
- struct usb_task sc_swap_task;
- uint16_t pageno;
- uint16_t ovl;
-
- const char *fw;
- uint8_t *dsp;
-
- struct usb_task sc_init_task;
-
- struct usbd_pipe *pipeh_tx;
- struct usbd_pipe *pipeh_rx;
- struct usbd_pipe *pipeh_idma;
- struct usbd_pipe *pipeh_intr;
-
- struct ueagle_isoreq isoreqs[UEAGLE_NISOREQS];
- struct ueagle_txreq txreqs[UEAGLE_TX_LIST_CNT];
- struct ueagle_vcc vcc;
- struct ueagle_stats stats;
-
- uint16_t isize;
- char ibuf[32];
-
- uint16_t index;
- uint32_t data;
-};
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
index d8f315bdf1c..a23fd6440ee 100644
--- a/sys/kern/uipc_domain.c
+++ b/sys/kern/uipc_domain.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_domain.c,v 1.32 2011/07/09 00:47:18 henning Exp $ */
+/* $OpenBSD: uipc_domain.c,v 1.33 2013/08/20 09:14:21 mpi Exp $ */
/* $NetBSD: uipc_domain.c,v 1.14 1996/02/09 19:00:44 christos Exp $ */
/*
@@ -92,9 +92,6 @@ domaininit(void)
#ifdef MPLS
ADDDOMAIN(mpls);
#endif
-#ifdef NATM
- ADDDOMAIN(natm);
-#endif
#ifdef IPSEC
#ifdef __KAME__
ADDDOMAIN(key);
diff --git a/sys/net/if.c b/sys/net/if.c
index 6dafd0d0d3c..3fc850a0b06 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.261 2013/06/20 12:03:40 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.262 2013/08/20 09:14:22 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -567,9 +567,6 @@ do { \
#ifdef INET6
IF_DETACH_QUEUES(ip6intrq);
#endif
-#ifdef NATM
- IF_DETACH_QUEUES(natmintrq);
-#endif
#undef IF_DETACH_QUEUES
/*
diff --git a/sys/net/if_atm.h b/sys/net/if_atm.h
deleted file mode 100644
index 6d8a8096865..00000000000
--- a/sys/net/if_atm.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $OpenBSD: if_atm.h,v 1.14 2010/05/07 13:33:16 claudio Exp $ */
-
-/*
- *
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor and
- * Washington University.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * net/if_atm.h
- */
-#ifndef _NET_IF_ATM_H_
-#define _NET_IF_ATM_H_
-
-/*
- * pseudo header for packet transmission
- */
-
-struct atm_pseudohdr {
- u_int8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */
-};
-
-#define ATM_PH_FLAGS(X) ((X)->atm_ph[0])
-#define ATM_PH_VPI(X) ((X)->atm_ph[1])
-#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3]))
-#define ATM_PH_SETVCI(X,V) do { \
- (X)->atm_ph[2] = ((V) >> 8) & 0xff; \
- (X)->atm_ph[3] = ((V) & 0xff); \
-} while (/* CONSTCOND */0)
-
-#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */
-#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */
-
-#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */
-#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */
-
-#define ATMMTU 9180 /* ATM MTU size for IP */
- /* XXX: could be 9188 with LLC/SNAP according
- to comer */
-
-/* user's ioctl hook for raw atm mode */
-#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */
-
-/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */
-struct atm_pseudoioctl {
- struct atm_pseudohdr aph;
- void *rxhand;
-};
-#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */
-#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */
-
-/*
- * XXX forget all the garbage in if_llc.h and do it the easy way
- */
-
-#define ATMLLC_HDR "\252\252\3\0\0\0"
-struct atmllc {
- u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */
- u_int8_t type[2]; /* "ethernet" type */
-};
-
-/* ATM_LLC macros: note type code in host byte order */
-#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1]))
-#define ATM_LLC_SETTYPE(X,V) do { \
- (X)->type[0] = ((V) >> 8) & 0xff; \
- (X)->type[1] = ((V) & 0xff); \
-} while (/* CONSTCOND */0)
-
-#ifdef _KERNEL
-void atm_ifattach(struct ifnet *);
-void atm_input(struct ifnet *, struct atm_pseudohdr *,
- struct mbuf *, void *);
-int atm_output(struct ifnet *, struct mbuf *, struct sockaddr *,
- struct rtentry *);
-#endif /* _KERNEL */
-#endif /* _NET_IF_ATM_H_ */
diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c
deleted file mode 100644
index e84c5e9746c..00000000000
--- a/sys/net/if_atmsubr.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* $OpenBSD: if_atmsubr.c,v 1.33 2013/03/28 16:55:27 deraadt Exp $ */
-
-/*
- *
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor and
- * Washington University.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * @(#)COPYRIGHT 1.1 (NRL) January 1995
- *
- * NRL grants permission for redistribution and use in source and binary
- * forms, with or without modification, of the software and documentation
- * created at NRL 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgements:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * This product includes software developed at the Information
- * Technology Division, US Naval Research Laboratory.
- * 4. Neither the name of the NRL nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THE SOFTWARE PROVIDED BY NRL IS PROVIDED BY NRL 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 NRL 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.
- *
- * The views and conclusions contained in the software and documentation
- * are those of the authors and should not be interpreted as representing
- * official policies, either expressed or implied, of the US Naval
- * Research Laboratory (NRL).
- */
-
-/*
- * if_atmsubr.c
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-
-
-#include <net/if.h>
-#include <net/netisr.h>
-#include <net/route.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-#include <net/if_atm.h>
-
-#include <netinet/in.h>
-#include <netinet/if_atm.h>
-#include <netinet/if_ether.h> /* XXX: for ETHERTYPE_* */
-#if defined(INET) || defined(INET6)
-#include <netinet/in_var.h>
-#endif
-#ifdef NATM
-#include <netnatm/natm.h>
-#endif
-
-#ifdef INET6
-#include <netinet6/in6_var.h>
-#endif /* INET6 */
-
-#define senderr(e) { error = (e); goto bad;}
-
-/*
- * atm_output: ATM output routine
- * inputs:
- * "ifp" = ATM interface to output to
- * "m0" = the packet to output
- * "dst" = the sockaddr to send to (either IP addr, or raw VPI/VCI)
- * "rt0" = the route to use
- * returns: error code [0 == ok]
- *
- * note: special semantic: if (dst == NULL) then we assume "m" already
- * has an atm_pseudohdr on it and just send it directly.
- * [for native mode ATM output] if dst is null, then
- * rt0 must also be NULL.
- */
-
-int
-atm_output(ifp, m0, dst, rt0)
- struct ifnet *ifp;
- struct mbuf *m0;
- struct sockaddr *dst;
- struct rtentry *rt0;
-{
- u_int16_t etype = 0; /* if using LLC/SNAP */
- int s, error = 0, sz, len;
- struct atm_pseudohdr atmdst, *ad;
- struct mbuf *m = m0;
- struct rtentry *rt;
- struct atmllc *atmllc;
- u_int32_t atm_flags;
-
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
- senderr(ENETDOWN);
-
-#ifdef DIAGNOSTIC
- if (ifp->if_rdomain != rtable_l2(m->m_pkthdr.rdomain)) {
- printf("%s: trying to send packet on wrong domain. "
- "if %d vs. mbuf %d, AF %d\n", ifp->if_xname,
- ifp->if_rdomain, rtable_l2(m->m_pkthdr.rdomain),
- dst->sa_family);
- }
-#endif
-
- /*
- * check route
- */
- if ((rt = rt0) != NULL) {
-
- if ((rt->rt_flags & RTF_UP) == 0) { /* route went down! */
- if ((rt0 = rt = rtalloc1(dst, RT_REPORT,
- m->m_pkthdr.rdomain)) != NULL)
- 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,
- RT_REPORT, ifp->if_rdomain);
- if ((rt = rt->rt_gwroute) == NULL)
- senderr(EHOSTUNREACH);
- }
- }
-
- /* XXX: put RTF_REJECT code here if doing ATMARP */
-
- }
-
- /*
- * check for non-native ATM traffic (dst != NULL)
- */
- if (dst) {
- switch (dst->sa_family) {
-#ifdef INET
- case AF_INET:
-#endif
-#ifdef INET6
- case AF_INET6:
-#endif
-#if defined(INET) || defined(INET6)
- if (dst->sa_family == AF_INET)
- etype = ETHERTYPE_IP;
- else
- etype = ETHERTYPE_IPV6;
- if (!atmresolve(rt, m, dst, &atmdst)) {
- m = NULL;
- /* XXX: atmresolve already free'd it */
- senderr(EHOSTUNREACH);
- /* XXX: put ATMARP stuff here */
- /* XXX: watch who frees m on failure */
- }
- break;
-#endif
-
- default:
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- printf("%s: can't handle af%d\n", ifp->if_xname,
- dst->sa_family);
-#elif defined(__FreeBSD__) || defined(__bsdi__)
- printf("%s%d: can't handle af%d\n", ifp->if_name,
- ifp->if_unit, dst->sa_family);
-#endif
- senderr(EAFNOSUPPORT);
- }
-
- /*
- * must add atm_pseudohdr to data
- */
- sz = sizeof(atmdst);
- atm_flags = ATM_PH_FLAGS(&atmdst);
- if (atm_flags & ATM_PH_LLCSNAP) sz += 8; /* sizeof snap == 8 */
- M_PREPEND(m, sz, M_DONTWAIT);
- if (m == 0)
- senderr(ENOBUFS);
- ad = mtod(m, struct atm_pseudohdr *);
- *ad = atmdst;
- if (atm_flags & ATM_PH_LLCSNAP) {
- atmllc = (struct atmllc *)(ad + 1);
- bcopy(ATMLLC_HDR, atmllc->llchdr,
- sizeof(atmllc->llchdr));
- ATM_LLC_SETTYPE(atmllc, etype);
- }
- }
-
- /*
- * Queue message on interface, and start output if interface
- * not yet active.
- */
- len = m->m_pkthdr.len;
- s = splnet();
- IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
- if (error) {
- splx(s);
- return (error);
- }
- ifp->if_obytes += len;
- if_start(ifp);
- splx(s);
- return (error);
-
-bad:
- if (m)
- m_freem(m);
- return (error);
-}
-
-/*
- * Process a received ATM packet;
- * the packet is in the mbuf chain m.
- */
-void
-atm_input(ifp, ah, m, rxhand)
- struct ifnet *ifp;
- struct atm_pseudohdr *ah;
- struct mbuf *m;
- void *rxhand;
-{
- struct ifqueue *inq;
- u_int16_t etype = ETHERTYPE_IP; /* default */
- int s;
-
- if ((ifp->if_flags & IFF_UP) == 0) {
- m_freem(m);
- return;
- }
-
- /* mark incoming routing domain */
- m->m_pkthdr.rdomain = ifp->if_rdomain;
-
- ifp->if_ibytes += m->m_pkthdr.len;
-
- if (rxhand) {
-#ifdef NATM
- struct natmpcb *npcb = rxhand;
- s = splnet(); /* in case 2 atm cards @ diff lvls */
- npcb->npcb_inq++; /* count # in queue */
- splx(s);
- schednetisr(NETISR_NATM);
- inq = &natmintrq;
- m->m_pkthdr.rcvif = rxhand; /* XXX: overload */
-#else
- printf("atm_input: NATM detected but not configured in kernel\n");
- m_freem(m);
- return;
-#endif
- } else {
- /*
- * handle LLC/SNAP header, if present
- */
- if (ATM_PH_FLAGS(ah) & ATM_PH_LLCSNAP) {
- struct atmllc *alc;
- if (m->m_len < sizeof(*alc) &&
- (m = m_pullup(m, sizeof(*alc))) == NULL)
- return; /* failed */
- alc = mtod(m, struct atmllc *);
- if (bcmp(alc, ATMLLC_HDR, 6)) {
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- printf("%s: recv'd invalid LLC/SNAP frame [vp=%d,vc=%d]\n",
- ifp->if_xname, ATM_PH_VPI(ah), ATM_PH_VCI(ah));
-#elif defined(__FreeBSD__) || defined(__bsdi__)
- printf("%s%d: recv'd invalid LLC/SNAP frame [vp=%d,vc=%d]\n",
- ifp->if_name, ifp->if_unit, ATM_PH_VPI(ah), ATM_PH_VCI(ah));
-#endif
- m_freem(m);
- return;
- }
- etype = ATM_LLC_TYPE(alc);
- m_adj(m, sizeof(*alc));
- }
-
- switch (etype) {
-#ifdef INET
- case ETHERTYPE_IP:
- schednetisr(NETISR_IP);
- inq = &ipintrq;
- break;
-#endif /* INET */
-#ifdef INET6
- case ETHERTYPE_IPV6:
- schednetisr(NETISR_IPV6);
- inq = &ip6intrq;
- break;
-#endif
- default:
- m_freem(m);
- return;
- }
- }
-
- s = splnet();
- IF_INPUT_ENQUEUE(inq, m);
- splx(s);
-}
-
-/*
- * Perform common duties while attaching to interface list
- */
-void
-atm_ifattach(ifp)
- struct ifnet *ifp;
-{
-
- ifp->if_type = IFT_ATM;
- ifp->if_addrlen = 0;
- ifp->if_hdrlen = 0;
- ifp->if_mtu = ATMMTU;
- ifp->if_output = atm_output;
-
- if_alloc_sadl(ifp);
-#ifdef notyet /* if using ATMARP, store hardware address using the next line */
- bcopy(ifp->hw_addr, LLADDR(ifp->if_sadl), ifp->if_addrlen);
-#endif
-}
diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index aa3bd1ff61f..34d87270f93 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -55,10 +55,6 @@ netintr(void *unused) /* ARGSUSED */
if (n & (1 << NETISR_MPLS))
mplsintr();
#endif
-#if NATM > 0
- if (n & (1 << NETISR_NATM))
- natmintr();
-#endif
#if NPPP > 0
if (n & (1 << NETISR_PPP))
pppintr();
diff --git a/sys/net/netisr.h b/sys/net/netisr.h
index 7f2294e1a9e..d0602afbfde 100644
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netisr.h,v 1.37 2012/10/07 23:56:21 mikeb Exp $ */
+/* $OpenBSD: netisr.h,v 1.38 2013/08/20 09:14:24 mpi Exp $ */
/* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */
/*
@@ -57,7 +57,6 @@
#define NETISR_ARP 18 /* same as AF_LINK */
#define NETISR_IPV6 24 /* same as AF_INET6 */
#define NETISR_ISDN 26 /* same as AF_E164 */
-#define NETISR_NATM 27 /* same as AF_ATM */
#define NETISR_PPP 28 /* for PPP processing */
#define NETISR_BRIDGE 29 /* for bridge processing */
#define NETISR_PPPOE 30 /* for pppoe processing */
@@ -73,7 +72,6 @@ void ipintr(void);
void ip6intr(void);
void atintr(void);
void clnlintr(void);
-void natmintr(void);
void pppintr(void);
void bridgeintr(void);
void pppoeintr(void);
diff --git a/sys/netinet/if_atm.c b/sys/netinet/if_atm.c
deleted file mode 100644
index ac3fbf89363..00000000000
--- a/sys/netinet/if_atm.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/* $OpenBSD: if_atm.c,v 1.18 2013/03/28 16:45:16 tedu Exp $ */
-
-/*
- *
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor and
- * Washington University.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * IP <=> ATM address resolution.
- */
-
-#if defined(INET) || defined(INET6)
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/syslog.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <net/if_atm.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_atm.h>
-
-#ifdef NATM
-#include <netnatm/natm.h>
-#endif
-
-
-#define SDL(s) ((struct sockaddr_dl *)s)
-
-/*
- * atm_rtrequest: handle ATM rt request (in support of generic code)
- * inputs: "req" = request code
- * "rt" = route entry
- * "sa" = sockaddr
- */
-
-void
-atm_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info)
-{
- struct sockaddr *gate = rt->rt_gateway;
- struct atm_pseudoioctl api;
- struct rt_addrinfo rtinfo;
-#ifdef NATM
- struct sockaddr_in *sin;
- struct natmpcb *npcb = NULL;
- struct atm_pseudohdr *aph;
-#endif
- static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK};
-
- if (rt->rt_flags & RTF_GATEWAY) /* link level requests only */
- return;
-
- switch (req) {
-
- case RTM_RESOLVE: /* resolve: only happens when cloning */
- printf("atm_rtrequest: RTM_RESOLVE request detected?\n");
- break;
-
- case RTM_ADD:
-
- /*
- * route added by a command (e.g. ifconfig, route, arp...).
- *
- * first check to see if this is not a host route, in which
- * case we are being called via "ifconfig" to set the address.
- */
-
- if ((rt->rt_flags & RTF_HOST) == 0) {
- rt_setgate(rt,rt_key(rt),(struct sockaddr *)&null_sdl, 0);
- gate = rt->rt_gateway;
- SDL(gate)->sdl_type = rt->rt_ifp->if_type;
- SDL(gate)->sdl_index = rt->rt_ifp->if_index;
- break;
- }
-
- if ((rt->rt_flags & RTF_CLONING) != 0) {
- printf("atm_rtrequest: cloning route detected?\n");
- break;
- }
- if (gate->sa_family != AF_LINK ||
- gate->sa_len < sizeof(null_sdl)) {
- log(LOG_DEBUG, "atm_rtrequest: bad gateway value\n");
- break;
- }
-
-#ifdef DIAGNOSTIC
- if (rt->rt_ifp->if_ioctl == NULL) panic("atm null ioctl");
-#endif
-
-#ifdef NATM
- /*
- * let native ATM know we are using this VCI/VPI
- * (i.e. reserve it)
- */
- sin = (struct sockaddr_in *) rt_key(rt);
- if (sin->sin_family != AF_INET)
- goto failed;
- aph = (struct atm_pseudohdr *) LLADDR(SDL(gate));
- npcb = npcb_add(NULL, rt->rt_ifp, ATM_PH_VCI(aph),
- ATM_PH_VPI(aph));
- if (npcb == NULL)
- goto failed;
- npcb->npcb_flags |= NPCB_IP;
- npcb->ipaddr.s_addr = sin->sin_addr.s_addr;
- /* XXX: move npcb to llinfo when ATM ARP is ready */
- rt->rt_llinfo = (caddr_t) npcb;
- rt->rt_flags |= RTF_LLINFO;
-#endif
- /*
- * let the lower level know this circuit is active
- */
- bcopy(LLADDR(SDL(gate)), &api.aph, sizeof(api.aph));
- api.rxhand = NULL;
- if (rt->rt_ifp->if_ioctl(rt->rt_ifp, SIOCATMENA,
- (caddr_t)&api) != 0) {
- printf("atm: couldn't add VC\n");
- goto failed;
- }
-
- SDL(gate)->sdl_type = rt->rt_ifp->if_type;
- SDL(gate)->sdl_index = rt->rt_ifp->if_index;
-
- break;
-
-failed:
-#ifdef NATM
- if (npcb) {
- npcb_free(npcb, NPCB_DESTROY);
- rt->rt_llinfo = NULL;
- rt->rt_flags &= ~RTF_LLINFO;
- }
-#endif
- bzero(&rtinfo, sizeof(rtinfo));
- rtinfo.rti_flags = rt->rt_flags;
- rtinfo.rti_info[RTAX_DST] = rt_key(rt);
- rtinfo.rti_info[RTAX_NETMASK] = rt_mask(rt);
-
- rtrequest1(RTM_DELETE, &rtinfo, rt->rt_priority, NULL, 0);
- break;
-
- case RTM_DELETE:
-
-#ifdef NATM
- /*
- * tell native ATM we are done with this VC
- */
-
- if (rt->rt_flags & RTF_LLINFO) {
- npcb_free((struct natmpcb *)rt->rt_llinfo,
- NPCB_DESTROY);
- rt->rt_llinfo = NULL;
- rt->rt_flags &= ~RTF_LLINFO;
- }
-#endif
- /*
- * tell the lower layer to disable this circuit
- */
-
- bcopy(LLADDR(SDL(gate)), &api.aph, sizeof(api.aph));
- api.rxhand = NULL;
- (void)rt->rt_ifp->if_ioctl(rt->rt_ifp, SIOCATMDIS,
- (caddr_t)&api);
-
- break;
- }
-}
-
-/*
- * atmresolve:
- * inputs:
- * [1] "rt" = the link level route to use (or null if need to look one up)
- * [2] "m" = mbuf containing the data to be sent
- * [3] "dst" = sockaddr_in (IP) address of dest.
- * output:
- * [4] "desten" = ATM pseudo header which we will fill in VPI/VCI info
- * return:
- * 0 == resolve FAILED; note that "m" gets m_freem'd in this case
- * 1 == resolve OK; desten contains result
- *
- * XXX: will need more work if we wish to support ATMARP in the kernel,
- * but this is enough for PVCs entered via the "route" command.
- */
-
-int
-atmresolve(struct rtentry *rt, struct mbuf *m, struct sockaddr *dst,
- struct atm_pseudohdr *desten)
-{
- struct sockaddr_dl *sdl;
-
- if (m->m_flags & (M_BCAST|M_MCAST)) {
- log(LOG_INFO,
- "atmresolve: BCAST/MCAST packet detected/dumped\n");
- goto bad;
- }
-
- if (rt == NULL) {
- rt = rtalloc1(dst, 0, m->m_pkthdr.rdomain);
- if (rt == NULL) goto bad; /* failed */
- rt->rt_refcnt--; /* don't keep LL references */
- if ((rt->rt_flags & RTF_GATEWAY) != 0 ||
- (rt->rt_flags & RTF_LLINFO) == 0 ||
- /* XXX: are we using LLINFO? */
- rt->rt_gateway->sa_family != AF_LINK) {
- goto bad;
- }
- }
-
- /*
- * note that rt_gateway is a sockaddr_dl which contains the
- * atm_pseudohdr data structure for this route. we currently
- * don't need any rt_llinfo info (but will if we want to support
- * ATM ARP [c.f. if_ether.c]).
- */
-
- sdl = SDL(rt->rt_gateway);
-
- /*
- * Check the address family and length is valid, the address
- * is resolved; otherwise, try to resolve.
- */
-
-
- if (sdl->sdl_family == AF_LINK && sdl->sdl_alen == sizeof(*desten)) {
- bcopy(LLADDR(sdl), desten, sdl->sdl_alen);
- return (1); /* ok, go for it! */
- }
-
- /*
- * we got an entry, but it doesn't have valid link address
- * info in it (it is prob. the interface route, which has
- * sdl_alen == 0). dump packet. (fall through to "bad").
- */
-
-bad:
- m_freem(m);
- return (0);
-}
-#endif /* INET */
diff --git a/sys/netinet/if_atm.h b/sys/netinet/if_atm.h
deleted file mode 100644
index 42c73264643..00000000000
--- a/sys/netinet/if_atm.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: if_atm.h,v 1.6 2002/06/09 16:26:10 itojun Exp $ */
-
-/*
- *
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor and
- * Washington University.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * if_atm.h
- */
-
-void atm_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
-int atmresolve(struct rtentry *, struct mbuf *, struct sockaddr *,
- struct atm_pseudohdr *);
diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c
deleted file mode 100644
index 4e8639ce52d..00000000000
--- a/sys/netnatm/natm.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/* $OpenBSD: natm.c,v 1.12 2010/02/11 22:33:33 claudio Exp $ */
-
-/*
- *
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor and
- * Washington University.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * natm.c: native mode ATM access (both aal0 and aal5).
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/domain.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/protosw.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-
-#include <net/if.h>
-#include <net/if_atm.h>
-#include <net/netisr.h>
-#include <net/radix.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-
-#include <netnatm/natm.h>
-
-u_long natm5_sendspace = 16*1024;
-u_long natm5_recvspace = 16*1024;
-
-u_long natm0_sendspace = 16*1024;
-u_long natm0_recvspace = 16*1024;
-
-/*
- * user requests
- */
-
-int natm_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control, struct proc *p)
-{
- int error = 0, s, s2;
- struct natmpcb *npcb;
- struct sockaddr_natm *snatm;
- struct atm_pseudoioctl api;
- struct atm_pseudohdr *aph;
- struct atm_rawioctl ario;
- struct ifnet *ifp;
- int proto = so->so_proto->pr_protocol;
-
- s = splsoftnet();
-
- npcb = (struct natmpcb *) so->so_pcb;
-
- if (npcb == NULL && req != PRU_ATTACH) {
- error = EINVAL;
- goto done;
- }
-
-
- switch (req) {
- case PRU_ATTACH: /* attach protocol to up */
-
- if (npcb) {
- error = EISCONN;
- break;
- }
-
- if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
- if (proto == PROTO_NATMAAL5)
- error = soreserve(so, natm5_sendspace, natm5_recvspace);
- else
- error = soreserve(so, natm0_sendspace, natm0_recvspace);
- if (error)
- break;
- }
-
- so->so_pcb = (caddr_t) (npcb = npcb_alloc(M_WAITOK));
- npcb->npcb_socket = so;
-
- break;
-
- case PRU_DETACH: /* detach protocol from up */
-
- /*
- * we turn on 'drain' *before* we sofree.
- */
-
- npcb_free(npcb, NPCB_DESTROY); /* drain */
- so->so_pcb = NULL;
- sofree(so);
-
- break;
-
- case PRU_CONNECT: /* establish connection to peer */
-
- /*
- * validate nam and npcb
- */
-
- if (nam->m_len != sizeof(*snatm)) {
- error = EINVAL;
- break;
- }
- snatm = mtod(nam, struct sockaddr_natm *);
- if (snatm->snatm_len != sizeof(*snatm) ||
- (npcb->npcb_flags & NPCB_FREE) == 0) {
- error = EINVAL;
- break;
- }
- if (snatm->snatm_family != AF_NATM) {
- error = EAFNOSUPPORT;
- break;
- }
-
- snatm->snatm_if[IFNAMSIZ-1] = '\0'; /* XXX ensure null termination
- since ifunit() uses strcmp */
-
- /*
- * convert interface string to ifp, validate.
- */
-
- ifp = ifunit(snatm->snatm_if);
- if (ifp == NULL || (ifp->if_flags & IFF_RUNNING) == 0) {
- error = ENXIO;
- break;
- }
- if (ifp->if_output != atm_output) {
- error = EAFNOSUPPORT;
- break;
- }
-
-
- /*
- * register us with the NATM PCB layer
- */
-
- if (npcb_add(npcb, ifp, snatm->snatm_vci, snatm->snatm_vpi) != npcb) {
- error = EADDRINUSE;
- break;
- }
-
- /*
- * enable rx
- */
-
- ATM_PH_FLAGS(&api.aph) = (proto == PROTO_NATMAAL5) ? ATM_PH_AAL5 : 0;
- ATM_PH_VPI(&api.aph) = npcb->npcb_vpi;
- ATM_PH_SETVCI(&api.aph, npcb->npcb_vci);
- api.rxhand = npcb;
- s2 = splnet();
- if (ifp->if_ioctl == NULL ||
- ifp->if_ioctl(ifp, SIOCATMENA, (caddr_t) &api) != 0) {
- splx(s2);
- npcb_free(npcb, NPCB_REMOVE);
- error = EIO;
- break;
- }
- splx(s2);
-
- soisconnected(so);
-
- break;
-
- case PRU_DISCONNECT: /* disconnect from peer */
-
- if ((npcb->npcb_flags & NPCB_CONNECTED) == 0) {
- printf("natm: disconnected check\n");
- error = EIO;
- break;
- }
- ifp = npcb->npcb_ifp;
-
- /*
- * disable rx
- */
-
- ATM_PH_FLAGS(&api.aph) = ATM_PH_AAL5;
- ATM_PH_VPI(&api.aph) = npcb->npcb_vpi;
- ATM_PH_SETVCI(&api.aph, npcb->npcb_vci);
- api.rxhand = npcb;
- s2 = splnet();
- if (ifp->if_ioctl != NULL)
- ifp->if_ioctl(ifp, SIOCATMDIS, (caddr_t) &api);
- splx(s2);
-
- npcb_free(npcb, NPCB_REMOVE);
- soisdisconnected(so);
-
- break;
-
- case PRU_SHUTDOWN: /* won't send any more data */
- socantsendmore(so);
- break;
-
- case PRU_SEND: /* send this data */
- if (control && control->m_len) {
- m_freem(control);
- m_freem(m);
- error = EINVAL;
- break;
- }
-
- /*
- * send the data. we must put an atm_pseudohdr on first
- */
-
- M_PREPEND(m, sizeof(*aph), M_WAITOK);
- aph = mtod(m, struct atm_pseudohdr *);
- ATM_PH_VPI(aph) = npcb->npcb_vpi;
- ATM_PH_SETVCI(aph, npcb->npcb_vci);
- ATM_PH_FLAGS(aph) = (proto == PROTO_NATMAAL5) ? ATM_PH_AAL5 : 0;
-
- error = atm_output(npcb->npcb_ifp, m, NULL, NULL);
-
- break;
-
- case PRU_SENSE: /* return status into m */
- /* return zero? */
- break;
-
- case PRU_PEERADDR: /* fetch peer's address */
- snatm = mtod(nam, struct sockaddr_natm *);
- bzero(snatm, sizeof(*snatm));
- nam->m_len = snatm->snatm_len = sizeof(*snatm);
- snatm->snatm_family = AF_NATM;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- bcopy(npcb->npcb_ifp->if_xname, snatm->snatm_if, sizeof(snatm->snatm_if));
-#elif defined(__FreeBSD__)
- sprintf(snatm->snatm_if, "%s%d", npcb->npcb_ifp->if_name,
- npcb->npcb_ifp->if_unit);
-#endif
- snatm->snatm_vci = npcb->npcb_vci;
- snatm->snatm_vpi = npcb->npcb_vpi;
- break;
-
- case PRU_CONTROL: /* control operations on protocol */
- /*
- * raw atm ioctl. comes in as a SIOCRAWATM. we convert it to
- * SIOCXRAWATM and pass it to the driver.
- */
- if ((u_long)m == SIOCRAWATM) {
- if (npcb->npcb_ifp == NULL) {
- error = ENOTCONN;
- break;
- }
- ario.npcb = npcb;
- ario.rawvalue = *((int *)nam);
- error = npcb->npcb_ifp->if_ioctl(npcb->npcb_ifp,
- SIOCXRAWATM, (caddr_t) &ario);
- if (!error) {
- if (ario.rawvalue)
- npcb->npcb_flags |= NPCB_RAW;
- else
- npcb->npcb_flags &= ~(NPCB_RAW);
- }
-
- break;
- }
-
- error = EOPNOTSUPP;
- break;
-
- case PRU_BIND: /* bind socket to address */
- case PRU_LISTEN: /* listen for connection */
- case PRU_ACCEPT: /* accept connection from peer */
- case PRU_CONNECT2: /* connect two sockets */
- case PRU_ABORT: /* abort (fast DISCONNECT, DETACH) */
- /* (only happens if LISTEN socket) */
- case PRU_RCVD: /* have taken data; more room now */
- case PRU_FASTTIMO: /* 200ms timeout */
- case PRU_SLOWTIMO: /* 500ms timeout */
- case PRU_RCVOOB: /* retrieve out of band data */
- case PRU_SENDOOB: /* send out of band data */
- case PRU_PROTORCV: /* receive from below */
- case PRU_PROTOSEND: /* send to below */
- case PRU_SOCKADDR: /* fetch socket's address */
-#ifdef DIAGNOSTIC
- printf("natm: PRU #%d unsupported\n", req);
-#endif
- error = EOPNOTSUPP;
- break;
-
- default: panic("natm usrreq");
- }
-
-done:
- splx(s);
- return(error);
-}
-
-/*
- * natmintr: splsoftnet interrupt
- *
- * note: we expect a socket pointer in rcvif rather than an interface
- * pointer. we can get the interface pointer from the so's PCB if
- * we really need it.
- */
-
-void
-natmintr()
-
-{
- int s;
- struct mbuf *m;
- struct socket *so;
- struct natmpcb *npcb;
-
-next:
- s = splnet();
- IF_DEQUEUE(&natmintrq, m);
- splx(s);
- if (m == NULL)
- return;
-
-#ifdef DIAGNOSTIC
- if ((m->m_flags & M_PKTHDR) == 0)
- panic("natmintr no HDR");
-#endif
-
- npcb = (struct natmpcb *) m->m_pkthdr.rcvif; /* XXX: overloaded */
- so = npcb->npcb_socket;
-
- s = splnet(); /* could have atm devs @ different levels */
- npcb->npcb_inq--;
- splx(s);
-
- if (npcb->npcb_flags & NPCB_DRAIN) {
- m_freem(m);
- if (npcb->npcb_inq == 0)
- free(npcb, M_PCB); /* done! */
- goto next;
- }
-
- if (npcb->npcb_flags & NPCB_FREE) {
- m_freem(m); /* drop */
- goto next;
- }
-
-#ifdef NEED_TO_RESTORE_IFP
- m->m_pkthdr.rcvif = npcb->npcb_ifp;
-#else
-#ifdef DIAGNOSTIC
-m->m_pkthdr.rcvif = NULL; /* null it out to be safe */
-#endif
-#endif
-
- if (sbspace(&so->so_rcv) > m->m_pkthdr.len ||
- ((npcb->npcb_flags & NPCB_RAW) != 0 && so->so_rcv.sb_cc < NPCB_RAWCC) ) {
-#ifdef NATM_STAT
- natm_sookcnt++;
- natm_sookbytes += m->m_pkthdr.len;
-#endif
- sbappendrecord(&so->so_rcv, m);
- sorwakeup(so);
- } else {
-#ifdef NATM_STAT
- natm_sodropcnt++;
- natm_sodropbytes += m->m_pkthdr.len;
-#endif
- m_freem(m);
- }
-
- goto next;
-}
-
-#if defined(__FreeBSD__)
-NETISR_SET(NETISR_NATM, natmintr);
-#endif
-
-
-/*
- * natm0_sysctl: not used, but here in case we want to add something
- * later...
- */
-
-int natm0_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
-
-int *name;
-u_int namelen;
-void *oldp;
-size_t *oldlenp;
-void *newp;
-size_t newlen;
-
-{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return (ENOTDIR);
- return (ENOPROTOOPT);
-}
-
-/*
- * natm5_sysctl: not used, but here in case we want to add something
- * later...
- */
-
-int natm5_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
-
-int *name;
-u_int namelen;
-void *oldp;
-size_t *oldlenp;
-void *newp;
-size_t newlen;
-
-{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return (ENOTDIR);
- return (ENOPROTOOPT);
-}
diff --git a/sys/netnatm/natm.h b/sys/netnatm/natm.h
deleted file mode 100644
index ee92b713575..00000000000
--- a/sys/netnatm/natm.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $OpenBSD: natm.h,v 1.9 2009/05/31 19:17:20 claudio Exp $ */
-
-/*
- *
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor and
- * Washington University.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * natm.h: native mode atm
- */
-
-
-/*
- * supported protocols
- */
-
-#define PROTO_NATMAAL0 1
-#define PROTO_NATMAAL5 2
-
-/*
- * sockaddr_natm
- */
-
-struct sockaddr_natm {
- u_int8_t snatm_len; /* length */
- u_int8_t snatm_family; /* AF_NATM */
- char snatm_if[IFNAMSIZ]; /* interface name */
- u_int16_t snatm_vci; /* vci */
- u_int8_t snatm_vpi; /* vpi */
-};
-
-
-#ifdef _KERNEL
-
-/*
- * natm protocol control block
- */
-
-struct natmpcb {
- LIST_ENTRY(natmpcb) pcblist; /* list pointers */
- u_int npcb_inq; /* # of our pkts in proto q */
- struct socket *npcb_socket; /* backpointer to socket */
- struct ifnet *npcb_ifp; /* pointer to hardware */
- struct in_addr ipaddr; /* remote IP address, if NPCB_IP */
- u_int16_t npcb_vci; /* VCI */
- u_int8_t npcb_vpi; /* VPI */
- u_int8_t npcb_flags; /* flags */
-};
-
-/* flags */
-#define NPCB_FREE 0x01 /* free (not on any list) */
-#define NPCB_CONNECTED 0x02 /* connected */
-#define NPCB_IP 0x04 /* used by IP */
-#define NPCB_DRAIN 0x08 /* destory as soon as inq == 0 */
-#define NPCB_RAW 0x10 /* in 'raw' mode? */
-
-/* flag arg to npcb_free */
-#define NPCB_REMOVE 0 /* remove from global list */
-#define NPCB_DESTROY 1 /* destroy and be free */
-
-/*
- * NPCB_RAWCC is a hack which applies to connections in 'raw' mode. it
- * is used to override the sbspace() macro when you *really* don't want
- * to drop rcv data. the recv socket buffer size is raised to this value.
- *
- * XXX: socket buffering needs to be looked at.
- */
-
-#define NPCB_RAWCC (1024*1024) /* 1MB */
-
-LIST_HEAD(npcblist, natmpcb);
-
-/* global data structures */
-
-extern struct npcblist natm_pcbs; /* global list of pcbs */
-extern struct ifqueue natmintrq; /* natm packet input queue */
-#define NATM_STAT
-#ifdef NATM_STAT
-extern u_int natm_sodropcnt,
- natm_sodropbytes; /* account of droppage */
-extern u_int natm_sookcnt,
- natm_sookbytes; /* account of ok */
-#endif
-
-/* atm_rawioctl: kernel's version of SIOCRAWATM [for internal use only!] */
-struct atm_rawioctl {
- struct natmpcb *npcb;
- int rawvalue;
-};
-#define SIOCXRAWATM _IOWR('a', 125, struct atm_rawioctl)
-
-/* external functions */
-
-/* natm_pcb.c */
-struct natmpcb *npcb_alloc(int);
-void npcb_free(struct natmpcb *, int);
-struct natmpcb *npcb_add(struct natmpcb *, struct ifnet *, int, int);
-
-/* natm.c */
-int natm_usrreq(struct socket *, int, struct mbuf *,
- struct mbuf *, struct mbuf *, struct proc *);
-int natm0_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-int natm5_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-void natmintr(void);
-
-#endif
diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c
deleted file mode 100644
index f997484ee10..00000000000
--- a/sys/netnatm/natm_pcb.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/* $OpenBSD: natm_pcb.c,v 1.10 2009/01/28 15:12:03 claudio Exp $ */
-
-/*
- *
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor and
- * Washington University.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * atm_pcb.c: manage atm protocol control blocks and keep IP and NATM
- * from trying to use each other's VCs.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/queue.h>
-#include <sys/socket.h>
-#include <sys/protosw.h>
-#include <sys/domain.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-
-#include <net/if.h>
-#include <net/radix.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-
-#include <netnatm/natm.h>
-
-struct npcblist natm_pcbs;
-
-/*
- * npcb_alloc: allocate a npcb [in the free state]
- */
-
-struct natmpcb *npcb_alloc(wait)
-
-int wait;
-
-{
- struct natmpcb *npcb;
-
- npcb = malloc(sizeof(*npcb), M_PCB, wait | M_ZERO);
-
- if (npcb) {
- npcb->npcb_flags = NPCB_FREE;
- }
- return(npcb);
-}
-
-
-/*
- * npcb_free: free a npcb
- */
-
-void npcb_free(npcb, op)
-
-struct natmpcb *npcb;
-int op;
-
-{
- int s = splnet();
-
- if ((npcb->npcb_flags & NPCB_FREE) == 0) {
- LIST_REMOVE(npcb, pcblist);
- npcb->npcb_flags = NPCB_FREE;
- }
- if (op == NPCB_DESTROY) {
- if (npcb->npcb_inq) {
- npcb->npcb_flags = NPCB_DRAIN; /* flag for distruction */
- } else {
- free(npcb, M_PCB); /* kill it! */
- }
- }
-
- splx(s);
-}
-
-
-/*
- * npcb_add: add or remove npcb from main list
- * returns npcb if ok
- */
-
-struct natmpcb *npcb_add(npcb, ifp, vci, vpi)
-
-struct natmpcb *npcb;
-struct ifnet *ifp;
-u_int16_t vci;
-u_int8_t vpi;
-
-{
- struct natmpcb *cpcb = NULL; /* current pcb */
- int s = splnet();
-
-
- /*
- * lookup required
- */
-
- LIST_FOREACH(cpcb, &natm_pcbs, pcblist) {
- if (ifp == cpcb->npcb_ifp && vci == cpcb->npcb_vci && vpi == cpcb->npcb_vpi)
- break;
- }
-
- /*
- * add & something already there?
- */
-
- if (cpcb) {
- cpcb = NULL;
- goto done; /* fail */
- }
-
- /*
- * need to allocate a pcb?
- */
-
- if (npcb == NULL) {
- cpcb = npcb_alloc(M_NOWAIT); /* could be called from lower half */
- if (cpcb == NULL)
- goto done; /* fail */
- } else {
- cpcb = npcb;
- }
-
- cpcb->npcb_ifp = ifp;
- cpcb->ipaddr.s_addr = 0;
- cpcb->npcb_vci = vci;
- cpcb->npcb_vpi = vpi;
- cpcb->npcb_flags = NPCB_CONNECTED;
-
- LIST_INSERT_HEAD(&natm_pcbs, cpcb, pcblist);
-
-done:
- splx(s);
- return(cpcb);
-}
-
-
-
-#ifdef DDB
-
-int npcb_dump(void);
-
-int npcb_dump()
-
-{
- struct natmpcb *cpcb;
-
- printf("npcb dump:\n");
- LIST_FOREACH(cpcb, &natm_pcbs, pcblist) {
- printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, flags=0x%x, inq=%d\n",
- cpcb->npcb_ifp->if_xname, cpcb->npcb_vci, cpcb->npcb_vpi,
- cpcb->ipaddr.s_addr, cpcb->npcb_socket,
- cpcb->npcb_flags, cpcb->npcb_inq);
- }
- printf("done\n");
- return(0);
-}
-
-#endif
diff --git a/sys/netnatm/natm_proto.c b/sys/netnatm/natm_proto.c
deleted file mode 100644
index 13e23993a3f..00000000000
--- a/sys/netnatm/natm_proto.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: natm_proto.c,v 1.6 2011/07/06 02:42:28 henning Exp $ */
-
-/*
- *
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor and
- * Washington University.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * protocol layer for access to native mode ATM
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/queue.h>
-#include <sys/socket.h>
-#include <sys/protosw.h>
-#include <sys/domain.h>
-#include <sys/mbuf.h>
-
-#include <net/if.h>
-#include <net/radix.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-
-#include <netnatm/natm.h>
-
-extern struct domain natmdomain;
-
-static void natm_init(void);
-
-struct protosw natmsw[] = {
-{ SOCK_STREAM, &natmdomain, PROTO_NATMAAL5, PR_CONNREQUIRED,
- 0, 0, 0, 0,
- natm_usrreq,
- 0, 0, 0, 0,
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- natm5_sysctl
-#endif
-},
-{ SOCK_DGRAM, &natmdomain, PROTO_NATMAAL5, PR_CONNREQUIRED | PR_ATOMIC,
- 0, 0, 0, 0,
- natm_usrreq,
- 0, 0, 0, 0,
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- natm5_sysctl
-#endif
-},
-{ SOCK_STREAM, &natmdomain, PROTO_NATMAAL0, PR_CONNREQUIRED,
- 0, 0, 0, 0,
- natm_usrreq,
- 0, 0, 0, 0,
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- natm0_sysctl
-#endif
-},
-};
-
-struct domain natmdomain =
- { AF_NATM, "natm", natm_init, 0, 0,
- natmsw, &natmsw[nitems(natmsw)], 0,
- 0, 0, 0};
-
-struct ifqueue natmintrq; /* natm packet input queue */
-int natmqmaxlen = IFQ_MAXLEN; /* max # of packets on queue */
-#ifdef NATM_STAT
-u_int natm_sodropcnt = 0; /* # mbufs dropped due to full sb */
-u_int natm_sodropbytes = 0; /* # of bytes dropped */
-u_int natm_sookcnt = 0; /* # mbufs ok */
-u_int natm_sookbytes = 0; /* # of bytes ok */
-#endif
-
-
-
-void natm_init()
-
-{
- LIST_INIT(&natm_pcbs);
- bzero(&natmintrq, sizeof(natmintrq));
- IFQ_SET_MAXLEN(&natmintrq, natmqmaxlen);
-}
-
-#if defined(__FreeBSD__)
-DOMAIN_SET(natm);
-#endif