aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-03-16 10:14:48 +0100
committerpespin <pespin@sysmocom.de>2023-03-17 18:08:26 +0000
commit9f7611a32f558fe70f4aa30c222b865dadda36ad (patch)
treec082bd2603ee6af8e7606d5fb101c99f7c984502 /include
parentcbf3e5d850ed2d921a2fbff839b5ee38cfe4ce48 (diff)
Fix Lb/A SCCP conn lookup after recent regression in optimization patch
In osmo-bsc, there's currently 0..1 Lb links and 0..N A links, where N is the number of MSC, but links can be shared in the underlaying stack (struct osmo_sccp_instance), hence range 0..N of different osmo_sccp_instance (identified by PC). Even more, the Lb and A link can share the same underlaying stack, so osmo-bsc can end up with only 1 struct osmo_sccp_instance shared by all the above mentioned links in case all are configured under the same PC. Total range A+Lb is 0..(1+N). A struct gsm_subscriber_conn stores 2 struct sccp_instance*, one for Lb (conn->lcs.lb.*)and one for A (conn->sccp.*). They can actually point to the same sccp_instance or to different ones, as explained above, depending on the configured setup. In any case, a gsm_subscriber_conn needs 2 rb_nodes since it can hold any of the 2 conn_ids independently (A or Lb). The previous patch forgot to add that 2nd rb_node as well as some initialization and release code for the Lb conn. This patch addresses that. When the 2nd rb_node, a problem when iterating the rbtree appears: how to find out the "conn" pointer from the rb_node pointer, since the rb_node pointer can be any of the 2 rb_nodes inside the struct at a different offsets. In order to solve that problem, a new struct bscp_sccp_conn_node is added, which holds all the relevant information used by the rbtree lookup code in a generic way (rb_node and conn_id), plus a backpointer to the struct bsc_gsm_subcriber it relates too. Fixes: 85062ccad31e9fb73e0256a5ee556c6ae0a16449 Change-Id: If42d93adee71d646766929a09bc01ae92b734ef3
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/bsc/gsm_data.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index dc7ee3f89..25e634ab8 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -281,6 +281,21 @@ struct handover {
struct osmo_mgcpc_ep_ci *created_ci_for_msc;
};
+struct gsm_subscriber_connection;
+
+struct bscp_sccp_conn_node {
+ /* entry in (struct bsc_sccp_inst)->connections */
+ struct rb_node node;
+ /* Sigtran connection ID:
+ * if set: Range (0..SCCP_CONN_ID_MAX) (24 bit)
+ * if unset: SCCP_CONN_ID_UNSET (-1) if unset */
+ uint32_t conn_id;
+ /* backpointer where this sccp conn belongs to: */
+ struct gsm_subscriber_connection *gscon;
+};
+
+void bscp_sccp_conn_node_init(struct bscp_sccp_conn_node *sccp_conn, struct gsm_subscriber_connection *gscon);
+
/* active radio connection of a mobile subscriber */
struct gsm_subscriber_connection {
/* global linked list of subscriber_connections */
@@ -332,15 +347,8 @@ struct gsm_subscriber_connection {
struct {
/* SCCP connection related */
struct bsc_msc_data *msc;
-
- /* entry in (struct bsc_sccp_inst)->connections */
- struct rb_node node;
-
- /* Sigtran connection ID:
- * if set: Range (0..SCCP_CONN_ID_MAX) (24 bit)
- * if unset: SCCP_CONN_ID_UNSET (-1) if unset */
- uint32_t conn_id;
enum subscr_sccp_state state;
+ struct bscp_sccp_conn_node conn;
} sccp;
/* for audio handling */
@@ -389,11 +397,8 @@ struct gsm_subscriber_connection {
/* Lb interface to the SMLC: BSSMAP-LE/SCCP connection associated with this subscriber */
struct {
- /* Sigtran connection ID:
- * if set: Range (0..SCCP_CONN_ID_MAX) (24 bit)
- * if unset: SCCP_CONN_ID_UNSET (-1) if unset */
- uint32_t conn_id;
enum subscr_sccp_state state;
+ struct bscp_sccp_conn_node conn;
} lb;
} lcs;
@@ -885,8 +890,8 @@ struct bsc_sccp_inst {
struct bsc_sccp_inst *bsc_sccp_inst_alloc(void *ctx);
uint32_t bsc_sccp_inst_next_conn_id(struct bsc_sccp_inst *bsc_sccp);
-int bsc_sccp_inst_register_gscon(struct bsc_sccp_inst *bsc_sccp, struct gsm_subscriber_connection *conn);
-void bsc_sccp_inst_unregister_gscon(struct bsc_sccp_inst *bsc_sccp, struct gsm_subscriber_connection *conn);
+int bsc_sccp_inst_register_gscon(struct bsc_sccp_inst *bsc_sccp, struct bscp_sccp_conn_node *sccp_conn);
+void bsc_sccp_inst_unregister_gscon(struct bsc_sccp_inst *bsc_sccp, struct bscp_sccp_conn_node *sccp_conn);
struct gsm_subscriber_connection *bsc_sccp_inst_get_gscon_by_conn_id(const struct bsc_sccp_inst *bsc_sccp, uint32_t conn_id);
struct gsm_network {