libosmocore/src/gsm
Neels Hofmeyr d2d44883ac fix gsm0808_sc_cfg <-> gsm48_mr_cfg conversion
Deprecate
 gsm0808_sc_cfg_from_gsm48_mr_cfg() and
 gsm48_mr_cfg_from_gsm0808_sc_cfg(),
and add new functions
 gsm0808_sc_cfg_from_amr_modes() and
 gsm0808_sc_cfg_get_best_amr_modes()
to fix the behavior as follows:

When the mr_cfg enables a specific rate, do not include all AMR
configurations that feature this rate. Instead, enable only those
configurations that are a subset of the mr_cfg.
For example, in the old functions, setting only m4_75 = 1 would result
in enabling all of S0, S8, S9, S10, S12, S14. S14 would allow all of
4.75k, 5.9k, 7.95k, 12.2k, instead of limiting to 4.75k only.

In the new functions, do not modify the .version and .icmi members, act
only on the AMR rates.

Changes from old behavior to new behavior is clearly shown in
tests/gsm0808/gsm0808_test.ok.

Keep the deprecated functions unchanged, yielding incorrect behavior,
and let the API users decide when and how to upgrade to the more sane
behavior.
For example, changing the behavior of existing functions in-place would
have repercussions on osmo-bsc installations, where now only those AMR
modes listed in the config would be used -- we are becoming stricter.
Possibly this would deteriorate or break sites alone from upgrading
libosmocore -- i.e. those sites that fail to list an essential AMR rate
for matching with peers, but where that essential AMR rate was
erratically allowed by the old behavior.

The old behavior, by example of osmo-bsc:
- Picking rates in osmo-bsc.cfg has non-obvious effects, often
  including rates that are configured as 'forbidden'.
- If any of 4.75, 5.90, 7.40, 12.2 is enabled in osmo-bsc.cfg, the
  configuration S1 ends up enabled in s15_s0
  (gsm0808_sc_cfg_from_gsm48_mr_cfg()).
- In gsm48_mr_cfg_from_gsm0808_sc_cfg() used during channel activation,
  if S1 is present, the four rates from S1 are returned.
- In summary, in the vast majority of cases, the S1 set will be used --
  even if only one of its AMR rates is originally present in mr_cfg.
- Configurations above S7 are ignored.

The new behavior, assuming osmo-bsc moved to the more sane
implementation introduced in this patch:
- Only one of the rate combinations defined by S0..S15 is going to be
  used.
  This is mainly because AMR rate selections are sent to the MSC and
  back from the MSC in the somewhat limited S0..S15 bit form.
  Enabling one or more of these combinations of rates in osmo-bsc.cfg
  makes sense:
  - 4.75, 5.90, 7.40, 12.2 (S1)
  - 4.75, 5.90 (S8)
  - 4.75, 5.90, 6.70 (S9)
  - 4.75, 5.90, 6.70, 7.40 (S10)
  - 4.75, 5.90, 6.70, 10.2 (S12)
  - 4.75, 5.90, 7.95, 12.2 (S14)
- e.g. if only 4.75 is enabled, only 4.75 is used (S0).
- e.g. in case of 6.70=allowed + 7.75=allowed + 10.2=allowed,
  we have to choose between "only 6.70", "only 7.75", "only 10.2".
  On FR we'd pick S6 = "only 10.2", because it is the highest rate.
  So osmo-bsc.cfg should rather choose rates exactly matching a specific
  Sn bit, e.g. all rates of S12, to obtain a flexible variety of AMR
  rates.

3GPP TS 48.008 3.2.2.103 'Speech Codec List' says to this:

 NOTE: One of these Codec Configurations, "Config-NB-Code 1" = S1, is
 recommended for TrFO [Transcoder Free Operation].

S14 also seems a good choice, it is like S1 but with 7k95 instead of
7k40; 7k95 is the highest possible AMR-HR rate. It is not clear at this
point why S1 seems to be preferred over S14.

Ironically, the old behavior would usually end up selecting exactly S1
in almost every case, which is what 3GPP TS 48.008 3.2.2.103 recommends.
This is, however, not obvious to the caller / the site admin.

