Commit Graph

1421 Commits

Author SHA1 Message Date
Pau Espin 7d621e0a79 constify state pointers of struct gsm_nm_state
This makes sure code accessing those fields is not changing its values,
since it would make no sense to change those. Follow up commit will make
convert those pointers to be full structs instead, as there's no need to
have pointers there.

Change-Id: I9979e62eac861e25bbe2161ab187ddb2b40fd097
2022-05-05 14:51:13 +02:00
Pau Espin 7cedfd4a44 cosmetic: Fix open brace in same line as func definition
Change-Id: Ibde106ea9ae1aea2b7f8fc6d9ed80eb79579b9e0
2022-05-05 14:51:13 +02:00
Pau Espin 633523167d abis_nm: Merge signals S_NM_STATECHG_ADM and S_NM_STATECHG_OPER
Having 2 signals makes all code handling them more complex, specially
because S_NM_STATE_CHG_OPER could actually provide any change in
admin/oper/availability.
Both signals already provided the same kind of data (the whole
admin/oper/avail state change), so let's simply merge the signals
themselves. Current code really doesn't act differently for those 2
signals anyway.

Change-Id: Ia86d20a42b859063d0327b940ba528ec1438b04a
2022-05-05 14:51:10 +02:00
Pau Espin 35dca11585 abis_nm: Use proper define for avail state 0xff
Change-Id: If5474700d368e99c8242290e3890b751fe1e85c2
2022-05-04 15:30:01 +02:00
Pau Espin 94890021a8 Remove commented out code
This code is not used currently. Furthemore, it makes little sense to
transmit an OPSTART if the BTS already told us it is enabled (because
OPSTART is what moves the BTS into operational enabled state).

Change-Id: I2c65e0803fbde7de9497089b562275baad58936a
2022-05-04 15:16:52 +02:00
Pau Espin 82a18caf11 Drop duplicate function helper
Change-Id: Idac049d07bf105b85a71af2f15f56552c453a370
2022-05-04 11:47:53 +02:00
Pau Espin 780c8a76dc paging: Remove TODO comment
That function is used to get the number of paging groups, so it doesn't
apply here.

Change-Id: I980c0961e86d9464235ea9c403adba6b0eded58e
2022-05-04 11:37:06 +02:00
Michael Iedema 5e2ac29703 stats: new trackers for lchan life duration
This patch adds two stats which track cummulative lchan lifetime by
type TCH and SDCCH. These new counters will accomplish two things:

1) Provide a glanceable way to see if lchan durations look healthy. When
examining a site, short-lived (<5s) and long-lived (>30s) TCH lchans
are difficult to tell apart. If we only see short-lived TCH lchans,
there is most likely an RF or signaling problem to investigate. This
new counter will expose channel ages in the VTY output

2) Provide a more accurate count for Erlangs per site. Currently, we
are basing Erlangs on active TCH channel counts per stats period. This
method skews high very quickly. Each active TCH in that period
translates into the full 10s of activity. This counter should improve
accuracy by two orders of magnitude.

Change-Id: I1b0670c47cb5e0b7776eda89d1e71545ba0e3347
2022-05-03 11:03:28 +00:00
Pau Espin 5f2a4a9fb3 paging: Take into account extra delay of all paging groups in BSC queue
So far we only calculated the expiration time based on the amount of
requests of the same paging group in the BSC queue.
However, also extra time has to be taken into account regarding requests
of other paging groups. This is important because requests of all paging
groups are mixed in the BSC queue, meaning having a lot of requests from
other groups before a certain req will anyway delay transmit of that
req to some extend.

Related: OS#5537
Change-Id: Ib55f947c5d3490b27e1d08d39392992919512f9a
2022-05-03 10:41:22 +02:00
Pau Espin 6b51f3d725 paging: Flush pending paging requests when bts obj freed
Change-Id: I3a81eda48cd44c70a2a690a0814a296ba22eaa8e
2022-05-03 10:27:19 +02:00
Pau Espin 1ddafb3781 bts: Properly free ctr/stat when bts object is freed
This was so far workarounded in tests by manually freeing the fields.
However, in follow-up patch the paging queue will also be properly
freed, so free of the counters needs to be previously fixed too so that
counters are freed at the right point of time.
Otherwise, during paging queue flush, counters are used and would crash
because they were freed before the BTS object in each test's bts_del().

Change-Id: Id213e21cf9bfc5439021e459c22ba4704d8cae2b
2022-05-03 10:25:15 +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
Oliver Smith 159246f94f Check VTY config against features reported by BTS
* Don't copy features for osmo-bts and nanobts initially, wait until
  BTS reported its features
* Checks for BTS features in VTY cmds: pass if features are not known
  (not yet reported by the BTS), fail if the feature is missing
* Once BTS reports its features, check relevant VTY config parts again

Related: SYS#5922, OS#5538
Change-Id: I7fca42a39a4bc98a6ea8b9cfab28c4bad3a6a0aa
2022-05-02 15:21:28 +02:00
Oliver Smith aa6404f3f8 abis_nm: add bts model features to reported ones
As pointed out in code review, for nanobts we need to be able to combine
the reported features with a list of features we assume that the bts
model supports. This is because the enum of features is based on what
nanobts is able to report, but was extended for osmo-bts.

Related: SYS#5922, OS#5538
Change-Id: I7bdbf28c148877275048e070dce7f503ca5e6226
2022-05-02 15:14:05 +02:00
Pau Espin ad1f436512 paging: Document 'ccch_load_ind_period * 2' value
Change-Id: Ie88bb0f9859bcf4b3b4a07ccf3b1791cb50163f1
2022-04-29 17:10:57 +02:00
Pau Espin 4821c9f4df paging: Recalculate work timer if waiting for retrans
If the queue is only holding requests in retransmition state, when we
add a new one, we have to re-calculate the work timer to a lower value
instead of letting it wait for the first retransmit to be ready.

Change-Id: Ibd4f8921c92f7481f0b9943041c141640ab812c8
2022-04-28 16:04:04 +02:00
Pau Espin e731301c25 paging: Early stop work_timer when paging queue becomes empty
There's no need to keep the timer running, since anyway upon next
trigger it will simply early exit in paging_handle_pending_requests()
becuase there's no more work to do.

Change-Id: I096ab7231f52c741c5fded37acd5b309e1de06e3
2022-04-28 16:04:04 +02:00
Pau Espin 26d55777fa paging: Increase T3113 based on paging group load in BSC queue
Related: OS#5536
Change-Id: I904c008222ddc3d92843d87fb3182c30b484c8a2
2022-04-28 16:04:04 +02:00
Pau Espin 98ff9bbb2a paging: Improve logging
Change-Id: I8a83352d6f2370bafa5acb0caba6b2f352263b5c
2022-04-28 16:04:04 +02:00
Pau Espin 5cfb63f4b0 paging: Improve calculate_timer_3113()
Depends: libosmocore.git Change-Id I6ef085ee92b2064cb46fa5ec3ae98a0ca59ad599
Change-Id: Id7d6bf93537bcef6658ec72e3ebedcedf64690ed
2022-04-28 16:04:04 +02:00
Pau Espin 1e79745e80 paging: Decouple retransmit period from regular worker interval
Before this patch, on each BTS a 500ms timer was used to schedule some
work, sending up to 20 paging requests verytime.

This means, however, for an initial paging request it may take up to
500ms delay to be scheduled to the BTS, which is huge.

While we still want to maintain this 500ms interval for retransmits, it
doesn't make sense to wait that much for other cases. It's far better
sending less requests (10 instead of 20) every half time (250ms instead
of 500ms), since it will spread the load and paging more over time,
allowing for other work to be done in the middle.

Change-Id: I7a1297452cc4734b6ee8c38fb94cf32f38d57c3d
2022-04-28 16:04:04 +02:00
Pau Espin a6474172e4 paging: Check C0 RSL link instead of OML link
PAging happens over C0 RSL link, not over OML, so let's actually
validate that the C0 RSL link is up before paging instead of the OML
one.

Change-Id: I11e5bb6f952534763935aa01470e514d4af247ed
2022-04-28 16:04:04 +02:00
Pau Espin 525567de74 paging: Rework timer lifecycle logic
Decouple credit_timer from event "available_slots became 0".
Let's actually relate credit_timer to the fact of not receiving CCCH
Load Indication: If no CCCH Load Indication is received (cch_load_ind_period * 2),
then assume we are below CCH Load Indication threshold (10% load) and
start estimating the available_slots in a cch_load_ind_period*2 time
frame.

Moreover, in paging_schedule_if_needed(), there's no use in delaying
start of processing work if the work_timer is not already doing work.

Related: OS#5537
Change-Id: I6a0da03c408270044079e81d431f6641527c00cd
2022-04-28 16:04:04 +02: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
Harald Welte 24567cfeed cbsp: Reject CBSP WRITE for emergency if emergency already active
From 3GPP TS 48.018:

If only the New Serial Number IE, and not the Old Serial Number IE, is
included in the WRITE-REPLACE message,then the BSC shall interpret the
message as a write request, i.e. a broadcast request of a new emergency
message without replacing an ongoing emergency message broadcast.

Only one emergency message at the time can be broadcasted in a cell. If
a write request is received for a cell where an emergency message
broadcast is currently ongoing, the write request is considered as
failed.

Change-Id: I376c9e796f3a2d26b22d0451f15ef1debbd7f656
Closes: OS#5539
Related: SYS#5906
2022-04-28 13:48:20 +00:00
Harald Welte 7a982712ac cbsp: Implement KILL for Emergency Broadcast
So far, we only implemented KILL for CBS, but not for Emergency
broadcasts.  This patch adds KILL support for Emergency, by which
a CBC can terminate broadcast of a previously-started Emergency
message before its scheduled period ends.

Change-Id: Ie91939b93de6847eeb5d00c97a137c43721c2711
Closes: OS#5540
Related: SYS#5906
2022-04-28 13:48:20 +00:00
Harald Welte bcd0f63dce smscb: Always start ETWS timer even in cells without ETWS support
ETWS is sent over both dedicated channels and broadcast channels.
Some BTS models may not support the latter, but it is still useful
to start the related timer to ensure bts->etws.active gets set to
false after the emergency period has concluded.

Change-Id: I448be9fd75b87c1f7333a5bfa4f6ba238569fdc3
2022-04-28 13:48:20 +00:00
Harald Welte 484f535c50 smscb: Store ETWS input state from CBSP
Only if we store data like the CBSP message_id and serial_number
we are able to later (in a subsequent patch) match a CBSP KILL
for ETWS/PWS and stop emergency broadcast.

Change-Id: Ide74638880d7e3c6a7c774bf6320d3dce4b11c74
Related: OS#5540
2022-04-28 13:48:20 +00:00
Harald Welte 5e7458cbd8 smscb: Don't include extraneous IEs in CBSP KILL COMPLETE / FAILURE
TS 48.049 states the following rules for the KILL COMPLETE / FAILURE
messages:

The Number of Broadcasts Completed List IE, if present, contains for
each cell the total number of broadcasts of the killed CBS message.

The Cell List IE, if present, contains the cells in which the emergency
message is successfully terminated.

As any message can only be either emergency or CBS, this means that
we can (at maximum) have only one of those two IEs in the message.

As there is no explicit indication in the KILL whether it relates
to CBS or Emergency, we use the "Channel Indicator" IE, which is
specified as "only included if the message refers to a CBS message".

Related: SYS#5906
Closes: OS#5541
Change-Id: I9a43d386da01f085663d231a555b8b5acc99faca
2022-04-28 13:48:20 +00:00
Oliver Smith 41aa1feb15 bts_model_*_start: move set_feature calls to _init
With previous patch Idf2d933aa8b03b1f708e56a08707fe6c620a97aa, the
features get copied from the BTS model to the BTS. For rbs2000, bs11 and
nokia_site, an empty feature set was copied because the features weren't
set at this point. Fix this by moving the set_feature calls to _init().

Notably the set_feature calls had been moved for osmo-bts and nanobts
from _start to _init already in 2013 in the patch e84dd98d
("sysmobts: Avoid a crash when trying to look-up a BTS").

Fixes: 2d818b9f ("Always use reported features if available")
Related: SYS#5922, OS#5538
Change-Id: I43389ae48d5e0f01381602751f6bad902011b158
2022-04-28 12:14:28 +00:00
Oliver Smith 3eb14ee7c7 abis_nm_ipaccess_rsl_connect: initialize ia
Fix access to uninitialized value from inet_ntoa(ia) inside the log
message, found with valgrind.

Change-Id: I6c04fdc329bb56b82087c817e2fbe5a6504bf1dc
2022-04-28 12:14:28 +00:00
Pau Espin 0bcd47f014 bts: Make sure paging timers are deleted when struct gsm_bts is freed
Change-Id: If8dffc948a3a9d8bdd9237f644e7f10f41c64853
2022-04-27 10:03:01 +00:00
Pau Espin c3487dd19d Introduce VTY command 'ccch load-indication-period <0-255>'
Change-Id: Id9d23238863c02a72bcf32942f6b0d40be127904
2022-04-27 10:03:01 +00:00
Oliver Smith 2d818b9f2e Always use reported features if available
Instead of sometimes checking against hardcoded BTS model features, and
sometimes against features reported at runtime (which only some BTS
models do):
* copy the hardcoded BTS model features to BTS features initially
* do all checks against BTS features

Related: SYS#5922, OS#5538
Change-Id: Idf2d933aa8b03b1f708e56a08707fe6c620a97aa
2022-04-26 12:06:47 +00:00
Oliver Smith d055493071 gsm_data: add gsm_set_bts_model
Let all changes of the bts model go through this function, so we can in
a future patch copy over the bts model's features to the bts.

Related: SYS#5922, OS#5538
Change-Id: I8475c8c20eb72411e8ca820181d1c8603c22a56d
2022-04-26 12:06:47 +00:00
Oliver Smith 5586149d73 abis_nm: don't compare assumed/reported features
Just log all reported features, instead of comparing them against an
expected set of features and logging mismatches. The point of reporting
features from the BTS at runtime is that the BSC can support various BTS
versions with various feature sets.

Related: SYS#5922, OS#5538
Change-Id: Ibd79bc7ef802d8e95e05d746df182ff974b78e29
2022-04-26 12:06:47 +00: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 5bad630fb5 emerg call deny: log on LOGL_ERROR
Change-Id: Id6ea25484479bfc1728124df8fe8e2e03bcee3ec
2022-04-25 21:19:10 +00:00
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 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
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 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
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
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
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
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
Harald Welte eba0a02017 SMSCB: Preserve padding at end of page in CBSP -> RSL conversion
When copying the CBS page content from CBSP to RSL data structures, we
use the User Information Length as length argument in the memcpy.  The
logic for that is that only this part of the message contains valid
data.

However, as the user information length is not passed on via RSL or
transmitted over the air, the receiving MS will get a  page with
zero-initialized padding, rather than whatever the originator of the
message has specified.  As zero bytes in the 8bit domain might get
translated into @-characters in the 7bit domain, this creates problems.

So instead, let's always copy the entire page (82 bytes) to ensure
transparency when passing on information from CBSP to RSL.

Change-Id: Iffcf1f6a7d41a08a2feffc6f2ac5634d940b63aa
Closes: SYS#5904
2022-03-28 18:48:08 +02:00
Vadim Yanitskiy 0d327979ee BSSMAP LE: handle optional LCS {Client Type, QoS} IEs
On receipt of the Perform Location Request message, the BSC needs
to forward it to the SMLC.  If the abovementioned IEs are present
in the original message, they must be delivered to the SMLC too.

Change-Id: Ifeb359b0468845da0b4fed9e2e4b79256067fa81
Depends: libosmocore.git I8775a93cf4089b1752d040e43d2cba6b8997f955
Related: SYS#5891
2022-03-22 19:17:44 +03:00
Vadim Yanitskiy b7f6623f60 BSSMAP LE: fix handling of LCS Client Type IE
On receipt of the Perform Location Request message, the BSC needs
to forward it to the SMLC.  If the LCS Client Type IE is present
in the original message, it must be delivered to the SMLC too.

Change-Id: Id3262e67c3dc25cb93fbd52a40689c5529ca2d41
Related: SYS#5891
2022-03-22 19:16:07 +03:00
Vadim Yanitskiy bd4a7dafd5 parse_bssmap_perf_loc_req(): make 'struct tlv_p_entry' pointer const
Change-Id: Ieba7f65667c5a1f9c0d7d2a350ec736994b1866e
2022-03-22 16:17:07 +03:00
Pau Espin 36fe6e4421 SI13: Get rid of si13_default
It's really confusing having a "default" struct whose inner values are
changing based on previous state. Furthermore, it's only used in
generate_si13() so there's no need to keep it outside the function.

Let's move it inside the function and rename it to avoid confusion.

Change-Id: I3ae4dd017dd4dad10c0365d21727666dd8e9fd41
2022-03-19 22:52:23 +01:00
Pau Espin 3ec2b8349c system_information: Move all si13 specific val update to generate_si13()
Change-Id: I6e920d1c8d8e1673194c88929586e8a1f22e09c5
2022-03-18 20:11:22 +01:00
Pau Espin 07fba2b629 SI13: Avoid enabling use_egprs_p_ch_req if egprs not supported
It makes no sense to enable that field if the ext_info.egprs_supported
field marks EGPRS as disabled.

From TS 44.060 11.2.5a:
"""
This message may be sent by an EGPRS capable mobile station
*in a cell supporting EGPRS* and where the EGPRS_PACKET_CHANNEL_REQUEST
parameter indicates that this message shall be used.
"""

Related: SYS#5891
Change-Id: I5ac173116f8681d7340b75b2baff110158fab9fd
2022-03-18 20:11:22 +01:00
Pau Espin 4501ed413c SI13: Make sure egprs_supported field is always updated
If "bts->gprs.mode" was changed dynamically at runtime (VTY or CTRL), it
could happen that the egprs_supported was kept as "1" if the dynamic
change was EGPRS->GPRS.

