Commit Graph

8262 Commits

Author SHA1 Message Date
Pau Espin b978d1582f nm_statechg_signal_data: Convert state ptr to data
There's no need to use pointers there, it is only asking for errors from
code handling the data structe from the signal by attempting to change
them. Even for mem size point of view it doesn't make sense, since it's
3 byte vs a 4 byte pointer.

Furthermore, this is a preparation for new commit, where the NM object
current state will be updated before emitting the signal. This patch
eases a lot the follow up mentioned patch.

Change-Id: I9b648dfd8392b7b40bfe2b38f3345017481f5129
2022-05-06 14:50:24 +02:00
Pau Espin 7b36d0b0a0 acc: Fix erratic ramping behavior when several BTS configured
One callback function was being registered for each BTS.
That means, when a C0 RCARRIER of one specific BTS changed NM state,
the outcome on whether to trigger/abort ramping would end up being
applied to all BTS.

Change-Id: I56c4dd1809fdcf8441a69bf77ad173e1ccc8eea7
2022-05-06 12:34:59 +00:00
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 5cc9ed5567 ipaccess-config: Use proper define for nm availability value
Change-Id: I368646c54f434094319c72492c616aeda5e09e6a
2022-05-04 15:39:02 +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 7048fc66bf tests: Introduce paging_test
Add unit test env to easily test several paging scenarios.

Change-Id: Iab61bf6a6eece5f439a19f7a5a0dc068a808ae8a
2022-05-03 11:03:00 +02: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
Pau Espin dc494caea2 tests/acc: Remove unused var
Change-Id: I1b56b4f8d3c3901cdf9a971e9ed95a6ebbbc1cca
2022-05-03 08:10:58 +00:00
Pau Espin f3044b585e tests: Order tests alphabetically
Change-Id: Ic7507c90854a1c953f4c016b1b0e569bca570b37
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 af523cf780 tests: acc_test: Get rid on unrelated logs in expect file
Change-Id: Id509fa1d27b18b5f9ba48f818671c432ff2719ac
2022-04-27 22:21:06 +00:00
Pau Espin 86e7e3cfaf tests: acc_test: fix typo in talloc ctx name
Change-Id: I80cd70ab0597a6d7d7b5445ddab504a38ac86c7b
2022-04-27 22:21:06 +00:00
Vadim Yanitskiy a985e3370d utils/meas_pcap2db: fix -Wpointer-sign in pcap_cb()
When building with CFLAGS="-flto -Wall", I get the following:

  meas_pcap2db.c: In function ‘pcap_cb’:
  meas_pcap2db.c:64:27: warning: pointer targets in initialization of
                                 ‘const char *’ from ‘const u_char *’
                                 {aka ‘const unsigned char *’} differ
                                 in signedness [-Wpointer-sign]
     64 |         const char *cur = bytes;

Change-Id: I84d8e6f290bda0f03476f182f292ecc7a9e520f2
2022-04-27 12:41:24 +00:00
Vadim Yanitskiy 8951197447 utils/meas_db: fix -Wunused-variable warnings
When building with CFLAGS="-flto -Wall", I get the following:

  meas_db.c: In function ‘_insert_ud’:
  meas_db.c:62:23: warning: unused variable ‘rowid’ [-Wunused-variable]
     62 |         unsigned long rowid;
  meas_db.c: In function ‘meas_db_insert’:
  meas_db.c:89:13: warning: unused variable ‘rc’ [-Wunused-variable]
     89 |         int rc;
  meas_db.c: In function ‘check_create_tbl’:
  meas_db.c:260:16: warning: unused variable ‘rc’ [-Wunused-variable]
    260 |         int i, rc;

Change-Id: Id12958f67a47b6b3ebece7252e4f7c0835d4bb96
2022-04-27 12:41:24 +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 f5183911c8 contrib/jenkins.sh: check osmo_bts_has_feature use
Make sure we don't check against bts->model->features instead of
bts->features by accident.

Related: SYS#5922, OS#5538
Change-Id: I47eef4978aaf9e20fc00a3ca029568671bd09d8d
2022-04-26 12:06:47 +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