new from 4.4-lite
This commit is contained in:
parent
592a166c31
commit
7c61a93844
|
@ -30,10 +30,9 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_le.c 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: if_le.c,v 1.23 93/04/21 02:39:38 torek Exp
|
||||
* $Id: if_le.c,v 1.6 1994/04/22 13:19:13 deraadt Exp $
|
||||
* from: Header: if_le.c,v 1.25 93/10/31 04:47:50 leres Locked
|
||||
* from: @(#)if_le.c 8.2 (Berkeley) 10/30/93
|
||||
* $Id: if_le.c,v 1.7 1994/05/13 20:11:06 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
@ -141,9 +140,6 @@ struct le_softc {
|
|||
int sc_busy;
|
||||
short sc_iflags;
|
||||
struct lestats sc_lestats; /* per interface statistics */
|
||||
#if NBPFILTER > 0
|
||||
caddr_t sc_bpf;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -186,7 +182,6 @@ leattach(parent, self, args)
|
|||
struct ifnet *ifp = &sc->sc_if;
|
||||
register struct bootpath *bp;
|
||||
register int a, pri;
|
||||
#define ISQUADALIGN(a) ((((long) a) & 0x3) == 0)
|
||||
|
||||
/* XXX the following declarations should be elsewhere */
|
||||
extern void myetheraddr(u_char *);
|
||||
|
@ -202,8 +197,6 @@ leattach(parent, self, args)
|
|||
mapiodev(sa->sa_ra.ra_paddr, sizeof(struct lereg1));
|
||||
ler2 = sc->sc_r2 = (volatile struct lereg2 *)
|
||||
dvma_malloc(sizeof(struct lereg2));
|
||||
if (!ISQUADALIGN(ler2))
|
||||
printf("? not quad aligned (0x%x)\n", ler2);
|
||||
|
||||
myetheraddr(sc->sc_addr);
|
||||
printf(": hardware address %s\n", ether_sprintf(sc->sc_addr));
|
||||
|
@ -223,13 +216,9 @@ if (!ISQUADALIGN(ler2))
|
|||
ler2->ler2_padr[4] = sc->sc_addr[5];
|
||||
ler2->ler2_padr[5] = sc->sc_addr[4];
|
||||
a = LANCE_ADDR(&ler2->ler2_rmd);
|
||||
if (!ISQUADALIGN(a))
|
||||
printf("rdra not quad aligned (0x%x)\n", a);
|
||||
ler2->ler2_rlen = LE_RLEN | (a >> 16);
|
||||
ler2->ler2_rdra = a;
|
||||
a = LANCE_ADDR(&ler2->ler2_tmd);
|
||||
if (!ISQUADALIGN(a))
|
||||
printf("tdra not quad aligned (0x%x)\n", a);
|
||||
ler2->ler2_tlen = LE_TLEN | (a >> 16);
|
||||
ler2->ler2_tdra = a;
|
||||
|
||||
|
@ -250,7 +239,6 @@ if (!ISQUADALIGN(a))
|
|||
|
||||
ifp->if_unit = sc->sc_dev.dv_unit;
|
||||
ifp->if_name = "le";
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_ioctl = leioctl;
|
||||
ifp->if_output = ether_output;
|
||||
ifp->if_start = lestart;
|
||||
|
@ -260,9 +248,10 @@ if (!ISQUADALIGN(a))
|
|||
ifp->if_flags |= IFF_NOTRAILERS;
|
||||
#endif
|
||||
#if NBPFILTER > 0
|
||||
bpfattach(&sc->sc_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
|
||||
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
|
||||
#endif
|
||||
if_attach(ifp);
|
||||
ether_ifattach(ifp);
|
||||
|
||||
#define SAME_LANCE(bp, sa) \
|
||||
((bp->val[0] == sa->sa_slot && bp->val[1] == sa->sa_offset) || \
|
||||
|
@ -298,6 +287,8 @@ lesetladrf(sc)
|
|||
|
||||
ler2->ler2_ladrf[0] = 0;
|
||||
ler2->ler2_ladrf[1] = 0;
|
||||
ler2->ler2_ladrf[2] = 0;
|
||||
ler2->ler2_ladrf[3] = 0;
|
||||
ifp->if_flags &= ~IFF_ALLMULTI;
|
||||
ETHER_FIRST_MULTI(step, &sc->sc_ac, enm);
|
||||
while (enm != NULL) {
|
||||
|
@ -313,8 +304,10 @@ lesetladrf(sc)
|
|||
* which the range is big enough to require all
|
||||
* bits set.)
|
||||
*/
|
||||
ler2->ler2_ladrf[0] = 0xffffffff;
|
||||
ler2->ler2_ladrf[1] = 0xffffffff;
|
||||
ler2->ler2_ladrf[0] = 0xffff;
|
||||
ler2->ler2_ladrf[1] = 0xffff;
|
||||
ler2->ler2_ladrf[2] = 0xffff;
|
||||
ler2->ler2_ladrf[3] = 0xffff;
|
||||
ifp->if_flags |= IFF_ALLMULTI;
|
||||
return;
|
||||
}
|
||||
|
@ -342,7 +335,7 @@ lesetladrf(sc)
|
|||
crc = crc >> 26;
|
||||
|
||||
/* Turn on the corresponding bit in the filter. */
|
||||
ler2->ler2_ladrf[crc >> 5] |= 1 << (crc & 0x1f);
|
||||
ler2->ler2_ladrf[crc >> 4] |= 1 << (crc & 0xf);
|
||||
|
||||
ETHER_NEXT_MULTI(step, enm);
|
||||
}
|
||||
|
@ -370,9 +363,6 @@ lereset(dev)
|
|||
lesetladrf(sc);
|
||||
|
||||
/* init receive and transmit rings */
|
||||
a = LANCE_ADDR(&ler2->ler2_rbuf[0][0]);
|
||||
if (!ISQUADALIGN(a))
|
||||
printf("rbuf not quad aligned (0x%x)\n", a);
|
||||
for (i = 0; i < LERBUF; i++) {
|
||||
a = LANCE_ADDR(&ler2->ler2_rbuf[i][0]);
|
||||
ler2->ler2_rmd[i].rmd0 = a;
|
||||
|
@ -381,9 +371,6 @@ if (!ISQUADALIGN(a))
|
|||
ler2->ler2_rmd[i].rmd2 = -LEMTU;
|
||||
ler2->ler2_rmd[i].rmd3 = 0;
|
||||
}
|
||||
a = LANCE_ADDR(&ler2->ler2_tbuf[0][0]);
|
||||
if (!ISQUADALIGN(a))
|
||||
printf("tbuf not quad aligned (0x%x)\n", a);
|
||||
for (i = 0; i < LETBUF; i++) {
|
||||
a = LANCE_ADDR(&ler2->ler2_tbuf[i][0]);
|
||||
ler2->ler2_tmd[i].tmd0 = a;
|
||||
|
@ -441,7 +428,7 @@ leinit(unit)
|
|||
if ((ifp->if_flags & IFF_RUNNING) == 0) {
|
||||
s = splimp();
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
lestart(ifp);
|
||||
splx(s);
|
||||
}
|
||||
|
@ -473,8 +460,8 @@ lestart(ifp)
|
|||
* If bpf is listening on this interface, let it
|
||||
* see the packet before we commit it to the wire.
|
||||
*/
|
||||
if (sc->sc_bpf)
|
||||
bpf_tap(sc->sc_bpf, sc->sc_r2->ler2_tbuf[0], len);
|
||||
if (sc->sc_if.if_bpf)
|
||||
bpf_tap(sc->sc_if.if_bpf, sc->sc_r2->ler2_tbuf[0], len);
|
||||
#endif
|
||||
|
||||
#ifdef PACKETSTATS
|
||||
|
@ -507,7 +494,7 @@ leintr(dev)
|
|||
leerror(sc, csr0);
|
||||
if (csr0 & LE_C0_MERR) {
|
||||
sc->sc_merr++;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
return (1);
|
||||
}
|
||||
if (csr0 & LE_C0_BABL)
|
||||
|
@ -520,12 +507,12 @@ leintr(dev)
|
|||
}
|
||||
if ((csr0 & LE_C0_RXON) == 0) {
|
||||
sc->sc_rxoff++;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
return (1);
|
||||
}
|
||||
if ((csr0 & LE_C0_TXON) == 0) {
|
||||
sc->sc_txoff++;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
return (1);
|
||||
}
|
||||
if (csr0 & LE_C0_RINT) {
|
||||
|
@ -564,7 +551,7 @@ err:
|
|||
sc->sc_if.if_oerrors++;
|
||||
if (tmd->tmd3 & (LE_T3_BUFF|LE_T3_UFLO)) {
|
||||
sc->sc_uflo++;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
} else if (tmd->tmd3 & LE_T3_LCOL)
|
||||
sc->sc_if.if_collisions++;
|
||||
else if (tmd->tmd3 & LE_T3_RTRY)
|
||||
|
@ -652,7 +639,7 @@ lerint(sc)
|
|||
if ((rmd->rmd1_bits &
|
||||
(LE_R1_OWN|LE_R1_ERR|LE_R1_STP|LE_R1_ENP)) !=
|
||||
LE_R1_ENP) {
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -680,11 +667,10 @@ leread(sc, pkt, len)
|
|||
struct mbuf *m;
|
||||
struct ifqueue *inq;
|
||||
int flags;
|
||||
u_short etype;
|
||||
|
||||
ifp->if_ipackets++;
|
||||
et = (struct ether_header *)pkt;
|
||||
etype = ntohs(et->ether_type);
|
||||
et->ether_type = ntohs((u_short)et->ether_type);
|
||||
/* adjust input length to account for header and CRC */
|
||||
len -= sizeof(struct ether_header) + 4;
|
||||
|
||||
|
@ -713,8 +699,9 @@ leread(sc, pkt, len)
|
|||
* If so, hand off the raw packet to enet, then discard things
|
||||
* not destined for us (but be sure to keep broadcast/multicast).
|
||||
*/
|
||||
if (sc->sc_bpf) {
|
||||
bpf_tap(sc->sc_bpf, pkt, len + sizeof(struct ether_header));
|
||||
if (sc->sc_if.if_bpf) {
|
||||
bpf_tap(sc->sc_if.if_bpf, pkt,
|
||||
len + sizeof(struct ether_header));
|
||||
if ((flags & (M_BCAST | M_MCAST)) == 0 &&
|
||||
bcmp(et->ether_dhost, sc->sc_addr,
|
||||
sizeof(et->ether_dhost)) != 0)
|
||||
|
@ -734,7 +721,7 @@ leread(sc, pkt, len)
|
|||
}
|
||||
/* XXX end of code from ether_input() */
|
||||
|
||||
switch (etype) {
|
||||
switch (et->ether_type) {
|
||||
|
||||
#ifdef INET
|
||||
case ETHERTYPE_IP:
|
||||
|
@ -743,14 +730,9 @@ leread(sc, pkt, len)
|
|||
break;
|
||||
|
||||
case ETHERTYPE_ARP:
|
||||
#if defined(NETISR_ARP) && 0
|
||||
schednetisr(NETISR_ARP);
|
||||
inq = &arpintrq;
|
||||
break;
|
||||
#else
|
||||
arpinput((struct arpcom *)ifp, m);
|
||||
return;
|
||||
#endif /* NETISR_ARP */
|
||||
#endif
|
||||
#ifdef NS
|
||||
case ETHERTYPE_NS:
|
||||
|
@ -953,7 +935,7 @@ leioctl(ifp, cmd, data)
|
|||
if (((ifp->if_flags ^ sc->sc_iflags) & IFF_PROMISC) &&
|
||||
(ifp->if_flags & IFF_RUNNING)) {
|
||||
sc->sc_iflags = ifp->if_flags;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
lestart(ifp);
|
||||
}
|
||||
break;
|
||||
|
@ -970,10 +952,11 @@ leioctl(ifp, cmd, data)
|
|||
* Multicast list has changed; set the hardware
|
||||
* filter accordingly.
|
||||
*/
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
}
|
||||
|
|
|
@ -30,10 +30,9 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_lereg.h 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: if_lereg.h,v 1.6 92/11/26 02:28:12 torek Exp
|
||||
* $Id: if_lereg.h,v 1.1 1993/10/02 10:23:54 deraadt Exp $
|
||||
* from: Header: if_lereg.h,v 1.7 93/10/31 04:41:00 leres Locked
|
||||
* from: @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
|
||||
* $Id: if_lereg.h,v 1.2 1994/05/13 20:11:09 deraadt Exp $
|
||||
*/
|
||||
|
||||
#define LEMTU 1518
|
||||
|
@ -89,15 +88,15 @@ struct lereg1 {
|
|||
*/
|
||||
struct lereg2 {
|
||||
/* initialization block */
|
||||
u_short ler2_mode; /* +0x0000: mode */
|
||||
u_char ler2_padr[6]; /* +0x0002: physical address */
|
||||
u_long ler2_ladrf[2]; /* +0x0008: logical address filter */
|
||||
u_short ler2_rdra; /* +0x0010: receive descriptor addr */
|
||||
u_short ler2_rlen; /* +0x0012: rda high and ring size */
|
||||
u_short ler2_tdra; /* +0x0014: transmit descriptor addr */
|
||||
u_short ler2_tlen; /* +0x0016: tda high and ring size */
|
||||
u_short ler2_mode; /* mode */
|
||||
u_char ler2_padr[6]; /* physical address */
|
||||
u_short ler2_ladrf[4]; /* logical address filter */
|
||||
u_short ler2_rdra; /* receive descriptor addr */
|
||||
u_short ler2_rlen; /* rda high and ring size */
|
||||
u_short ler2_tdra; /* transmit descriptor addr */
|
||||
u_short ler2_tlen; /* tda high and ring size */
|
||||
/* receive message descriptors. bits/hadr are byte order dependent. */
|
||||
struct lermd { /* +0x0018 */
|
||||
struct lermd {
|
||||
u_short rmd0; /* low address of packet */
|
||||
u_char rmd1_bits; /* descriptor bits */
|
||||
u_char rmd1_hadr; /* high address of packet */
|
||||
|
@ -105,15 +104,15 @@ struct lereg2 {
|
|||
u_short rmd3; /* message byte count */
|
||||
} ler2_rmd[LERBUF];
|
||||
/* transmit message descriptors */
|
||||
struct letmd { /* +0x0058 */
|
||||
struct letmd {
|
||||
u_short tmd0; /* low address of packet */
|
||||
u_char tmd1_bits; /* descriptor bits */
|
||||
u_char tmd1_hadr; /* high address of packet */
|
||||
short tmd2; /* buffer byte count */
|
||||
u_short tmd3; /* transmit error bits */
|
||||
} ler2_tmd[LETBUF];
|
||||
char ler2_rbuf[LERBUF][LEMTU]; /* +0x0060 */
|
||||
char ler2_tbuf[LETBUF][LEMTU]; /* +0x2fd0 */
|
||||
char ler2_rbuf[LERBUF][LEMTU];
|
||||
char ler2_tbuf[LETBUF][LEMTU];
|
||||
};
|
||||
|
||||
/* Initialzation block (mode) */
|
||||
|
|
|
@ -30,10 +30,9 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_le.c 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: if_le.c,v 1.23 93/04/21 02:39:38 torek Exp
|
||||
* $Id: if_le.c,v 1.6 1994/04/22 13:19:13 deraadt Exp $
|
||||
* from: Header: if_le.c,v 1.25 93/10/31 04:47:50 leres Locked
|
||||
* from: @(#)if_le.c 8.2 (Berkeley) 10/30/93
|
||||
* $Id: if_le.c,v 1.7 1994/05/13 20:11:06 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
@ -141,9 +140,6 @@ struct le_softc {
|
|||
int sc_busy;
|
||||
short sc_iflags;
|
||||
struct lestats sc_lestats; /* per interface statistics */
|
||||
#if NBPFILTER > 0
|
||||
caddr_t sc_bpf;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -186,7 +182,6 @@ leattach(parent, self, args)
|
|||
struct ifnet *ifp = &sc->sc_if;
|
||||
register struct bootpath *bp;
|
||||
register int a, pri;
|
||||
#define ISQUADALIGN(a) ((((long) a) & 0x3) == 0)
|
||||
|
||||
/* XXX the following declarations should be elsewhere */
|
||||
extern void myetheraddr(u_char *);
|
||||
|
@ -202,8 +197,6 @@ leattach(parent, self, args)
|
|||
mapiodev(sa->sa_ra.ra_paddr, sizeof(struct lereg1));
|
||||
ler2 = sc->sc_r2 = (volatile struct lereg2 *)
|
||||
dvma_malloc(sizeof(struct lereg2));
|
||||
if (!ISQUADALIGN(ler2))
|
||||
printf("? not quad aligned (0x%x)\n", ler2);
|
||||
|
||||
myetheraddr(sc->sc_addr);
|
||||
printf(": hardware address %s\n", ether_sprintf(sc->sc_addr));
|
||||
|
@ -223,13 +216,9 @@ if (!ISQUADALIGN(ler2))
|
|||
ler2->ler2_padr[4] = sc->sc_addr[5];
|
||||
ler2->ler2_padr[5] = sc->sc_addr[4];
|
||||
a = LANCE_ADDR(&ler2->ler2_rmd);
|
||||
if (!ISQUADALIGN(a))
|
||||
printf("rdra not quad aligned (0x%x)\n", a);
|
||||
ler2->ler2_rlen = LE_RLEN | (a >> 16);
|
||||
ler2->ler2_rdra = a;
|
||||
a = LANCE_ADDR(&ler2->ler2_tmd);
|
||||
if (!ISQUADALIGN(a))
|
||||
printf("tdra not quad aligned (0x%x)\n", a);
|
||||
ler2->ler2_tlen = LE_TLEN | (a >> 16);
|
||||
ler2->ler2_tdra = a;
|
||||
|
||||
|
@ -250,7 +239,6 @@ if (!ISQUADALIGN(a))
|
|||
|
||||
ifp->if_unit = sc->sc_dev.dv_unit;
|
||||
ifp->if_name = "le";
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_ioctl = leioctl;
|
||||
ifp->if_output = ether_output;
|
||||
ifp->if_start = lestart;
|
||||
|
@ -260,9 +248,10 @@ if (!ISQUADALIGN(a))
|
|||
ifp->if_flags |= IFF_NOTRAILERS;
|
||||
#endif
|
||||
#if NBPFILTER > 0
|
||||
bpfattach(&sc->sc_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
|
||||
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
|
||||
#endif
|
||||
if_attach(ifp);
|
||||
ether_ifattach(ifp);
|
||||
|
||||
#define SAME_LANCE(bp, sa) \
|
||||
((bp->val[0] == sa->sa_slot && bp->val[1] == sa->sa_offset) || \
|
||||
|
@ -298,6 +287,8 @@ lesetladrf(sc)
|
|||
|
||||
ler2->ler2_ladrf[0] = 0;
|
||||
ler2->ler2_ladrf[1] = 0;
|
||||
ler2->ler2_ladrf[2] = 0;
|
||||
ler2->ler2_ladrf[3] = 0;
|
||||
ifp->if_flags &= ~IFF_ALLMULTI;
|
||||
ETHER_FIRST_MULTI(step, &sc->sc_ac, enm);
|
||||
while (enm != NULL) {
|
||||
|
@ -313,8 +304,10 @@ lesetladrf(sc)
|
|||
* which the range is big enough to require all
|
||||
* bits set.)
|
||||
*/
|
||||
ler2->ler2_ladrf[0] = 0xffffffff;
|
||||
ler2->ler2_ladrf[1] = 0xffffffff;
|
||||
ler2->ler2_ladrf[0] = 0xffff;
|
||||
ler2->ler2_ladrf[1] = 0xffff;
|
||||
ler2->ler2_ladrf[2] = 0xffff;
|
||||
ler2->ler2_ladrf[3] = 0xffff;
|
||||
ifp->if_flags |= IFF_ALLMULTI;
|
||||
return;
|
||||
}
|
||||
|
@ -342,7 +335,7 @@ lesetladrf(sc)
|
|||
crc = crc >> 26;
|
||||
|
||||
/* Turn on the corresponding bit in the filter. */
|
||||
ler2->ler2_ladrf[crc >> 5] |= 1 << (crc & 0x1f);
|
||||
ler2->ler2_ladrf[crc >> 4] |= 1 << (crc & 0xf);
|
||||
|
||||
ETHER_NEXT_MULTI(step, enm);
|
||||
}
|
||||
|
@ -370,9 +363,6 @@ lereset(dev)
|
|||
lesetladrf(sc);
|
||||
|
||||
/* init receive and transmit rings */
|
||||
a = LANCE_ADDR(&ler2->ler2_rbuf[0][0]);
|
||||
if (!ISQUADALIGN(a))
|
||||
printf("rbuf not quad aligned (0x%x)\n", a);
|
||||
for (i = 0; i < LERBUF; i++) {
|
||||
a = LANCE_ADDR(&ler2->ler2_rbuf[i][0]);
|
||||
ler2->ler2_rmd[i].rmd0 = a;
|
||||
|
@ -381,9 +371,6 @@ if (!ISQUADALIGN(a))
|
|||
ler2->ler2_rmd[i].rmd2 = -LEMTU;
|
||||
ler2->ler2_rmd[i].rmd3 = 0;
|
||||
}
|
||||
a = LANCE_ADDR(&ler2->ler2_tbuf[0][0]);
|
||||
if (!ISQUADALIGN(a))
|
||||
printf("tbuf not quad aligned (0x%x)\n", a);
|
||||
for (i = 0; i < LETBUF; i++) {
|
||||
a = LANCE_ADDR(&ler2->ler2_tbuf[i][0]);
|
||||
ler2->ler2_tmd[i].tmd0 = a;
|
||||
|
@ -441,7 +428,7 @@ leinit(unit)
|
|||
if ((ifp->if_flags & IFF_RUNNING) == 0) {
|
||||
s = splimp();
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
lestart(ifp);
|
||||
splx(s);
|
||||
}
|
||||
|
@ -473,8 +460,8 @@ lestart(ifp)
|
|||
* If bpf is listening on this interface, let it
|
||||
* see the packet before we commit it to the wire.
|
||||
*/
|
||||
if (sc->sc_bpf)
|
||||
bpf_tap(sc->sc_bpf, sc->sc_r2->ler2_tbuf[0], len);
|
||||
if (sc->sc_if.if_bpf)
|
||||
bpf_tap(sc->sc_if.if_bpf, sc->sc_r2->ler2_tbuf[0], len);
|
||||
#endif
|
||||
|
||||
#ifdef PACKETSTATS
|
||||
|
@ -507,7 +494,7 @@ leintr(dev)
|
|||
leerror(sc, csr0);
|
||||
if (csr0 & LE_C0_MERR) {
|
||||
sc->sc_merr++;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
return (1);
|
||||
}
|
||||
if (csr0 & LE_C0_BABL)
|
||||
|
@ -520,12 +507,12 @@ leintr(dev)
|
|||
}
|
||||
if ((csr0 & LE_C0_RXON) == 0) {
|
||||
sc->sc_rxoff++;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
return (1);
|
||||
}
|
||||
if ((csr0 & LE_C0_TXON) == 0) {
|
||||
sc->sc_txoff++;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
return (1);
|
||||
}
|
||||
if (csr0 & LE_C0_RINT) {
|
||||
|
@ -564,7 +551,7 @@ err:
|
|||
sc->sc_if.if_oerrors++;
|
||||
if (tmd->tmd3 & (LE_T3_BUFF|LE_T3_UFLO)) {
|
||||
sc->sc_uflo++;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
} else if (tmd->tmd3 & LE_T3_LCOL)
|
||||
sc->sc_if.if_collisions++;
|
||||
else if (tmd->tmd3 & LE_T3_RTRY)
|
||||
|
@ -652,7 +639,7 @@ lerint(sc)
|
|||
if ((rmd->rmd1_bits &
|
||||
(LE_R1_OWN|LE_R1_ERR|LE_R1_STP|LE_R1_ENP)) !=
|
||||
LE_R1_ENP) {
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -680,11 +667,10 @@ leread(sc, pkt, len)
|
|||
struct mbuf *m;
|
||||
struct ifqueue *inq;
|
||||
int flags;
|
||||
u_short etype;
|
||||
|
||||
ifp->if_ipackets++;
|
||||
et = (struct ether_header *)pkt;
|
||||
etype = ntohs(et->ether_type);
|
||||
et->ether_type = ntohs((u_short)et->ether_type);
|
||||
/* adjust input length to account for header and CRC */
|
||||
len -= sizeof(struct ether_header) + 4;
|
||||
|
||||
|
@ -713,8 +699,9 @@ leread(sc, pkt, len)
|
|||
* If so, hand off the raw packet to enet, then discard things
|
||||
* not destined for us (but be sure to keep broadcast/multicast).
|
||||
*/
|
||||
if (sc->sc_bpf) {
|
||||
bpf_tap(sc->sc_bpf, pkt, len + sizeof(struct ether_header));
|
||||
if (sc->sc_if.if_bpf) {
|
||||
bpf_tap(sc->sc_if.if_bpf, pkt,
|
||||
len + sizeof(struct ether_header));
|
||||
if ((flags & (M_BCAST | M_MCAST)) == 0 &&
|
||||
bcmp(et->ether_dhost, sc->sc_addr,
|
||||
sizeof(et->ether_dhost)) != 0)
|
||||
|
@ -734,7 +721,7 @@ leread(sc, pkt, len)
|
|||
}
|
||||
/* XXX end of code from ether_input() */
|
||||
|
||||
switch (etype) {
|
||||
switch (et->ether_type) {
|
||||
|
||||
#ifdef INET
|
||||
case ETHERTYPE_IP:
|
||||
|
@ -743,14 +730,9 @@ leread(sc, pkt, len)
|
|||
break;
|
||||
|
||||
case ETHERTYPE_ARP:
|
||||
#if defined(NETISR_ARP) && 0
|
||||
schednetisr(NETISR_ARP);
|
||||
inq = &arpintrq;
|
||||
break;
|
||||
#else
|
||||
arpinput((struct arpcom *)ifp, m);
|
||||
return;
|
||||
#endif /* NETISR_ARP */
|
||||
#endif
|
||||
#ifdef NS
|
||||
case ETHERTYPE_NS:
|
||||
|
@ -953,7 +935,7 @@ leioctl(ifp, cmd, data)
|
|||
if (((ifp->if_flags ^ sc->sc_iflags) & IFF_PROMISC) &&
|
||||
(ifp->if_flags & IFF_RUNNING)) {
|
||||
sc->sc_iflags = ifp->if_flags;
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
lestart(ifp);
|
||||
}
|
||||
break;
|
||||
|
@ -970,10 +952,11 @@ leioctl(ifp, cmd, data)
|
|||
* Multicast list has changed; set the hardware
|
||||
* filter accordingly.
|
||||
*/
|
||||
lereset((struct device *)sc);
|
||||
lereset(&sc->sc_dev);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
}
|
||||
|
|
|
@ -30,10 +30,9 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_lereg.h 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: if_lereg.h,v 1.6 92/11/26 02:28:12 torek Exp
|
||||
* $Id: if_lereg.h,v 1.1 1993/10/02 10:23:54 deraadt Exp $
|
||||
* from: Header: if_lereg.h,v 1.7 93/10/31 04:41:00 leres Locked
|
||||
* from: @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
|
||||
* $Id: if_lereg.h,v 1.2 1994/05/13 20:11:09 deraadt Exp $
|
||||
*/
|
||||
|
||||
#define LEMTU 1518
|
||||
|
@ -89,15 +88,15 @@ struct lereg1 {
|
|||
*/
|
||||
struct lereg2 {
|
||||
/* initialization block */
|
||||
u_short ler2_mode; /* +0x0000: mode */
|
||||
u_char ler2_padr[6]; /* +0x0002: physical address */
|
||||
u_long ler2_ladrf[2]; /* +0x0008: logical address filter */
|
||||
u_short ler2_rdra; /* +0x0010: receive descriptor addr */
|
||||
u_short ler2_rlen; /* +0x0012: rda high and ring size */
|
||||
u_short ler2_tdra; /* +0x0014: transmit descriptor addr */
|
||||
u_short ler2_tlen; /* +0x0016: tda high and ring size */
|
||||
u_short ler2_mode; /* mode */
|
||||
u_char ler2_padr[6]; /* physical address */
|
||||
u_short ler2_ladrf[4]; /* logical address filter */
|
||||
u_short ler2_rdra; /* receive descriptor addr */
|
||||
u_short ler2_rlen; /* rda high and ring size */
|
||||
u_short ler2_tdra; /* transmit descriptor addr */
|
||||
u_short ler2_tlen; /* tda high and ring size */
|
||||
/* receive message descriptors. bits/hadr are byte order dependent. */
|
||||
struct lermd { /* +0x0018 */
|
||||
struct lermd {
|
||||
u_short rmd0; /* low address of packet */
|
||||
u_char rmd1_bits; /* descriptor bits */
|
||||
u_char rmd1_hadr; /* high address of packet */
|
||||
|
@ -105,15 +104,15 @@ struct lereg2 {
|
|||
u_short rmd3; /* message byte count */
|
||||
} ler2_rmd[LERBUF];
|
||||
/* transmit message descriptors */
|
||||
struct letmd { /* +0x0058 */
|
||||
struct letmd {
|
||||
u_short tmd0; /* low address of packet */
|
||||
u_char tmd1_bits; /* descriptor bits */
|
||||
u_char tmd1_hadr; /* high address of packet */
|
||||
short tmd2; /* buffer byte count */
|
||||
u_short tmd3; /* transmit error bits */
|
||||
} ler2_tmd[LETBUF];
|
||||
char ler2_rbuf[LERBUF][LEMTU]; /* +0x0060 */
|
||||
char ler2_tbuf[LETBUF][LEMTU]; /* +0x2fd0 */
|
||||
char ler2_rbuf[LERBUF][LEMTU];
|
||||
char ler2_tbuf[LETBUF][LEMTU];
|
||||
};
|
||||
|
||||
/* Initialzation block (mode) */
|
||||
|
|
Loading…
Reference in New Issue