New version from David Boggs.

This commit is contained in:
christos 2006-04-20 16:51:57 +00:00
parent f02ed04954
commit 3d76b885e1
2 changed files with 1630 additions and 1636 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
/*-
* $NetBSD: if_lmc.h,v 1.2 2006/02/11 23:00:06 christos Exp $
* $NetBSD: if_lmc.h,v 1.3 2006/04/20 16:51:58 christos Exp $
*
* Copyright (c) 2002-2006 David Boggs. (boggs@boggs.palo-alto.ca.us)
* All rights reserved.
*
* BSD License:
* BSD LICENSE:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* GNU General Public License:
* GNU GENERAL PUBLIC LICENSE:
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@ -50,12 +50,12 @@
#define DEVICE_NAME "lmc"
#define VER_YEAR 2006
#define VER_MONTH 2
#define VER_DAY 1
#define VER_MONTH 4
#define VER_DAY 11
/* netgraph stuff */
#define NG_LMC_NODE_TYPE "if_"DEVICE_NAME
#define NGM_LMC_COOKIE 1138860051 /* date -u +'%s' */
#define NGM_LMC_COOKIE 1144752198 /* date -u +'%s' */
/* Tulip PCI configuration registers */
#define TLP_CFID 0x00 /* 0: CFg ID register */
@ -82,12 +82,12 @@
#define TLP_CFLT_LATENCY 0x0000FF00
#define TLP_CFLT_CACHE 0x000000FF
#define LMC_CSID_HSSI 0x00031376 /* LMC 5200 HSSI card */
#define LMC_CSID_T3 0x00041376 /* LMC 5245 T3 card */
#define LMC_CSID_SSI 0x00051376 /* LMC 1000 SSI card */
#define LMC_CSID_T1E1 0x00061376 /* LMC 1200 T1E1 card */
#define LMC_CSID_HSSIc 0x00071376 /* LMC 5200 HSSI cPCI */
#define LMC_CSID_SDSL 0x00081376 /* LMC 1168 SDSL card */
#define CSID_LMC_HSSI 0x00031376 /* LMC 5200 HSSI card */
#define CSID_LMC_T3 0x00041376 /* LMC 5245 T3 card */
#define CSID_LMC_SSI 0x00051376 /* LMC 1000 SSI card */
#define CSID_LMC_T1E1 0x00061376 /* LMC 1200 T1E1 card */
#define CSID_LMC_HSSIc 0x00071376 /* LMC 5200 HSSI cPCI */
#define CSID_LMC_SDSL 0x00081376 /* LMC 1168 SDSL card */
#define TLP_CFIT_MAX_LAT 0xFF000000
@ -219,7 +219,7 @@
/* GPIO bits common to all cards */
#define GPIO_INIT 0x01 /* from Xilinx */
#define GPIO_RESET 0x02 /* to Xilinx */
/* bits 2 and 3 vary with board type -- see below */
/* bits 2 and 3 vary with card type -- see below */
#define GPIO_MODE 0x10 /* to Xilinx */
#define GPIO_DP 0x20 /* to/from Xilinx */
#define GPIO_DATA 0x40 /* serial data */
@ -620,7 +620,7 @@
# define LMCIOCREAD _IOWR('i', 243, struct ioctl)
# define LMCIOCWRITE _IOW('i', 244, struct ioctl)
# define LMCIOCTL _IOWR('i', 245, struct ioctl)
#elif defined(__linux__) /* sigh */
#elif defined(__linux__)
# define LMCIOCGSTAT SIOCDEVPRIVATE+0
# define LMCIOCGCFG SIOCDEVPRIVATE+1
# define LMCIOCSCFG SIOCDEVPRIVATE+2
@ -751,8 +751,8 @@ struct cntrs
u_int32_t mfrm_errs; /* Rx T3 Multi-frame bit errors */
u_int32_t rxbuf; /* Rx out of packet buffers */
u_int32_t txdma; /* Tx out of DMA desciptors */
u_int32_t lck_watch; /* try_lock conflict in watchdog */
u_int32_t lck_intr; /* try_lock conflict in interrupt */
u_int32_t lck_watch; /* lock conflict in watchdog */
u_int32_t lck_intr; /* lock conflict in interrupt */
u_int32_t spare1; /* debugging temp */
u_int32_t spare2; /* debugging temp */
u_int32_t spare3; /* debugging temp */
@ -769,8 +769,8 @@ struct status
u_int32_t tx_speed; /* measured TX bits/sec */
u_int32_t cable_type; /* SSI only: cable type */
u_int32_t time_slots; /* T1E1 only: actual TSs in use */
u_int32_t line_pkg; /* actual line pkg in use */
u_int32_t line_prot; /* actual line proto in use */
u_int32_t stack; /* actual line stack in use */
u_int32_t proto; /* actual line proto in use */
u_int32_t keep_alive; /* actual keep-alive status */
u_int32_t ticks; /* incremented by watchdog @ 1 Hz */
struct cntrs cntrs; /* event counters */
@ -783,23 +783,23 @@ struct status
} snmp;
};
/* line protocol package codes */
#define PKG_NONE 0 /* not set fnobl */
#define PKG_RAWIP 1 /* driver yyyyy */
#define PKG_SPPP 2 /* fbsd, nbsd, obsd yyynn */
#define PKG_P2P 3 /* bsd/os nnnyn */
#define PKG_GEN_HDLC 4 /* linux nnnny */
#define PKG_SYNC_PPP 5 /* linux nnnny */
#define PKG_NETGRAPH 6 /* fbsd ynnnn */
/* protocol stack codes */
#define STACK_NONE 0 /* not set fnobl */
#define STACK_RAWIP 1 /* driver yyyyy */
#define STACK_SPPP 2 /* fbsd, nbsd, obsd yyynn */
#define STACK_P2P 3 /* bsd/os nnnyn */
#define STACK_GEN_HDLC 4 /* linux nnnny */
#define STACK_SYNC_PPP 5 /* linux nnnny */
#define STACK_NETGRAPH 6 /* fbsd ynnnn */
/* line protocol codes */
#define PROT_NONE 0 /* not set fnobl */
#define PROT_IP_HDLC 1 /* raw IP4/6 pkts in HDLC yyyyy */
#define PROT_PPP 2 /* Point-to-Point Protocol yyyyy */
#define PROT_C_HDLC 3 /* Cisco HDLC Protocol yyyyy */
#define PROT_FRM_RLY 4 /* Frame Relay Protocol ynnyy */
#define PROT_ETH_HDLC 5 /* raw Ether pkts in HDLC nnnny */
#define PROT_X25 6 /* X.25/LAPB Protocol nnnny */
#define PROTO_NONE 0 /* not set fnobl */
#define PROTO_IP_HDLC 1 /* raw IP4/6 pkts in HDLC yyyyy */
#define PROTO_PPP 2 /* Point-to-Point Protocol yyyyy */
#define PROTO_C_HDLC 3 /* Cisco HDLC Protocol yyyyy */
#define PROTO_FRM_RLY 4 /* Frame Relay Protocol ynnyy */
#define PROTO_ETH_HDLC 5 /* raw Ether pkts in HDLC nnnny */
#define PROTO_X25 6 /* X.25/LAPB Protocol nnnny */
/* oper_status codes (same as SNMP status codes) */
#define STATE_UP 1 /* may/will tx/rx pkts */
@ -838,8 +838,8 @@ struct config
u_int32_t tx_pulse; /* T1: transmitter pulse shape */
u_int32_t tx_lbo; /* T1: transmitter atten 0-22.5 dB */
u_int32_t debug; /* ALL: extra printout */
u_int32_t line_pkg; /* ALL: use this line pkg */
u_int32_t line_prot; /* ALL: use this line proto */
u_int32_t stack; /* ALL: use this line stack */
u_int32_t proto; /* ALL: use this line proto */
u_int32_t keep_alive; /* SPPP: use keep-alive packets */
};
@ -937,7 +937,7 @@ struct ioctl
#define IOCTL_XILINX_ROM 17 /* load Xilinx program from ROM */
#define IOCTL_XILINX_FILE 18 /* load Xilinx program from file */
#define IOCTL_SET_STATUS 50 /* set mdm ctrl bits (internal use)*/
#define IOCTL_SET_STATUS 50 /* set mdm ctrl bits (internal) */
#define IOCTL_SNMP_SEND 51 /* trunk MIB send code */
#define IOCTL_SNMP_LOOP 52 /* trunk MIB loop configuration */
#define IOCTL_SNMP_SIGS 53 /* RS232-like modem control sigs */
@ -974,123 +974,30 @@ const char *ssi_cables[] =
#if KERNEL || _KERNEL || __KERNEL__
/* Hide the minor differences between OS versions */
/* Hide the minor differences between Operating Systems */
#ifdef __FreeBSD__
typedef void intr_return_t;
# define READ_PCI_CFG(sc, addr) pci_read_config ((sc)->dev, addr, 4)
# define WRITE_PCI_CFG(sc, addr, data) pci_write_config((sc)->dev, addr, data, 4)
# define IOREF_CSR 1 /* 1=IO refs; 0=MEM refs */
# define READ_CSR(csr) bus_space_read_4 (sc->csr_tag, sc->csr_handle, csr)
# define WRITE_CSR(csr, val) bus_space_write_4(sc->csr_tag, sc->csr_handle, csr, val)
# define NAME_UNIT device_get_nameunit(sc->dev)
# define BOOT_VERBOSE bootverbose
# define TOP_LOCK mtx_lock (&sc->top_mtx)
# define TOP_TRYLOCK mtx_trylock(&sc->top_mtx)
# define TOP_UNLOCK mtx_unlock (&sc->top_mtx)
# define BOTTOM_TRYLOCK mtx_trylock(&sc->bottom_mtx)
# define BOTTOM_UNLOCK mtx_unlock (&sc->bottom_mtx)
# define CHECK_CAP suser(curthread)
# define DISABLE_INTR /* nothing */
# define ENABLE_INTR /* nothing */
# define IRQ_NONE /* nothing */
# define IRQ_HANDLED /* nothing */
# define IFP2SC(ifp) (ifp)->if_softc
# define COPY_BREAK MHLEN
# define SLEEP(usecs) tsleep(sc, PCATCH | PZERO, DEVICE_NAME, 1+(usecs/tick))
# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, flags)
# define DMA_LOAD(map, addr, size) bus_dmamap_load(ring->tag, map, addr, size, fbsd_dmamap_load, ring, 0)
# if NBPFILTER
# define LMC_BPF_MTAP(mbuf) if (sc->ifp->if_bpf) bpf_mtap(sc->ifp->if_bpf, mbuf)
# define LMC_BPF_ATTACH(dlt, len) bpfattach(sc->ifp, dlt, len)
# define LMC_BPF_DETACH bpfdetach(sc->ifp)
# endif
# define IF_DROP(ifq) _IF_DROP(ifq)
# define IF_QFULL(ifq) _IF_QFULL(ifq)
#endif /* __FreeBSD__ */
#ifdef __NetBSD__
typedef int intr_return_t;
# define READ_PCI_CFG(sc, addr) pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr)
# define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data)
# define IOREF_CSR 1 /* 1=IO refs; 0=MEM refs */
# define READ_CSR(csr) bus_space_read_4 (sc->csr_tag, sc->csr_handle, csr)
# define WRITE_CSR(csr, val) bus_space_write_4(sc->csr_tag, sc->csr_handle, csr, val)
# define NAME_UNIT sc->dev.dv_xname
# define BOOT_VERBOSE (boothowto & AB_VERBOSE)
# define TOP_LOCK simple_lock (&sc->top_lock)
# define TOP_TRYLOCK simple_lock_try(&sc->top_lock)
# define TOP_UNLOCK simple_unlock (&sc->top_lock)
# define BOTTOM_TRYLOCK simple_lock_try(&sc->bottom_lock)
# define BOTTOM_UNLOCK simple_unlock (&sc->bottom_lock)
# define CHECK_CAP suser(curproc->p_ucred, &curproc->p_acflag)
# define DISABLE_INTR int spl = splnet()
# define ENABLE_INTR splx(spl)
# define IRQ_NONE 0
# define IRQ_HANDLED 1
# define IFP2SC(ifp) (ifp)->if_softc
# define COPY_BREAK MHLEN
# define SLEEP(usecs) tsleep(sc, PCATCH | PZERO, DEVICE_NAME, 1+(usecs/tick))
# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, 0, size, flags)
# define DMA_LOAD(map, addr, size) bus_dmamap_load(ring->tag, map, addr, size, 0, BUS_DMA_NOWAIT)
# if NBPFILTER
# define LMC_BPF_MTAP(mbuf) if (sc->ifp->if_bpf) bpf_mtap(sc->ifp->if_bpf, mbuf)
# define LMC_BPF_ATTACH(dlt, len) bpfattach(sc->ifp, dlt, len)
# define LMC_BPF_DETACH bpfdetach(sc->ifp)
# endif
#endif /* __NetBSD__ */
#ifdef __OpenBSD__
typedef int intr_return_t;
# define READ_PCI_CFG(sc, addr) pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr)
# define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data)
# define IOREF_CSR 1 /* 1=IO refs; 0=MEM refs */
# define READ_CSR(csr) bus_space_read_4 (sc->csr_tag, sc->csr_handle, csr)
# define WRITE_CSR(csr, val) bus_space_write_4(sc->csr_tag, sc->csr_handle, csr, val)
# define NAME_UNIT sc->dev.dv_xname
# define BOOT_VERBOSE 1
# define TOP_LOCK simple_lock (&sc->top_lock)
# define TOP_TRYLOCK simple_lock_try(&sc->top_lock)
# define TOP_UNLOCK simple_unlock (&sc->top_lock)
# define BOTTOM_TRYLOCK simple_lock_try(&sc->bottom_lock)
# define BOTTOM_UNLOCK simple_unlock (&sc->bottom_lock)
# define CHECK_CAP suser(curproc, 0)
# define DISABLE_INTR int spl = splnet()
# define ENABLE_INTR splx(spl)
# define IRQ_NONE 0
# define IRQ_HANDLED 1
# define IFP2SC(ifp) (ifp)->if_softc
# define COPY_BREAK MHLEN
# define SLEEP(usecs) tsleep(sc, PCATCH | PZERO, DEVICE_NAME, 1+(usecs/tick))
# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, 0, size, flags)
# define DMA_LOAD(map, addr, size) bus_dmamap_load(ring->tag, map, addr, size, 0, BUS_DMA_NOWAIT)
# if NBPFILTER
# define LMC_BPF_MTAP(mbuf) if (sc->ifp->if_bpf) bpf_mtap(sc->ifp->if_bpf, mbuf)
# define LMC_BPF_ATTACH(dlt, len) bpfattach(&sc->ifp->if_bpf, sc->ifp, dlt, len)
# define LMC_BPF_DETACH bpfdetach(sc->ifp)
# endif
#endif /* __OpenBSD__ */
#ifdef __bsdi__
#if defined(__bsdi__)
typedef int intr_return_t;
# define READ_PCI_CFG(sc, addr) pci_inl(&(sc)->cfgbase, addr)
# define WRITE_PCI_CFG(sc, addr, data) pci_outl(&(sc)->cfgbase, addr, data)
# define IOREF_CSR 1 /* 1=IO refs; 0=MEM refs */
# if IOREF_CSR
# define READ_CSR(csr) inl(sc->csr_iobase+(csr))
# define WRITE_CSR(csr, val) outl(sc->csr_iobase+(csr), (val))
# define READ_CSR(sc, csr) inl ((sc)->csr_iobase+(csr))
# define WRITE_CSR(sc, csr, val) outl((sc)->csr_iobase+(csr), (val))
# else
# error Memory refs to Tulip CSRs cause page faults in BSD/OS
# define READ_CSR(csr) (0 + *(sc->csr_membase+(csr)))
# define WRITE_CSR(csr, val) ((void)(*(sc->csr_membase+(csr)) = (val)))
# error Memory refs to Tulip CSRs do not work
# define READ_CSR(sc, csr) (0 + *((sc)->csr_membase+(csr)))
# define WRITE_CSR(sc, csr, val) ((void)(*((sc)->csr_membase+(csr)) = (val)))
# endif
# define NAME_UNIT sc->dev.dv_xname
# define BOOT_VERBOSE (autoprint & AC_VERBOSE)
# define TOP_LOCK simple_lock (&sc->top_lock)
# define TOP_TRYLOCK simple_lock_try(&sc->top_lock)
# define TOP_UNLOCK simple_unlock (&sc->top_lock)
# define BOTTOM_TRYLOCK simple_lock_try(&sc->bottom_lock)
# define BOTTOM_UNLOCK simple_unlock (&sc->bottom_lock)
static __inline int test_and_set(volatile int *ptr, int val)
{ __asm volatile ("xchgl %0,(%2)" :"=r" (val):"0" (val),"r" (ptr)); return val; }
# define TOP_LOCK(sc) ({ while (test_and_set(&(sc)->top_lock.lock_data, 1)) \
tsleep((sc), PCATCH|PZERO, DEVICE_NAME, 1); 0; })
# define TOP_TRYLOCK(sc) (test_and_set(&(sc)->top_lock.lock_data, 1)==0)
# define TOP_UNLOCK(sc) (sc)->top_lock.lock_data = 0
# define BOTTOM_TRYLOCK(sc) (test_and_set(&(sc)->bottom_lock.lock_data, 1)==0)
# define BOTTOM_UNLOCK(sc) (sc)->bottom_lock.lock_data = 0
# define CHECK_CAP suser(PCPU(curproc)->p_ucred, &PCPU(curproc)->p_acflag)
# define DISABLE_INTR int spl = splimp()
# define ENABLE_INTR splx(spl)
@ -1098,18 +1005,17 @@ const char *ssi_cables[] =
# define IRQ_HANDLED 1
# define IFP2SC(ifp) (ifp)->if_softc
# define COPY_BREAK MHLEN
# define SLEEP(usecs) tsleep(sc, PCATCH | PZERO, DEVICE_NAME, 1+(usecs/tick))
# define SLEEP(usecs) tsleep(sc, PZERO, DEVICE_NAME, 1+(usecs/tick))
# define DMA_SYNC(map, size, flags) /* nothing */
# define DMA_LOAD(map, addr, size) 0
# define bus_dmamap_unload(tag, map) /* nothing */
# define bus_dmamap_destroy(tag, map) /* nothing */
# if NBPFILTER
# define LMC_BPF_MTAP(mbuf) if (sc->ifp->if_bpf) bpf_mtap(sc->ifp->if_bpf, mbuf)
# define LMC_BPF_ATTACH(dlt, len) bpfattach(&sc->ifp->if_bpf, sc->ifp, dlt, len)
# define LMC_BPF_DETACH /* bpfdetach(sc->ifp) */
# endif
# define memcpy(dst, src, len) bcopy(src, dst, len)
# define if_detach(ifp) /* nothing */
# if NBPFILTER
# define LMC_BPF_MTAP(sc, mbuf) if ((sc)->ifp->if_bpf) bpf_mtap((sc)->ifp->if_bpf, mbuf)
# define LMC_BPF_ATTACH(sc, dlt, len) bpfattach(&(sc)->ifp->if_bpf, (sc)->ifp, dlt, len)
# define LMC_BPF_DETACH(sc) /* bpfdetach((sc)->ifp) */
# endif
/* BSD/OS-4.1 doesn't have a back pointer to softc in struct ifnet, */
/* and it passes a unit number not a struct ifnet* to watchdog. */
@ -1121,37 +1027,121 @@ const char *ssi_cables[] =
# endif
#endif /* __bsdi__ */
#ifdef __linux__
# define WRITE_PCI_CFG(sc, addr, data) pci_write_config_dword(sc->pcidev, addr, data)
# define IOREF_CSR 1 /* 1=IO refs; 0=MEM refs */
# if IOREF_CSR
# define READ_CSR(csr) inl((sc->csr_iobase+(csr)))
# define WRITE_CSR(csr, val) outl((val),(sc->csr_iobase+(csr)))
# else
# define READ_CSR(csr) readl((sc->csr_membase+(csr)))
# define WRITE_CSR(csr, val) writel((val),(sc->csr_membase+(csr)))
# endif
# define NAME_UNIT sc->netdev->name
static int debug = 0; /* module_param */
static int verbose = 0; /* module_param */
# define BOOT_VERBOSE verbose
# define TOP_LOCK (down_interruptible(&sc->top_lock) ? 0:1)
# define TOP_TRYLOCK (down_trylock(&sc->top_lock) ? 0:1)
# define TOP_UNLOCK up(&sc->top_lock)
# define BOTTOM_TRYLOCK spin_trylock_bh(&sc->bottom_lock)
# define BOTTOM_UNLOCK spin_unlock_bh(&sc->bottom_lock)
# define CHECK_CAP capable(CAP_NET_ADMIN)? 0 : -EPERM
#if defined(__FreeBSD__)
typedef void intr_return_t;
# define READ_PCI_CFG(sc, addr) pci_read_config ((sc)->dev, addr, 4)
# define WRITE_PCI_CFG(sc, addr, data) pci_write_config((sc)->dev, addr, data, 4)
# define READ_CSR(sc, csr) bus_space_read_4 ((sc)->csr_tag, (sc)->csr_handle, csr)
# define WRITE_CSR(sc, csr, val) bus_space_write_4((sc)->csr_tag, (sc)->csr_handle, csr, val)
# define NAME_UNIT device_get_nameunit(sc->dev)
# define BOOT_VERBOSE bootverbose
# define TOP_LOCK(sc) ({ mtx_lock(&(sc)->top_lock); 0; })
# define TOP_TRYLOCK(sc) mtx_trylock(&(sc)->top_lock)
# define TOP_UNLOCK(sc) mtx_unlock (&(sc)->top_lock)
# define BOTTOM_TRYLOCK(sc) atomic_cmpset_int(&(sc)->bottom_lock, 0, 1)
# define BOTTOM_UNLOCK(sc) (sc)->bottom_lock = 0
# define CHECK_CAP suser(curthread)
# define DISABLE_INTR /* nothing */
# define ENABLE_INTR /* nothing */
# define IRQ_NONE /* nothing */
# define IRQ_HANDLED /* nothing */
# define IFP2SC(ifp) (ifp)->if_softc
# define COPY_BREAK MHLEN
# define SLEEP(usecs) tsleep(sc, PZERO, DEVICE_NAME, 1+(usecs/tick))
# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, flags)
# define DMA_LOAD(map, addr, size) bus_dmamap_load(ring->tag, map, addr, size, fbsd_dmamap_load, ring, 0)
# if NBPFILTER
# define LMC_BPF_MTAP(sc, mbuf) if ((sc)->ifp->if_bpf) bpf_mtap((sc)->ifp->if_bpf, mbuf)
# define LMC_BPF_ATTACH(sc, dlt, len) bpfattach((sc)->ifp, dlt, len)
# define LMC_BPF_DETACH(sc) bpfdetach((sc)->ifp)
# endif
#endif /* __FreeBSD__ */
#if defined(__NetBSD__)
typedef int intr_return_t;
# define READ_PCI_CFG(sc, addr) pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr)
# define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data)
# define READ_CSR(sc, csr) bus_space_read_4 ((sc)->csr_tag, (sc)->csr_handle, csr)
# define WRITE_CSR(sc, csr, val) bus_space_write_4((sc)->csr_tag, (sc)->csr_handle, csr, val)
# define NAME_UNIT sc->dev.dv_xname
# define BOOT_VERBOSE (boothowto & AB_VERBOSE)
# define TOP_LOCK(sc) ({ while (__cpu_simple_lock_try(&(sc)->top_lock)==0) \
tsleep((sc), PCATCH|PZERO, DEVICE_NAME, 1); 0; })
# define TOP_TRYLOCK(sc) __cpu_simple_lock_try(&(sc)->top_lock)
# define TOP_UNLOCK(sc) __cpu_simple_unlock (&(sc)->top_lock)
# define BOTTOM_TRYLOCK(sc) __cpu_simple_lock_try(&(sc)->bottom_lock)
# define BOTTOM_UNLOCK(sc) __cpu_simple_unlock (&(sc)->bottom_lock)
# define CHECK_CAP suser(curproc->p_ucred, &curproc->p_acflag)
/* kauth_authorize_generic(curproc->p_cred, KAUTH_GENERIC_ISSUSER, &curproc->p_acflag) */
# define DISABLE_INTR int spl = splnet()
# define ENABLE_INTR splx(spl)
# define IRQ_NONE 0
# define IRQ_HANDLED 1
# define IFP2SC(ifp) (ifp)->if_softc
# define COPY_BREAK MHLEN
# define SLEEP(usecs) tsleep(sc, PZERO, DEVICE_NAME, 1+(usecs/tick))
# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, 0, size, flags)
# define DMA_LOAD(map, addr, size) bus_dmamap_load(ring->tag, map, addr, size, 0, BUS_DMA_NOWAIT)
# if NBPFILTER
# define LMC_BPF_MTAP(sc, mbuf) if ((sc)->ifp->if_bpf) bpf_mtap((sc)->ifp->if_bpf, mbuf)
# define LMC_BPF_ATTACH(sc, dlt, len) bpfattach((sc)->ifp, dlt, len)
# define LMC_BPF_DETACH(sc) bpfdetach((sc)->ifp)
# endif
#endif /* __NetBSD__ */
#if defined(__OpenBSD__)
typedef int intr_return_t;
# define READ_PCI_CFG(sc, addr) pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr)
# define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data)
# define READ_CSR(sc, csr) bus_space_read_4 ((sc)->csr_tag, (sc)->csr_handle, csr)
# define WRITE_CSR(sc, csr, val) bus_space_write_4((sc)->csr_tag, (sc)->csr_handle, csr, val)
# define NAME_UNIT sc->dev.dv_xname
# define BOOT_VERBOSE 1
# define TOP_LOCK(sc) ({ while (__cpu_simple_lock_try(&(sc)->top_lock)==0) \
tsleep((sc), PCATCH|PZERO, DEVICE_NAME, 1); 0; })
# define TOP_TRYLOCK(sc) __cpu_simple_lock_try(&(sc)->top_lock)
# define TOP_UNLOCK(sc) __cpu_simple_unlock (&(sc)->top_lock)
# define BOTTOM_TRYLOCK(sc) __cpu_simple_lock_try(&(sc)->bottom_lock)
# define BOTTOM_UNLOCK(sc) __cpu_simple_unlock (&(sc)->bottom_lock)
# define CHECK_CAP suser(curproc, 0)
# define DISABLE_INTR int spl = splnet()
# define ENABLE_INTR splx(spl)
# define IRQ_NONE 0
# define IRQ_HANDLED 1
# define IFP2SC(ifp) (ifp)->if_softc
# define COPY_BREAK MHLEN
# define SLEEP(usecs) tsleep(sc, PZERO, DEVICE_NAME, 1+(usecs/tick))
# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, 0, size, flags)
# define DMA_LOAD(map, addr, size) bus_dmamap_load(ring->tag, map, addr, size, 0, BUS_DMA_NOWAIT)
# if NBPFILTER
# define LMC_BPF_MTAP(sc, mbuf) if ((sc)->ifp->if_bpf) bpf_mtap((sc)->ifp->if_bpf, mbuf)
# define LMC_BPF_ATTACH(sc, dlt, len) bpfattach(&(sc)->ifp->if_bpf, (sc)->ifp, dlt, len)
# define LMC_BPF_DETACH(sc) bpfdetach((sc)->ifp)
# endif
#endif /* __OpenBSD__ */
#if defined(__linux__)
static int debug = 0; /* module_param */
static int verbose = 0; /* module_param */
# define WRITE_PCI_CFG(sc, addr, data) pci_write_config_dword(sc->pcidev, addr, data)
# define READ_CSR(sc, csr) ioread32((sc)->csr_cookie+(csr))
# define WRITE_CSR(sc, csr, val) iowrite32((val), (sc)->csr_cookie+(csr))
# define NAME_UNIT sc->netdev->name
# define BOOT_VERBOSE verbose
# define TOP_LOCK(sc) down_interruptible(&(sc)->top_lock)
# define TOP_TRYLOCK(sc) (down_trylock(&(sc)->top_lock) ? 0:1)
# define TOP_UNLOCK(sc) up(&(sc)->top_lock)
# define BOTTOM_TRYLOCK(sc) (test_and_set_bit(0, &(sc)->bottom_lock)==0)
# define BOTTOM_UNLOCK(sc) (sc)->bottom_lock = 0
# define CHECK_CAP capable(CAP_NET_ADMIN)? 0 : -EPERM
# define NETDEV2SC(netdev) (netdev)->ec_ptr /* HACK */
# define COPY_BREAK 200
# define SLEEP(usecs) schedule_timeout_interruptible(1+(usecs*HZ)/1000000UL)
# define DELAY(usecs) udelay(usecs)
# define SLEEP(usecs) do { set_current_state(TASK_INTERRUPTIBLE);\
schedule_timeout(1+(usecs*HZ)/1000000UL); } while (0)
# define printf printk
# define copyin(u, k, len) copy_from_user(k, u, len)
# define microtime(time) do_gettimeofday(time)
# define malloc(len, t, f) kmalloc(len, GFP_KERNEL)
# define malloc(len, t, f) kzalloc(len, GFP_KERNEL)
# define free(addr, t) kfree(addr)
# define LITTLE_ENDIAN 4321
# define BIG_ENDIAN 1234
@ -1160,11 +1150,11 @@ const char *ssi_cables[] =
# elif defined(__BIG_ENDIAN)
# define BYTE_ORDER BIG_ENDIAN
# else
# error "asm/byteorder.h is wrong"
# error "byte order confusion"
# endif
#endif /* __linux__ */
static int driver_announced = 0;/* print driver version info once only */
static int driver_announced = 0; /* print driver info once only */
#define SNDQ_MAXLEN 32 /* packets awaiting transmission */
#define DESCS_PER_PKT 4 /* DMA descriptors per TX pkt */
@ -1176,18 +1166,18 @@ static int driver_announced = 0;/* print driver version info once only */
* 2047 isn't a multiple of a cache line size (32 bytes typically).
* So back off to 2048-32 = 2016 bytes per chunk (2 chunks per descr).
*/
#define MAX_CHUNK_LEN 2016
#define MAX_CHUNK_LEN (2048-32)
#define MAX_DESC_LEN (2 * MAX_CHUNK_LEN)
/* Tulip DMA descriptor; THIS STRUCT MUST MATCH THE HARDWARE */
struct dma_desc
{
u_int32_t status; /* hardware->to->software */
#if BYTE_ORDER == LITTLE_ENDIAN /* left-to-right packing by compiler */
#if BYTE_ORDER == LITTLE_ENDIAN /* left-to-right packing */
unsigned length1:11; /* buffer1 length */
unsigned length2:11; /* buffer2 length */
unsigned control:10; /* software->to->hardware */
#else /* right-to-left packing by compiler */
#else /* right-to-left packing */
unsigned control:10; /* software->to->hardware */
unsigned length2:11; /* buffer2 length */
unsigned length1:11; /* buffer1 length */
@ -1197,7 +1187,7 @@ struct dma_desc
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
bus_dmamap_t map; /* bus dmamap for this descriptor */
# define TLP_BUS_DSL_VAL (sizeof(bus_dmamap_t) & TLP_BUS_DSL)
#else
#else /* BUS_DMA */
# define TLP_BUS_DSL_VAL 0
#endif
} __attribute__ ((packed));
@ -1236,22 +1226,22 @@ struct desc_ring
struct dma_desc *first; /* first descriptor in ring */
struct dma_desc *last; /* last descriptor in ring */
struct dma_desc *temp; /* temporary write pointer for tx */
u_int32_t dma_addr; /* bus address for desc array */ /* XXX */
u_int32_t dma_addr; /* bus addr for desc array XXX */
int size_descs; /* bus_dmamap_sync needs this */
int num_descs; /* used to set rx quota */
#ifdef __linux__
struct sk_buff *head; /* tail-queue of skbuffs */
struct sk_buff *tail;
#elif BSD
#if IFNET || NETGRAPH
struct mbuf *head; /* tail-queue of mbufs */
struct mbuf *tail;
#elif NETDEV
struct sk_buff *head; /* tail-queue of skbuffs */
struct sk_buff *tail;
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
bus_dma_tag_t tag; /* bus_dma tag for desc array */
bus_dma_tag_t tag; /* bus_dma_tag for desc array */
bus_dmamap_t map; /* bus_dmamap for desc array */
bus_dma_segment_t segs[2]; /* bus_dmamap_load() or bus_dmamem_alloc() */
int nsegs; /* bus_dmamap_load() or bus_dmamem_alloc() */
# endif
#endif
#endif /* BUS_DMA */
};
/* break circular definition */
@ -1266,9 +1256,8 @@ struct card /* an object */
void (*detach) (softc_t *);
};
struct line /* an object */
struct stack /* an object */
{
void (* watchdog)(softc_t *);
#if IFNET || NETGRAPH
int (*ioctl) (softc_t *, u_long, caddr_t);
void (*input) (softc_t *, struct mbuf *);
@ -1278,6 +1267,7 @@ struct line /* an object */
int (*type) (softc_t *, struct sk_buff *);
int (*mtu) (softc_t *, int);
#endif
void (*watchdog) (softc_t *);
int (*open) (softc_t *, struct config *);
int (*attach) (softc_t *, struct config *);
int (*detach) (softc_t *);
@ -1287,34 +1277,34 @@ struct line /* an object */
/* NetBSD, OpenBSD and BSD/OS want struct device first in the softc. */
struct softc
{
#if defined(__NetBSD__) || defined(__OpenBSD__)
struct device dev; /* base device -- must be first in softc */
pcitag_t pa_tag; /* pci_conf_read/write need this */
pci_chipset_tag_t pa_pc; /* pci_conf_read/write need this */
bus_dma_tag_t pa_dmat; /* bus_dma needs this */
bus_space_tag_t csr_tag; /* bus_space needs this */
bus_space_handle_t csr_handle;/* bus_space needs this */
pci_intr_handle_t intr_handle;/* interrupt handle */
void *irq_cookie; /* pci_intr_disestablish needs this */
void *sdh_cookie; /* shutdownhook_disestablish needs this */
struct simplelock top_lock; /* lock card->watchdog vs lmc_ioctl */
struct simplelock bottom_lock;/* lock for buf queues & descriptor rings */
struct mbuf *tx_mbuf; /* hang mbuf here while building dma descs */
#endif /* __NetBSD__ || __OpenBSD__ */
#ifdef __bsdi__
struct device dev; /* base device -- must be first in softc */
struct isadev id; /* bus resource */
struct intrhand ih; /* interrupt vectoring */
struct atshutdown ats; /* shutdown hook */
pci_devaddr_t cfgbase; /* base address of PCI config regs */
u_int16_t csr_iobase; /* io base address of Tulip CSRs */
u_int32_t *csr_membase; /* kv mem base address of Tulip CSRs */
struct simplelock top_lock; /* lock card->watchdog vs lmc_ioctl */
struct simplelock bottom_lock;/* lock for buf queues & descriptor rings */
struct mbuf *tx_mbuf; /* hang mbuf here while building dma descs */
#if defined(__bsdi__)
struct device dev; /* must be first in softc */
struct isadev id;
struct intrhand ih;
struct atshutdown ats;
pci_devaddr_t cfgbase;
u_int16_t csr_iobase;
u_int32_t *csr_membase;
struct mbuf *tx_mbuf; /* mbuf while building dma descs */
struct simplelock top_lock; /* lock card->watchdog vs ioctls */
struct simplelock bottom_lock; /* lock buf queues & desc rings */
#endif /* __bsdi__ */
#if defined(__NetBSD__) || defined(__OpenBSD__)
struct device dev; /* must be first in softc */
pcitag_t pa_tag;
pci_chipset_tag_t pa_pc;
bus_dma_tag_t pa_dmat;
bus_space_tag_t csr_tag;
bus_space_handle_t csr_handle;
pci_intr_handle_t intr_handle;
void *irq_cookie;
void *sdh_cookie;
struct mbuf *tx_mbuf; /* hang mbuf here while building dma descs */
__cpu_simple_lock_t top_lock; /* lock card->watchdog vs ioctls */
__cpu_simple_lock_t bottom_lock; /* lock buf queues & descriptor rings */
#endif /* __NetBSD__ || __OpenBSD__ */
/* State for kernel-resident Line Protocols */
#if IFNET
# if SPPP
@ -1329,12 +1319,12 @@ struct softc
struct ifnet ifnet;
# endif
struct ifnet *ifp;
struct ifmedia ifm; /* hooks for ifconfig(8) */
struct ifmedia ifm;
#endif /* IFNET */
#if NETDEV
# if GEN_HDLC
hdlc_device *hdlcdev; /* contains a struct net_device_stats */
hdlc_device *hdlcdev; /* contains struct net_device_stats */
# else
struct net_device_stats netdev_stats;
# endif
@ -1354,61 +1344,60 @@ struct softc
struct ifaltq ng_fastq;
#endif /* NETGRAPH */
#ifdef __FreeBSD__
#if defined(__FreeBSD__)
struct device *dev; /* base device pointer */
bus_space_tag_t csr_tag; /* bus_space needs this */
bus_space_handle_t csr_handle;/* bus_space_needs this */
void *irq_cookie; /* bus_teardown_intr needs this */
struct resource *irq_res; /* bus_release_resource needs this */
int irq_res_id; /* bus_release_resource needs this */
struct resource *csr_res; /* bus_release_resource needs this */
int csr_res_id; /* bus_release resource needs this */
int csr_res_type; /* bus_release resource needs this */
struct mbuf *tx_mbuf; /* hang mbuf here while building dma descs */
struct mtx top_mtx; /* lock card->watchdog vs lmc_ioctl */
struct mtx bottom_mtx; /* lock for buf queues & descriptor rings */
bus_space_tag_t csr_tag;
bus_space_handle_t csr_handle;
void *irq_cookie;
struct resource *irq_res;
int irq_res_id;
struct resource *csr_res;
int csr_res_id;
int csr_res_type;
struct mbuf *tx_mbuf; /* mbuf while building dma descs */
struct mtx top_lock; /* lock card->watchdog vs ioctls */
int bottom_lock; /* lock buf queues & desc rings */
#endif /* __FreeBSD__ */
#ifdef __linux__
struct pci_dev *pcidev; /* READ/WRITE_PCI_CFG macros need this */
struct timer_list wd_timer; /* timer calls watchdog() once a second */
u_int32_t csr_iobase; /* io base address of Tulip CSRs */
void *csr_membase; /* kv mem base address of Tulip CSRs */
struct sk_buff *tx_skb; /* hang skb here while building dma descs */
struct semaphore top_lock; /* lock card->watchdog vs lmc_ioctl */
spinlock_t bottom_lock; /* lock for buf queues & descriptor rings */
#if defined(__linux__)
struct pci_dev *pcidev;
struct timer_list wd_timer;
void *csr_cookie;
struct sk_buff *tx_skb; /* skb while building dma descs */
struct semaphore top_lock; /* lock card->watchdog vs ioctls */
long bottom_lock; /* lock buf queues & desc rings */
#endif /* __linux__ */
/* Top-half state used by all card types; lock with top_lock, */
struct status status; /* driver status lmcconfig can read */
struct config config; /* driver config lmcconfig can read/write */
const char *dev_desc; /* string describing type of board */
struct card *card; /* card methods: watchdog, ioctl ... */
struct line *line; /* line methods: watchdog, ioctl ... */
u_int32_t gpio_dir; /* s/w copy of GPIO direction register */
/* State used by all card types; lock with top_lock. */
struct status status; /* lmcconfig can read */
struct config config; /* lmcconfig can read/write */
const char *dev_desc; /* string describing card */
struct card *card; /* card methods */
struct stack *stack; /* line methods */
u_int32_t gpio_dir; /* s/w copy of GPIO direction reg */
u_int16_t led_state; /* last value written to mii16 */
int quota; /* used for packet flow control */
/* Top-half state used by card-specific watchdogs; lock with top_lock. */
u_int32_t last_mii16; /* SSI, HSSI: MII reg 16 one second ago */
u_int32_t last_stat16; /* T3: framer reg 16 one second ago */
u_int32_t last_alm1; /* T1E1: framer reg 47 one second ago */
u_int32_t last_link_state;/* ALL: status.link_state one second ago */
/* State used by card-specific watchdogs; lock with top_lock. */
u_int32_t last_mii16; /* SSI, HSSI: MII reg 16 one sec ago */
u_int32_t last_stat16; /* T3: framer reg 16 one sec ago */
u_int32_t last_alm1; /* T1E1: framer reg 47 one sec ago */
u_int32_t last_link_state; /* ALL: status.link_state 1 ec ago */
u_int32_t last_FEAC; /* T3: last FEAC msg code received */
u_int32_t loop_timer; /* T1E1, T3: secs until loopback expires */
u_int32_t loop_timer; /* T1E1, T3: secs until loop ends */
/* Bottom-half state used by the interrupt code; lock with bottom_lock. */
/* State used by the interrupt code; lock with bottom_lock. */
struct desc_ring txring; /* tx descriptor ring state */
struct desc_ring rxring; /* rx descriptor ring state */
}; /* end of softc */
#if NBPFILTER == 0
# define LMC_BPF_MTAP(mbuf) /* nothing */
# define LMC_BPF_ATTACH(dlt, len) /* nothing */
# define LMC_BPF_DETACH /* nothing */
#if BSD && (NBPFILTER == 0)
# define LMC_BPF_MTAP(sc, mbuf) /* nothing */
# define LMC_BPF_ATTACH(sc, dlt, len) /* nothing */
# define LMC_BPF_DETACH(sc) /* nothing */
#endif
#if defined(__bsdi__)
#if defined(__bsdi__) /* ALTQ shims */
# define IFQ_ENQUEUE(ifq, m, pa, err) \
do { \
if (pa==0); /* suppress warning */ \
@ -1437,12 +1426,12 @@ do { \
m_freem(m); \
} \
} while (0)
#endif
#endif /* __bsdi__ */
#define HSSI_DESC "LMC HSSI Card"
#define T3_DESC "LMC T3 Card"
#define SSI_DESC "LMC SSI Card"
#define T1E1_DESC "LMC T1E1 Card"
#define HSSI_DESC "LMC5200 HSSI Card"
#define T3_DESC "LMC5245 T3 Card"
#define SSI_DESC "LMC1000 SSI Card"
#define T1E1_DESC "LMC1200 T1E1 Card"
/* procedure prototypes */
@ -1513,91 +1502,90 @@ static void t1_attach(softc_t *, struct config *);
static void t1_detach(softc_t *);
#if NETGRAPH
static void netgraph_line_watchdog(softc_t *);
static int netgraph_line_ioctl(softc_t *, u_long, caddr_t);
static void netgraph_line_input(softc_t *, struct mbuf *);
static void netgraph_line_output(softc_t *);
static int netgraph_line_open(softc_t *, struct config *);
static int netgraph_line_attach(softc_t *, struct config *);
static int netgraph_line_detach(softc_t *);
static int netgraph_ioctl(softc_t *, u_long, caddr_t);
static void netgraph_input(softc_t *, struct mbuf *);
static void netgraph_output(softc_t *);
static void netgraph_watchdog(softc_t *);
static int netgraph_open(softc_t *, struct config *);
static int netgraph_attach(softc_t *, struct config *);
static int netgraph_detach(softc_t *);
#endif /* NETGRAPH */
#if SYNC_PPP
static void sync_ppp_line_watchdog(softc_t *);
static int sync_ppp_line_ioctl(softc_t *, struct ifreq *, int);
static int sync_ppp_line_type(softc_t *, struct sk_buff *);
static int sync_ppp_line_mtu(softc_t *, int);
static int sync_ppp_line_open(softc_t *, struct config *);
static int sync_ppp_line_attach(softc_t *, struct config *);
static int sync_ppp_line_detach(softc_t *);
static int sync_ppp_ioctl(softc_t *, struct ifreq *, int);
static int sync_ppp_type(softc_t *, struct sk_buff *);
static int sync_ppp_mtu(softc_t *, int);
static void sync_ppp_watchdog(softc_t *);
static int sync_ppp_open(softc_t *, struct config *);
static int sync_ppp_attach(softc_t *, struct config *);
static int sync_ppp_detach(softc_t *);
#endif /* SYNC_PPP */
#if GEN_HDLC
static void gen_hdlc_line_watchdog(softc_t *);
static int gen_hdlc_line_ioctl(softc_t *, struct ifreq *, int);
static int gen_hdlc_line_type(softc_t *, struct sk_buff *);
static int gen_hdlc_line_mtu(softc_t *, int);
static int gen_hdlc_line_open(softc_t *, struct config *);
static int gen_hdlc_line_attach(softc_t *, struct config *);
static int gen_hdlc_line_detach(softc_t *);
static int gen_hdlc_card_params(struct net_device *, unsigned short, unsigned short);
static int gen_hdlc_ioctl(softc_t *, struct ifreq *, int);
static int gen_hdlc_type(softc_t *, struct sk_buff *);
static int gen_hdlc_mtu(softc_t *, int);
static void gen_hdlc_watchdog(softc_t *);
static int gen_hdlc_open(softc_t *, struct config *);
static int gen_hdlc_attach(softc_t *, struct config *);
static int gen_hdlc_detach(softc_t *);
static int gen_hdlc_card_params(struct net_device *, unsigned short,
unsigned short);
#endif /* GEN_HDLC */
#if P2P
static void p2p_line_watchdog(softc_t *);
static int p2p_line_ioctl(softc_t *, u_long, caddr_t);
static void p2p_line_input(softc_t *, struct mbuf *);
static void p2p_line_output(softc_t *);
static int p2p_line_open(softc_t *, struct config *);
static int p2p_line_attach(softc_t *, struct config *);
static int p2p_line_detach(softc_t *);
static int p2p_stack_ioctl(softc_t *, u_long, caddr_t);
static void p2p_stack_input(softc_t *, struct mbuf *);
static void p2p_stack_output(softc_t *);
static void p2p_stack_watchdog(softc_t *);
static int p2p_stack_open(softc_t *, struct config *);
static int p2p_stack_attach(softc_t *, struct config *);
static int p2p_stack_detach(softc_t *);
static int p2p_getmdm(struct p2pcom *, caddr_t);
static int p2p_mdmctl(struct p2pcom *, int);
#endif /* P2P */
#if SPPP
static void sppp_line_watchdog(softc_t *);
static int sppp_line_ioctl(softc_t *, u_long, caddr_t);
static void sppp_line_input(softc_t *, struct mbuf *);
static void sppp_line_output(softc_t *);
static int sppp_line_open(softc_t *, struct config *);
static int sppp_line_attach(softc_t *, struct config *);
static int sppp_line_detach(softc_t *);
static int sppp_stack_ioctl(softc_t *, u_long, caddr_t);
static void sppp_stack_input(softc_t *, struct mbuf *);
static void sppp_stack_output(softc_t *);
static void sppp_stack_watchdog(softc_t *);
static int sppp_stack_open(softc_t *, struct config *);
static int sppp_stack_attach(softc_t *, struct config *);
static int sppp_stack_detach(softc_t *);
static void sppp_tls(struct sppp *);
static void sppp_tlf(struct sppp *);
#endif /* SPPP */
static void rawip_line_watchdog(softc_t *);
#if IFNET
static int rawip_line_ioctl(softc_t *, u_long, caddr_t);
static void rawip_line_input(softc_t *, struct mbuf *);
static void rawip_line_output(softc_t *);
static int rawip_ioctl(softc_t *, u_long, caddr_t);
static void rawip_input(softc_t *, struct mbuf *);
static void rawip_output(softc_t *);
#elif NETDEV
static int rawip_line_ioctl(softc_t *, struct ifreq *, int);
static int rawip_line_type(softc_t *, struct sk_buff *);
static int rawip_line_mtu(softc_t *, int);
static int rawip_ioctl(softc_t *, struct ifreq *, int);
static int rawip_type(softc_t *, struct sk_buff *);
static int rawip_mtu(softc_t *, int);
#endif
static int rawip_line_open(softc_t *, struct config *);
static int rawip_line_attach(softc_t *, struct config *);
static int rawip_line_detach(softc_t *);
static void rawip_watchdog(softc_t *);
static int rawip_open(softc_t *, struct config *);
static int rawip_attach(softc_t *, struct config *);
static int rawip_detach(softc_t *);
#if IFNET
static int ifnet_raw_ioctl(struct ifnet *, u_long, caddr_t);
static void ifnet_raw_input(struct ifnet *, struct mbuf *);
static int ifnet_raw_output(struct ifnet *, struct mbuf *,
static void ifnet_input(struct ifnet *, struct mbuf *);
static int ifnet_output(struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *);
static int ifnet_ioctl(struct ifnet *, u_long, caddr_t);
static void ifnet_start(struct ifnet *);
static void ifnet_watchdog(struct ifnet *);
static void ifmedia_setup(softc_t *);
static int ifmedia_change(struct ifnet *);
static void ifmedia_status(struct ifnet *, struct ifmediareq *);
static void ifnet_setup(struct ifnet *);
static int ifnet_attach(softc_t *);
static void ifnet_detach(softc_t *);
static void ifmedia_setup(softc_t *);
static int ifmedia_change(struct ifnet *);
static void ifmedia_status(struct ifnet *, struct ifmediareq *);
#endif /* IFNET */
#if NETDEV
@ -1610,8 +1598,7 @@ static int netdev_poll(struct net_device *, int *);
static int netdev_ioctl(struct net_device *, struct ifreq *, int);
static int netdev_mtu(struct net_device *, int);
static void netdev_timeout(struct net_device *);
static struct net_device_stats *
netdev_stats(struct net_device *);
static struct net_device_stats *netdev_stats(struct net_device *);
static void netdev_watchdog(unsigned long);
static void netdev_setup(struct net_device *);
@ -1646,17 +1633,12 @@ static int txintr_setup_mbuf(softc_t *, struct mbuf *);
static int txintr_setup(softc_t *);
static intr_return_t bsd_interrupt(void *);
#endif /* BSD */
# if DEVICE_POLLING
static void bsd_poll(struct ifnet *, enum poll_cmd, int);
# endif
#endif /* BSD */
#ifdef __FreeBSD__
static void fbsd_dmamap_load(void *, bus_dma_segment_t *, int, int);
#endif
#ifdef __linux__
#if defined(__linux__)
static int create_ring(softc_t *, struct desc_ring *, int);
static void destroy_ring(softc_t *, struct desc_ring *);
@ -1673,8 +1655,8 @@ static int txintr_setup(softc_t *);
static irqreturn_t linux_interrupt(int, void *, struct pt_regs *);
#endif /* __linux__ */
static int line_open(softc_t *, struct config *);
static int line_attach(softc_t *, struct config *);
static int open_proto(softc_t *, struct config *);
static int attach_stack(softc_t *, struct config *);
static int lmc_ioctl(softc_t *, u_long, caddr_t);
static void lmc_watchdog(softc_t *);
@ -1682,45 +1664,51 @@ static void lmc_watchdog(softc_t *);
static void set_ready(softc_t *, int);
static void reset_cntrs(softc_t *);
static void user_interrupt(softc_t *, int);
static void lmc_interrupt(void *, int);
static void lmc_interrupt(void *, int, int);
static void check_intr_status(softc_t *);
static int lmc_attach(softc_t *, const char *);
static int lmc_attach(softc_t *);
static void lmc_detach(softc_t *);
static void tulip_loop(softc_t *, struct config *);
static int tulip_attach(softc_t *);
static void tulip_detach(void *);
#ifdef __FreeBSD__
static void print_driver_info(void);
#if defined(__FreeBSD__)
static int fbsd_probe(device_t);
static int fbsd_attach(device_t);
static int fbsd_detach(device_t);
static void fbsd_shutdown(device_t);
static void fbsd_dmamap_load(void *, bus_dma_segment_t *, int, int);
#endif /* __FreeBSD__ */
#ifdef __NetBSD__
#if defined(__NetBSD__)
static int nbsd_match(struct device *, struct cfdata *, void *);
static void nbsd_attach(struct device *, struct device *, void *);
static int nbsd_detach(struct device *, int);
# if defined(LKM)
int if_lmc_lkmentry(struct lkm_table *, int, int);
# endif
#endif /* __NetBSD__ */
#ifdef __OpenBSD__
#if defined(__OpenBSD__)
static int obsd_match(struct device *, void *, void *);
static void obsd_attach(struct device *, struct device *, void *);
static int obsd_detach(struct device *, int);
# if defined(LKM)
int if_lmc_lkmentry(struct lkm_table *, int, int);
# endif
#endif /* __OpenBSD__ */
#ifdef __bsdi__
#if defined(__bsdi__)
static int bsdi_match(pci_devaddr_t *);
static int bsdi_probe(struct device *, struct cfdata *, void *);
static void bsdi_attach(struct device *, struct device *, void *);
#endif /* __bsdi__ */
#ifdef __linux__
#if defined(__linux__)
static int __init linux_probe(struct pci_dev *, const struct pci_device_id *);
static int __init linux_attach(struct pci_dev *);
static void __exit linux_remove(struct pci_dev *);