In summary, if EGPRS support was set, it couldn't be unset until BSC was
restarted.

Related: SYS#5894
Change-Id: Id2c2319044da474642c4cc710baa27cfee4fb592
2022-03-18 20:11:22 +01:00
Pau Espin 6dec88682f SI13: Always send ext_info
Values in ext_info are modified in several places, so it's difficult
validating whether we deviate from default. Let's always send it so that
we always have a clear view on what the MS uses.

This fixes a bug where paging_coordination or ccn_active would not be
announced if GPRS was not enabled.

Related: SYS#5894
Change-Id: If96de3e0d77503cf6344dfbc611f9260ac3281aa
2022-03-18 20:11:14 +01:00
Pau Espin 789d4e92c3 bts_vty.c: Fix typo in comment
Change-Id: Id4c49e93fe5b4eaa4efdac116df34853f359dd98
2022-03-18 20:00:25 +01:00
Vadim Yanitskiy c1f7452c16 System Information Type 3: allow updating T3212 at run-time
The value in bts->si_common.chan_desc may get out of sync with the
actual value in net->T_defs (e.g. after changing it via the VTY),
so we need to sync it in generate_si3().

Note that synchronizing the values in cfg_net_per_loc_upd_cmd is
a bad idea, because the value of T3212 may also be changed using
generic timer management commands.

Change-Id: Iee291623c2825505eeb5175adcedadfe35375b9e
Related: SYS#5888
2022-03-16 22:33:55 +03:00
Vadim Yanitskiy a76c9dcc3b gsm_bts_trx_set_system_infos(): cosmetic: improve readability
Change-Id: Ic63ee79c7509ec57ad72f85442b5756ae31c0a52
Related: SYS#5888
2022-03-16 22:33:04 +03:00
Vadim Yanitskiy 7c14a12a78 fixup: gsm48_make_ho_cmd(): optionally add Synchronization Indication IE
This was overlooked during the code review.  GCC does not complain
because internally both 'enum handover_scope' and 'bool' are
interpreted as 'int'.  Found this while running my WIP testcase
TC_srvcc_eutran_to_geran_a5_3.  This change makes it pass.

Change-Id: I807fd4a0e700e54c67ca3547d9c0c1b442dd1c54
Fixes: I4e5b1163a71443d706f14ce4bfd5c2294c320432
Related: SYS#5838
2022-03-14 17:26:16 +03:00
Vadim Yanitskiy 53d05951a5 gsm48_make_ho_cmd(): optionally add Synchronization Indication IE
Change-Id: I4e5b1163a71443d706f14ce4bfd5c2294c320432
Related: SYS#5838
2022-03-14 14:07:39 +03:00
Vadim Yanitskiy 2902d91d69 gsm48_make_ho_cmd(): optionally add Cipher Mode Setting IE
According to 3GPP TS 44.018, section 9.1.15, the RR Handover Command
message may optionally contain the Cipher Mode Setting IE (10.5.2.9).
Section 9.1.15.10 states that this IE may be omitted in case of the
intra-RAT GERAN-to-GERAN handover, however in case of the inter-RAT
handover (e.g. EUTRAN-to-GERAN), this IE *shall* always be included.

Change-Id: I1d270e82d0a9b12897fc94dae4e8999aa132a22f
Related: SYS#5838
2022-03-13 18:20:40 +03:00
Vadim Yanitskiy 798a71eb30 gsm48_make_ho_cmd(): make 'struct gsm_lchan' pointer const
Change-Id: I731179bf7f5d711ca114e36af661faccf0caa19f
2022-03-13 17:50:19 +03:00
Vadim Yanitskiy a0033f5da7 gsm48_make_ho_cmd(): cosmetic: use existing BTS pointer
Change-Id: I98abe2e43af1f8fa7e70fcf7155478b39751fced
2022-03-13 14:15:39 +03:00
Vadim Yanitskiy 0a01573bc1 gsm48_send_ho_cmd(): this function is not used, remove it
Change-Id: I9771d7e1f2073ebf6d900c067885485e54790bca
2022-03-13 14:15:39 +03:00
Vadim Yanitskiy 663d6fed0c system_information: fix DCS/PCS band indicator in generate_si6()
Change-Id: Iaa8377919a144e7f3799b76249f579c8f3874145
2022-03-10 15:54:29 +00:00
Vadim Yanitskiy be5a6c949e system_information: use is_ipaccess_bts() helper
Change-Id: Id14f39f50a6d7644f81b21c0b89e10f44901348b
2022-03-10 15:54:29 +00:00