Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/qbus Totally rewritten DEQNA device driver, that use...
details: https://anonhg.NetBSD.org/src/rev/b3d1313effff
branches: trunk
changeset: 473800:b3d1313effff
user: ragge <ragge%NetBSD.org@localhost>
date: Sun Jun 20 00:04:47 1999 +0000
description:
Totally rewritten DEQNA device driver, that uses the bus.h interface
instead. This almost doubled the receive speed of the interface :-)
diffstat:
sys/dev/qbus/if_qe.c | 1492 +++++++++++++++++++---------------------------
sys/dev/qbus/if_qereg.h | 41 +-
2 files changed, 648 insertions(+), 885 deletions(-)
diffs (truncated from 1793 to 300 lines):
diff -r 1d4c3a842153 -r b3d1313effff sys/dev/qbus/if_qe.c
--- a/sys/dev/qbus/if_qe.c Sat Jun 19 19:44:08 1999 +0000
+++ b/sys/dev/qbus/if_qe.c Sun Jun 20 00:04:47 1999 +0000
@@ -1,11 +1,6 @@
-/* $NetBSD: if_qe.c,v 1.36 1999/06/06 19:26:44 ragge Exp $ */
-
+/* $NetBSD: if_qe.c,v 1.37 1999/06/20 00:04:47 ragge Exp $ */
/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Digital Equipment Corp.
+ * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -17,273 +12,119 @@
* 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 the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_qe.c 7.20 (Berkeley) 3/28/91
- */
-
-/* from @(#)if_qe.c 1.15 (ULTRIX) 4/16/86 */
-
-/****************************************************************
- * *
- * Licensed from Digital Equipment Corporation *
- * Copyright (c) *
- * Digital Equipment Corporation *
- * Maynard, Massachusetts *
- * 1985, 1986 *
- * All rights reserved. *
- * *
- * The Information in this software is subject to change *
- * without notice and should not be construed as a commitment *
- * by Digital Equipment Corporation. Digital makes no *
- * representations about the suitability of this software for *
- * any purpose. It is supplied "As Is" without expressed or *
- * implied warranty. *
- * *
- * If the Regents of the University of California or its *
- * licensees modify the software in a manner creating *
- * derivative copyright rights, appropriate copyright *
- * legends may be placed on the derivative work in addition *
- * to that set forth above. *
- * *
- ****************************************************************/
-/* ---------------------------------------------------------------------
- * Modification History
- *
- * 15-Apr-86 -- afd
- * Rename "unused_multi" to "qunused_multi" for extending Generic
- * kernel to MicroVAXen.
- *
- * 18-mar-86 -- jaw br/cvec changed to NOT use registers.
+ * This product includes software developed at Ludd, University of
+ * Lule}, Sweden and its contributors.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
*
- * 12 March 86 -- Jeff Chase
- * Modified to handle the new MCLGET macro
- * Changed if_qe_data.c to use more receive buffers
- * Added a flag to poke with adb to log qe_restarts on console
- *
- * 19 Oct 85 -- rjl
- * Changed the watch dog timer from 30 seconds to 3. VMS is using
- * less than 1 second in their's. Also turned the printf into an
- * mprintf.
- *
- * 09/16/85 -- Larry Cohen
- * Add 43bsd alpha tape changes for subnet routing
- *
- * 1 Aug 85 -- rjl
- * Panic on a non-existent memory interrupt and the case where a packet
- * was chained. The first should never happen because non-existant
- * memory interrupts cause a bus reset. The second should never happen
- * because we hang 2k input buffers on the device.
- *
- * 1 Aug 85 -- rich
- * Fixed the broadcast loopback code to handle Clusters without
- * wedging the system.
- *
- * 27 Feb. 85 -- ejf
- * Return default hardware address on ioctl request.
- *
- * 12 Feb. 85 -- ejf
- * Added internal extended loopback capability.
- *
- * 27 Dec. 84 -- rjl
- * Fixed bug that caused every other transmit descriptor to be used
- * instead of every descriptor.
- *
- * 21 Dec. 84 -- rjl
- * Added watchdog timer to mask hardware bug that causes device lockup.
- *
- * 18 Dec. 84 -- rjl
- * Reworked driver to use q-bus mapping routines. MicroVAX-I now does
- * copying instead of m-buf shuffleing.
- * A number of deficencies in the hardware/firmware were compensated
- * for. See comments in qestart and qerint.
- *
- * 14 Nov. 84 -- jf
- * Added usage counts for multicast addresses.
- * Updated general protocol support to allow access to the Ethernet
- * header.
- *
- * 04 Oct. 84 -- jf
- * Added support for new ioctls to add and delete multicast addresses
- * and set the physical address.
- * Add support for general protocols.
- *
- * 14 Aug. 84 -- rjl
- * Integrated Shannon changes. (allow arp above 1024 and ? )
- *
- * 13 Feb. 84 -- rjl
- *
- * Initial version of driver. derived from IL driver.
- *
- * ---------------------------------------------------------------------
+ * 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.
*/
/*
- * Digital Q-BUS to NI Adapter
- * supports DEQNA and DELQA in DEQNA-mode.
+ * Driver for DEQNA/DELQA ethernet cards.
+ * Things that is still to do:
+ * Have a timeout check for hang transmit logic.
+ * Handle ubaresets. Does not work at all right now.
+ * Fix ALLMULTI reception. But someone must tell me how...
+ * Collect statistics.
*/
#include "opt_inet.h"
-#include "opt_ccitt.h"
-#include "opt_llc.h"
-#include "opt_iso.h"
-#include "opt_ns.h"
#include "bpfilter.h"
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/mbuf.h>
-#include <sys/buf.h>
-#include <sys/protosw.h>
#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
#include <sys/device.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/reboot.h>
+#include <sys/systm.h>
+#include <sys/sockio.h>
#include <net/if.h>
#include <net/if_ether.h>
#include <net/if_dl.h>
-#ifdef INET
#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
#include <netinet/if_inarp.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-
-#ifdef ISO
-#include <netiso/iso.h>
-#include <netiso/iso_var.h>
-extern char all_es_snpa[], all_is_snpa[], all_l1is_snpa[], all_l2is_snpa[];
-#endif
-
-#if defined(CCITT) && defined(LLC)
-#include <sys/socketvar.h>
-#include <netccitt/x25.h>
-#include <netccitt/pk.h>
-#include <netccitt/pk_var.h>
-#include <netccitt/pk_extern.h>
-#endif
#if NBPFILTER > 0
#include <net/bpf.h>
#include <net/bpfdesc.h>
#endif
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/rpb.h>
+#include <machine/bus.h>
-#include <vax/if/if_qereg.h>
-#include <vax/if/if_uba.h>
-#include <vax/uba/ubareg.h>
-#include <vax/uba/ubavar.h>
+#include <dev/qbus/ubavar.h>
+#include <dev/qbus/if_qereg.h>
-#define NRCV 15 /* Receive descriptors */
-#define NXMT 5 /* Transmit descriptors */
-#define NTOT (NXMT + NRCV)
+#include "ioconf.h"
-#define QETIMEOUT 2 /* transmit timeout, must be > 1 */
-#define QESLOWTIMEOUT 40 /* timeout when no xmits in progress */
-
-#define MINDATA 60
+#define RXDESCS 30 /* # of receive descriptors */
+#define TXDESCS 60 /* # transmit descs */
/*
- * Ethernet software status per interface.
- *
- * Each interface is referenced by a network interface structure,
- * qe_if, which the routing code uses to locate the interface.
- * This structure contains the output queue for the interface, its address, ...
+ * Structure containing the elements that must be in DMA-safe memory.
*/
-struct qe_softc {
- struct device qe_dev; /* Configuration common part */
- struct ethercom qe_ec; /* Ethernet common part */
-#define qe_if qe_ec.ec_if /* network-visible interface */
- struct ifubinfo qe_uba; /* Q-bus resources */
- struct ifrw qe_ifr[NRCV]; /* for receive buffers; */
- struct ifxmt qe_ifw[NXMT]; /* for xmit buffers; */
- struct qedevice *qe_vaddr;
- int qe_flags; /* software state */
-#define QEF_RUNNING 0x01
-#define QEF_SETADDR 0x02
-#define QEF_FASTTIMEO 0x04
- int setupaddr; /* mapping info for setup pkts */
- int ipl; /* interrupt priority */
- struct qe_ring *rringaddr; /* mapping info for rings */
- struct qe_ring *tringaddr; /* "" */
- struct qe_ring rring[NRCV+1]; /* Receive ring descriptors */
- struct qe_ring tring[NXMT+1]; /* Xmit ring descriptors */
- u_char setup_pkt[16][8]; /* Setup packet */
- int rindex; /* Receive index */
- int tindex; /* Transmit index */
- int otindex; /* Old transmit index */
- int qe_intvec; /* Interrupt vector */
- struct qedevice *addr; /* device addr */
- int setupqueued; /* setup packet queued */
- int setuplength; /* length of setup packet */
- int nxmit; /* Transmits in progress */
- int qe_restarts; /* timeouts */
+struct qe_cdata {
+ struct qe_ring qc_recv[RXDESCS+1]; /* Receive descriptors */
+ struct qe_ring qc_xmit[TXDESCS+1]; /* Transmit descriptors */
+ u_int8_t qc_setup[128]; /* Setup packet layout */
};
-int qematch __P((struct device *, struct cfdata *, void *));
-void qeattach __P((struct device *, struct device *, void *));
-void qereset __P((int));
-void qeinit __P((struct qe_softc *));
-void qestart __P((struct ifnet *));
-void qeintr __P((int));
-void qetint __P((int));
-void qerint __P((int));
-int qeioctl __P((struct ifnet *, u_long, caddr_t));
-void qe_setaddr __P((u_char *, struct qe_softc *));
-void qeinitdesc __P((struct qe_ring *, caddr_t, int));
-void qesetup __P((struct qe_softc *));
Home |
Main Index |
Thread Index |
Old Index