Neels Hofmeyr | 71e5a82 | 2018-05-26 23:53:31 +0200 | [diff] [blame^] | 1 | msc { |
| 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", |
| 57 | label="There seems to be no timer watching over Chan Release nor dyn TS switchover!"]; |
| 58 | ...; |
| 59 | bts => bsc [label="i) RSL RF Chan Release ACK (Osmocom dyn TS)"]; |
| 60 | bts => bsc [label="OR ii) RSL PDCH Deact ACK (ip.access dyn TS)"]; |
| 61 | bsc box bsc [label="rsl_chan_activate_lchan() re-invoked"]; |
| 62 | bts <= bsc [label="RSL Chan Activ"]; |
| 63 | --- [label="else (no dyn TS switchover)"]; |
| 64 | |
| 65 | bts <= bsc [label="RSL Chan Activ"]; |
| 66 | bsc -> bsc_gscon [label="gsm0808_assign_req() returns"]; |
| 67 | bsc_gscon abox bsc_gscon [label="ST_WAIT_ASS_COMPL (GSM0808_T10_VALUE=6s)"]; |
| 68 | ---; |
| 69 | |
| 70 | ...; |
| 71 | --- [label="On Timeout"]; |
| 72 | bsc_gscon => msc_ [label="BSSMAP Assignment Failure"]; |
| 73 | bsc_gscon abox bsc_gscon [label="ST_ACTIVE"]; |
| 74 | bsc_gscon note bsc_mgcp [linecolor="red", |
| 75 | label="The mgcp FSM from CRCX above apparently lacks a cleanup action for this case. |
| 76 | It should be cleaned up eventually when the conn is torn down, but we should |
| 77 | release RTP endpoints as soon as possible."]; |
| 78 | --- [label="end: 'On Timeout'"]; |
| 79 | ...; |
| 80 | |
| 81 | bts => bsc [label="RSL Chan Activ ACK"]; |
| 82 | bsc box bsc [label="bsc_api.c handle_chan_ack()"]; |
| 83 | ms <= bsc [label="RR Assignment Command"]; |
| 84 | |
| 85 | ...; |
| 86 | ms note bsc_gscon [label="We rely on the overall conn FSM ST_WAIT_ASS_COMPL timeout."]; |
| 87 | ...; |
| 88 | |
| 89 | ms => bsc [label="RR Assignment Complete"]; |
| 90 | bsc box bsc [label="handle_ass_compl()"]; |
| 91 | --- [label="Release old lchan"]; |
| 92 | bsc box bsc [label="_lchan_handle_release(sacch_deact=0)"]; |
| 93 | bsc box bsc [label="rsl_release_sapis_from(start=1)"]; |
| 94 | bts <= bsc [label="RSL Release Request (Local End)..."]; |
| 95 | bts <= bsc [label="...for each SAPI except link_id=0"]; |
| 96 | bsc box bsc [label="rsl_release_request(link_id=0)"]; |
| 97 | bts <= bsc [label="RSL Release Request (Local End) for link_id=0"]; |
| 98 | bsc box bsc [label="_lchan_handle_release() returns here, the remaining release is asynchronous; |
| 99 | see `End: 'Release old lchan'` below."]; |
| 100 | ...; |
| 101 | bts note bsc_gscon [linecolor="red", |
| 102 | label="There seems to be no timer watching over RSL Release Request!"]; |
| 103 | ...; |
| 104 | bts => bsc [label="RSL Release Confirm..."]; |
| 105 | bts => bsc [label="...for each SAPI and link_id=0"]; |
| 106 | bsc abox bsc [label="start T3111"]; |
| 107 | ...; |
| 108 | bsc box bsc [label="T3111 expires"]; |
| 109 | bsc abox bsc [label="Start lchan->act_timer with lchan_deact_tmr_cb"]; |
| 110 | bts <= bsc [label="RSL RF Channel Release"]; |
| 111 | ...; |
| 112 | --- [label="On timeout"]; |
| 113 | bsc box bsc [label="lchan_deact_tmr_cb()"]; |
| 114 | bsc box bsc [label="rsl_lchan_mark_broken(): state=LCHAN_S_BROKEN"]; |
| 115 | bsc box bsc [label="lchan_free()"]; |
| 116 | bsc -> bsc [label="S_LCHAN_UNEXPECTED_RELEASE"]; |
| 117 | bsc box bsc [label="bsc_api.c handle_release()"]; |
| 118 | bsc box bsc [label="bsc->assign_fail()"]; |
| 119 | bsc -> bsc_gscon [label="GSCON_EV_RR_ASS_FAIL"]; |
| 120 | bsc note bsc_gscon [linecolor="orange", |
| 121 | label="The name 'RR_ASS_FAIL' might suggest the event means an actual RR Assignment |
| 122 | Failure message being received. Maybe this should be called GSCON_EV_ASSIGNMENT_ERROR."]; |
| 123 | ...; |
| 124 | bsc box bsc [label="bsc->clear_request()"]; |
| 125 | bsc box bsc [label="bsc_clear_request encodes a BSSMAP Clear Request message and passes it on |
| 126 | to the conn FSM as data argument via:"]; |
| 127 | bsc -> bsc_gscon [label="GSCON_EV_TX_SCCP"]; |
| 128 | bsc_gscon => msc_ [label="BSSMAP Clear Request"]; |
| 129 | bsc note bsc_gscon [linecolor="red", |
| 130 | label="Instead of sending an arbitrary message, the conn FSM should |
| 131 | be explicitly instructed to clear the connection, to be able |
| 132 | to notice if the MSC failed to respond to the Clear Request. |
| 133 | Currently, this relies on the MSC responding with a Clear |
| 134 | Command, hopefully, some time later."]; |
| 135 | --- [label="End: 'On timeout'"]; |
| 136 | ...; |
| 137 | bts => bsc [label="RSL RF Channel Release Ack"]; |
| 138 | --- [label="End: 'Release old lchan'"]; |
| 139 | bsc box bsc [label="still in handle_ass_compl()"]; |
| 140 | bsc note bsc [label="officially take over new lchan: conn->lchan = conn->secondary_lchan"]; |
| 141 | --- [label="is BTS using IPA Abis? (osmo-bts, ip.access)"]; |
| 142 | bts <= bsc [label="IPACC CRCX"]; |
| 143 | ---; |
| 144 | bsc -> bsc [label="handle_ass_compl() calls bsc_api->assign_compl()"]; |
| 145 | --- [label="is BTS using IPA Abis? (osmo-bts, ip.access) && conn->user_plane.rtp_ip"]; |
| 146 | bsc box bsc [label="bsc_assign_compl()"]; |
| 147 | bsc note bsc [label="set ass_compl.valid = true, |
| 148 | postponing GSCON_EV_RR_ASS_COMPL until after the |
| 149 | IPACC MDCX ACK received in osmo_bsc_audio.c"]; |
| 150 | bsc box bsc [label="exit early: bsc_assign_compl()"]; |
| 151 | bsc box bsc [label="exit early: handle_ass_compl()"]; |
| 152 | bsc box bsc [label="osmo_bsc_audio.c"]; |
| 153 | bts => bsc [label="IPACC CRCX ACK"]; |
| 154 | bts <= bsc [label="IPACC MDCX"]; |
| 155 | bts => bsc [label="IPACC MDCX ACK"]; |
| 156 | bsc box bsc [label="handle_abisip_signal()"]; |
| 157 | bsc -> bsc_gscon [label="GSCON_EV_RR_ASS_COMPL"]; |
| 158 | --- [label="else"]; |
| 159 | bsc box bsc [label="bsc_assign_compl()"]; |
| 160 | bsc -> bsc_gscon [label="GSCON_EV_RR_ASS_COMPL"]; |
| 161 | --- ; |
| 162 | |
| 163 | --- [label="is chan_mode a speech mode?"]; |
| 164 | bsc_gscon abox bsc_gscon [label="ST_WAIT_MDCX_BTS"]; |
| 165 | bsc_gscon -> bsc_mgcp [label="mgcp_conn_modify()"]; |
| 166 | bsc_mgcp note bsc_mgcp [label="same mgcp FSM as above, for BTS side"]; |
| 167 | bsc_mgcp => mgw [label="MDCX (for BTS)"]; |
| 168 | bsc_mgcp <= mgw [label="MDCX OK"]; |
| 169 | bsc_mgcp -> bsc_gscon [label="GSCON_EV_MGW_MDCX_RESP_BTS"]; |
| 170 | bsc_gscon abox bsc_gscon [label="ST_WAIT_CRCX_MSC"]; |
| 171 | bsc_gscon -> bsc_mgcp [label="mgcp_conn_create()"]; |
| 172 | bsc_mgcp note bsc_mgcp [label="second mgcp FSM for MSC side"]; |
| 173 | bsc_mgcp => mgw [label="CRCX (for MSC)"]; |
| 174 | bsc_mgcp <= mgw [label="CRCX OK (for MSC)"]; |
| 175 | bsc_gscon <- bsc_mgcp [label="GSCON_EV_MGW_CRCX_RESP_MSC"]; |
| 176 | ---; |
| 177 | |
| 178 | bsc_gscon => msc_ [label="BSSMAP Assignment Complete"]; |
| 179 | |
| 180 | bsc_gscon abox bsc_gscon [label="ST_ACTIVE"]; |
| 181 | } |