aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-09-15 01:03:58 +0000
committerNeels Hofmeyr <neels@hofmeyr.de>2020-10-07 11:40:12 +0000
commit86a1dca5c765f3abdd3b01f4ba49217dbc0f34e0 (patch)
tree0023b9f53544b7a73386a0b030a9d56a6e866338 /include
parentd4946b22f7607d93095386e418ff29e456c243a2 (diff)
introduce osmo_use_count for bsc_subscr
During LCS development, I'm getting use count bugs and would like to see use token strings to figure it out. Change-Id: I29bf60059d4cf7bb99a00753e6cdc149baf95f94
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/bsc/bsc_subscr_conn_fsm.h2
-rw-r--r--include/osmocom/bsc/bsc_subscriber.h31
-rw-r--r--include/osmocom/bsc/paging.h3
3 files changed, 23 insertions, 13 deletions
diff --git a/include/osmocom/bsc/bsc_subscr_conn_fsm.h b/include/osmocom/bsc/bsc_subscr_conn_fsm.h
index 354c5ee93..9b6398a3f 100644
--- a/include/osmocom/bsc/bsc_subscr_conn_fsm.h
+++ b/include/osmocom/bsc/bsc_subscr_conn_fsm.h
@@ -3,6 +3,8 @@
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/core/fsm.h>
+#define BSUB_USE_CONN "conn"
+
enum gscon_fsm_event {
/* local SCCP stack tells us incoming conn from MSC */
GSCON_EV_A_CONN_IND,
diff --git a/include/osmocom/bsc/bsc_subscriber.h b/include/osmocom/bsc/bsc_subscriber.h
index a602a9ef6..6fffafdb3 100644
--- a/include/osmocom/bsc/bsc_subscriber.h
+++ b/include/osmocom/bsc/bsc_subscriber.h
@@ -5,6 +5,7 @@
#include <stdint.h>
#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/use_count.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
#include <osmocom/gsm/gsm48.h>
@@ -12,7 +13,7 @@ struct log_target;
struct bsc_subscr {
struct llist_head entry;
- int use_count;
+ struct osmo_use_count use_count;
char imsi[GSM23003_IMSI_MAX_DIGITS+1];
uint32_t tmsi;
@@ -22,25 +23,29 @@ const char *bsc_subscr_name(struct bsc_subscr *bsub);
const char *bsc_subscr_id(struct bsc_subscr *bsub);
struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list,
- const char *imsi);
+ const char *imsi,
+ const char *use_token);
struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list,
- uint32_t tmsi);
-struct bsc_subscr *bsc_subscr_find_or_create_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi);
+ uint32_t tmsi,
+ const char *use_token);
+struct bsc_subscr *bsc_subscr_find_or_create_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi,
+ const char *use_token);
struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list,
- const char *imsi);
+ const char *imsi,
+ const char *use_token);
struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list,
- uint32_t tmsi);
-struct bsc_subscr *bsc_subscr_find_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi);
+ uint32_t tmsi,
+ const char *use_token);
+struct bsc_subscr *bsc_subscr_find_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi,
+ const char *use_token);
void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi);
-struct bsc_subscr *_bsc_subscr_get(struct bsc_subscr *bsub,
- const char *file, int line);
-struct bsc_subscr *_bsc_subscr_put(struct bsc_subscr *bsub,
- const char *file, int line);
-#define bsc_subscr_get(bsub) _bsc_subscr_get(bsub, __FILE__, __LINE__)
-#define bsc_subscr_put(bsub) _bsc_subscr_put(bsub, __FILE__, __LINE__)
+#define bsc_subscr_get(bsc_subscr, use) \
+ OSMO_ASSERT(osmo_use_count_get_put(&(bsc_subscr)->use_count, use, 1) == 0)
+#define bsc_subscr_put(bsc_subscr, use) \
+ OSMO_ASSERT(osmo_use_count_get_put(&(bsc_subscr)->use_count, use, -1) == 0)
void log_set_filter_bsc_subscr(struct log_target *target,
struct bsc_subscr *bsub);
diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h
index c6eb9dfaa..cd351cb5d 100644
--- a/include/osmocom/bsc/paging.h
+++ b/include/osmocom/bsc/paging.h
@@ -42,6 +42,9 @@ struct bsc_msc_data;
#define LOG_PAGING_BTS(PARAMS, BTS, SUBSYS, LEVEL, fmt, args...) \
LOG_PAGING(PARAMS, SUBSYS, LEVEL, "(bts%u) " fmt, (BTS) ? (BTS)->nr : 255, ##args)
+#define BSUB_USE_PAGING_START "paging-start"
+#define BSUB_USE_PAGING_REQUEST "paging-req"
+
/* Bitmask of reasons for Paging. Each individual Paging via bsc_paging_start() typically has only one of these reasons
* set, but when a subscriber responds, we need to aggregate all pending Paging reasons (by bitwise-OR). */
enum bsc_paging_reason {