// GateForInit.bcpl -- initialization for GateForward.bcpl // Last modified February 8, 1979 3:30 PM by Boggs get "Pup0.decl" get "Pup1.decl" get "GateForward.decl" external [ // outgoing procedures InitForwarder // incoming procedures TMLookup Allocate; Zero; SysErr; SetTimer // incoming statics @gf; ndbQ; numNets; gatewayIQ; sysZone ] //---------------------------------------------------------------------------- let InitForwarder(numPBI) be //---------------------------------------------------------------------------- // numPBI is the number of PBIs in the system [ gf = Allocate(sysZone, lenGF); Zero(gf, lenGF) // Pup1Init initializes gatewayIQ to -> pbiFreeQ gatewayIQ = lv gf>>GF.iQ // gateway statistics gf>>GF.stats.version = gfStatsVersion let logTMSize = (numNets*(numNets+1)*10)/8 for i = 1 to 16 do [ //round up to next power of 2 and take log logTMSize = logTMSize rshift 1 if logTMSize eq 0 then [ logTMSize = i; break ] ] let lenTM = lenHTP+lenTME*(1 lshift logTMSize) let tm = Allocate(sysZone, lenTM); Zero(tm, lenTM) tm>>HTP.enumerate = SysErr tm>>HTP.delete = SysErr tm>>HTP.lookup = TMLookup tm>>HTP.insert = SysErr tm>>HTP.logSize = logTMSize for i = 0 to (1 lshift logTMSize)-1 do //init to empty tm>>TM.TME^i.sdNet = -1 gf>>GF.tm = tm // wait 30 sec before first routing info broadcast SetTimer(lv gf>>GF.routeBcstTimer, 3000) // No net may have more than 1/2 of the PBIs waiting on its OQ let ndb = ndbQ!0; while ndb ne 0 do [ ndb>>NDB.numGPBI = numPBI/2 ndb = ndb!0 ] ]