aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/assignment_fsm.c
AgeCommit message (Collapse)AuthorFilesLines
2018-11-14lchan release: always Deact SACCHNeels Hofmeyr1-2/+2
If an lchan is being released and had a SACCH active, there is no reason to omit the Deact SACCH message ever. All of the callers that passed do_deact_sacch = false did so for no good reason. Drop the do_deact_sacch flag everywhere and, when the lchan type matches and SAPI[0] is still active, simply always send a Deact SACCH message. The do_deact_sacch flag was carried over from legacy code, by me, mainly because I never really understood why it was there. I do hope I'm correct now, asserting that having this flag makes no sense. Change-Id: Id3301df059582da2377ef82feae554e94fa42035
2018-11-14fix: send RR Release (e.g. after BSSMAP Clear Cmd)Neels Hofmeyr1-2/+2
After commit [1], the code makes sure to disassociate lchan and conn before invoking the lchan release. However, we only send RR Release if a conn is present, which clearly is nonsense after [1]. [1] commit 8b818a01b00ea3daad4ad58c162ac52b4f08a5cb "subscr conn: properly forget lchan before release" Change-Id: I4fd582b41ba4599af704d670af83651d2450b1db Manage sending of RR Release via a flag, set during invoking lchan release. Add do_rr_release arg to lchan_release(), gscon_release_lchans(). In lchan_fsm.c, send RR Release only if do_rr_release was passed true; do not care whether a conn is still associated (because it won't ever be since [1]). That way we can intelligently decide what release process makes sense (whether the lchan terminates the subscriber connection or whether the connection goes on at another lchan), and still disassociate lchan and conn early. BTW, this problem wasn't caught by the stock OsmoBSC TTCN3 tests, because the f_expect_chan_rel() don't care whether an RR Release happens or not. This is being fixed by Ibc64058f1e214bea585f4e8dcb66f3df8ead3845. So far this patch should fix BSC_Tests_LCLS.TC_lcls_connect_clear. Related: OS#3413 Change-Id: I666b3b4f45706d898d664d380bd0fd2b018be358
2018-10-05codec_pref: handle S0-S15 in ASSIGNMENT REQUESTPhilipp Maier1-1/+2
Opposed to all other codecs that are common in GSM, AMR requires a codec configuration that is expressed by a bitmask (S0 to S15) in the speech codec list in the ASSIGNMENT REQUEST. Also the BSC acknowledges those configuration in the ASSIGNMENT COMPLETE message. At the moment osmo-bsc ignores all incoming configuration bits. The bits in the ASSIGNMENT COMPLETE speech codec (choosen) field are hardcoded. - Store the configuration bits while parsing the ASSIGNMENT COMPLETE - Create an intersection with the configuration that is actually supported by the BSS - Return the resulting (chosen) configuration bits with the assignment complete message. - Use the (highest of the) agreed codec rates in RSL channel activation. Change-Id: I2d8ded51b3eb4c003fe2da6f2d6f48d001b73737 Related: OS#3529
2018-09-26cosmetic: drop param from send_assignment_complete()Neels Hofmeyr1-4/+4
After previous patch I8dd561d744d8081b5ac5ffa7635f17ac19bcda45, all callers pass conn->lchan to send_assignment_complete(), so there is no need to pass it separately from conn. Change-Id: I3c038d91a53c81d9fcf4ec62f853b59bb1ecd244
2018-09-26fix LCLS during Assignment: actually use new TCH lchanNeels Hofmeyr1-6/+10
In assignment_success(), don't trigger lcls_apply_config() before the conn->lchan points at the actual new voice lchan. The entire LCLS code relies on conn->lchan. The assignment FSM wants to point conn->lchan to the new lchan only after it is sure that sending the Assignment Complete to the MSC was successful. However, a failure is a) very unlikely and b) if sending to the MSC fails we might as well tear the whole conn down anyway. Now, if sending to the MSC fails, release the lchan and the conn should clean itself up. Related: OS#1602 Change-Id: I8dd561d744d8081b5ac5ffa7635f17ac19bcda45
2018-09-24assignment_fsm: only include speech codec (choosen) on AoIP networksPhilipp Maier1-4/+8
The field speech codec (choosen) in the ASSIGNMENT COMPLETE message has been specified with AoIP. Since sccp-lite has been specified before AoIP, we should not include the speech codec (choosen) field in the ASSIGNMENT COMPLETE, when osmo-bsc is connected to an sccp-lite based network. - make sure speech codec (choosen) is only included on AoIP based networks Change-Id: Ic7f28aacc953d96ebf3aa04f3e1810475458c1a8
2018-09-07SCCPlite Assignment Complete: include Speech Codec (Chosen)Neels Hofmeyr1-4/+4
Compose the Speech Codec (Chosen) IE not only for AoIP, but also for SCCPlite: place the code that assigns the codec to sc_ptr outside of the gscon_is_aoip() if scope. This way the MSC is told the chosen speech codec, which is mandatory for IP based user plane, and was missing until now. Related: OS#3528 Change-Id: Ibedade8d71a7994d25a63bc2faa2a24a10bfffa1
2018-09-06assignment: remove unnecessary call to gsm0808_speech_codec_from_chan_type()Philipp Maier1-2/+0
There is a function call to gsm0808_speech_codec_from_chan_type() after an if construct that checks if we need voice and if we need it if it is related to an AoIP connection. However, at the moment we call gsm0808_speech_codec_from_chan_type() all the time, even when just figured out that we don't need to. Presumably this is a refactory leftover. Lets remove the excess function call. Change-Id: I34d9281944b36cd89ad8e1c5774f0ea80fdfadc8
2018-07-28cosmetic: rename bsc_api.h to gsm_08_08.hNeels Hofmeyr1-1/+1
See also I91922f557072d0fb8cfe213a8a7b50f3bb23dea0, which renames osmo_bsc_api.c to gsm_08_08.c. Change-Id: I7179eb27183ee213f8fc8d548895b67aa43dc6a2
2018-07-28create separate logging categories for lchan,ts,as FSMsNeels Hofmeyr1-1/+1
Change-Id: Ie889b8860a4a63c7c22ef65025f690d64cd7330c
2018-07-28cosmetic: FSMs: allow ignorable eventsNeels Hofmeyr1-3/+7
In various FSMs, some events may appear later or earlier without need of action. Do not indicate these as 'ERROR' (event not permitted), but allow and ignore them. Debug-log about some of those. From the old code, we've taken over the habit to change into WAIT_BEFORE_RF_RELEASE even before SAPI[0] is released. Hence we may still receive a SAPI[0] REL_IND in WAIT_BEFORE_RF_RELEASE. Don't show this as error message, just silently accept it. Change-Id: Ie320c7c6a1436184aaf2ec5a1843e04f4b3414ab
2018-07-28large refactoring: use FSMs for lchans; add inter-BSC HONeels Hofmeyr1-0/+650
Add FSMs: - timeslot_fsm: handle dynamic timeslots and OML+RSL availability. - lchan_fsm: handle an individual lchan activation, RTP stream and release, signal the appropriate calling FSMs on success, failure, release. - mgw_endpoint_fsm: handle one entire endpoint with several CI. - assignment_fsm: BSSMAP Assignment Request. - handover_fsm: all of intra, inter-MO and inter-MT handover. Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing the maximum amount events (32), and it is more logical to treat assignment, handover and MGW procedures in separate FSMs. - Add logging macros for each FSM type: - LOG_TS() - LOG_LCHAN() - LOG_MGWEP(), LOG_CI() - LOG_ASSIGNMENT() - LOG_HO() These log with the osmo_fsm_inst where present. New style decision: logging without a final newline char is awkward, especially for gsmtap logging and when other logs interleave LOGPC() calls; we have various cases where the final \n goes missing, and also this invokes the log category checking N times instead of once. So I decided to make these macros *always* append a newline, but only if there is no final newline yet. I hope that the compiler optimizes the strlen() of the constant format strings away. Thus I can log with or without typing "\n" and always get an \n termination anyway. General: - replace osmo_timers, state enums and program-wide osmo_signal_dispatch() with dedicated FSM timeouts, states and events. - introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def. These can be used (with some macro magic) to define a state's timeout once, and not make mistakes for each osmo_fsm_inst_state_chg(). Details: bsc_subscr_conn_fsm.c: - move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and mgw_endpoint_fsm. - There is exactly one state for an ongoing Assignment, with all details handled in conn->assignment.fi. The state relies on the assignment_fsm's timeout. - There is one state for an ongoing Handover; except for an incoming Handover from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn are both established. - move bssmap_add_lcls_status() to osmo_bsc_lcls.c abis_rsl.c: - move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in abis_rsl.c - reduce some rsl functions to merely send a message, rename to "_tx_". - rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function. - move all timers and error/release handling away into various FSMs. - tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an lchan passed, but just mode,type that they require. Rename to ipacc_speech_mode*() and ipacc_payload_type(). - add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR message received during BSSMAP Handover Command. - move various logging to LOG_LCHAN() in order to log with the lchan FSM instance. One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging from DRR to DRSL. It might actually make sense to combine those categories. - lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance. - handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's correct). - gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS. assignment_fsm.c: - the Chan Mode Modify in case of re-using the same lchan is not implemented yet, because this was also missing in the previous implementation (OS#3357). osmo_bsc_api.c: - simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv twice, once by member assignment and then again with a memcpy.) - During handover, we used to copy the MR config from the old lchan. Since we may handover between FR and HR, rather set the MR Config anew every time, so that FR rates are always available on FR lchans, and never on HR lchans. Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore), I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore) Change-Id: I82e3f918295daa83274a4cf803f046979f284366