MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / macThreadFunc

Function macThreadFunc

GPRS/MAC.cpp:2472–2515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2470}
2471
2472static void *macThreadFunc(void *arg)
2473{
2474 gL2MAC.macRunning = true;
2475
2476 // Set the current RLC BSN.
2477 //Time tstart = gBTS.time().FN();
2478 Time tstart = gBTS.time();
2479 int fnstart = tstart.FN();
2480 gBSNNext = FrameNumber2BSN(fnstart);
2481
2482 ChIdleCounter = ChCongestionCounter = 0;
2483
2484 // Lets start synced up on a 52-multiframe boundary.
2485 if (0) { // why bother?
2486 int offset = fnstart % 52;
2487 if (offset) {
2488 fnstart += (52 - offset);
2489 gBTS.clock().wait(fnstart);
2490 }
2491 }
2492
2493 GPRSLOG(1) << "macServiceLoop starting:" << LOGVAR(gBSNNext) <<LOGVAR(fnstart);
2494
2495 // We need to run the service loop even if there are no channels allocated because
2496 // the BSSG may add downlink PDUs to an MS which will create a new TBF,
2497 // which will add a channel on demand.
2498 bool firsttime = true; // First iteration.
2499 while (!gL2MAC.macStopFlag) {
2500 gL2MAC.macConfigInit();
2501 advanceBSNNext(1);
2502 serviceLoopSynchronize(firsttime);
2503 firsttime = false;
2504
2505 {
2506 ScopedLock lock(gL2MAC.macLock);
2507 gL2MAC.macServiceLoop();
2508 }
2509 }
2510
2511 GPRSLOG(1) << "macServiceLoop ending:" << LOGVAR(gBSNNext);
2512
2513 gL2MAC.macRunning = false;
2514 return NULL;
2515}
2516
2517
2518// When the MS RACHes into the GSM RR/MM side for any reason, we must cancel ongoing TBFs.

Callers

nothing calls this directly

Calls 8

FrameNumber2BSNFunction · 0.85
advanceBSNNextFunction · 0.85
serviceLoopSynchronizeFunction · 0.85
macConfigInitMethod · 0.80
macServiceLoopMethod · 0.80
timeMethod · 0.45
FNMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected