aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/l1sap.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-08-31 11:24:49 +0200
committerHarald Welte <laforge@gnumonks.org>2018-08-31 12:44:31 +0000
commitbd3462f35589d687c995fb24e9409f1e7b6485c1 (patch)
tree9b3cce769c9d9ee346adf90b083dda52c6f146e7 /src/common/l1sap.c
parentbf87717cc8fdb546ab48b1f462f3c679e09a0bc6 (diff)
paging: add unit-test to check different bs_ag_blks_res settings
The parameter bs_ag_blks_res, which is loaded into the BTS via the SI3 setting, defines how many of the CCCH blocks shall be used for AGCH. The remaining CCCH blocks will then be available as PCH for paging. Unfortunately there is no unit-test yet that verifies that all of the 8 different settings for bs_ag_blks_res. - Separate the the decision logic that checks if a given fn is part of an AGCH into a function to have it available in the unit-test. - Add a test that checks all possible bs_ag_blks_res settings. Change-Id: Ib9652f4013a4da3766852f8f03ce9ec5590f6989 Related: OS#1575
Diffstat (limited to 'src/common/l1sap.c')
-rw-r--r--src/common/l1sap.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index b8cec0e7..55b4a4bb 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -666,6 +666,15 @@ static int lchan_pdtch_ph_rts_ind_loop(struct gsm_lchan *lchan,
return 0;
}
+/* Check if given CCCH frame number is for a PCH or for an AGCH (this function is
+ * only used internally, it is public to call it from unit-tests) */
+int is_ccch_for_agch(struct gsm_bts_trx *trx, uint32_t fn) {
+ /* Note: The number of available access grant channels is set by the
+ * parameter BS_AG_BLKS_RES via system information type 3. This SI is
+ * transfered to osmo-bts via RSL */
+ return L1SAP_FN2CCCHBLOCK(fn) < num_agch(trx, "PH-RTS-IND");
+}
+
/* PH-RTS-IND prim received from bts model */
static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
struct osmo_phsap_prim *l1sap, struct ph_data_param *rts_ind)
@@ -681,6 +690,7 @@ static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
struct osmo_phsap_prim pp;
bool dtxd_facch = false;
int rc;
+ int is_ag_res;
chan_nr = rts_ind->chan_nr;
link_id = rts_ind->link_id;
@@ -783,9 +793,8 @@ static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
}
} else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) {
p = msgb_put(msg, GSM_MACBLOCK_LEN);
- rc = bts_ccch_copy_msg(trx->bts, p, &g_time,
- (L1SAP_FN2CCCHBLOCK(fn) <
- num_agch(trx, "PH-RTS-IND")));
+ is_ag_res = is_ccch_for_agch(trx, fn);
+ rc = bts_ccch_copy_msg(trx->bts, p, &g_time, is_ag_res);
if (rc <= 0)
memcpy(p, fill_frame, GSM_MACBLOCK_LEN);
}