aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/codec_pref.c
AgeCommit message (Collapse)AuthorFilesLines
2018-10-23codec_pref: also check amr codec rates in check_codec_pref()Philipp Maier1-0/+49
The function check_codec_pref() currently only does a basic check over the general codec configuration of bts and msc. However, it does not yet check if the amr codec rate settings for the BTSs contradict the allowed/forbidden amr codec rates of the MSC. When the two settings do contradict AMR would not work, even when everything else is correctly configured. We need to check this on startup to spot configuration problems quickly. - Add function to calculate intersections of struct gsm48_multi_rate_conf variables. - Calculate the intersection between the multi rate config of each BTS with the one of the MSC Change-Id: I3537d1c89e2520d35cc0e150ba8e6d3693e06710 Related: OS#3529
2018-10-10codec_pref: also check physical channelsPhilipp Maier1-4/+34
At the moment codec_pref only checks the codec configuration, but it does not check if there is actually a matching physical channel available. This should be checked too we must make sure that the codec we select fits the physical channels available on the BTS. Change-Id: I2d29dfed450e5ef93c26ed5ec9fdc0730eb3d7dd Related: OS#3503
2018-10-10codec_pref: cosmetic: seperate half/full rate determinationPhilipp Maier1-21/+36
The function match_codec_pref determines whether a permitted speech value belongs to a half-rate or full-rate codec. Lets seperate this into a separate function. Change-Id: Iec1db4621ba5a09bc0e3fc40b66f3a3bc5f54add Related: OS#3503
2018-10-08codec_pref: check codec configuration before startPhilipp Maier1-0/+26
In networks with a couple of different BTSs it may be likely that one accidently sets up a codec configuration (codec-support)) that will be mutually exclusive towards the codec configuration for the MSC (codec-list). We need a check that validates the configuration before start to catch such configuration flaws quickly. - Add a check that checks each MSC codec-list against each BTS codec-support setting. Change-Id: Ice827896bab1a2330741e0fccc731a04f1a07d38 Related: OS#3625
2018-10-05codec_pref: handle S0-S15 in ASSIGNMENT REQUESTPhilipp Maier1-40/+81
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-24codec_pref: Add Codec List to COMPLETE LAYER 3 INFORMATIONPhilipp Maier1-0/+65
The COMPLETE LAYER 3 INFORMATION message lacks the Codec List (BSS Supported) information element. This information element is mandatory for networks that use an IP based user plane (AoIP). - Add function to generate the speech codec list from the current codec settings (Available codecs) - Generate and embed information element in L3 Compl. message Depends: libosmocore I4e656731b16621736c7a2f4e64d9ce63b1064e98 Change-Id: Id6f2af3fdab45bf05f06aec03e222734d7a4cf70 Related: OS#3548
2018-09-14codec_pref: fix missing breaks in switch-case statementPhilipp Maier1-0/+4
In function test_codec_support_bts() the switch case statement lacks break; statements for some cases. This may lead into messed up codec decisions. - Add missing break statements Change-Id: Ib5400a0a0a8a39fa714bd087df345160bed5cc61
2018-09-14codec_pref: fix typo in commentPhilipp Maier1-1/+1
Change-Id: Ie4ea8179395cd331dad4b62227debb026b5b008c
2018-09-07codec_pref.c: Add comment in expected switch case without breakPau Espin Pedrol1-0/+1
Change-Id: I568353f070f049003326306106dce89b35deb92f
2018-09-04codec_pref: Log HR2 specifically as never specifiedPau Espin Pedrol1-1/+2
Change-Id: Ia7d6545710b4bf609c2872e13dcb3b44abfc604e
2018-09-04codec_pref: Log unsupported codec name usedPau Espin Pedrol1-1/+4
Change-Id: If3ed8ba3bad7c927ed0efc908c005cd308e304e6
2018-07-28large refactoring: use FSMs for lchans; add inter-BSC HONeels Hofmeyr1-27/+49
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
2018-07-22codec_pref: check bts codec supportPhilipp Maier1-3/+41
The vty option bts->codec-support allows the user to set the supported codecs per BTS level. However, those values are currently only used to make the handover decision but the logic that handles the BSSMAP ASSIGNMENT REQUEST does not check those flags. - Do not ignore bts->codec-support flags on BSSMAP ASSIGNMENT REQUEST Change-Id: I285234e9c81de74d9fb9907fca2c443b08537435 Closes: OS#3361
2018-07-22codec_pref: move match_codec_pref() to separate c-file and add unit-testPhilipp Maier1-0/+175
At the moment there are three sources that may advertise a list of supported audio codec/rate settings. There is the MS that advertises advertises a speech codec list and the MSC that sends a channel type information element over A and there are also settings in the bsc configuration file that may restrict the codec/rate types that are allowed to use. The function match_codec_pref() looks at all of the three buckets and selects a codec that satisfies all three. This is already a somewhat complicated process, overit is very isolated, so lets give it its own c-file. Due to the lack of unit-tests it is very hard to make changes here so lets add also unit-test to make sure that regressions are catched early. - Put match_codec_pref() and all its helper functions into a separate c-file. - Add a unit test. Change-Id: Iabedfdcec8b99a319f2d57cbea45c5e36c7b6e29 Related: OS#3361