aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/l1sap.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-08-27 19:57:51 +0200
committerHarald Welte <laforge@gnumonks.org>2015-09-22 16:39:03 +0200
commit7cf313c75bb25502ce0228952271021d35d50f68 (patch)
tree1ce148d9eb31731c5f8b712c95cf66ac1085d4bf /src/common/l1sap.c
parent21b5e6318e7bfbd233fdf542a3f43588ab92282b (diff)
l1sap: Re-introduce more correct RACH slot counting
The original code handled both the fact where a TIME indication would be missed (and thus the frame number be higher than previous + 1), as well as the two cases for combined / non-combined CCCH. The L1SAP code removed some of those bits, which I'm re-introducing here.
Diffstat (limited to 'src/common/l1sap.c')
-rw-r--r--src/common/l1sap.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 6cb636d7..9bbbdf3b 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -77,6 +77,8 @@ static int l1sap_info_time_ind(struct gsm_bts_trx *trx,
struct gsm_bts *bts = trx->bts;
struct gsm_bts_role_bts *btsb = bts->role;
+ int frames_expired = info_time_ind->fn - btsb->gsm_time.fn;
+
DEBUGP(DL1P, "MPH_INFO time ind %u\n", info_time_ind->fn);
/* Update our data structures with the current GSM time */
@@ -89,10 +91,18 @@ static int l1sap_info_time_ind(struct gsm_bts_trx *trx,
* and pre-compute the respective measurement */
trx_meas_check_compute(trx, info_time_ind->fn - 1);
- /* increment 'total' for every possible rach */
- if (bts->c0->ts[0].pchan != GSM_PCHAN_CCCH_SDCCH4
- || (info_time_ind->fn % 51) < 27)
- btsb->load.rach.total++;
+ /* increment number of RACH slots that have passed by since the
+ * last time indication */
+ if (trx == bts->c0) {
+ unsigned int num_rach_per_frame;
+ /* 27 / 51 taken from TS 05.01 Figure 3 */
+ if (bts->c0->ts[0].pchan == GSM_PCHAN_CCCH_SDCCH4)
+ num_rach_per_frame = 27;
+ else
+ num_rach_per_frame = 51;
+
+ btsb->load.rach.total += frames_expired * num_rach_per_frame;
+ }
return 0;
}