projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
merge 4.1b with 4.1c
[unix-history]
/
usr
/
src
/
sys
/
vax
/
if
/
if_ec.c
diff --git
a/usr/src/sys/vax/if/if_ec.c
b/usr/src/sys/vax/if/if_ec.c
index
e13e91f
..
97526b4
100644
(file)
--- a/
usr/src/sys/vax/if/if_ec.c
+++ b/
usr/src/sys/vax/if/if_ec.c
@@
-1,4
+1,4
@@
-/* if_ec.c 4.2
4 82/10/10
*/
+/* if_ec.c 4.2
9 82/11/13
*/
#include "ec.h"
#include "ec.h"
@@
-34,6
+34,7
@@
#include "../vaxuba/ubavar.h"
#define ECMTU 1500
#include "../vaxuba/ubavar.h"
#define ECMTU 1500
+#define ECMIN (60-14)
#define ECMEM 0000000
int ecprobe(), ecattach(), ecrint(), ecxint(), eccollide();
#define ECMEM 0000000
int ecprobe(), ecattach(), ecrint(), ecxint(), eccollide();
@@
-45,7
+46,7
@@
u_char ec_iltop[3] = { 0x02, 0x07, 0x01 };
#define ECUNIT(x) minor(x)
int ecinit(),ecoutput(),ecreset();
#define ECUNIT(x) minor(x)
int ecinit(),ecoutput(),ecreset();
-struct mbuf *ecget();
+struct mbuf *ecget();
extern struct ifnet loif;
extern struct ifnet loif;
@@
-66,7
+67,7
@@
struct ec_softc {
struct ifuba es_ifuba; /* UNIBUS resources */
short es_mask; /* mask for current output delay */
short es_oactive; /* is output active? */
struct ifuba es_ifuba; /* UNIBUS resources */
short es_mask; /* mask for current output delay */
short es_oactive; /* is output active? */
-
caddr_t es_buf[16];
/* virtual addresses of buffers */
+
u_char *es_buf[16];
/* virtual addresses of buffers */
u_char es_enaddr[6]; /* board's ethernet address */
} ec_softc[NEC];
u_char es_enaddr[6]; /* board's ethernet address */
} ec_softc[NEC];
@@
-93,15
+94,15
@@
ecprobe(reg)
* Disable map registers for ec unibus space,
* but don't allocate yet.
*/
* Disable map registers for ec unibus space,
* but don't allocate yet.
*/
- ubamem(numuba, ECMEM, 32*2, 0);
+
(void)
ubamem(numuba, ECMEM, 32*2, 0);
/*
* Check for existence of buffers on Unibus.
*/
/*
* Check for existence of buffers on Unibus.
*/
- if (badaddr((caddr_t)
ecbuf, 2)) {
+ if (badaddr((caddr_t)ecbuf, 2)) {
bad1:
printf("ec: buffer mem not found\n");
bad2:
bad1:
printf("ec: buffer mem not found\n");
bad2:
-
ubamem(numuba, 0, 0, 0);
/* reenable map (780 only) */
+
(void) ubamem(numuba, 0, 0, 0);
/* reenable map (780 only) */
addr->ec_rcr = EC_MDISAB; /* disable memory */
return (0);
}
addr->ec_rcr = EC_MDISAB; /* disable memory */
return (0);
}
@@
-198,9
+199,9
@@
ecattach(ui)
ifp->if_init = ecinit;
ifp->if_output = ecoutput;
ifp->if_init = ecinit;
ifp->if_output = ecoutput;
- ifp->if_
uba
reset = ecreset;
+ ifp->if_reset = ecreset;
for (i=0; i<16; i++)
for (i=0; i<16; i++)
- es->es_buf[i] = &umem[ui->ui_ubanum][ECMEM+2048*i];
+ es->es_buf[i] =
(u_char *)
&umem[ui->ui_ubanum][ECMEM+2048*i];
if_attach(ifp);
}
if_attach(ifp);
}
@@
-217,7
+218,7
@@
ecreset(unit, uban)
ui->ui_ubanum != uban)
return;
printf(" ec%d", unit);
ui->ui_ubanum != uban)
return;
printf(" ec%d", unit);
-
ubamem(uban, ECMEM, 32*2, 0); /* map registe
r disable (no alloc) */
+
(void) ubamem(uban, ECMEM, 32*2, 0); /* m
r disable (no alloc) */
ecinit(unit);
}
ecinit(unit);
}
@@
-261,11
+262,10
@@
ecinit(unit)
ecstart(dev)
dev_t dev;
{
ecstart(dev)
dev_t dev;
{
- int unit = ECUNIT(dev)
, dest
;
+ int unit = ECUNIT(dev);
struct ec_softc *es = &ec_softc[unit];
struct ecdevice *addr;
struct mbuf *m;
struct ec_softc *es = &ec_softc[unit];
struct ecdevice *addr;
struct mbuf *m;
- caddr_t ecbuf;
if (es->es_oactive)
goto restart;
if (es->es_oactive)
goto restart;
@@
-401,15
+401,15
@@
ecread(unit)
struct ecdevice *addr = (struct ecdevice *)ecinfo[unit]->ui_addr;
register struct ec_header *ec;
struct mbuf *m;
struct ecdevice *addr = (struct ecdevice *)ecinfo[unit]->ui_addr;
register struct ec_header *ec;
struct mbuf *m;
- int len, off, resid, ecoff, buf;
+ int len, off, resid, ecoff,
r
buf;
register struct ifqueue *inq;
register struct ifqueue *inq;
-
caddr_t
ecbuf;
+
u_char *
ecbuf;
es->es_if.if_ipackets++;
es->es_if.if_ipackets++;
- buf = addr->ec_rcr & EC_RBN;
- if (
buf < ECRLBF ||
buf > ECRHBF)
+
r
buf = addr->ec_rcr & EC_RBN;
+ if (
rbuf < ECRLBF || r
buf > ECRHBF)
panic("ecrint");
panic("ecrint");
- ecbuf = es->es_buf[buf];
+ ecbuf = es->es_buf[
r
buf];
ecoff = *(short *)ecbuf;
if (ecoff <= ECRDOFF || ecoff > 2046) {
es->es_if.if_ierrors++;
ecoff = *(short *)ecbuf;
if (ecoff <= ECRDOFF || ecoff > 2046) {
es->es_if.if_ierrors++;
@@
-482,7
+482,7
@@
setup:
/*
* Reset for next packet.
*/
/*
* Reset for next packet.
*/
- addr->ec_rcr = EC_READ|EC_RCLR|buf;
+ addr->ec_rcr = EC_READ|EC_RCLR|
r
buf;
}
/*
}
/*
@@
-512,7
+512,7
@@
ecoutput(ifp, m0, dst)
case AF_INET:
dest = ((struct sockaddr_in *)dst)->sin_addr.s_addr;
if ((dest &~ 0xff) == 0)
case AF_INET:
dest = ((struct sockaddr_in *)dst)->sin_addr.s_addr;
if ((dest &~ 0xff) == 0)
- mcopy = m_copy(m, 0, M_COPYALL);
+ mcopy = m_copy(m, 0,
(int)
M_COPYALL);
else if (dest == ((struct sockaddr_in *)&es->es_if.if_addr)->
sin_addr.s_addr) {
mcopy = m;
else if (dest == ((struct sockaddr_in *)&es->es_if.if_addr)->
sin_addr.s_addr) {
mcopy = m;
@@
-621,8
+621,11
@@
bad:
}
/*
}
/*
- * Routine to copy from mbuf chain to transmit
ter
+ * Routine to copy from mbuf chain to transmit
* buffer in UNIBUS memory.
* buffer in UNIBUS memory.
+ * If packet size is less than the minimum legal size,
+ * the buffer is expanded. We probably should zero out the extra
+ * bytes for security, but that would slow things down.
*/
ecput(ecbuf, m)
u_char *ecbuf;
*/
ecput(ecbuf, m)
u_char *ecbuf;
@@
-634,6
+637,8
@@
ecput(ecbuf, m)
for (off = 2048, mp = m; mp; mp = mp->m_next)
off -= mp->m_len;
for (off = 2048, mp = m; mp; mp = mp->m_next)
off -= mp->m_len;
+ if (2048 - off < ECMIN + sizeof (struct ec_header))
+ off = 2048 - ECMIN - sizeof (struct ec_header);
*(u_short *)ecbuf = off;
bp = (u_char *)(ecbuf + off);
for (mp = m; mp; mp = mp->m_next) {
*(u_short *)ecbuf = off;
bp = (u_char *)(ecbuf + off);
for (mp = m; mp; mp = mp->m_next) {