Neels Hofmeyr | 71e5a82 | 2018-05-26 23:53:31 +0200 | [diff] [blame] | 1 | # Handover between cells, intra-BSC |
| 2 | msc { |
| 3 | hscale=3; |
| 4 | ms [label="MS"], bts [label="BTS"], bsc[label="BSC"], bsc_gscon[label="BSC conn FSM"], bsc_mgcp[label="BSC mgcp FSM"], mgw[label="MGW"]; |
| 5 | |
| 6 | ms note mgw [label="intra-BSC Handover sequence"]; |
| 7 | |
| 8 | bsc_gscon abox bsc_gscon [label="ST_ACTIVE"]; |
| 9 | bsc box bsc [label="bsc_handover_start(): init conn->ho"]; |
| 10 | bsc -> bsc_gscon [label="GSCON_EV_HO_START"]; |
| 11 | bsc <- bsc_gscon [label="bsc_handover_start_gscon()"]; |
| 12 | |
| 13 | bsc box bsc [label="lchan_alloc(): pick available lchan"]; |
| 14 | bsc box bsc [label="rsl_chan_activate_lchan()"]; |
| 15 | |
| 16 | --- [label="is the chosen lchan on dynamic timeslot that is currently used as PDCH?"]; |
| 17 | bts <= bsc [label="i) RSL RF Chan Release of PDCH (Osmocom dyn TS)"]; |
| 18 | bts <= bsc [label="OR ii) RSL PDCH Deact (ip.access dyn TS)"]; |
| 19 | bsc -> bsc_gscon [label="bsc_handover_start_gscon() returns early"]; |
| 20 | bsc_gscon abox bsc_gscon [label="ST_WAIT_HO_COMPL (no timeout, relies on T3103 below)"]; |
| 21 | ...; |
| 22 | bts note bsc_gscon [linecolor="red", |
| 23 | label="There seems to be no timer watching over Chan Release nor dyn TS switchover!"]; |
| 24 | ...; |
| 25 | bts => bsc [label="i) RSL RF Chan Release ACK (Osmocom dyn TS)"]; |
| 26 | bts => bsc [label="OR ii) RSL PDCH Deact ACK (ip.access dyn TS)"]; |
| 27 | bsc box bsc [label="rsl_chan_activate_lchan() re-invoked"]; |
| 28 | bts <= bsc [label="RSL Chan Activ"]; |
| 29 | --- [label="else (no dyn TS switchover)"]; |
| 30 | |
| 31 | bts <= bsc [label="RSL Chan Activ"]; |
| 32 | bsc -> bsc_gscon [label="bsc_handover_start_gscon() returns"]; |
| 33 | ---; |
| 34 | bsc_gscon abox bsc_gscon [label="ST_WAIT_HO_COMPL (no timeout, relies on T3103 below)"]; |
| 35 | |
| 36 | ...; |
| 37 | bts note bsc_gscon [linecolor="red", |
| 38 | label="There seems to be no timer watching out for RSL Chan Activ ACK/NACK!"]; |
| 39 | ...; |
| 40 | bts => bsc [label="RSL Chan Activ ACK"]; |
| 41 | bsc -> bsc [label="S_LCHAN_ACTIVATE_ACK"]; |
| 42 | bsc box bsc [label="handover_logic.c ho_logic_sig_cb()"]; |
| 43 | bsc box bsc [label="ho_chan_activ_ack()"]; |
| 44 | bsc note bsc [label="gsm48_send_ho_cmd()"]; |
| 45 | ms <= bsc [label="RR Handover Command"]; |
| 46 | bsc abox bsc [label="start T3103"]; |
| 47 | --- [label="is BTS using IPA Abis? (osmo-bts, ip.access)"]; |
| 48 | bts <= bsc [label="IPACC CRCX"]; |
| 49 | bsc -> bsc [label="ho_chan_activ_ack() returns"]; |
| 50 | bts note bsc [linecolor="red", |
| 51 | label="There seems to be no timer watching over IPACC CRCX ACK/NACK! |
| 52 | If no response is received, we simply ignore that fact and carry on as if |
| 53 | everything was fine."]; |
| 54 | ...; |
| 55 | bts note bsc [label="The IPACC CRCX and MDCX ACKs may come back at any time: |
| 56 | before or after the Handover Detect, before or after Handover Complete."]; |
| 57 | bts note bsc_mgcp [linecolor="red", |
| 58 | label="The CRCX ACK contains vital information for routing the RTP stream. |
| 59 | If the CRCX ACK were very slow, we would not know which RTP/RTPC ports |
| 60 | to point the MGW at, below at mgcp_conn_modify()! |
| 61 | Even though this being unrealistic, we must make sure to receive a CRCX ACK."]; |
| 62 | ...; |
| 63 | bsc box bsc [label="osmo_bsc_audio.c"]; |
| 64 | bts => bsc [label="IPACC CRCX ACK"]; |
| 65 | bts <= bsc [label="IPACC MDCX"]; |
| 66 | ...; |
| 67 | bts note bsc [linecolor="red", |
| 68 | label="There seems to be no timer watching over IPACC MDCX ACK/NACK! |
| 69 | If no response is received, we simply ignore that fact and carry on as if |
| 70 | everything was fine."]; |
| 71 | ...; |
| 72 | bts => bsc [label="IPACC MDCX ACK"]; |
| 73 | bts note bsc [label="IPACC MDCX ACK triggers no events or actions"]; |
| 74 | ---; |
| 75 | |
| 76 | ...; |
| 77 | ms => bsc [label="RR Handover Detect"]; |
| 78 | bsc -> bsc [label="S_LCHAN_HANDOVER_DETECT"]; |
| 79 | bsc box bsc [label="ho_rsl_detect(): no action, only logging"]; |
| 80 | bsc note bsc_gscon [label="Handover Detect triggers no events or actions"]; |
| 81 | bsc note bsc_gscon [linecolor="red", |
| 82 | label="upon Handover Detect, we should already start re-routing the RTP! |
| 83 | Instead we wait for Handover Complete."]; |
| 84 | |
| 85 | ...; |
| 86 | ms => bsc [label="RR Handover Complete"]; |
| 87 | bsc -> bsc [label="S_LCHAN_HANDOVER_COMPL"]; |
| 88 | bsc box bsc [label="handover_logic.c ho_logic_sig_cb()"]; |
| 89 | bsc box bsc [label="ho_gsm48_ho_compl()"]; |
| 90 | bsc box bsc [label="stop T3103"]; |
| 91 | bts note bsc_gscon [label="If anything goes wrong from this point on, we will not move back |
| 92 | to the old lchan: would be pointless after Handover Complete."]; |
| 93 | bsc note bsc [label="officially take over new lchan: conn->lchan = ho->new_lchan"]; |
| 94 | |
| 95 | --- [label="Release old lchan"]; |
| 96 | bsc box bsc [label="_lchan_handle_release(sacch_deact=0)"]; |
| 97 | bsc box bsc [label="rsl_release_sapis_from(start=1)"]; |
| 98 | bts <= bsc [label="RSL Release Request (Local End)..."]; |
| 99 | bts <= bsc [label="...for each SAPI except link_id=0"]; |
| 100 | bsc box bsc [label="rsl_release_request(link_id=0)"]; |
| 101 | bts <= bsc [label="RSL Release Request (Local End) for link_id=0"]; |
| 102 | bsc box bsc [label="_lchan_handle_release() returns here, the remaining release is asynchronous; |
| 103 | see `End: 'Release old lchan'` below."]; |
| 104 | ...; |
| 105 | bts note bsc_gscon [linecolor="red", |
| 106 | label="There seems to be no timer watching over RSL Release Request!"]; |
| 107 | ...; |
| 108 | bts => bsc [label="RSL Release Confirm..."]; |
| 109 | bts => bsc [label="...for each SAPI and link_id=0"]; |
| 110 | bsc abox bsc [label="start T3111"]; |
| 111 | ...; |
| 112 | bsc box bsc [label="T3111 expires"]; |
| 113 | bsc abox bsc [label="Start lchan->act_timer with lchan_deact_tmr_cb"]; |
| 114 | bts <= bsc [label="RSL RF Channel Release"]; |
| 115 | ...; |
| 116 | --- [label="On timeout"]; |
| 117 | bsc box bsc [label="lchan_deact_tmr_cb()"]; |
| 118 | bsc box bsc [label="rsl_lchan_mark_broken(): state=LCHAN_S_BROKEN"]; |
| 119 | bsc box bsc [label="lchan_free()"]; |
| 120 | bsc -> bsc [label="S_LCHAN_UNEXPECTED_RELEASE"]; |
| 121 | bsc box bsc [label="bsc_api.c handle_release()"]; |
| 122 | bsc box bsc [label="bsc->clear_request()"]; |
| 123 | bsc box bsc [label="bsc_clear_request encodes a BSSMAP Clear Request message and passes it on |
| 124 | to the conn FSM as data argument via:"]; |
| 125 | bsc -> bsc_gscon [label="GSCON_EV_TX_SCCP"]; |
| 126 | bsc_gscon rbox bsc_gscon [label="BSSMAP Clear Request to MSC"]; |
| 127 | bsc note bsc_gscon [linecolor="red", |
| 128 | label="During Handover, we actually release the entire conn just because we failed to |
| 129 | gracefully release the old lchan. That is obviously nonsense."]; |
| 130 | bsc note bsc [label="Stop T3101 (but was not active in this code path)"]; |
| 131 | bsc -> bsc [label="S_CHALLOC_FREED"]; |
| 132 | --- [label="End: 'On timeout'"]; |
| 133 | ...; |
| 134 | bts => bsc [label="RSL RF Channel Release Ack"]; |
| 135 | ---; |
| 136 | |
| 137 | bsc box bsc [label="still in ho_gsm48_ho_compl()"]; |
| 138 | bsc note bsc [label="handover_free(), conn->ho = NULL"]; |
| 139 | bsc -> bsc_gscon [label="GSCON_EV_HO_COMPL"]; |
| 140 | bsc note bsc_gscon [linecolor="orange", |
| 141 | label="Handover information is cleared before signalling the conn FSM. |
| 142 | That means the conn FSM cannot possibly log sensible information about exactly |
| 143 | which Handover has just completed."]; |
| 144 | |
| 145 | bsc_gscon abox bsc_gscon [label="ST_WAIT_MDCX_BTS_HO |
| 146 | (MGCP_MGW_TIMEOUT=4s with MGCP_MGW_HO_TIMEOUT_TIMER_NR)"]; |
| 147 | |
| 148 | bsc_gscon -> bsc_mgcp [label="mgcp_conn_modify()"]; |
| 149 | bsc_mgcp note bsc_mgcp [label="mgcp FSM that was established for old lchan, for BTS side"]; |
| 150 | bsc_mgcp => mgw [label="MDCX (for BTS)"]; |
| 151 | ...; |
| 152 | bsc_gscon note mgw [ |
| 153 | label="If we get no MDCX ACK, the MGCP FSM terminates, and emits GSCON_EV_MGW_FAIL_BTS. |
| 154 | Besides invalidating the MGCP FSM pointer, this event has no |
| 155 | effect in ST_WAIT_MDCX_BTS_HO, and we rely on above conn FSM |
| 156 | timeout instead."]; |
| 157 | bsc_gscon note bsc_gscon [linecolor="red", |
| 158 | label="A timeout of ST_WAIT_MDCX_BTS_HO simply transitions back to ST_ACTIVE! |
| 159 | Even though the MGW failed, we carry on as if everything were fine."]; |
| 160 | ...; |
| 161 | bsc_mgcp <= mgw [label="MDCX OK"]; |
| 162 | bsc_mgcp -> bsc_gscon [label="GSCON_EV_MGW_MDCX_RESP_BTS"]; |
| 163 | bsc_gscon abox bsc_gscon [label="ST_ACTIVE"]; |
| 164 | } |