Related: SYS#5066
Change-Id: I900fda192742fa8f6dd54e9131ef1704b14cc41a
2023-03-09 04:08:58 +01:00
..
kdf kdf: add key derivation functions 2021-06-08 02:38:15 +02:00
milenage add osmo_auth_c3() (separate from gsm_milenage()) 2017-12-18 23:05:24 +00:00
Makefile.am gsm: TS 44.021 modified V.110 frame encoding/decoding support 2023-03-08 20:43:15 +01:00
a5.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
abis_nm.c Rename osmo dyn ts enums 2021-06-30 13:14:08 +02:00
apn.c Use internal <osmocom/core/talloc.h> everywhere 2022-04-27 12:42:15 +00:00
auth_comp128v1.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
auth_comp128v23.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
auth_core.c Rename OSMO_AUTH_ALG_XOR to OSMO_AUTH_ALG_XOR_3G 2023-02-22 09:45:15 +01:00
auth_milenage.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
auth_xor.c Rename OSMO_AUTH_ALG_XOR to OSMO_AUTH_ALG_XOR_3G 2023-02-22 09:45:15 +01:00
auth_xor_2g.c Implement the XOR-2G authentication algorithm 2023-02-21 22:25:04 +01:00
bsslap.c gsm/{bsslap,bssmap_le}: zero-initialize structs using memset() 2023-02-25 08:15:11 +00:00
bssmap_le.c gsm/{bsslap,bssmap_le}: zero-initialize structs using memset() 2023-02-25 08:15:11 +00:00
bts_features.c gsm: ensure completeness of osmo_bts_features_{descs,names}[] 2023-02-24 17:06:21 +07:00
cbsp.c fix _thread order 2023-03-07 14:27:59 +01:00
comp128.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
comp128v23.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gad.c gad.c: fix rc for osmo_gad_enc_ell_point_unc_circle() 2020-10-15 01:02:04 +00:00
gan.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
gea.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gprs_cipher_core.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gprs_gea.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gprs_rlc.c Move libosmogsm TS 44.060 declarations under include/osmocom/gsm/ 2023-02-20 12:21:30 +01:00
gsm48.c SI: add missing header 2023-01-30 18:52:41 +00:00
gsm48_arfcn_range_encode.c range_enc_determine_range(): Don't dereference array on size=0 2021-06-01 14:04:20 +02:00
gsm48_ie.c doxygen: fix various typos in commands \param and \returns 2023-02-28 18:48:56 +00:00
gsm48_rest_octets.c gsm: Introduce API osmo_gsm48_rest_octets_si13_decode 2021-02-18 00:54:33 +00:00
gsm0341.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gsm0411_smc.c gsm0411_{smc,smr}.c: Work around newlib bug 2020-07-30 21:35:10 +02:00
gsm0411_smr.c fix spelling in 'value_string' arrays: existAnt -> existEnt 2020-10-29 18:09:36 +07:00
gsm0411_utils.c doxygen: fix various typos in commands \param and \returns 2023-02-28 18:48:56 +00:00
gsm0414.c doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
gsm0480.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gsm0502.c gsm: constify several readonly params 2022-11-24 17:09:03 +01:00
gsm0808.c add gsm0808_amr_modes_from_cfg 2023-02-28 23:00:45 +00:00
gsm0808_utils.c fix gsm0808_sc_cfg <-> gsm48_mr_cfg conversion 2023-03-09 04:08:58 +01:00
gsm23003.c gsm: [ABI BREAK] Support CellId SAI, change CellId CGI-PS id number 2022-02-16 17:59:23 +01:00
gsm23236.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gsm29118.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gsm29205.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
gsm44021.c gsm: TS 44.021 modified V.110 frame encoding/decoding support 2023-03-08 20:43:15 +01:00
gsm48049.c gsm/gsm48049.c: fix use of GNU 'missing =' extension in designator 2020-01-21 18:34:04 +07:00
gsm_04_08_gprs.c fix spelling in 'value_string' arrays: existAnt -> existEnt 2020-10-29 18:09:36 +07:00
gsm_utils.c gsm: gsm_gsmtime2fn(): constify param 2023-03-06 13:59:40 +01:00
gsup.c gsup: Introduce OSMO_GSUP_NUM_VECTORS_REQ_IE 2019-12-09 10:54:30 +00:00
gsup_sms.c GSUP/SMS: introduce MO-/MT-FORWARD-SM messages 2018-12-18 21:52:01 +07:00
ipa.c ipa_ccm_make_id_resp: Make it work at all 2021-04-29 19:59:12 +02:00
iuup.c gsm: use OSMO_ASSERT() in osmo_iuup_msgb_alloc_c() 2023-02-27 09:58:46 +00:00
kasumi.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
kdf.c Fix all references to config.h 2023-01-18 19:04:36 +01:00
lapdm.c doxygen: fix various typos in commands \param and \returns 2023-02-28 18:48:56 +00:00
libosmogsm.map fix gsm0808_sc_cfg <-> gsm48_mr_cfg conversion 2023-03-09 04:08:58 +01:00
mncc.c Fix all references to config.h 2023-01-18 19:04:36 +01:00
oap.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
oap_client.c oap_client: Fix license: GPLv2+ instead of AGPLv3+ 2019-05-27 23:26:45 +02:00
rsl.c gsm: rsl: Define new osmocom extension TLV IE to pass Osmux CID 2022-08-09 08:35:55 +00:00
rxlev_stat.c treewide: remove FSF address 2021-12-14 12:44:03 +01:00
sysinfo.c Add SI10 support 2023-02-04 10:07:28 +00:00
tlv_parser.c doxygen: fix various typos in commands \param and \returns 2023-02-28 18:48:56 +00:00