Commit Graph

170 Commits

Author SHA1 Message Date
Pau Espin d38ccedad7 Move paging queue specific handling to signal callback outside RSL code
The signal is already there but not being used.
Let's further split generic paging code from RSL specificites.

Change-Id: Iabc1c29908a5136501d6dc6e60f8777dab511b86
2023-03-31 12:12:21 +02:00
Pau Espin 4de0769720 abis_rsl: Document spec ref of CCCH Load Ind
Change-Id: Iada13bb29688249eecbd492388a6d4b0cc95575d
2023-03-30 15:51:02 +02:00
Vadim Yanitskiy cbf3e5d850 fix ipacc_rtp_csd_fmt_non_transp(): add missing breaks
Change-Id: I13adcabd26c5f6543681e418b87c70b2822e7dcf
Fixes: CID#310964, CID#310965, CID#310967
2023-03-17 16:42:34 +07:00
Oliver Smith 2689ad73a8 abis_rsl: CSD: add RTP_CSD_FMT IE to CRCX/MDCX
Related: OS#4393
Change-Id: I4964b268124d29354e252c2ee509866ae75fab6d
2023-03-08 11:52:12 +00:00
Oliver Smith d83d22bad3 Cosmetic: channel_mode_from_lchan: remove fixme
Remove the FIXME comment, as the function handles CSD now.

Related: OS#4393
Change-Id: Ic074cb814662d73f52d4401d1cf9cdbf682040a9
2023-03-06 10:23:31 +01:00
Oliver Smith d5ca920cc3 rsl_tx_ipacc_crcx/mdcx: omit speech mode for CSD
Omit the A-bis/IP specific RSL_IE_IPAC_SPEECH_MODE, as it doesn't make
sense for circuit switched data.

Related: OS#4393
Change-Id: I6641b713177276bcf798f08123e1dd2e88ffdce6
2023-03-06 10:23:30 +01:00
Oliver Smith b11bf4d651 abis_rsl: ipacc_payload_type: handle CSD
Depends: libsmo-abis Ibf0bfb577faa5c82e10706b42ede8b72dd611655
Change-Id: Ie561d87ecdc161b9a69eb7683889f0395524faa8
2023-03-06 10:23:30 +01:00
Oliver Smith 17df53ea1a channel_mode_from_lchan: add GSM48_CMODE_DATA_3k6
Related: OS#4393
Change-Id: Id9ec34f77c96d3a209c6f78d2addf1ea0dfa228d
2023-03-05 18:04:41 +00:00
Oliver Smith 5a16fcee93 lchan.h: remove enum lchan_csd_mode
It looks like the idea was to translate the CSD rate from BSSAP to
lchan_csd_mode before translating it to RSL. But instead we can just
directly translate the BSSAP value to the RSL value.

The previous code was not used yet (nothing wrote to csd_mode).

Related: OS#4393
Depends: libosmocore I25bfd02aa1428a35492b20376a31635a442e545f
Change-Id: Ice914744da3a2084e82d125848fb69404b8e8a36
2023-03-05 18:04:41 +00:00
Philipp Maier 52b74175dd abis_rsl: guard against over long IMMEDIATE ASSIGNMENT Messages
The length parameter in rsl_imm_assign_cmd_common() may cause a buffer
overflow when it is chosen larger than GSM_MACBLOCK_LEN. Lets make sure
this cannot happen.

Change-Id: I9417b35fb8c0517f2555e17059bf8ac60fa59791
2023-03-02 14:59:41 +01:00
Philipp Maier 8a0572256b abis_rsl: constify parameters of rsl_X_imm_assign_cmd
Related: OS#5198
Change-Id: I1bd2e0c844bf273d2c4381eec9e9bb9562254873
2023-02-13 12:39:22 +01:00
Philipp Maier 7a346a547e abis_rsl: add support for sending IMMEDIATE ASSIGNMENT through PCH
The IMMEDIATE ASSIGNMENT for downlink TBFs needs to be sent through the
PCH instead of the AGCH. Since this method is not specified in RSL, it
is usually a vendor specific extension.

Change-Id: I4452f4973d1ec69c96aad527b057226e8a6edf99
Related: OS#5198
2023-02-13 12:39:22 +01:00
Philipp Maier 0b7d9b26b6 abis_rsl: fix sourcecode formatting
Change-Id: I6c4b6bd86c081046e34f51625c86015fc58c55c2
2023-01-12 13:59:22 +00:00
Philipp Maier 9b45d86e5e abis_rsl: fix frame number calculation
The formula that is used to recover the (relative) frame number from the
T1, T2, T3 parameters matches the definition in the spec, but since the
partial term t3-t2 can be negative special precaution is required when
performing the MOD 26 operation.  This is due to the truncated modulo
implementation in C/C++, which has a very specific understanding on how
to deal with negative input parameters.

The libosmocore gsm_gsmtime2fn(() offers a correct implementation, so
lets use it.

Change-Id: I5fb2b0ada8d409730ac22963741fb4ab0026abdd
Related: OS#5198
2023-01-12 13:55:49 +01:00
Philipp Maier 813e083f90 abis_rsl: when doing packet access, log t1,t3,t2 and fn
The (relative) frame number that is forwarded to the PCU is an
important parameter which is computed from t1,t3,t2.

Change-Id: I83d20ba9e0ce6488d458ccf4a85c8445c30e3a89
2023-01-10 12:29:50 +01:00
Philipp Maier f471b3932a abis_rsl: show full request reference in log
When a CHAN RQD is received via RSL, we show ra and other parameters.
Lets also show T1, T3 and T2.

Change-Id: I78499b49ae176b736e384e193fadc0bdd669dffa
2023-01-10 11:27:55 +00:00
Philipp Maier 71a4f1302b abis_rsl: add spec ref for frame number calculation
The frame number calculation in rsl_rx_pchan_rqd() is done using a
specific formula. Lets add a spec reference and also restructure the
code a bit.

Change-Id: I60500c8694dbc2e6e2c4bbffd4ff7057bbc324e6
2023-01-06 16:22:04 +01:00
Philipp Maier 79d2f44e65 abis_rsl: be more clear about vendor specif RSL extension
The function rsl_ericsson_imm_assign_cmd has a comment "Chapter 8.5.6"
above it. However, thats only half true. The function implements
ericsson vendor specific RSL IEs, so lets be more clear about this in
the spec reference.

Change-Id: Id27662e208ca8ac0a48851583c11fbacf85f988c
2022-10-28 14:26:02 +00:00
Philipp Maier ad27ef2b15 abis_rsl: delete CHAN RQD from queue when rach ind was sent
The CHAN REQ entry is not deleted after its information was passed on to
the PCU. This causes the same entry to be used over and over again while
blocking other incoming CHAN RQD.

Change-Id: Ia4abc55fc6fcb1c00991cc84d09529131d014910
Related: OS#5198
2022-10-14 16:08:17 +02:00
Pau Espin 2627dc07ee Drop Osmux call setup if BTS didn't provide a remote CID
We expect osmo-bts to provide us with a remote CID in order to be able
to set up MGW to send Osmux frames to it.

Related: SYS#5987
Change-Id: Ia90e8e0d18193d64c0fa0788dbd0eb242a359b61
2022-09-21 18:59:26 +02:00
Pau Espin d8b5bf08e8 Add Osmux support on the Abis-side data plane
Related: SYS#5987
Change-Id: I48483b278ff829ee29d3e7fbcab0dd3a54728825
2022-09-13 17:37:35 +02:00
Pau Espin 3d0fbe387f split lchan specific defines and code to its own file
It is really difficult right now to find out where all the different
stuff relative to operation and lifecycle of an lchan is. Let's move
everything to its own file to have all the related defines and logic
together.

Change-Id: Idd855d126c43ac6576c5f3ba7e0b8014127a65e1
2022-08-09 08:38:51 +00:00
Pau Espin 742bb99ed9 Use libosmocore available API to get value_list
This API has been available since 1.0.0, and we actually require
libosmocore >= 1.7.0 nowadays, so it's totally fine using the
libosmocore API and drops the local duplicate.

Change-Id: I95c59b31cf1b08e1d513b589ef386d2dd55f09a2
2022-08-09 08:38:51 +00:00
Vadim Yanitskiy a019e9af8b lchan_select: implement dynamic selection mode for assignment
This change implements an additional channel allocation mode, which
can be employed during a TCH channel allocation for assignment.
Selection between ascending and descending order is performed
depending on pre-configured parameters:

* Uplink RxLev threshold and number of samples for averaging,
* C0 (BCCH carrier) channel load threshold.

This is useful in setups where Tx power of the RF carriers cannot be
adjusted +dynamically at run-time and thus BS Power Control cannot
be performed.  In such setups the BCCH carrier is transmitting at
relatively higher power than the other RF carriers.  The key idea
is to allocate channels in a smarter way, so that UEs with poor signal
would get channels on carriers with high Tx power, while UEs with good
signal could use carriers with lower Tx power.

Change-Id: I1b7a0d706976b73cc5c30a8714b830811addfe8d
Related: osmo-ttcn3-hacks.git Ia522f37c1c001b3a36f5145b8875fbb88311c2e5
Related: SYS#5460
2022-06-30 16:36:55 +00:00
Vadim Yanitskiy c2928ac269 lchan_select: allow different alloc order for assignment and handover
A follow-up patch implements a special channel allocation mode, which is
only working for assignment (basically TCH selection for a voice call).
This mode cannot be employed for initial CHANNEL REQUEST or handover due
to the absence of an already established lchan.

Adding this mode to the existing VTY command syntax would be confusing:

  channel allocator (ascending|desscending|dynamic)
                                           ^^^^^^^

so this patch extends the VTY syntax in a way that it becomes possible
to configure different channel allocator modes for different cases:

  OsmoBSC(config-net-bts)# channel allocator mode ?
    set-all     Set a single mode for all variants
    chan-req    Channel allocation for CHANNEL REQUEST (RACH)
    assignment  Channel allocation for assignment
    handover    Channel allocation for handover

The old command syntax, which is basically 'set-all', is kept for
backwards compatibility, but marked as deprecated.

Change-Id: I3ae73b36ee9433cc768376b56f0765e5f416162f
Related: SYS#5460
2022-06-30 16:36:41 +00:00
Michael Iedema 3ef30f3424 Expand VTY option which controls use of TCH for signalling
For statistical clarity and site tuning, it is sometimes
desirable to completely disable the use of TCH for signaling.

In the existing version of this VTY command, there is no way to
accomplish this. We can only restrict TCH for signaling non-voice
related actions.

This patch deprecates 'allow-tch-for-signalling (0|1)' and
adds 'tch-signalling-policy (never|emergency|voice|always)' to
provide more options.

Change-Id: I4459941ddad4e4a3bec8409b180d9a23a735e640
2022-06-15 06:06:26 -07:00
Neels Hofmeyr c1bfc88b6b fix performance for chan_counts and all_allocated stats
The all_allocated_update_bsc() does inefficient iterating to count
active/inactive lchans, which scales badly for high numbers of TRX
managed by osmo-bsc.

We need to update the all_allocated flags immediately (periodic counting
alone would suffer from undersampling), so, until now, we are calling
this inefficient function every time a channel state changes.

Instead of iterating all channels for any chan state changes anywhere,
keep global state of the current channel counts, and on channel state
change only update those ts, trx, bts counts that actually change.

A desirable side effect: for connection stats and handover decision 2,
we can now also use the globally updated channel counts and save a bunch
of inefficient iterations.

To get accurate channel counts at all times, spread around some
chan_counts_ts_update() calls in pivotal places. It re-counts the given
timeslot and cascades counter changes, iff required.

Just in case I missed some channel accounting, still run an inefficient
iterating count regularly that detects errors, logs them and fixes them.
No real harm done if such error appears. None show in ttcn3 BSC_Tests.
It is fine to do the inefficient iteration once per second; channel
state changes can realistically happen hundreds of times per second.

Related: SYS#5976
Change-Id: I580bfae329aac8d4552723164741536af6512011
2022-06-02 14:24:30 +02:00
Pau Espin 36595ea7c5 abis_rsl: Use proper struct in rsl_paging_cmd
Use the same one as used to decode the message in osmo-bts.

This patch doesn't cause a change in logic since both headers are binary
identical.

Change-Id: Ideb863fdaedf77caac1a320de6696ba4f507a398
2022-05-03 10:23:16 +02:00
Pau Espin 48a428084e abis_rsl.c: Drop unused function
Change-Id: I14457608aba799eccf9db6983d72fe0a5343be5c
2022-05-03 08:10:58 +00:00
Pau Espin c9ac7cb91f paging: Estimate available_slots based on BTS config when no CCCH Load Ind received
Related: OS#5537
Change-Id: I2df68e10eb549d62765ad3b25429f7fe2d5bb0b9
2022-04-28 16:04:04 +02:00
Neels Hofmeyr 7dc3048759 emerg call: send BSSMAP Clear Req cause as preemption
After the lchan release, the gscon would go into the Clear dance with an
arbitrary cause value. Instead, explicitly ask for a Clear upon
pre-emption, with the proper cause value.

Related: OS#5535
Change-Id: I20108f7b4769400b89b7b0d65c8dab883bf87c46
2022-04-25 21:19:10 +00:00
Neels Hofmeyr 96f4ff310e emerg call: tweak log, comments
Change-Id: I01e457ae6a9a951a2525c2159cb5979a0cb8bd95
2022-04-25 21:19:10 +00:00
Vadim Yanitskiy 2641f5c3a7 abis_rsl: fix NULL pointer dereference in abis_rsl_rx_rll()
Found with GCC's static analyzer (-fanalyzer).

Change-Id: I620538388f6971418980b03a6a1b2384e7c87e15
2022-04-25 13:05:33 +00:00
Pau Espin 2f281f1e90 rsl_rx_ccch_load: Use UINT16_MAX instead of -1
The variables are unsigned, so -1 gets actually translated to UNIT16_MAX
when the value is casted to uint16_t. Let's do that explicitly so that
readers don't think those are signed variables.

Change-Id: I02ad80e5d10f1a47cdf712f7f7c576a2e20fe607
2022-04-25 11:29:35 +02:00
Neels Hofmeyr 7857b0969e emerg call: fix RR release cause for pre-emption
If an lchan needs to be released to make room for an emergency call,
send the proper release cause ("pre-emption").

Related: OS#5534
Change-Id: I0423621d15ace11a53ae1653e5e7f5cb93605edb
2022-04-24 00:34:17 +02:00
Harald Welte 249700add7 abis_rsl: Fix typo in log message
Change-Id: Ia614541ccb02beddc7a869b9fb9151393959844c
2022-04-18 08:17:25 +02:00
Vadim Yanitskiy 108d5dee74 abis_rsl: always check return value of rsl_tlv_parse()
Change-Id: Id022628934e7d51ce66cb255baa88f24bf5c918a
Related: SYS#5905
2022-03-31 21:29:17 +03:00
Harald Welte 9dfe6cb3d5 abis_rsl: Ensure message length is sufficient for respective header
Change-Id: I63b64f1f241de3a76f9b66ed2cf524cc88933062
2022-03-31 21:29:17 +03:00
Vadim Yanitskiy 7fb4817b78 struct gsm_encr: store alg_id in human-readable format
I find it weird that we store the A5 algorithm ID in a format that
is used on the wire: N + 1 (valid for both A-bis and A interfaces).
What confused me even more is that in some functions we print it
as if it was in a normal, human-readable format.  And this is
also why one can see weird constructions like:

  if (lchan->encr.alg_id > ALG_A5_NR_TO_RSL(0)) { ... }

Let's ensure that our internal structures use the A5/N format:

  alg_id=0: A5/0   (0x01 on the A-bis/A interface)
  alg_id=1: A5/1   (0x02 on the A-bis/A interface)
  alg_id=2: A5/2   (0x03 on the A-bis/A interface)
  ...
  alg_id=7: A5/7   (0x08 on the A-bis/A interface)

so that we can print and compare the value of alg_id without using
additional arithmetics.  Let's also rename 'alg_id' to 'alg_a5_n'
as it most clearly indicates which representation it is storing.

This is how the above code snippet would look like:

  if (lchan->encr.alg_a5_n > 0) { ... }

Change-Id: Ieb50c9a352cfa5481aebac2379e0a461663543ec
2022-03-29 11:50:12 +00:00
Neels Hofmeyr a0fb37906d rename RSL_ENC_ALG_A5 to ALG_A5_NR_TO_RSL, clarify
The naming confused me so that I wrote buggy code again. Hopefully this
clarifies which representations the code paths are using.

In the macro code, highlight the error case of n <= -1 explicitly.

Also add ALG_A5_NR_TO_PERM_ALG_BITS. I need the 1<<n case in an
upcoming patch.

Related: SYS#5839
Change-Id: I7557ae97764bba09c906748a18e9031dfb362611
2022-02-18 13:21:56 +01:00
Neels Hofmeyr fdf2262968 fix chreq:* counters: typos in chreq:successful_* constants
Related: SYS#4878
Related: I17a7702b151ac03fd9f7ecd6927ef42133aad953 (osmo-ttcn3-hacks)
Change-Id: I1fde77d5d5920093ab037184eb3518876804353d
2021-11-30 14:19:05 +01:00
Neels Hofmeyr 33e687a97e dbg log: abis_rsl print_meas_rep(): clarify rxlev
Change-Id: Ia2c1d59eac556b8f6a56c39abf12b35a3ba807eb
2021-11-29 15:10:49 +00:00
Vadim Yanitskiy 335361fbeb [overpower] Allow configuring specific channel mode(s)
Change-Id: I34d29d7d0f66c629367f3d6e8a660e199ecbe080
Related: SYS#5319
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 820b30d8c6 abis_rsl: s/*_acch_cap_for_bts/put_*_acch_cap_ie/g
Change-Id: I663023adb4f2381d4b8debb01786801803b3d741
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 92442c9309 abis_rsl: {rep,top}_acch_cap_for_bts(): make *lchan const
Change-Id: I3e71bb88db7b1eadff5a73fdb98fe7eee2fc2540
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy f59abedb24 struct gsm_bts: s/temporary_overpower/top_acch_cap/g
Let's have a short and consistent naming for both ACCH repetition
and temporary ACCH overpower structures, like it's done in osmo-bts.

Change-Id: I39b98dcd14219402959646524315d5afea7c08cf
Related: Ib1d51f91139b4c2fe794e37fc8543b2d7a9b9c07
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy c8bd1eeaca struct gsm_bts: s/repeated_acch_policy/rep_acch_cap/g
Let's have a short and consistent naming for both ACCH repetition
and temporary ACCH overpower structures, like it's done in osmo-bts.

Change-Id: Ia12c83ad1af4744ce28ba655ac806784f746e88a
Related: Ib1d51f91139b4c2fe794e37fc8543b2d7a9b9c07
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 508058ee28 abis_rsl: cosmetic: fix coding style rep_acch_cap_for_bts()
The linter (executed by Jenkins) complains:

  src/osmo-bsc/abis_rsl.c:543: ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"

and blocks changes, adding V-1 when I am changing the related code.

Change-Id: I0cf00ff898e69734850659e8ba0e2ff023f9b2dd
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 836947918c abis_rsl: simplify checking if channel mode is AMR
Change-Id: If933ce0fa0a162c4518ddab840f186ebaa1bcff9
2021-11-15 11:59:03 +00:00
Neels Hofmeyr a249babf20 implement bts.N.cm_serv_rej:<cause> rate counters
Related: I0214b27da18af87eca9715ebf7eeeff945e3e12a (osmo-ttcn3-hacks)
Related: SYS#4878
Change-Id: I79b1261e5a281d9797eaaf9c27d90edd8e27c78b
2021-11-10 17:53:44 +00:00