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
start up cleanly
[unix-history]
/
usr
/
src
/
sys
/
vax
/
if
/
if_dmc.c
diff --git
a/usr/src/sys/vax/if/if_dmc.c
b/usr/src/sys/vax/if/if_dmc.c
index
31503f6
..
a2b5bf4
100644
(file)
--- a/
usr/src/sys/vax/if/if_dmc.c
+++ b/
usr/src/sys/vax/if/if_dmc.c
@@
-1,4
+1,4
@@
-/* if_dmc.c 4.
4 82/03/13
*/
+/* if_dmc.c 4.
18 82/10/09
*/
#include "dmc.h"
#if NDMC > 0
#include "dmc.h"
#if NDMC > 0
@@
-24,13
+24,13
@@
int dmcdebug = 1;
#include "../h/cpu.h"
#include "../h/mtpr.h"
#include "../h/vmmac.h"
#include "../h/cpu.h"
#include "../h/mtpr.h"
#include "../h/vmmac.h"
-#include "../net/in.h"
-#include "../net/in_systm.h"
+#include "../net
inet
/in.h"
+#include "../net
inet
/in_systm.h"
#include "../net/if.h"
#include "../net/if.h"
-#include "../
net
/if_uba.h"
-#include "../
net
/if_dmc.h"
-#include "../net/
ip
.h"
-#include
"../net/ip_var.h"
+#include "../
vaxif
/if_uba.h"
+#include "../
vaxif
/if_dmc.h"
+#include "../net/
route
.h"
+#include
<errno.h>
/*
* Driver information for auto-configuration stuff.
/*
* Driver information for auto-configuration stuff.
@@
-41,8
+41,8
@@
u_short dmcstd[] = { 0 };
struct uba_driver dmcdriver =
{ dmcprobe, 0, dmcattach, 0, dmcstd, "dmc", dmcinfo };
struct uba_driver dmcdriver =
{ dmcprobe, 0, dmcattach, 0, dmcstd, "dmc", dmcinfo };
-#define DMC_
PF 0xff /* 8 bits of protocol
type in ui_flags */
-#define DMC_NET 0xff
00 /* 8
bits of net number in ui_flags */
+#define DMC_
AF 0xff /* 8 bits of address
type in ui_flags */
+#define DMC_NET 0xff
ffff00 /* 24
bits of net number in ui_flags */
/*
* DMC software status per interface.
/*
* DMC software status per interface.
@@
-91,14
+91,17
@@
dmcprobe(reg)
for (i = 100000; i && (addr->bsel1 & DMC_RUN) == 0; i--)
;
if ((addr->bsel1 & DMC_RUN) == 0)
for (i = 100000; i && (addr->bsel1 & DMC_RUN) == 0; i--)
;
if ((addr->bsel1 & DMC_RUN) == 0)
- return(0);
+ return
(0);
addr->bsel1 &= ~DMC_MCLR;
addr->bsel0 = DMC_RQI|DMC_IEI;
DELAY(100000);
addr->bsel1 = DMC_MCLR;
for (i = 100000; i && (addr->bsel1 & DMC_RUN) == 0; i--)
;
addr->bsel1 &= ~DMC_MCLR;
addr->bsel0 = DMC_RQI|DMC_IEI;
DELAY(100000);
addr->bsel1 = DMC_MCLR;
for (i = 100000; i && (addr->bsel1 & DMC_RUN) == 0; i--)
;
- return(1);
+#ifdef ECHACK
+ br = 0x16;
+#endif
+ return (1);
}
/*
}
/*
@@
-110,18
+113,21
@@
dmcattach(ui)
register struct uba_device *ui;
{
register struct dmc_softc *sc = &dmc_softc[ui->ui_unit];
register struct uba_device *ui;
{
register struct dmc_softc *sc = &dmc_softc[ui->ui_unit];
+ register struct sockaddr_in *sin;
sc->sc_if.if_unit = ui->ui_unit;
sc->sc_if.if_name = "dmc";
sc->sc_if.if_mtu = DMCMTU;
sc->sc_if.if_net = (ui->ui_flags & DMC_NET) >> 8;
sc->sc_if.if_host[0] = 17; /* random number */
sc->sc_if.if_unit = ui->ui_unit;
sc->sc_if.if_name = "dmc";
sc->sc_if.if_mtu = DMCMTU;
sc->sc_if.if_net = (ui->ui_flags & DMC_NET) >> 8;
sc->sc_if.if_host[0] = 17; /* random number */
- sc->sc_if.if_addr =
- if_makeaddr(sc->sc_if.if_net, sc->sc_if.if_host[0]);
+ sin = (struct sockaddr_in *)&sc->sc_if.if_addr;
+ sin->sin_family = AF_INET;
+ sin->sin_addr = if_makeaddr(sc->sc_if.if_net, sc->sc_if.if_host[0]);
sc->sc_if.if_init = dmcinit;
sc->sc_if.if_output = dmcoutput;
sc->sc_if.if_ubareset = dmcreset;
sc->sc_if.if_init = dmcinit;
sc->sc_if.if_output = dmcoutput;
sc->sc_if.if_ubareset = dmcreset;
- sc->sc_ifuba.ifuba_flags = UBA_NEEDBDP;
+ /* DON'T KNOW IF THIS WILL WORK WITH A BDP AT HIGH SPEEDS */
+ sc->sc_ifuba.ifu_flags = UBA_NEEDBDP | UBA_CANTWAIT;
if_attach(&sc->sc_if);
}
if_attach(&sc->sc_if);
}
@@
-161,6
+167,7
@@
dmcinit(unit)
if (if_ubainit(&sc->sc_ifuba, ui->ui_ubanum, 0,
(int)btoc(DMCMTU)) == 0) {
printf("dmc%d: can't initialize\n", unit);
if (if_ubainit(&sc->sc_ifuba, ui->ui_ubanum, 0,
(int)btoc(DMCMTU)) == 0) {
printf("dmc%d: can't initialize\n", unit);
+ sc->sc_if.if_flags &= ~IFF_UP;
return;
}
addr = (struct dmcdevice *)ui->ui_addr;
return;
}
addr = (struct dmcdevice *)ui->ui_addr;
@@
-172,6
+179,12
@@
dmcinit(unit)
base = sc->sc_ifuba.ifu_r.ifrw_info & 0x3ffff;
dmcload(sc, DMC_READ, base, ((base>>2)&DMC_XMEM)|DMCMTU);
printd(" first read queued, addr 0x%x\n", base);
base = sc->sc_ifuba.ifu_r.ifrw_info & 0x3ffff;
dmcload(sc, DMC_READ, base, ((base>>2)&DMC_XMEM)|DMCMTU);
printd(" first read queued, addr 0x%x\n", base);
+ sc->sc_if.if_flags |= IFF_UP;
+ /* set up routing table entry */
+ if ((sc->sc_if.if_flags & IFF_ROUTE) == 0) {
+ rtinit(&sc->sc_if.if_addr, &sc->sc_if.if_addr, RTF_HOST|RTF_UP);
+ sc->sc_if.if_flags |= IFF_ROUTE;
+ }
}
/*
}
/*
@@
-202,7
+215,7
@@
dmcstart(dev)
* Have request mapped to UNIBUS for transmission.
* Purge any stale data from this BDP and start the output.
*/
* Have request mapped to UNIBUS for transmission.
* Purge any stale data from this BDP and start the output.
*/
- if (sc->sc_ifuba.ifu
ba
_flags & UBA_NEEDBDP)
+ if (sc->sc_ifuba.ifu_flags & UBA_NEEDBDP)
UBAPURGE(sc->sc_ifuba.ifu_uba, sc->sc_ifuba.ifu_w.ifrw_bdp);
addr = sc->sc_ifuba.ifu_w.ifrw_info & 0x3ffff;
printd(" len %d, addr 0x%x, ", len, addr);
UBAPURGE(sc->sc_ifuba.ifu_uba, sc->sc_ifuba.ifu_w.ifrw_bdp);
addr = sc->sc_ifuba.ifu_w.ifrw_info & 0x3ffff;
printd(" len %d, addr 0x%x, ", len, addr);
@@
-247,21
+260,13
@@
dmcrint(unit)
register struct dmc_softc *sc;
register struct dmcdevice *addr;
register int n;
register struct dmc_softc *sc;
register struct dmcdevice *addr;
register int n;
- int w0, w1; /* DEBUG */
addr = (struct dmcdevice *)dmcinfo[unit]->ui_addr;
sc = &dmc_softc[unit];
while (addr->bsel0&DMC_RDYI) {
addr = (struct dmcdevice *)dmcinfo[unit]->ui_addr;
sc = &dmc_softc[unit];
while (addr->bsel0&DMC_RDYI) {
- w0 = getw(&sc->sc_que); /* DEBUG */
- addr->sel4 = w0; /* DEBUG */
- w1 = getw(&sc->sc_que); /* DEBUG */
- addr->sel6 = w1; /* DEBUG */
- /* DEBUG
addr->sel4 = getw(&sc->sc_que);
addr->sel6 = getw(&sc->sc_que);
addr->sel4 = getw(&sc->sc_que);
addr->sel6 = getw(&sc->sc_que);
- DEBUG */
addr->bsel0 &= ~(DMC_IEI|DMC_RQI);
addr->bsel0 &= ~(DMC_IEI|DMC_RQI);
- printd(" w0 0x%x, w1 0x%x\n", w0, w1);
while (addr->bsel0&DMC_RDYI)
;
if (sc->sc_que.c_cc == 0)
while (addr->bsel0&DMC_RDYI)
;
if (sc->sc_que.c_cc == 0)
@@
-306,28
+311,32
@@
dmcxint(unit)
* higher-level input routine.
*/
sc->sc_if.if_ipackets++;
* higher-level input routine.
*/
sc->sc_if.if_ipackets++;
- if (sc->sc_ifuba.ifu
ba
_flags & UBA_NEEDBDP)
+ if (sc->sc_ifuba.ifu_flags & UBA_NEEDBDP)
UBAPURGE(sc->sc_ifuba.ifu_uba,
sc->sc_ifuba.ifu_r.ifrw_bdp);
len = arg & DMC_CCOUNT;
printd(" read done, len %d\n", len);
UBAPURGE(sc->sc_ifuba.ifu_uba,
sc->sc_ifuba.ifu_r.ifrw_bdp);
len = arg & DMC_CCOUNT;
printd(" read done, len %d\n", len);
- switch (ui->ui_flags & DMC_
P
F) {
+ switch (ui->ui_flags & DMC_
A
F) {
#ifdef INET
#ifdef INET
- case
P
F_INET:
- s
etipintr(
);
+ case
A
F_INET:
+ s
chednetisr(NETISR_IP
);
inq = &ipintrq;
break;
#endif
default:
inq = &ipintrq;
break;
#endif
default:
- printf("dmc%d: unknown
packet
type %d\n", unit,
- ui->ui_flags & DMC_
NET
);
+ printf("dmc%d: unknown
address
type %d\n", unit,
+ ui->ui_flags & DMC_
AF
);
goto setup;
}
m = if_rubaget(&sc->sc_ifuba, len, 0);
if (m == 0)
goto setup;
goto setup;
}
m = if_rubaget(&sc->sc_ifuba, len, 0);
if (m == 0)
goto setup;
- IF_ENQUEUE(inq, m);
+ if (IF_QFULL(inq)) {
+ IF_DROP(inq);
+ (void) m_freem(m);
+ } else
+ IF_ENQUEUE(inq, m);
setup:
arg = sc->sc_ifuba.ifu_r.ifrw_info & 0x3ffff;
setup:
arg = sc->sc_ifuba.ifu_r.ifrw_info & 0x3ffff;
@@
-345,7
+354,7
@@
setup:
sc->sc_if.if_opackets++;
sc->sc_oactive = 0;
if (sc->sc_ifuba.ifu_xtofree) {
sc->sc_if.if_opackets++;
sc->sc_oactive = 0;
if (sc->sc_ifuba.ifu_xtofree) {
- m_freem(sc->sc_ifuba.ifu_xtofree);
+
(void)
m_freem(sc->sc_ifuba.ifu_xtofree);
sc->sc_ifuba.ifu_xtofree = 0;
}
if (sc->sc_if.if_snd.ifq_head == 0)
sc->sc_ifuba.ifu_xtofree = 0;
}
if (sc->sc_if.if_snd.ifq_head == 0)
@@
-376,24
+385,30
@@
setup:
* Just send the data, header was supplied by
* upper level protocol routines.
*/
* Just send the data, header was supplied by
* upper level protocol routines.
*/
-dmcoutput(ifp, m,
pf
)
+dmcoutput(ifp, m,
dst
)
register struct ifnet *ifp;
register struct mbuf *m;
register struct ifnet *ifp;
register struct mbuf *m;
-
int pf
;
+
struct sockaddr *dst
;
{
struct uba_device *ui = dmcinfo[ifp->if_unit];
int s;
printd("dmcoutput\n");
{
struct uba_device *ui = dmcinfo[ifp->if_unit];
int s;
printd("dmcoutput\n");
- if (
pf != (ui->ui_flags & DMC_P
F)) {
- printf("dmc%d:
protocol
%d not supported\n", ifp->if_unit, pf);
+ if (
dst->sa_family != (ui->ui_flags & DMC_A
F)) {
+ printf("dmc%d:
af
%d not supported\n", ifp->if_unit, pf);
m_freem(m);
m_freem(m);
- return (
0
);
+ return (
EAFNOSUPPORT
);
}
s = splimp();
}
s = splimp();
+ if (IF_QFULL(&ifp->if_snd)) {
+ IF_DROP(&ifp->if_snd);
+ m_freem(m);
+ splx(s);
+ return (ENOBUFS);
+ }
IF_ENQUEUE(&ifp->if_snd, m);
if (dmc_softc[ifp->if_unit].sc_oactive == 0)
dmcstart(ifp->if_unit);
splx(s);
IF_ENQUEUE(&ifp->if_snd, m);
if (dmc_softc[ifp->if_unit].sc_oactive == 0)
dmcstart(ifp->if_unit);
splx(s);
- return (
1
);
+ return (
0
);
}
}