aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/bsc/bssmap_reset.h
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-10-04 21:32:52 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2020-10-15 05:28:24 +0200
commitc27ae2da550efbd35cccbcd9ea620d1bca8aa926 (patch)
tree7f32edfc42318b009fb884f5051f501a5d22acef /include/osmocom/bsc/bssmap_reset.h
parent8ab883b9b6ef6db570a8d3445a6da61a24ac6280 (diff)
BSSMAP RESET: generalize a_reset FSM
Separate the a_reset FSM implementation from BSSMAP and MSC specifics, so that it can be re-used on the Lb interface. Move the FSM implementation to bssmap_reset.c and tweak, to match common practices we have generally established in our osmo_fsm implementations. Keep a_reset.h and a_reset.c and redirect to bssmap_reset.c. A difficulty is setting a proper logging category: the FSM definition allows only one fixed logging category for FSM state transitions and events. Ideally, the BSSMAP reset fsm would log on DMSC, and the BSSMAP-LE reset fsm would log on DLCS. Since that is not possible, introduce a separate DRESET logging category. This in fact matches an item on my wishlist, because if a given MSC is configured but currently not connected, the previous RESET FSM would continuously "spam" log LOGL_NOTICE messages indicating that it is resending RESET, and I often want to silence those messages without silencing the entire DMSC category. This is now easily possible by setting DRESET logging to LOGL_ERROR. There is additional "link up" / "link lost" logging on DMSC, so all interesting info is still visible on DMSC. Change-Id: Ib3c3a163186c40a93be0dea666230431172136df
Diffstat (limited to 'include/osmocom/bsc/bssmap_reset.h')
-rw-r--r--include/osmocom/bsc/bssmap_reset.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/osmocom/bsc/bssmap_reset.h b/include/osmocom/bsc/bssmap_reset.h
new file mode 100644
index 000000000..ba6425701
--- /dev/null
+++ b/include/osmocom/bsc/bssmap_reset.h
@@ -0,0 +1,27 @@
+/* Manage RESET and disconnection detection on BSSMAP and BSSMAP-LE */
+#pragma once
+
+enum bssmap_reset_fsm_event {
+ BSSMAP_RESET_EV_RX_RESET_ACK,
+ BSSMAP_RESET_EV_CONN_CFM_SUCCESS,
+ BSSMAP_RESET_EV_CONN_CFM_FAILURE,
+};
+
+struct bssmap_reset_cfg {
+ int conn_cfm_failure_threshold;
+ struct {
+ void (*tx_reset)(void *data);
+ void (*link_up)(void *data);
+ void (*link_lost)(void *data);
+ } ops;
+ void *data;
+};
+
+struct bssmap_reset {
+ struct osmo_fsm_inst *fi;
+ struct bssmap_reset_cfg cfg;
+ int conn_cfm_failures;
+};
+
+struct bssmap_reset *bssmap_reset_alloc(void *ctx, const char *label, const struct bssmap_reset_cfg *cfg);
+bool bssmap_reset_is_conn_ready(const struct bssmap_reset *bssmap_reset);