blob: d470d014b3bd7586be42c2d2ed3a1ef0ec893c40 [file] [log] [blame]
Neels Hofmeyr71e5a822018-05-26 23:53:31 +02001msc {
2 hscale=3;
3 ms [label="MS"], bts [label="BTS"], bsc[label="BSC"], bsc_gscon[label="BSC conn FSM"], bsc_mgcp[label="BSC mgcp FSM"], mgw[label="MGW"], msc_[label="MSC"];
4
5 ms note msc_ [label="lchan allocation sequence for BSSMAP Assignment Request"];
6
7 bsc <= msc_ [label="BSSMAP Assignment Request"];
8 bsc box bsc [label="bssmap_handle_assignm_req()"];
9 bsc -> bsc_gscon [label="GSCON_EV_A_ASSIGNMENT_CMD"];
10
11 --- [label="is the chan_mode a speech mode?"];
12
13 bsc_gscon abox bsc_gscon [label="ST_WAIT_CRCX_BTS (MGCP_MGW_TIMEOUT = 4s)"];
14 bsc_gscon -> bsc_mgcp [label="mgcp_conn_create()"];
15 bsc_mgcp => mgw [label="CRCX (for BTS)"];
16 bsc_mgcp abox bsc_mgcp [label="ST_CRCX (MGCP_MGW_TIMEOUT = 4s)"];
17 bsc_gscon note bsc_mgcp [label="two timeouts running in parallel"];
18 bsc_gscon note bsc_mgcp [label="note: #define MGCP_MGW_TIMEOUT exists twice,
19 once in libosmo-mgcp-client,
20 once in bsc_subscr_conn_fsm.c"];
21 bsc_mgcp -> bsc_gscon [label="mgcp_conn_create() exits"];
22 bsc_gscon -> bsc [label="bssmap_handle_assignm_req() exits"];
23 ...;
24 --- [label="On Timeout"];
25 bsc_gscon note bsc_gscon [label="The conn FSM likely timeouts first"];
26 bsc_gscon => msc_ [label="BSSMAP Assignment Failure"];
27 bsc_gscon abox bsc_gscon [label="ST_ACTIVE"];
28 bsc_mgcp note bsc_mgcp [label="The MGCP FSM will timeout right after that, and terminate itself,
29 emitting the parent_term event set upon mgcp_conn_create():"];
30 bsc_mgcp -> bsc_gscon [label="GSCON_EV_MGW_FAIL_BTS"];
31 bsc_gscon note bsc_gscon [label="GSCON_EV_MGW_FAIL_BTS is handled by the conn FSM allstate
32 handler. It sets conn->user_plane.fi_bts = NULL. There is code
33 that would emit a BSSMAP Assignment Failure, but not in
34 ST_ACTIVE"];
35 --- [label="end: 'On Timeout'"];
36 ...;
37
38 bsc_mgcp <= mgw [label="CRCX OK (for BTS)"];
39 bsc_mgcp box bsc_mgcp [label="libosmo-mgcp-client fsm_crcx_resp_cb()"];
40 bsc_mgcp -> bsc_gscon [label="GSCON_EV_MGW_CRCX_RESP_BTS"];
41 --- [label="end: 'is the chan_mode a speech mode?'"];
42
43 bsc_gscon note bsc_gscon [label="for mode=sign, we're still handling GSCON_EV_A_ASSIGNMENT_CMD;
44 for speech mode, we're handling GSCON_EV_MGW_CRCX_RESP_BTS"];
45 bsc <- bsc_gscon [label="gsm0808_assign_req()"];
46
47 bsc box bsc [label="lchan_alloc(): pick available lchan"];
48 bsc box bsc [label="rsl_chan_activate_lchan()"];
49
50 --- [label="is the chosen lchan on dynamic timeslot that is currently used as PDCH?"];
51 bts <= bsc [label="i) RSL RF Chan Release of PDCH (Osmocom dyn TS)"];
52 bts <= bsc [label="OR ii) RSL PDCH Deact (ip.access dyn TS)"];
53 bsc -> bsc_gscon [label="gsm0808_assign_req() returns early"];
54 bsc_gscon abox bsc_gscon [label="ST_WAIT_ASS_COMPL (GSM0808_T10_VALUE=6s)"];
55 ...;
56 bts note bsc_gscon [linecolor="red",
Neels Hofmeyrc8658ac2018-05-26 23:53:31 +020057 label="Osmocom style dyn TS use lchan->act_timer to watch over RF Chan Release, but there
58 seems to be no timer watching over PDCH Deact!"];
Neels Hofmeyr71e5a822018-05-26 23:53:31 +020059 ...;
60 bts => bsc [label="i) RSL RF Chan Release ACK (Osmocom dyn TS)"];
61 bts => bsc [label="OR ii) RSL PDCH Deact ACK (ip.access dyn TS)"];
62 bsc box bsc [label="rsl_chan_activate_lchan() re-invoked"];
Neels Hofmeyrc8658ac2018-05-26 23:53:31 +020063 bsc box bsc [label="lchan->state = LCHAN_S_ACT_REQ"];
Neels Hofmeyr71e5a822018-05-26 23:53:31 +020064 bts <= bsc [label="RSL Chan Activ"];
65 --- [label="else (no dyn TS switchover)"];
66
Neels Hofmeyrc8658ac2018-05-26 23:53:31 +020067 bsc box bsc [label="lchan->state = LCHAN_S_ACT_REQ"];
Neels Hofmeyr71e5a822018-05-26 23:53:31 +020068 bts <= bsc [label="RSL Chan Activ"];
69 bsc -> bsc_gscon [label="gsm0808_assign_req() returns"];
70 bsc_gscon abox bsc_gscon [label="ST_WAIT_ASS_COMPL (GSM0808_T10_VALUE=6s)"];
71 ---;
72
73 ...;
74 --- [label="On Timeout"];
75 bsc_gscon => msc_ [label="BSSMAP Assignment Failure"];
76 bsc_gscon abox bsc_gscon [label="ST_ACTIVE"];
77 bsc_gscon note bsc_mgcp [linecolor="red",
78 label="The mgcp FSM from CRCX above apparently lacks a cleanup action for this case.
79 It should be cleaned up eventually when the conn is torn down, but we should
80 release RTP endpoints as soon as possible."];
81 --- [label="end: 'On Timeout'"];
82 ...;
83
84 bts => bsc [label="RSL Chan Activ ACK"];
Neels Hofmeyrc8658ac2018-05-26 23:53:31 +020085 bsc box bsc [label="rsl_rx_chan_act_ack()"];
86 bsc box bsc [label="Stop lchan->act_timer"];
87 bsc box bsc [label="lchan->state = LCHAN_S_ACTIVE"];
88 bsc -> bsc [label="S_LCHAN_ACTIVATE_ACK"];
Neels Hofmeyr71e5a822018-05-26 23:53:31 +020089 bsc box bsc [label="bsc_api.c handle_chan_ack()"];
90 ms <= bsc [label="RR Assignment Command"];
91
92 ...;
93 ms note bsc_gscon [label="We rely on the overall conn FSM ST_WAIT_ASS_COMPL timeout."];
94 ...;
95
96 ms => bsc [label="RR Assignment Complete"];
97 bsc box bsc [label="handle_ass_compl()"];
98 --- [label="Release old lchan"];
99 bsc box bsc [label="_lchan_handle_release(sacch_deact=0)"];
100 bsc box bsc [label="rsl_release_sapis_from(start=1)"];
101 bts <= bsc [label="RSL Release Request (Local End)..."];
102 bts <= bsc [label="...for each SAPI except link_id=0"];
103 bsc box bsc [label="rsl_release_request(link_id=0)"];
104 bts <= bsc [label="RSL Release Request (Local End) for link_id=0"];
105 bsc box bsc [label="_lchan_handle_release() returns here, the remaining release is asynchronous;
106 see `End: 'Release old lchan'` below."];
107 ...;
108 bts note bsc_gscon [linecolor="red",
109 label="There seems to be no timer watching over RSL Release Request!"];
110 ...;
111 bts => bsc [label="RSL Release Confirm..."];
112 bts => bsc [label="...for each SAPI and link_id=0"];
113 bsc abox bsc [label="start T3111"];
114 ...;
115 bsc box bsc [label="T3111 expires"];
116 bsc abox bsc [label="Start lchan->act_timer with lchan_deact_tmr_cb"];
117 bts <= bsc [label="RSL RF Channel Release"];
118 ...;
119 --- [label="On timeout"];
120 bsc box bsc [label="lchan_deact_tmr_cb()"];
121 bsc box bsc [label="rsl_lchan_mark_broken(): state=LCHAN_S_BROKEN"];
122 bsc box bsc [label="lchan_free()"];
123 bsc -> bsc [label="S_LCHAN_UNEXPECTED_RELEASE"];
124 bsc box bsc [label="bsc_api.c handle_release()"];
125 bsc box bsc [label="bsc->assign_fail()"];
126 bsc -> bsc_gscon [label="GSCON_EV_RR_ASS_FAIL"];
127 bsc note bsc_gscon [linecolor="orange",
128 label="The name 'RR_ASS_FAIL' might suggest the event means an actual RR Assignment
129 Failure message being received. Maybe this should be called GSCON_EV_ASSIGNMENT_ERROR."];
130 ...;
131 bsc box bsc [label="bsc->clear_request()"];
132 bsc box bsc [label="bsc_clear_request encodes a BSSMAP Clear Request message and passes it on
133 to the conn FSM as data argument via:"];
134 bsc -> bsc_gscon [label="GSCON_EV_TX_SCCP"];
135 bsc_gscon => msc_ [label="BSSMAP Clear Request"];
136 bsc note bsc_gscon [linecolor="red",
137 label="Instead of sending an arbitrary message, the conn FSM should
138 be explicitly instructed to clear the connection, to be able
139 to notice if the MSC failed to respond to the Clear Request.
140 Currently, this relies on the MSC responding with a Clear
141 Command, hopefully, some time later."];
142 --- [label="End: 'On timeout'"];
143 ...;
144 bts => bsc [label="RSL RF Channel Release Ack"];
Neels Hofmeyrc8658ac2018-05-26 23:53:31 +0200145 bsc box bsc [label="Stop lchan->act_timer"];
146 bsc box bsc [label="Stop lchan->T3111"];
Neels Hofmeyr71e5a822018-05-26 23:53:31 +0200147 --- [label="End: 'Release old lchan'"];
148 bsc box bsc [label="still in handle_ass_compl()"];
149 bsc note bsc [label="officially take over new lchan: conn->lchan = conn->secondary_lchan"];
150 --- [label="is BTS using IPA Abis? (osmo-bts, ip.access)"];
151 bts <= bsc [label="IPACC CRCX"];
152 ---;
153 bsc -> bsc [label="handle_ass_compl() calls bsc_api->assign_compl()"];
154 --- [label="is BTS using IPA Abis? (osmo-bts, ip.access) && conn->user_plane.rtp_ip"];
155 bsc box bsc [label="bsc_assign_compl()"];
156 bsc note bsc [label="set ass_compl.valid = true,
157 postponing GSCON_EV_RR_ASS_COMPL until after the
158 IPACC MDCX ACK received in osmo_bsc_audio.c"];
159 bsc box bsc [label="exit early: bsc_assign_compl()"];
160 bsc box bsc [label="exit early: handle_ass_compl()"];
161 bsc box bsc [label="osmo_bsc_audio.c"];
162 bts => bsc [label="IPACC CRCX ACK"];
163 bts <= bsc [label="IPACC MDCX"];
164 bts => bsc [label="IPACC MDCX ACK"];
165 bsc box bsc [label="handle_abisip_signal()"];
166 bsc -> bsc_gscon [label="GSCON_EV_RR_ASS_COMPL"];
167 --- [label="else"];
168 bsc box bsc [label="bsc_assign_compl()"];
169 bsc -> bsc_gscon [label="GSCON_EV_RR_ASS_COMPL"];
170 --- ;
171
172 --- [label="is chan_mode a speech mode?"];
173 bsc_gscon abox bsc_gscon [label="ST_WAIT_MDCX_BTS"];
174 bsc_gscon -> bsc_mgcp [label="mgcp_conn_modify()"];
175 bsc_mgcp note bsc_mgcp [label="same mgcp FSM as above, for BTS side"];
176 bsc_mgcp => mgw [label="MDCX (for BTS)"];
177 bsc_mgcp <= mgw [label="MDCX OK"];
178 bsc_mgcp -> bsc_gscon [label="GSCON_EV_MGW_MDCX_RESP_BTS"];
179 bsc_gscon abox bsc_gscon [label="ST_WAIT_CRCX_MSC"];
180 bsc_gscon -> bsc_mgcp [label="mgcp_conn_create()"];
181 bsc_mgcp note bsc_mgcp [label="second mgcp FSM for MSC side"];
182 bsc_mgcp => mgw [label="CRCX (for MSC)"];
183 bsc_mgcp <= mgw [label="CRCX OK (for MSC)"];
184 bsc_gscon <- bsc_mgcp [label="GSCON_EV_MGW_CRCX_RESP_MSC"];
185 ---;
186
187 bsc_gscon => msc_ [label="BSSMAP Assignment Complete"];
188
189 bsc_gscon abox bsc_gscon [label="ST_ACTIVE"];
190}