aboutsummaryrefslogtreecommitdiffstats
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2022-06-22bts_chan_load(): also calculate per-TRX channel loadVadim Yanitskiy1-0/+1
This is required for the upcoming dynamic channel allocation mode. Change-Id: I220145238c23135f7e68ca2d474764312ffb66c5 Related: SYS#5460
2022-06-17stats: track TCH/SDCCH lchans reaching fully-established stateMichael Iedema1-0/+2
When calculating average lchan duration based on the new stats for BTS_CTR_CHAN_{TCH,SDCCH}_ACTIVE_MILLISECONDS_TOTAL there are discrepancies which emerge. Specificially in bandwidth-constrained environments, there are still-unknown failure states which can occur that cause the TCH or SDCCH activity count to increment but zero milliseconds of activity on the lchan to accumulate. This portrays a failure as a success. These new fully-established stats are intended to provide a more accurate denominator when calculating average lchan duration as they are incremented in proximity to the duration timestamp initialization. Change-Id: I417940ad9479719f5324fb12d45883cd3cb2c578
2022-06-16smscb: Base cell operational life cycle on CBCH being operativePau Espin Pedrol1-1/+3
This allows running CBCH/ETWS related procedures only when the CBCH towards MS under that cell is operative. This also allows providing awarness of per-cell status to the CBSP peer as required per specs. Related: SYS#5910 Change-Id: Ia93919be94132fc010acb5bbfef0a6fd51c42981
2022-06-15Expand VTY option which controls use of TCH for signallingMichael Iedema1-3/+9
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-10Move all SMSCB/CBC vty code to its own filePau Espin Pedrol1-2/+4
This way we separate all the VTY boilerplate from the actual logic, as we usually do in all other subsystems. Change-Id: Ifc7d1693d745dd2a3c31e3ee9610d8c634b50812
2022-06-02fix performance for chan_counts and all_allocated statsNeels Hofmeyr5-4/+48
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-02code cleanup for all_allocated timers, no functional changeNeels Hofmeyr3-9/+11
Reduce some code dup in all_allocated accounting and cosmetically prepare for upcoming performance fix. Have a struct all_allocated, allow easy re-use of function all_allocated_update(). Rename function to all_allocated_update_bsc(). Upcoming patch will also add all_allocated_update_bts(). Related: SYS#5976 Change-Id: Id7a82c65d56a87818fc35bbeedf67e2af2f89f11
2022-05-23stats: new trackers for lchan life duration (v2)Michael Iedema2-0/+12
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: Ie3771233ecbd4bc24a24fb22c1064a18e7b8b2b0
2022-05-15smscb: "Warning Security Information is always present in ETWSHarald Welte1-1/+2
As per TS 48.049 Table 8.1.3.1.1 the WRITE-REPLACE message always has a Warning Security Information IE if it relates to ETWS. This is also implemented in the libosmocore CBSP parser. As the previous Change Id369bb3676ba279bafc234378fbe21dbc7b0614b has pointed out, the CBSP parser structure doesn't even permit any way of handing a decoded message to us without the warning_sec_info static struct member. So as a result, there's also no need to dynamically allocate bts_etws_state.input.sec_info via talloc. We can have it in-line as a static struct member and reduce code complexity and runtime memory allocations. Change-Id: Ib1b8e4af37b1f9f9398b81dad29942e82218c70b
2022-05-13paging: start/stop credit_timer based on C0 runningPau Espin Pedrol1-0/+2
This way we avoid triggering timers and doing extra poll loops for each BTS which is configured but not up. It also has the effect of removing logging about estimating paging buffers for BTS which are down, which can be confusing. Furthermore, since work is delayed until the TRX and cell in general is configured, the first estimation is properly done now since the correct configuration is in place at that time. Related: SYS#5922 Change-Id: I1b5b1a98115b4e9d821eb3330fc5b970a0e78a44
2022-05-13Introduce new signal S_NM_RUNNING_CHG and implement it for rcarrier,bbtranscPau Espin Pedrol2-0/+16
This allows different parts of the code to hook to some signals which allow start/stopping processes based, for instance, on whether C0 is available or not. This can be later used by paging or CBSP code. Also ACC code can be ported to this new system (acc_ramp_nm_sig_cb()). Same signal can be used for other NM objects, but is left unimplemented until there's use for them. Change-Id: I206d4c7863a77fbab6a600126742a6a6b8fc3614
2022-05-13smscb: Send ETWS PN to BTS if ETWS active before BTS connectsHarald Welte1-0/+1
Especially during emergencies / natural disasters, it is particularly likely that networks become unreliable and BTSs disconnect and reconnect. If upon reconnect there still is an active ETWS/PWS emergency message active for this BTS, send it to the BTS to ensure it re-starts broadcasting that message until disabled. Change-Id: I175c33297c08e65bdbf38447e697e37f8a64d527
2022-05-12Revert "stats: new trackers for lchan life duration"Pau Espin Pedrol2-5/+0
This reverts commit 5e2ac29703b4b05f202734698fecdb04b4461bd8. This patch was found to be a troublemaker regarding osmo-bsc performance, since it's scheduling one timer every 100ms for each channel. On a BSC with dozens of BTS, each with several TRX, this ends up in a huge amount of timers scheduled in a tight timeframe, which ends up in osmo-bsc spending CPU time getting in and out of the poll() main loop. Related: SYS#5922 Change-Id: Ibd5123e7f04ae8f4eb8f08b63525527f526f0b2c
2022-05-09Add stat_item for per-bts [dynamic] T3113 timerHarald Welte1-0/+1
This allows external monitoring to see where the T3113 timer has been adjusted to, in case it is set dynamically. Change-Id: I533f2ca3c8e66c143154cbf03b827c9cbbacccdf
2022-05-09paging: Avoid queueing more than 60 second estimated requestsHarald Welte2-0/+3
Reaching this point will only make system load (CPU, mem) grow, making it hard for the process to keep up with work to do, with no benefit since the requests will anyway be scheduled too late. Related: SYS#5922 Change-Id: I6523c6816a4d16b71084d004e979be40cf0aeeb0
2022-05-06paging: Fix recalculate work timer if waiting for retransPau Espin Pedrol1-0/+3
We want to recalculate the timer based on last time the work_timer was triggered (that is, the time when the worker re-armed the pag req to retransmit). We don't want to recalculate based on the last time the pag ret tro retransmit was scheduled. In loaded paging queue, there's lots of retrans (let's say 200) and it may take more than 500ms to actually retransmit them. That means in most cases we could end up in a situation where only pag req to retrans where in the queue, hitting this recalculate path. Since the 500ms were for sure elapsed, that would most probably schedule the work_timer at {0,0} for each new paging request that arrived. As a result, the worker would be scheduled lots of times per second (once for each new req arriving) and only submitting 1 pag req (the new one) plus potentially 1 or serveral pag req to retransmit. In summary, there was not throthling applied in the scenario where only pag req to retransmit where in the queue and new pag reqs kept arriving. This incurrs into augmented paging throughput and also augmented frequency of polls(). Related: OS#5922 Fixes: 4821c9f4dff3cb9d06ee8392de18fd7c63399bf0 Change-Id: I7ce6f436286b50dc31331d218ff256cf7be3f619
2022-05-06nm_statechg_signal_data: Convert state ptr to dataPau Espin Pedrol1-2/+2
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-06acc: Fix erratic ramping behavior when several BTS configuredPau Espin Pedrol1-0/+2
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-05constify state pointers of struct gsm_nm_statePau Espin Pedrol1-2/+2
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-05abis_nm: Merge signals S_NM_STATECHG_ADM and S_NM_STATECHG_OPERPau Espin Pedrol1-2/+2
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-03stats: new trackers for lchan life durationMichael Iedema2-0/+5
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-02Check VTY config against features reported by BTSOliver Smith1-2/+9
* 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-04-28paging: Increase T3113 based on paging group load in BSC queuePau Espin Pedrol1-0/+2
Related: OS#5536 Change-Id: I904c008222ddc3d92843d87fb3182c30b484c8a2
2022-04-28paging: Improve loggingPau Espin Pedrol1-2/+2
Change-Id: I8a83352d6f2370bafa5acb0caba6b2f352263b5c
2022-04-28paging: Decouple retransmit period from regular worker intervalPau Espin Pedrol1-0/+2
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-28paging: Estimate available_slots based on BTS config when no CCCH Load Ind ↵Pau Espin Pedrol1-0/+2
received Related: OS#5537 Change-Id: I2df68e10eb549d62765ad3b25429f7fe2d5bb0b9
2022-04-28smscb: Store ETWS input state from CBSPHarald Welte3-1/+24
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-27bts: Make sure paging timers are deleted when struct gsm_bts is freedPau Espin Pedrol1-0/+1
Change-Id: If8dffc948a3a9d8bdd9237f644e7f10f41c64853
2022-04-27Introduce VTY command 'ccch load-indication-period <0-255>'Pau Espin Pedrol1-1/+3
Change-Id: Id9d23238863c02a72bcf32942f6b0d40be127904
2022-04-26gsm_data: add gsm_set_bts_modelOliver Smith1-0/+1
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-25emerg call: send BSSMAP Clear Req cause as preemptionNeels Hofmeyr1-0/+1
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-25bts: Use uint8_t instead of int for ccch_load_ind_threshPau Espin Pedrol1-1/+1
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-25Rename functions generating OML SetAttr messagesPau Espin Pedrol1-5/+5
Its name is totally misleading, since they seem to be related to GetAttributes messages rather than SetAttributes. Change-Id: I306cb407dbd9b98e301b5d93046bdadcb466b82b
2022-04-25Move struct gsm_bts_paging_state to paging.hPau Espin Pedrol3-20/+21
Change-Id: I8c058d308fc816828b5e6a86e7c5a1f629a2d7c4
2022-04-21bts: Simplify bts->paging initializationPau Espin Pedrol1-0/+2
Related: SYS#5922 Change-Id: Id103d5f3d437065abcd32788caef339343b1e96
2022-04-08Move power control related definitions to power_control.hVadim Yanitskiy3-92/+93
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-03-31hodec2: add penalty-time low-rxqual-hoNeels Hofmeyr1-0/+7
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-29struct gsm_encr: store alg_id in human-readable formatVadim Yanitskiy2-2/+3
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-22BSSMAP LE: handle optional LCS {Client Type, QoS} IEsVadim Yanitskiy1-0/+6
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-22BSSMAP LE: fix handling of LCS Client Type IEVadim Yanitskiy1-0/+3
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-14gsm48_make_ho_cmd(): optionally add Synchronization Indication IEVadim Yanitskiy1-1/+1
Change-Id: I4e5b1163a71443d706f14ce4bfd5c2294c320432 Related: SYS#5838
2022-03-13gsm48_make_ho_cmd(): optionally add Cipher Mode Setting IEVadim Yanitskiy1-0/+3
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-13gsm48_make_ho_cmd(): make 'struct gsm_lchan' pointer constVadim Yanitskiy1-1/+2
Change-Id: I731179bf7f5d711ca114e36af661faccf0caa19f
2022-03-13gsm48_send_ho_cmd(): this function is not used, remove itVadim Yanitskiy1-2/+0
Change-Id: I9771d7e1f2073ebf6d900c067885485e54790bca
2022-03-09fix typo in name of BSS_MAP_MSG_ASSIGNMENT_RQSTNeels Hofmeyr1-1/+1
Historically, we first only had BSS_MAP_MSG_ASSIGMENT_RQST ^ with missing N. libosmocore has this renamed a long time ago and provides a shim #define that makes the typo version still work. Having the typo is bad for grepping, so rather use the non-typo name. Also rename the constant for the ass req counter which so far has a similar typo, and fix the same typo in the counter description. The counter name exposed on CTRL luckily doesn't have this typo in it. Change-Id: Ieaa4f4e6e6f7e1563b1bd15a83f0c1a9112d2312
2022-03-09support "empty" SCCP N-Connect from MSCNeels Hofmeyr1-0/+1
Teach osmo-bsc to handle empty N-Connect. So far we were always expecting user data in an SCCP N-Connect from an MSC. However, it is perfectly valid for an initial BSSMAP request to follow later. This is relevant for: - Handover Request (incoming inter-BSC handover) - Perform Location Request (query physical location of the MS) Add state WAIT_INITIAL_USER_DATA with new timeout net X25. Always enter this state so that we don't have two separate code paths for handling initial user data. Related: SYS#5864 Change-Id: I535c791fa01e99a2226392eb05f676ba6c3cc16e
2022-03-09add counter for inter-BSC incoming Handover RequestNeels Hofmeyr1-0/+1
Related: SYS#5864 Change-Id: Icdde2bb339a5e367a4d297802214a1ef3f36eefa
2022-02-22fix inter-BSC-in handover encryptionNeels Hofmeyr1-0/+4
In the field we saw Handover Requests without any Chosen Encryption Algorithm IE, and osmo-bsc completely failed on those. This made me understand my mistake from when I wrote this handover code. So far, from a BSSMAP Handover Request, we (I) used only the Chosen Encryption Algorithm IE to pick the encryption to use on the target lchan. That is very wrong. Instead, figure out the intersection of permitted algorithms MSC & BSC, and pick the best of those. Which means, actually, completely ignore the Chosen Encryption Algorithm IE. In the message, the permitted algorithms are passed as a bitmask. The current code using gsm0808_dec_encrypt_info() passes this on as an array. In order to select_best_cipher(), I could convert that array back to a bitmask. Instead pass the bitmask on from message decoding alongside the struct gsm0808_encrypt_info in req->ei_as_bitmask. In handover_end(), change the condition so that we can also pass HO_RESULT_FAIL_RR_HO_FAIL to emit a Handover Failure. Related: SYS#5839 Change-Id: Iffedc981b60d309ed2e5decd5efedee07a757b53
2022-02-18rename RSL_ENC_ALG_A5 to ALG_A5_NR_TO_RSL, clarifyNeels Hofmeyr1-1/+18
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-01-21fix two comments in chan_counts.hNeels Hofmeyr1-2/+2
An earlier patch version had that typedef, the merged version switched to the struct containing the array. Change-Id: Id8ca7b298436feb98f4a563ad3cdea510b9362b0