From f2419bf8c38efa877644bdc88a99fc1278a89f58 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 23 May 2019 23:58:42 +0200 Subject: l1sap: Fix calculation of expired RACH slots in case of missing frame numbers In case of a Combined CCCH (with SDCCH/4), the number of RACH slots depends on the frame number. So in case of lost/skipped frame numbers, we cannot simply compute the value for the current fn and then multiply it by the number of frame numbers expired. Rather, we have to 'replay' all missed frame numbers and individually determine how many RACH slots happened in that frame. Related: OS#3750 Change-Id: If4f8d2ea55fc722c64c330cde09e833b67ee98fe --- src/common/l1sap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/l1sap.c b/src/common/l1sap.c index d9ffdb8f..52f2b334 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -493,6 +493,7 @@ static int l1sap_info_time_ind(struct gsm_bts *bts, struct info_time_ind_param *info_time_ind) { int frames_expired; + int i; DEBUGPFN(DL1P, info_time_ind->fn, "Rx MPH_INFO time ind\n"); @@ -513,8 +514,10 @@ static int l1sap_info_time_ind(struct gsm_bts *bts, /* increment number of RACH slots that have passed by since the * last time indication */ - bts->load.rach.total += - calc_exprd_rach_frames(bts, info_time_ind->fn) * frames_expired; + for (i = 0; i < frames_expired; i++) { + uint32_t fn = (info_time_ind->fn + GSM_HYPERFRAME - i) % GSM_HYPERFRAME; + bts->load.rach.total += calc_exprd_rach_frames(bts, fn); + } return 0; } -- cgit v1.2.3