pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28002 )
Change subject: paging: Take into account extra delay of all paging groups in BSC queue
......................................................................
paging: Take into account extra delay of all paging groups in BSC queue
So far we only calculated the expiration time based on the amount of
requests of the same paging group in the BSC queue.
However, also extra time has to be taken into account regarding requests
of other paging groups. This is important because requests of all paging
groups are mixed in the BSC queue, meaning having a lot of requests from
other groups before a certain req will anyway delay transmit of that
req to some extend.
Related: OS#5537
Change-Id: Ib55f947c5d3490b27e1d08d39392992919512f9a
---
M src/osmo-bsc/paging.c
1 file changed, 30 insertions(+), 9 deletions(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index 1293739..90a0d12 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -340,9 +340,11 @@
}
#define GSM51_MFRAME_DURATION_us (51 * GSM_TDMA_FN_DURATION_uS) /* 235365 us */
-static unsigned int paging_estimate_delay_us(struct gsm_bts *bts, unsigned int num_reqs);
+static unsigned int paging_estimate_delay_us(struct gsm_bts *bts, unsigned int num_reqs,
+ unsigned int num_reqs_same_pgroup);
-static unsigned int calculate_timer_3113(struct gsm_paging_request *req, unsigned int reqs_before)
+static unsigned int calculate_timer_3113(struct gsm_paging_request *req, unsigned int reqs_before,
+ unsigned int reqs_before_same_pgroup)
{
unsigned int to_us, to;
struct gsm_bts *bts = req->bts;
@@ -369,7 +371,7 @@
GSM_TDMA_FN_DURATION_uS * rach_tx_integer * rach_max_trans;
/* Now add some extra time based on how many requests need to be transmitted before this one: */
- to_us += paging_estimate_delay_us(bts, reqs_before);
+ to_us += paging_estimate_delay_us(bts, reqs_before, reqs_before_same_pgroup);
/* ceiling in seconds + extra time */
to = (to_us + 999999) / 1000000 + d->val;
@@ -388,7 +390,7 @@
struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req, *last_initial_req = NULL;
unsigned int t3113_timeout_s;
- unsigned int reqs_before_same_pgroup = 0;
+ unsigned int reqs_before = 0, reqs_before_same_pgroup = 0;
uint8_t pgroup = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
str_to_imsi(params->bsub->imsi));
@@ -410,10 +412,12 @@
}
if (req->attempts == 0) {
last_initial_req = req;
+ reqs_before++;
if (req->pgroup == pgroup)
reqs_before_same_pgroup++;
} else if (last_initial_req == NULL) {
/* If no req with attempts=0 was found, we'll append to end of list, so keep counting. */
+ reqs_before++;
if (req->pgroup == pgroup)
reqs_before_same_pgroup++;
}
@@ -438,7 +442,7 @@
else/* Add in the middle of the list after last_initial_req */
__llist_add(&req->entry, &last_initial_req->entry, last_initial_req->entry.next);
- t3113_timeout_s = calculate_timer_3113(req, reqs_before_same_pgroup);
+ t3113_timeout_s = calculate_timer_3113(req, reqs_before, reqs_before_same_pgroup);
osmo_timer_schedule(&req->T3113, t3113_timeout_s, 0);
/* Trigger scheduler if needed: */
@@ -648,11 +652,28 @@
/*! Conservative estimate of time needed by BTS to schedule a number of paging
* requests (num_reqs), based on current load at the BSC queue (doesn't take into
* account BTs own buffer) */
-static unsigned int paging_estimate_delay_us(struct gsm_bts *bts, unsigned int num_reqs)
+static unsigned int paging_estimate_delay_us(struct gsm_bts *bts, unsigned int num_reqs,
+ unsigned int num_reqs_same_pgroup)
{
- unsigned int n_pag_blocks = gsm0502_get_n_pag_blocks(&bts->si_common.chan_desc);
- unsigned int n_mframes = (num_reqs + (n_pag_blocks - 1)) / n_pag_blocks;
- unsigned int time_us = n_mframes * GSM51_MFRAME_DURATION_us;
+ unsigned int n_pag_blocks, n_mframes, time_us = 0;
+
+ n_pag_blocks = gsm0502_get_n_pag_blocks(&bts->si_common.chan_desc);
+
+ /* First of all, we need to extend the timeout in relation to the amount
+ * of paging requests in the BSC queue. In here we don't care about the
+ * paging group, because they are mixed in the same queue. If we don't
+ * take this into account, it could happen that if lots of requests are
+ * received at the BSC (from MSC) around the same time, they could time
+ * out in the BSC queue before arriving at the BTS. We already account of
+ * same-paging-group ones further below, so don't take them into account
+ * here: */
+ unsigned int num_reqs_other_groups = num_reqs - num_reqs_same_pgroup;
+ time_us += ((num_reqs_other_groups * GSM51_MFRAME_DURATION_us) + (n_pag_blocks - 1)) / n_pag_blocks;
+
+ /* Now we extend the timeout based on the amount of requests of the same
+ * paging group before the present one: */
+ n_mframes = (num_reqs_same_pgroup + (n_pag_blocks - 1)) / n_pag_blocks;
+ time_us += n_mframes * GSM51_MFRAME_DURATION_us;
/* the multiframes are not consecutive for a paging group, let's add the spacing between: */
if (n_mframes > 1) {
unsigned int bs_pa_mfrms = (bts->si_common.chan_desc.bs_pa_mfrms + 2);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28002
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib55f947c5d3490b27e1d08d39392992919512f9a
Gerrit-Change-Number: 28002
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28001 )
Change subject: tests: Introduce paging_test
......................................................................
tests: Introduce paging_test
Add unit test env to easily test several paging scenarios.
Change-Id: Iab61bf6a6eece5f439a19f7a5a0dc068a808ae8a
---
M configure.ac
M tests/Makefile.am
A tests/paging/Makefile.am
A tests/paging/paging_test.c
A tests/paging/paging_test.ok
M tests/testsuite.at
6 files changed, 8,323 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28001
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Iab61bf6a6eece5f439a19f7a5a0dc068a808ae8a
Gerrit-Change-Number: 28001
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28003 )
Change subject: bts: Properly free ctr/stat when bts object is freed
......................................................................
bts: Properly free ctr/stat when bts object is freed
This was so far workarounded in tests by manually freeing the fields.
However, in follow-up patch the paging queue will also be properly
freed, so free of the counters needs to be previously fixed too so that
counters are freed at the right point of time.
Otherwise, during paging queue flush, counters are used and would crash
because they were freed before the BTS object in each test's bts_del().
Change-Id: Id213e21cf9bfc5439021e459c22ba4704d8cae2b
---
M src/osmo-bsc/bts.c
M tests/acc/acc_test.c
M tests/gsm0408/gsm0408_test.c
3 files changed, 3 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, approved
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 02cd3a8..2dfd4fa 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -163,6 +163,9 @@
osmo_fsm_inst_free(bts->mo.fi);
bts->mo.fi = NULL;
}
+
+ osmo_stat_item_group_free(bts->bts_statg);
+ rate_ctr_group_free(bts->bts_ctrs);
return 0;
}
diff --git a/tests/acc/acc_test.c b/tests/acc/acc_test.c
index 1e78f73..ce3b0cb 100644
--- a/tests/acc/acc_test.c
+++ b/tests/acc/acc_test.c
@@ -58,8 +58,6 @@
#define bts_del(bts) _bts_del(bts, __func__)
static inline void _bts_del(struct gsm_bts *bts, const char *msg)
{
- osmo_stat_item_group_free(bts->bts_statg);
- rate_ctr_group_free(bts->bts_ctrs);
if (osmo_timer_pending(&bts->acc_mgr.rotate_timer))
osmo_timer_del(&bts->acc_mgr.rotate_timer);
if (osmo_timer_pending(&bts->acc_ramp.step_timer))
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index a7270a4..03b2ee1 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -137,8 +137,6 @@
#define bts_del(bts) _bts_del(bts, __func__)
static inline void _bts_del(struct gsm_bts *bts, const char *msg)
{
- osmo_stat_item_group_free(bts->bts_statg);
- rate_ctr_group_free(bts->bts_ctrs);
if (osmo_timer_pending(&bts->acc_mgr.rotate_timer))
osmo_timer_del(&bts->acc_mgr.rotate_timer);
/* no need to llist_del(&bts->list), we never registered the bts there. */
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28003
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Id213e21cf9bfc5439021e459c22ba4704d8cae2b
Gerrit-Change-Number: 28003
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28002 )
Change subject: paging: Take into account extra delay of all paging groups in BSC queue
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28002
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib55f947c5d3490b27e1d08d39392992919512f9a
Gerrit-Change-Number: 28002
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 03 May 2022 09:53:35 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment