Commit Graph

8262 Commits

Author SHA1 Message Date
Neels Hofmeyr 43f46d3b3a emerg call deny: fix RR release cause
So far the we indicated pre-emption in the release cause of denying an
emergency setup, instead indicate protocol error.

When emergency calls are disallowed, it is not pre-emption (making room
for an emergency call) but a protocol error (MS asks for emergency call
when the network does not allow it).

Related: OS#5534
Change-Id: Ia195621165cb7bbe33e6c2e915abc42ab16a2a4f
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
Pau Espin 8a9addf2f5 bts: Use uint8_t instead of int for ccch_load_ind_thresh
The range used for this variable is 0-100, so no need to use a signed
integer. Morever, uint8_it is enough for the range.

Change-Id: I863d9531baf5308b45a2ebe60266ba02d1041cc3
2022-04-25 17:08:27 +02:00
Pau Espin 201eb29616 Rename functions generating OML SetAttr messages
Its name is totally misleading, since they seem to be related to
GetAttributes messages rather than SetAttributes.

Change-Id: I306cb407dbd9b98e301b5d93046bdadcb466b82b
2022-04-25 17:06:22 +02:00
Pau Espin 3a46ae5962 cosmetic:: Document TLVs in nanobts_attr_bts_get()
Change-Id: I7e9cbf84edb6bdcbaf38f03552103236ea1cef6c
2022-04-25 16:58:59 +02:00
Pau Espin 08446e5b89 paging: Prioritize requests for new subscribers over retransmitions
Currently, the Tx paging_req queue at the BSC always has new paging
requests adding at the end (as long as the subscriber is not already in
the queue).
That means, if the queue is full of retransmitions, it will take a long
time until the first paging_req is sent towards that subscriber.
The rationale here is that it makes sense to attempt the first paging
ASAP, and give lower prio to paging_req retransmitions, since it may
well be that those other subsribers are not available/reachable and
won't answer.

Related: SYS#5922
Change-Id: I1ae6d97152c458247bc538233b97c2d245196359
2022-04-25 14:12:59 +00:00
Pau Espin 7ed160afd2 paging: Submit up to 20 paging requests in a single work iteration
Having one paging request being sent every PAGING_TIMER (500msec) is too
slow in case BSC is serving lots of subscribers on a BTS. Hence, we want
to send many paging requests at once while still trying not to fill the
BTS buffer.
Morever, we don't want to send tons of paging requests at once, hence we
limit the amount of paging requests sent in one timer iteration
(MAX_PAGE_REQ_PER_ITER) in order to avoid the BSC doing lots of work
there at once, keeping it busy from processing other tasks.

Related: SYS#5922
Change-Id: I609fa67834b426456f48f6fb2acb601c5905f178
2022-04-25 14:12:59 +00:00
Vadim Yanitskiy 5339e3abb2 abis_nm: always check return value of tlv_parse()
Change-Id: Iecba34a96f71922ddd25028e7d3404f89b1106de
2022-04-25 16:09:25 +03:00
Vadim Yanitskiy c6043c8877 bssap: always check return value of tlv_parse()
Also take a chance to replace tlv_parse() with osmo_bssap_tlv_parse().

Change-Id: I90a732d26b4e674d9f7f10197105f7bf9860261d
2022-04-25 16:09:25 +03:00
Oliver Smith 265a04791f Cosmetic: bts_model_osmobts_init: update comment
Mention bts_init too.

Related: SYS#5922, OS#5538
Change-Id: I885c7e294051627064a763fca6dae08daca4b650
2022-04-25 13:06:20 +00:00
Vadim Yanitskiy 462628ebd9 gsm_data: use llist_for_each_entry() in gsm_bts_by_lac()
Change-Id: I55c8067dc377aaccb63e8d5f8d2ca89cbb74b11a
2022-04-25 13:05:33 +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 63f9a04bcc paging: Log skip paging due to not enough free channels
Change-Id: I311f90be99c4561b45f99ce98533aab5909301d0
2022-04-25 11:31:16 +02:00
Pau Espin 35778138a8 paging: Use llist_first_entry() macro
Change-Id: I83e88de6f48cc8aad18ed80ab981b0b438e72b1a
2022-04-25 11:31:16 +02:00
Pau Espin fc90e56178 paging: Avoid setting up credit_timer every time
Change-Id: Id4da0ab094ffe939cad9ff5708721e25b5a1a984
2022-04-25 11:31:16 +02: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
Pau Espin 81abce68a6 paging: Use define available in libosmogsm
Change-Id: I6425a9cb1100391404d79ead66dfb1337bbcbcab
2022-04-25 08:35:57 +00:00
Pau Espin 8ba95b4d5a Move struct gsm_bts_paging_state to paging.h
Change-Id: I8c058d308fc816828b5e6a86e7c5a1f629a2d7c4
2022-04-25 08:35:57 +00: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
Pau Espin 89579f0b2b tests/bsc/Makefile.am: remove duplicate CFLAGS
Change-Id: I7af974a9920558af03495b6ca297b158caebc007
2022-04-21 16:09:02 +00:00
Pau Espin e11910a8cf bts: Simplify bts->paging initialization
Related: SYS#5922
Change-Id: Id103d5f3d437065abcd32788caef339343b1e96
2022-04-21 16:08:40 +00:00
Pau Espin 304485ac8d bsc_vty: Add missing header
Change-Id: I83c6dc786ed07703da5eeb3c89df66cc6c4f2033
2022-04-21 16:08:40 +00:00
Oliver Smith f72b07e5da bts_model_osmobts_init: order feats alphabetically
Order the features and add a comment that reminds of updating OsmoBTS
to actually report the new features that are assumed to be supported
here.

Related: SYS#5922, OS#5538
Change-Id: I6f041648990db4ae479538cf3970c826bc6703ed
2022-04-21 17:21:55 +02:00
Harald Welte e053f9a492 Fix compile errors on #warning with '-Wall' on gcc-11.2
pcu_sock.c: In function ‘pcu_tx_info_ind’:
pcu_sock.c:197:2: error: #warning "isn't dl_tbf_ext wrong?: * 10 and no ntohs" [-Werror=cpp]
  197 | #warning        "isn't dl_tbf_ext wrong?: * 10 and no ntohs"
      |  ^~~~~~~
pcu_sock.c:199:2: error: #warning "isn't ul_tbf_ext wrong?: * 10 and no ntohs" [-Werror=cpp]
  199 | #warning        "isn't ul_tbf_ext wrong?: * 10 and no ntohs"
      |  ^~~~~~~

they made it here from osmo-bts.git
(b4999b60d4 states that the PCUIF support
was copied from there). The gitlog shows that these warnings were added
in 744f745d7a508605254afa8f78412ad410d153b0 by jolly (in 2012!)
together with the PCUIF support, and before
c1368d4ebe49f8e01f1f5fff3bc3583cb5960c1d these warnings were in German:
"ist dl_tbf_ext nicht falsch?"

As nobody has bothered for the past ten years, degrade them to comments.

Change-Id: I9ef7e18f56aa86b48f0ffeec58406260736170f3
2022-04-20 21:49:50 +02:00
Harald Welte 83ac4b26be lchan_fsm.c: Fix misleading comment
From Vadim in https://gerrit.osmocom.org/c/osmo-bsc/+/27818

By checking !(link_id & 0xc0) we actually make sure that this is not
SACCH. So the comment "but not if the link_id contains a TCH flag" is
wrong, there is simply no such thing like "a TCH flag".

Change-Id: I8f0f6d7bf952426fd2f27802f1499d6ee8981982
2022-04-20 21:46:58 +02:00
Harald Welte e0e4941098 lchan_fsm: Ignore other SAPIs of RLL_REL_IND for SAPI=0 is received
If the BTS tells us SAPI=0 is gone, there is no point in trying to keep
the lchan around for SAPI=3, as it is not possible to operate GSM with
SAPI=0 gone.

This occurred with RBS6000, which don't seem to send RLL REL IND for
SAPI3 after doing so for SAPI0.  However, rather than an
ericsson-specific hack, let's make this the general rule: If SAPI=0
is gone, don't stop the lchan from being released.

Change-Id: Ia9caa5b0a5efdc459d94621367376927959a6e65
Related: OS#5530
2022-04-20 19:44:51 +00:00
Harald Welte 0c93a3390a Handle unknown rllr_ind enum values in rll_ind_cb()
If we receive something unexpected, log it (and free the msgb!)

Change-Id: I43fab6a3a1c5e7a6545d6ef848636f5ba1be1576
Related: OS#5530 (only tangentially related)
2022-04-20 15:04:09 +00:00
Neels Hofmeyr c68096c2c3 hodec2: apply penalty_low_rxqual_as only on assignment
The penalty timer low_rxqual_as() is only supposed to apply on an
intra-cell re-assignment. However, a segfault has been reported that
apparently applies it to inter-BSC handover.

Make sure that this timer applies only to re-assignment. In effect this
makes sure that the target bts is non-NULL and avoids the segfault.

Related: OS#5525
Change-Id: Ifdb9891fbe7e3f3423a96371def4fcbf2fc0bc0d
2022-04-18 12:04:42 +00:00
Harald Welte 249700add7 abis_rsl: Fix typo in log message
Change-Id: Ia614541ccb02beddc7a869b9fb9151393959844c
2022-04-18 08:17:25 +02:00
Vadim Yanitskiy c8536c4216 tests: use 'check_PROGRAMS' instead of 'noinst_PROGRAMS'
When using 'check_PROGRAMS', autoconf/automake generates smarter
Makefiles, so that the test programs are not being compiled during
the normal 'make all', but only during 'make check'.

Change-Id: I030c88545cdc71b3ad9e83f9c2ba7b27177c2ac8
2022-04-14 17:21:50 +00:00
Harald Welte 592c8ec29d smscb: Populate "Number of Broadcasts Completed" to KILL COMPLETE
When responding to a CBSP KILL with a CBSP KILL COMPLETE, make sure
we include the optional "Number of Broadcasts Completed List" IE
in order to inform the CBC about how many times the just-killed
message had been broadcast before it was killed.

It seems some CBCs expect this IE to be present, while 3GPP TS 48.049
lists it as optional.  Since we alrady have code to encode it, let's
just always add it - it certainly won't hurt.

Change-Id: I47aebd613dfc6dd9261ea9019a51aff0cd6470d8
Closes: SYS#5906
2022-04-14 12:44:56 +02:00
Vadim Yanitskiy 5f2d30f0ea bts: gsm_bts_alloc(): use reasonable multi-rate config defaults
The current multi-rate configuration uses the same threshold and
the same hysteresis values for all modes: 32 and 8, respectively.
This basically forces the AMR link adoptation loop in the BTS to
stick to the initial codec mode during an lchan's lifetime.

Let's use more reasonable default values from 3GPP TS 51.010-1
(version 13.11.0), sections 14.2.19.4.1 and 14.2.20.4.1 for
AMR-FR and AMR-HR, respectively.

                  ^ C/I (dB)             |  FR  /  HR  |
           |      |
           |      |
  MODE4    |      |
         = |  ----+----  THR_MX_Up(3)    | 20.5 / 18.0 |
         | |      |
         | =  ----+----  THR_MX_Dn(4)    | 18.5 / 16.0 |
  MODE3  |        |
         | =  ----+----  THR_MX_Up(2)    | 14.5 / 14.0 |
         | |      |
         = |  ----+----  THR_MX_Dn(3)    | 12.5 / 12.0 |
  MODE2    |      |
         = |  ----+----  THR_MX_Up(1)    |  8.5 / 10.0 |
         | |      |
         | =  ----+----  THR_MX_Dn(2)    |  6.5 /  8.0 |
  MODE1  |        |
         |        |
         |        |

Change-Id: Ic5f8d55d250976d8d4c9cae2d89480fd52326717
Related: SYS#5917, OS#4984
2022-04-12 13:22:54 +03:00
Vadim Yanitskiy ec51e40607 bts: gsm_bts_alloc(): rework default multi-rate configuration
This is cosmetic change making the default multi-rate configuration
easier to read/understand and modify.

Change-Id: I3d03c2188d007a60a86961a346744400bc81d4e6
Related: SYS#5917, OS#4984
2022-04-12 13:22:48 +03:00
Vadim Yanitskiy 7f3705742f VTY: clarify help for the Adaptive Multi Rate settings
* Always say 'codec mode', not just 'codec'.
* Suggest proper modes in AMR_{TH,HY}_HELP_STR.
* Use 3GPP's definition of threshold and hysteresis.
* Clarify that threshold and hysteresis values are in 0.5 dB steps.

Change-Id: I996eae8aafeb2850e5e1a6f5a7764d745e1289b5
Related: SYS#5917, OS#4984
2022-04-12 09:53:34 +03:00
Vadim Yanitskiy 6a97cd39b6 Move power control related definitions to power_control.h
Now that we have separate header/code files for the power control,
let's move the related definitions there.  This change makes the
code consistent with osmo-bts, where it's already done this way.

Change-Id: I1cb3f6bfba0306e8f371dcd5162d1813beb3a088
2022-04-08 01:23:04 +03:00
Vadim Yanitskiy 6c33014bb9 power_ctrl_params_def_reset(): set .ctrl_interval for both UL/DL
For the sake of consistency and code readability, initialize the
power loop control interval (P_Con_INTERVAL) for both Uplink and
Downlink directions in the same function.

Change-Id: Ie3d4b481cbfacf27004787616e22b6f8a863b47b
2022-04-08 01:12:17 +03:00
Neels Hofmeyr 18334d506d assignment_fsm: always update RTP info
When the assignment succeeds, the assignment_request has taken effect
and whatever it requested should now be in effect.

Hence copy the new RTP information from the assignment_request to the
conn's storage indicating what is currently used, always, not only when
lchan_changed == true. The RTP information may have changed also from a
Mode Modify where the lchan stays the same but changes its mode of use,
e.g. from signalling to voice.

When there is no RTP involved, this data is zero or empty, so there is
no harm in copying it, always.

Related: SYS#5916
Change-Id: I0788d1f013b8f820f559b6ed58a5f9bb8a02e0b4
2022-04-07 00:04:27 +02:00
Neels Hofmeyr a5cf45a3dc assignment_fsm: always mark MGCP ci as completed
When the assignment fails, we roll back the MSC side RTP endpoint at the
MGW that may have been created before the failure occured. On success,
we clear the mgcp_ci pointer so it is not rolled back.

Always clear this, not only when lchan_changed == true. That is because
a channel Mode Modify may also have added a voice stream that should
retain the newly created RTP endpoint at the MGW.

If no voice stream is involved, the pointer should already be NULL.
There is no reason to have a condition for clearing this pointer.
Just always clear it.

This fixes all voice calls that modify a TCH lchan from signalling-only
to voice mode. Before this patch, their MSC side RTP endpoint was DLCX'd
right on assignment success.

In particular, this fixes Emergency Calls (which usually get a TCH lchan
assigned right from the start, and hence do a Mode Modify to add voice).

Related: SYS#5916
Change-Id: I5ab10ee7fd9c5d7608e8a06893881d990943feed
2022-04-07 00:04:27 +02:00
Oliver Smith 88c13cf4cc contrib/osmo-bsc.spec.in: fix 4trx example paths
The paths were wrong in my previous attempt, add the proper paths now.
I've verified that this file builds, and adjusted the current nightly
rpm spec uploaded to OBS with this change manually this time so it
doesn't block.

Fix for:
  File not found: /home/abuild/rpmbuild/BUILDROOT/osmo-bsc-1.8.0.90.e0187.202204061142-1.1.x86_64/etc/osmocom/osmo-bsc-4trx-fh.confmerge
  File not found: /home/abuild/rpmbuild/BUILDROOT/osmo-bsc-1.8.0.90.e0187.202204061142-1.1.x86_64/etc/osmocom/osmo-bsc-4trx.cfg

Fixes: e0187bc3 ("contrib/osmo-bsc.spec.in: add new config files")
Change-Id: I92a7d85b64a9659db7ef71af5b00110b582dc4d9
2022-04-06 14:48:22 +02:00
Oliver Smith e0187bc3bb contrib/osmo-bsc.spec.in: add new config files
Fix for:
  Installed (but unpackaged) file(s) found:
  /usr/share/doc/osmo-bsc/examples/osmo-bsc/osmo-bsc-4trx-fh.confmerge
  /usr/share/doc/osmo-bsc/examples/osmo-bsc/osmo-bsc-4trx.cfg

Change-Id: Ie6c68681e5e68f4aa071fe4cee8f49040a4463e6
2022-04-06 11:28:39 +02:00
Vadim Yanitskiy a41573994c doc/examples: add a confmerge file with example hopping parameters
This file was taken from docker-playground.git, and this is basically
what we use when running the ttcn3-bts-test with hopping enabled.

Change-Id: I205eb53901e06ee52dc64e050cfe2374cb9c771e
2022-04-01 06:33:42 +03:00
Vadim Yanitskiy caf091f465 doc/examples: add a multi-trx config config example
So far we had no multi-trx config examples at all.  Let's add one.
Use unique 'RSL TEI' for each TRX, as this simplifies analyzing the
Abis protocol traces.  Also use the new 'TCH/F_TCH/H_SDCCH8_PDCH'.

Change-Id: I20f86fa74dc4bd71538627ec59c5d2cd3678a089
Fixes: OS#4748
2022-04-01 06:05:36 +03:00
Vadim Yanitskiy 97ea5cb506 doc/examples: avoid using deprecated configuration commands
Change-Id: Id29fae10ec17eb3d0ac8534d8aebd7251a17577d
2022-04-01 06:05:36 +03: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 041411cb70 fix gsm_bts_get_cbch(): CBCH can be allocated on Cn
According to 3GPP TS 45.002, table 3, unlike the CCCH+SDCCH/4+CBCH
combination, which can only be allocated on C0/TS0, the SDCCH/8+CBCH
can be allocated on C0..n/TS0..3.  In other words, having CBCH on
e.g. TRX1/C1 is perfectly legal.  This is why in gsm_bts_get_cbch()
we should check all transceivers, not just the C0.

Change-Id: Ie79ccff4f8f0f1134757ec0c35e18b58081cc158
Related: SYS#5905
2022-03-31 17:37:31 +00:00
Vadim Yanitskiy 79d2af9b31 cbch_scheduler: cosmetic: s/bts_cbch_timer/bts_cbch_timer_cb/
Change-Id: Ibff3045d8066b644b437e46330848ebadfb373fd
2022-03-31 17:37:31 +00:00
Neels Hofmeyr a0c4a06371 hodec2: add penalty-time low-rxqual-ho
When bad RxQual causes handover to a cell with weaker RxLev, then
handover oscillation *will* happen, as shown in test_rxqual.ho_vty.
Introduce a penalty timer for a cell where we had bad RxQual.

This delays handover back to the cell with stronger RxLev by the penalty
timeout; hopefully the interference is gone after the timeout.

Usually, we set new configuration elements so that osmo-bsc behaves the
same as before the config item was added. In this instance, this makes
no sense, because no-one ever wants handover oscillation from bad
RxQual, which is guaranteed to happen without the new penalty timer. Set
it to 60 seconds by default, same as other penalty timers.

Related: SYS#5911
Change-Id: I057b156604a104a26a7ce45d1c7adadbf452c932
2022-03-31 14:43:48 +00:00
Neels Hofmeyr 9f691dfdb8 hodec2: show reported ho oscillation from bad rxqual
First show the problem.

Related: SYS#5911
Change-Id: I51f3101901492ae742d8e56d6eed2725408216cb
2022-03-31 14:43:48 +00:00
Harald Welte 968367caec CBSP: implement MESSAGE STATUS QUERY
This add support for handling inbound MESSAGE STATUS QUERY from the CBC,
and responding with MESSAGE STATUS QUERY COMPLETE or MESSAGE STATUS
QUERY FAILURE, as applicable.

Change-Id: I3b738dc29d0ead4f735abeeb6960d3675cb05ae2
Related: SYS#5909
2022-03-29 14:25:15 +00:00