From e902ae382af37f99de8502900b9c41f023faa10f Mon Sep 17 00:00:00 2001 From: "Rodney W. Grimes" Date: Thu, 2 Mar 1995 07:40:27 +0000 Subject: [PATCH] Remove unused variables, and move some inside of DEBUGDO to quite up compiler. Be carefull about over usage of volatile, it really killed performance in a few areas and there was a better place to make things volatile in almost all cases. The driver can now receive at full speed without RNR errors. --- sys/i386/isa/if_ix.c | 18 ++++++------------ sys/i386/isa/if_ixreg.h | 38 ++++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/sys/i386/isa/if_ix.c b/sys/i386/isa/if_ix.c index 813ad723ec70..92db779b2e75 100644 --- a/sys/i386/isa/if_ix.c +++ b/sys/i386/isa/if_ix.c @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_ix.c,v 1.2 1995/02/26 19:40:06 rgrimes Exp $ + * $Id: if_ix.c,v 1.3 1995/02/26 20:13:14 rgrimes Exp $ */ #include "ix.h" @@ -42,6 +42,8 @@ #include #include +#include + #include #include #include @@ -808,7 +810,6 @@ ixinit(int unit) { void ixinit_rfa(int unit) { ix_softc_t *sc = &ix_softc[unit]; - scb_t *scb; rfd_t *rfd; rbd_t *rbd; caddr_t rb; @@ -931,7 +932,6 @@ ixinit_rfa(int unit) { void ixinit_tfa(int unit) { ix_softc_t *sc = &ix_softc[unit]; - scb_t *scb; cb_transmit_t *cb; tbd_t *tbd; caddr_t tb; @@ -1178,9 +1178,9 @@ ixintr_cx(int unit) { static inline void ixintr_cx_free(int unit, cb_t *cb) { - ix_softc_t *sc = &ix_softc[unit]; DEBUGBEGIN(DEBUGINTR_CX) + DEBUGDO(ix_softc_t *sc = &ix_softc[unit];) DEBUGDO(printf("cb=%x:cb->status=%x:", KVTOBOARD(cb), cb->status);) DEBUGEND /*1*/ cb->command = CB_CMD_EL | CB_CMD_NOP; @@ -1190,7 +1190,6 @@ ixintr_cx_free(int unit, cb_t *cb) { static inline void ixintr_fr(int unit) { ix_softc_t *sc = &ix_softc[unit]; - struct ifnet *ifp = &sc->arpcom.ac_if; DEBUGBEGIN(DEBUGINTR_FR) DEBUGDO(printf("fr:");) @@ -1210,13 +1209,13 @@ ixintr_fr_copy(int unit, rfd_t *rfd) { caddr_t rb; struct mbuf *m0, *m; struct ether_header *eh; - int i, - length, + int length, bytesleft; rbd = (rbd_t *)(sc->maddr + rfd->rbd_offset); rb = (caddr_t)(sc->maddr + rbd->buffer); DEBUGBEGIN(DEBUGINTR_FR) + DEBUGDO(int i;) DEBUGDO(printf("rfd=%x:", KVTOBOARD(rfd));) DEBUGDO(printf("rfd->status=%x:", rfd->status);) DEBUGDO(printf("rbd->act_count=%x:", rbd->act_count);) @@ -1448,11 +1447,6 @@ int ixstop(struct ifnet *ifp) { int unit = ifp->if_unit; ix_softc_t *sc = &ix_softc[unit]; - scp_t *scp = (scp_t *)(sc->maddr + SCP_ADDR); - iscp_t *iscp = (iscp_t *)(sc->maddr + ISCP_ADDR); - scb_t *scb = (scb_t *)(sc->maddr + SCB_ADDR); - cb_t *cb; - tbd_t *tbd; DEBUGBEGIN(DEBUGSTOP) DEBUGDO(printf("ixstop:");) diff --git a/sys/i386/isa/if_ixreg.h b/sys/i386/isa/if_ixreg.h index c229b439744a..380407105add 100644 --- a/sys/i386/isa/if_ixreg.h +++ b/sys/i386/isa/if_ixreg.h @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_ixreg.h,v 1.2 1995/02/26 19:40:07 rgrimes Exp $ + * $Id: if_ixreg.h,v 1.3 1995/02/26 20:13:15 rgrimes Exp $ */ /* @@ -143,7 +143,7 @@ #define RFA_SIZE (SCP_ADDR - RFA_START) #define RB_SIZE (ETHER_MAX_LENGTH) /* size of receive buffer */ -typedef volatile struct /* System Configuration Pointer */ +typedef struct /* System Configuration Pointer */ { u_short unused1; /* should be zeros for 82596 compatibility */ u_short sysbus; /* width of the 82586 data bus 0=16, 1=8 */ @@ -152,8 +152,9 @@ typedef volatile struct /* System Configuration Pointer */ u_long iscp; /* iscp address (24bit 586, 32bit 596) */ } scp_t; -typedef volatile struct /* Intermediate System Configuration Pointer */ +typedef struct /* Intermediate System Configuration Pointer */ { + volatile u_short busy; /* Set to 1 by host before its first CA, cleared by 82586 after reading */ #define ISCP_BUSY 0x01 /* 82586 is busy reading the iscp */ @@ -161,8 +162,9 @@ typedef volatile struct /* Intermediate System Configuration Pointer */ u_long scb_base; /* scb base address (24bit 586, 32bit 596) */ } iscp_t; -typedef volatile struct /* System Control Block */ +typedef struct /* System Control Block */ { + volatile u_short status; /* status bits */ #define SCB_RUS_MASK 0x0070 /* receive unit status mask */ #define SCB_RUS_IDLE 0x0000 /* receive unit status idle */ @@ -202,14 +204,19 @@ typedef volatile struct /* System Control Block */ with its I (interrupt) bit set */ u_short cbl_offset; /* first command block on the cbl */ u_short rfa_offset; /* receive frame area */ + volatile u_short crc_errors; /* frame was aligned, but bad crc */ + volatile u_short aln_errors; /* frame was not aligned, and had bad crc */ + volatile u_short rsc_errors; /* did not have resources to receive */ + volatile u_short ovr_errors; /* system bus was not availiable to receive */ } scb_t; -typedef volatile struct /* command block - nop (also the common part of cb's */ +typedef struct /* command block - nop (also the common part of cb's */ { + volatile u_short status; /* status bits */ #define CB_COLLISIONS 0x000F /* the number of collisions that occured */ #define CB_BIT4 0x0010 /* reserved by intel */ @@ -247,18 +254,18 @@ typedef struct /* command block - individual address setup command */ /* ethernet hardware address */ } cb_ias_t; -typedef volatile struct /* command block - configure command */ +typedef struct /* command block - configure command */ { cb_t common; /* common part of all command blocks */ u_char byte[12]; /* ZZZ this is ugly, but it works */ } cb_configure_t; -typedef volatile struct /* command block - multicast address setup command */ +typedef struct /* command block - multicast address setup command */ { cb_t common; /* common part of all command blocks */ } cb_mcas_t; -typedef volatile struct /* command block - transmit command */ +typedef struct /* command block - transmit command */ { cb_t common; /* common part of all command blocks */ u_short tbd_offset; /* transmit buffer descriptor offset */ @@ -269,31 +276,33 @@ typedef volatile struct /* command block - transmit command */ * code for the special cb's */ } cb_transmit_t; -typedef volatile struct /* command block - tdr command */ +typedef struct /* command block - tdr command */ { cb_t common; /* common part of all command blocks */ } cb_tdr_t; -typedef volatile struct /* command block - dump command */ +typedef struct /* command block - dump command */ { cb_t common; /* common part of all command blocks */ } cb_dump_t; -typedef volatile struct /* command block - diagnose command */ +typedef struct /* command block - diagnose command */ { cb_t common; /* common part of all command blocks */ } cb_diagnose_t; -typedef volatile struct /* Transmit Buffer Descriptor */ +typedef struct /* Transmit Buffer Descriptor */ { + volatile u_short act_count; /* size of buffer actual count of valid bytes */ #define TBD_STAT_EOF 0x8000 /* end of frame */ u_short next; /* pointer to the next tbd */ u_long buffer; /* transmit buffer address (24bit 586, 32bit 596) */ } tbd_t; -typedef volatile struct /* Receive Frame Descriptor */ +typedef struct /* Receive Frame Descriptor */ { + volatile u_short status; /* status bits */ #define RFD_BUSY 0x4000 /* frame is being received */ #define RFD_COMPLETE 0x8000 /* this frame is complete */ @@ -307,8 +316,9 @@ typedef volatile struct /* Receive Frame Descriptor */ u_short length; /* ethernet length field */ } rfd_t; -typedef volatile struct /* Receive Buffer Descriptor */ +typedef struct /* Receive Buffer Descriptor */ { + volatile u_short act_count; /* Actual Count (size) and status bits */ #define RBD_STAT_SIZE 0x3FFF /* size mask */ #define RBD_STAT_VALID 0x4000 /* act_count field is valid */