<p>Neels Hofmeyr <strong>uploaded patch set #13</strong> to this change.</p><p><a href="https://gerrit.osmocom.org/9671">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">large refactoring: use FSMs for lchans; add inter-BSC HO<br><br>Add FSMs:<br><br>- timeslot_fsm: handle dynamic timeslots and OML+RSL availability.<br>- lchan_fsm: handle an individual lchan activation, RTP stream and release,<br>  signal the appropriate calling FSMs on success, failure, release.<br>- mgw_endpoint_fsm: handle one entire endpoint with several CI.<br>- assignment_fsm: BSSMAP Assignment Request.<br>- handover_fsm: all of intra, inter-MO and inter-MT handover.<br><br>Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing<br>the maximum amount events (32), and it is more logical to treat assignment,<br>handover and MGW procedures in separate FSMs.<br><br>- Add logging macros for each FSM type:<br>  - LOG_TS()<br>  - LOG_LCHAN()<br>  - LOG_MGWEP(), LOG_CI()<br>  - LOG_ASSIGNMENT()<br>  - LOG_HO()<br>  These log with the osmo_fsm_inst where present.<br>  New style decision: logging without a final newline char is awkward,<br>  especially for gsmtap logging and when other logs interleave LOGPC() calls;<br>  we have various cases where the final \n goes missing, and also this invokes<br>  the log category checking N times instead of once.<br>  So I decided to make these macros *always* append a newline, but only if<br>  there is no final newline yet. I hope that the compiler optimizes the<br>  strlen() of the constant format strings away. Thus I can log with or without<br>  typing "\n" and always get an \n termination anyway.<br><br>General:<br><br>- replace osmo_timers, state enums and program-wide osmo_signal_dispatch()<br>  with dedicated FSM timeouts, states and events.<br><br>- introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def.<br>  These can be used (with some macro magic) to define a state's timeout once,<br>  and not make mistakes for each osmo_fsm_inst_state_chg().<br><br>Details:<br><br>bsc_subscr_conn_fsm.c:<br><br>- move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and<br>  mgw_endpoint_fsm.<br><br>- There is exactly one state for an ongoing Assignment, with all details<br>  handled in conn->assignment.fi. The state relies on the assignment_fsm's<br>  timeout.<br><br>- There is one state for an ongoing Handover; except for an incoming Handover<br>  from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn<br>  are both established.<br><br>- move bssmap_add_lcls_status() to osmo_bsc_lcls.c<br><br>abis_rsl.c:<br><br>- move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in<br>  abis_rsl.c<br><br>- reduce some rsl functions to merely send a message, rename to "_tx_".<br>  - rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the<br>    lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function.<br><br>- move all timers and error/release handling away into various FSMs.<br><br>- tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an<br>  lchan passed, but just mode,type that they require. Rename to<br>  ipacc_speech_mode*() and ipacc_payload_type().<br><br>- add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR<br>  message received during BSSMAP Handover Command.<br><br>- move various logging to LOG_LCHAN() in order to log with the lchan FSM instance.<br>  One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging<br>  from DRR to DRSL. It might actually make sense to combine those categories.<br><br>- lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance.<br><br>- handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's<br>  correct).<br><br>- gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during<br>  inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS.<br><br>assignment_fsm.c:<br><br>- the Chan Mode Modify in case of re-using the same lchan is not implemented<br>  yet, because this was also missing in the previous implementation (OS#3357).<br><br>osmo_bsc_api.c:<br><br>- simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to<br>  lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv<br>  twice, once by member assignment and then again with a memcpy.)<br><br>- During handover, we used to copy the MR config from the old lchan. Since we<br>  may handover between FR and HR, rather set the MR Config anew every time, so<br>  that FR rates are always available on FR lchans, and never on HR lchans.<br><br>Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f<br>Change-Id: I82e3f918295daa83274a4cf803f046979f284366<br>---<br>M include/osmocom/bsc/Makefile.am<br>M include/osmocom/bsc/abis_rsl.h<br>A include/osmocom/bsc/assignment_fsm.h<br>M include/osmocom/bsc/bsc_api.h<br>M include/osmocom/bsc/bsc_msc_data.h<br>M include/osmocom/bsc/bsc_subscr_conn_fsm.h<br>M include/osmocom/bsc/bsc_subscriber.h<br>M include/osmocom/bsc/chan_alloc.h<br>M include/osmocom/bsc/debug.h<br>M include/osmocom/bsc/gsm_data.h<br>M include/osmocom/bsc/gsm_timers.h<br>M include/osmocom/bsc/handover.h<br>A include/osmocom/bsc/handover_fsm.h<br>A include/osmocom/bsc/lchan_fsm.h<br>A include/osmocom/bsc/lchan_select.h<br>A include/osmocom/bsc/mgw_endpoint_fsm.h<br>M include/osmocom/bsc/neighbor_ident.h<br>M include/osmocom/bsc/osmo_bsc.h<br>M include/osmocom/bsc/osmo_bsc_lcls.h<br>A include/osmocom/bsc/timeslot_fsm.h<br>M src/ipaccess/Makefile.am<br>M src/ipaccess/stubs.c<br>M src/osmo-bsc/Makefile.am<br>M src/osmo-bsc/abis_om2000.c<br>M src/osmo-bsc/abis_rsl.c<br>A src/osmo-bsc/assignment_fsm.c<br>M src/osmo-bsc/bsc_api.c<br>D src/osmo-bsc/bsc_dyn_ts.c<br>M src/osmo-bsc/bsc_subscr_conn_fsm.c<br>M src/osmo-bsc/bsc_subscriber.c<br>M src/osmo-bsc/bsc_vty.c<br>M src/osmo-bsc/bts_ericsson_rbs2000.c<br>M src/osmo-bsc/bts_ipaccess_nanobts.c<br>M src/osmo-bsc/bts_nokia_site.c<br>M src/osmo-bsc/bts_siemens_bs11.c<br>M src/osmo-bsc/chan_alloc.c<br>M src/osmo-bsc/gsm_04_08_utils.c<br>M src/osmo-bsc/gsm_data.c<br>M src/osmo-bsc/gsm_timers.c<br>M src/osmo-bsc/handover_decision.c<br>M src/osmo-bsc/handover_decision_2.c<br>A src/osmo-bsc/handover_fsm.c<br>M src/osmo-bsc/handover_logic.c<br>A src/osmo-bsc/lchan_fsm.c<br>A src/osmo-bsc/lchan_select.c<br>M src/osmo-bsc/meas_feed.c<br>A src/osmo-bsc/mgw_endpoint_fsm.c<br>M src/osmo-bsc/neighbor_ident_vty.c<br>M src/osmo-bsc/osmo_bsc_api.c<br>D src/osmo-bsc/osmo_bsc_audio.c<br>M src/osmo-bsc/osmo_bsc_bssap.c<br>M src/osmo-bsc/osmo_bsc_ctrl.c<br>M src/osmo-bsc/osmo_bsc_filter.c<br>M src/osmo-bsc/osmo_bsc_grace.c<br>M src/osmo-bsc/osmo_bsc_lcls.c<br>M src/osmo-bsc/osmo_bsc_main.c<br>M src/osmo-bsc/osmo_bsc_sigtran.c<br>M src/osmo-bsc/paging.c<br>M src/osmo-bsc/pcu_sock.c<br>M src/osmo-bsc/system_information.c<br>A src/osmo-bsc/timeslot_fsm.c<br>M src/utils/Makefile.am<br>M src/utils/bs11_config.c<br>M src/utils/meas_json.c<br>D src/utils/stubs.c<br>M tests/abis/abis_test.c<br>M tests/bsc/Makefile.am<br>M tests/bsc/bsc_test.c<br>M tests/gsm0408/gsm0408_test.c<br>M tests/handover/Makefile.am<br>M tests/handover/handover_test.c<br>M tests/handover/neighbor_ident_test.c<br>M tests/nanobts_omlattr/nanobts_omlattr_test.c<br>73 files changed, 8,495 insertions(+), 4,942 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/71/9671/13</pre><p>To view, visit <a href="https://gerrit.osmocom.org/9671">change 9671</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/9671"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>
<div style="display:none"> Gerrit-Change-Id: I82e3f918295daa83274a4cf803f046979f284366 </div>
<div style="display:none"> Gerrit-Change-Number: 9671 </div>
<div style="display:none"> Gerrit-PatchSet: 13 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>