--- xinu/sys/netinit.c 2018/04/24 17:39:04 1.1.1.1 +++ xinu/sys/netinit.c 2018/04/24 17:39:51 1.1.1.2 @@ -2,35 +2,40 @@ #include #include -#include -#include +#include + +#ifndef RING0IN +#define RING0IN -1 +#endif +#ifndef RING0OUT +#define RING0OUT -1 +#endif +#ifndef RING1IN +#define RING1IN -1 +#endif +#ifndef RING1OUT +#define RING1OUT -1 +#endif +#ifndef NNETS +#define NNETS 0 +#endif + +#define MAXNETS 2 /* maximum nets assigned in netdevs */ +static int netdevs[][MAXNETS] + = {RING0IN,RING0OUT,RING1IN,RING1OUT}; /*------------------------------------------------------------------------ - * netinit - initialize network data structures + * netinit -- iniitalize networks by starting frame level I/O *------------------------------------------------------------------------ */ netinit() { - struct netq *nqptr; - int i; + int netid; - /* Initialize pool of network buffers and rest of Net structure */ - - if (clkruns == FALSE) - panic("net: no clock"); - Net.netpool = mkpool(EMAXPAK, NETBUFS); - for (i=0 ; ivalid = FALSE; - nqptr->uport = -1; - nqptr->xport = pcreate(NETQLEN); - } - Net.mnvalid = Net.mavalid = FALSE; - dot2ip(Net.gateway, GATEWAY); - Net.nxtprt = ULPORT; - Net.nmutex = screate(1); - Net.npacket = Net.ndrop = Net.nover = 0; + if (NNETS > MAXNETS) + panic("netinit - too few devices to netdevs table"); + frbpool = mkpool(FRLEN, NFRAMES); + for (netid=0 ; netid