aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-07-09 16:37:16 +0200
committerOliver Smith <osmith@sysmocom.de>2021-08-06 19:03:29 +0200
commitd4a027598aede54a6de229621a18b6ed3aaaef59 (patch)
tree51e002e2291850cfbbbff69645fd8d5041427189
parent84d9f8ffc8ed588234690fcf8eb9d1f3dd84d31a (diff)
Add counters: pcu.bts.N.pch.requests.timeoutosmith/perf_counters
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
-rw-r--r--src/Makefile.am1
-rw-r--r--src/bts.cpp3
-rw-r--r--src/bts.h4
-rw-r--r--src/bts_pch_timer.c84
-rw-r--r--src/bts_pch_timer.h42
-rw-r--r--src/gprs_pcu.c1
-rw-r--r--src/gprs_rlcmac.cpp2
-rw-r--r--src/tbf_ul.cpp2
8 files changed, 139 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8070fda..d603f2d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 \
diff --git a/src/bts.cpp b/src/bts.cpp
index 4e3b770..a96fe24 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -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;
}
diff --git a/src/bts.h b/src/bts.h
index c28bd97..5e45527 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -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
diff --git a/src/bts_pch_timer.c b/src/bts_pch_timer.c
new file mode 100644
index 0000000..c496072
--- /dev/null
+++ b/src/bts_pch_timer.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ *
+ * 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);
+}
diff --git a/src/bts_pch_timer.h b/src/bts_pch_timer.h
new file mode 100644
index 0000000..eff6237
--- /dev/null
+++ b/src/bts_pch_timer.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ *
+ * 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
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index 37563ec..a7bab8d 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -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 },
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index ffa656c..22b12df 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -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);
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index b5f9f01..5ca02d9 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -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",