Add counters: pcu.bts.N.pch.requests.timeout

Implement T3113 for paging over PCH with default value of 7s (same as
T3113 in OsmoBSC). Increase the new counter on timeout.

Related: SYS#4878
Change-Id: I97475c3dbe2cf00b9cbfec39e93a3c65cb7f749f
This commit is contained in:
Oliver Smith 2021-07-09 16:37:16 +02:00
parent 4df959d305
commit d3c7591304
8 changed files with 142 additions and 0 deletions

View File

@ -62,6 +62,7 @@ libgprs_la_SOURCES = \
tbf_ul.cpp \
tbf_dl.cpp \
bts.cpp \
bts_pch_timer.c \
pdch.cpp \
pdch_ul_controller.c \
encoding.cpp \
@ -101,6 +102,7 @@ noinst_HEADERS = \
tbf_ul.h \
tbf_dl.h \
bts.h \
bts_pch_timer.h \
pdch.h \
pdch_ul_controller.h \
encoding.h \

View File

@ -133,6 +133,7 @@ static const struct rate_ctr_desc bts_ctr_description[] = {
{ "llc:dl_bytes", "RLC encapsulated PDUs"},
{ "llc:ul_bytes", "full PDUs received "},
{ "pch:requests", "PCH requests sent "},
{ "pch:requests:timeout", "PCH requests timeout "},
{ "rach:requests", "RACH requests received"},
{ "11bit_rach:requests", "11BIT_RACH requests received"},
{ "spb:uplink_first_segment", "First seg of UL SPB "},
@ -283,6 +284,8 @@ struct gprs_rlcmac_bts* bts_alloc(struct gprs_pcu *pcu, uint8_t bts_nr)
llist_add_tail(&bts->list, &pcu->bts_list);
INIT_LLIST_HEAD(&bts->pch_timer);
return bts;
}

View File

@ -126,6 +126,7 @@ enum {
CTR_LLC_DL_BYTES,
CTR_LLC_UL_BYTES,
CTR_PCH_REQUESTS,
CTR_PCH_REQUESTS_TIMEDOUT,
CTR_RACH_REQUESTS,
CTR_11BIT_RACH_REQUESTS,
CTR_SPB_UL_FIRST_SEGMENT,
@ -263,6 +264,9 @@ struct gprs_rlcmac_bts {
struct osmo_stat_item_group *statg;
struct GprsMsStorage *ms_store;
/* List of struct bts_pch_timer for active PCH pagings */
struct llist_head pch_timer;
};
#ifdef __cplusplus

85
src/bts_pch_timer.c Normal file
View File

@ -0,0 +1,85 @@
/*
* Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* Author: Oliver Smith
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <string.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/tdef.h>
#include <osmocom/core/utils.h>
#include <gprs_debug.h>
#include <gprs_pcu.h>
#include <bts_pch_timer.h>
static struct bts_pch_timer *bts_pch_timer_get(struct gprs_rlcmac_bts *bts, const char *imsi)
{
struct bts_pch_timer *p;
llist_for_each_entry(p, &bts->pch_timer, entry) {
if (strcmp(p->imsi, imsi) == 0)
return p;
}
return NULL;
}
static void bts_pch_timer_remove(struct bts_pch_timer *p)
{
osmo_timer_del(&p->T3113);
llist_del(&p->entry);
LOGP(DPCU, LOGL_DEBUG, "PCH paging timer stopped for IMSI=%s\n", p->imsi);
talloc_free(p);
}
static void T3113_callback(void *data)
{
struct bts_pch_timer *p = data;
LOGP(DPCU, LOGL_INFO, "PCH paging timeout for IMSI=%s\n", p->imsi);
bts_do_rate_ctr_inc(p->bts, CTR_PCH_REQUESTS_TIMEDOUT);
bts_pch_timer_remove(p);
}
void bts_pch_timer_start(struct gprs_rlcmac_bts *bts, const char *imsi)
{
if (bts_pch_timer_get(bts, imsi))
return;
struct bts_pch_timer *p;
p = talloc_zero(bts, struct bts_pch_timer);
llist_add_tail(&p->entry, &bts->pch_timer);
osmo_strlcpy(p->imsi, imsi, sizeof(p->imsi));
p->bts = bts;
struct osmo_tdef *tdef = osmo_tdef_get_entry(the_pcu->T_defs, 3113);
OSMO_ASSERT(tdef);
osmo_timer_setup(&p->T3113, T3113_callback, p);
osmo_timer_schedule(&p->T3113, tdef->val, 0);
LOGP(DPCU, LOGL_DEBUG, "PCH paging timer started for IMSI=%s\n", p->imsi);
}
void bts_pch_timer_stop(struct gprs_rlcmac_bts *bts, const char *imsi)
{
struct bts_pch_timer *p = bts_pch_timer_get(bts, imsi);
if (p)
bts_pch_timer_remove(p);
}

43
src/bts_pch_timer.h Normal file
View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* Author: Oliver Smith
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
#include <bts.h>
#ifdef __cplusplus
extern "C" {
#endif
struct bts_pch_timer {
struct llist_head entry;
struct gprs_rlcmac_bts *bts;
struct osmo_timer_list T3113;
char imsi[OSMO_IMSI_BUF_SIZE];
};
void bts_pch_timer_start(struct gprs_rlcmac_bts *bts, const char *imsi);
void bts_pch_timer_stop(struct gprs_rlcmac_bts *bts, const char *imsi);
#ifdef __cplusplus
}
#endif

View File

@ -30,6 +30,7 @@
struct gprs_pcu *the_pcu;
static struct osmo_tdef T_defs_pcu[] = {
{ .T=3113, .default_val=7, .unit=OSMO_TDEF_S, .desc="Timeout for paging", .val=0 },
{ .T=3190, .default_val=5, .unit=OSMO_TDEF_S, .desc="Return to packet idle mode after Packet DL Assignment on CCCH (s)", .val=0},
{ .T=3141, .default_val=10, .unit=OSMO_TDEF_S, .desc="Timeout for contention resolution procedure (s)", .val=0 },
{ .T=PCU_TDEF_NEIGH_RESOLVE_TO, .default_val=1000, .unit=OSMO_TDEF_MS, .desc="[ARFCN+BSIC]->[RAC+CI] resolution timeout (ms)", .val=0 },

View File

@ -26,6 +26,7 @@ extern "C" {
#include <pcu_l1_if.h>
#include <gprs_rlcmac.h>
#include <bts.h>
#include <bts_pch_timer.h>
#include <encoding.h>
#include <tbf.h>
#include <gprs_debug.h>
@ -48,6 +49,7 @@ int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mo
return -1;
}
bts_do_rate_ctr_inc(bts, CTR_PCH_REQUESTS);
bts_pch_timer_start(bts, mi->imsi);
pcu_l1if_tx_pch(bts, paging_request, plen, pgroup);
bitvec_free(paging_request);

View File

@ -20,6 +20,7 @@
*/
#include <bts.h>
#include <bts_pch_timer.h>
#include <tbf.h>
#include <tbf_ul.h>
#include <rlc.h>
@ -494,6 +495,7 @@ int gprs_rlcmac_ul_tbf::rcv_data_block_acknowledged(
"Decoded premier TLLI=0x%08x of UL DATA TFI=%d.\n",
new_tlli, rlc->tfi);
update_ms(new_tlli, GPRS_RLCMAC_UL_TBF);
bts_pch_timer_stop(bts, ms_imsi(ms()));
} else if (new_tlli != GSM_RESERVED_TMSI && new_tlli != tlli()) {
LOGPTBFUL(this, LOGL_NOTICE,
"Decoded TLLI=%08x mismatch on UL DATA TFI=%d. (Ignoring due to contention resolution)\n",