From patchwork Wed Aug 27 21:54:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Welte X-Patchwork-Id: 383580 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 79DFC1400AF for ; Thu, 28 Aug 2014 08:05:21 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1XMlL6-0006D9-48; Thu, 28 Aug 2014 00:05:12 +0200 Received: from uucp by ganesha.gnumonks.org with local-bsmtp (Exim 4.72) (envelope-from ) id 1XMlBk-0004L5-7h; Wed, 27 Aug 2014 23:55:32 +0200 Received: from laforge by localhost.localdomain with local (Exim 4.84) (envelope-from ) id 1XMlBH-0003W6-QQ; Wed, 27 Aug 2014 23:55:03 +0200 From: Harald Welte To: openbsc@lists.osmocom.org Subject: [PATCH 17/33] l1sap: Re-introduce more correct RACH slot counting Date: Wed, 27 Aug 2014 23:54:36 +0200 Message-Id: <1409176492-13269-18-git-send-email-laforge@gnumonks.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1409176492-13269-1-git-send-email-laforge@gnumonks.org> References: <1409176492-13269-1-git-send-email-laforge@gnumonks.org> Cc: Harald Welte X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org 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. --- src/common/l1sap.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 6cb636d..9bbbdf3 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; }