From 1e7dd5c0bbb60d17a347a28d5fe179f626f8c4cc Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 29 Nov 2022 11:51:41 +0100 Subject: [PATCH] paging: Replace reqs waiting for retransmission with new incoming inital req if queue is full If queue size (in transmit delay of requests) is too long (above threshold) when a new initial incoming request arrives, instead of directly discarding it, see if we can drop a pending retransmission and insert the new one instead, in order to avoid losing initial requests. This is done under the assumption that it is more important to transmit intial requests than to retransmit already transmitted ones. The rationale is that there's lower chances that an MS which didn't answer lately will answer now (aka being reachable at the cell), so it's better to allocate resources for new requests (new MS) which may be available in the cell. Change-Id: Idfd93254ae456b1ee08416e05479488299dd063d Related: OS#5552 --- src/osmo-bsc/paging.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c index b972ddc3e..627d7b634 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -504,13 +504,6 @@ static int _paging_request(const struct bsc_paging_params *params, struct gsm_bt rate_ctr_inc(rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_PAGING_ATTEMPTED)); - /* Don't try to queue more requests than we can realistically handle within X3113 seconds, - * see PAGING_THRESHOLD_X3113_DEFAULT_SEC. */ - if (paging_pending_requests_nr(bts) > paging_estimate_available_slots(bts, x3113_s)) { - rate_ctr_inc(rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_PAGING_OVERLOAD)); - return -ENOSPC; - } - /* Find if we already have one for the given subscriber on this BTS: */ if (bsc_subscr_find_req_by_bts(params->bsub, bts)) { LOG_PAGING_BTS(params, bts, DPAG, LOGL_INFO, "Paging request already pending for this subscriber\n"); @@ -518,6 +511,20 @@ static int _paging_request(const struct bsc_paging_params *params, struct gsm_bt return -EEXIST; } + /* Don't try to queue more requests than we can realistically handle within X3113 seconds, + * see PAGING_THRESHOLD_X3113_DEFAULT_SEC. */ + if (paging_pending_requests_nr(bts) > paging_estimate_available_slots(bts, x3113_s)) { + struct gsm_paging_request *first_retrans_req; + rate_ctr_inc(rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_PAGING_OVERLOAD)); + /* Need to drop a retrans from the queue if possible, in order to make space for the new initial req. */ + if (bts_entry->retrans_req_list_len == 0) { + /* There are no retrans to be replaced by this initial request, discard it. */ + return -ENOSPC; + } + first_retrans_req = llist_first_entry(&bts_entry->retrans_req_list, struct gsm_paging_request, entry); + paging_remove_request(first_retrans_req); + } + /* The incoming new req will be stored in initial_req_list giving higher prio * to it over retransmissions. This avoids new subscribers being paged to * be delayed if the paging queue is full due to a lot of retranmissions.