aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-01-18Split PCU global PCU object from BTS objectPau Espin Pedrol24-788/+1006
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold both PCU global fields and BTS specific fields, all mangled together. The BTS is even accessed in lots of places by means of a singleton. This patch introduces a new struct gprs_pcu object aimed at holding all global state, and several fields are already moved from BTS to it. The new object can be accessed as global variable "the_pcu", reusing and including an already exisitng "the_pcu" global variable only used for bssgp related purposes so far. This is only a first step towards having a complete split global pcu and BTS, some fields are still kept in BTS and will be moved over follow-up smaller patches in the future (since this patch is already quite big). So far, the code still only supports one BTS, which can be accessed using the_pcu->bts. In the future that field will be replaced with a list, and the BTS singletons will be removed. The cur_fn output changes in TbfTest are actually a side effect fix, since the singleton main_bts() now points internally to the_pcu->bts, hence the same we allocate and assign in the test. Beforehand, "the_bts" was allocated in the stack while main_bts() still returned an unrelated singleton BTS object instance. Related: OS#4935 Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-15gprs_rlc_ts_alloc: ensure no rolling slots are allocatedAlexander Couzens3-15677/+15692
When allocating multiple slots for a UE the following example is not allowed 'UU----UU' for a UE class 12. The time slot number can not roll over 7 and move to 0. 44.060 or 45.002 only specifies contigous however it was unclear it this is an allowed pattern. Only the example 45.002 B.3 in release 12 cleared this up. It gives an example for a multi slot class 5 UE which has 7 possible configuration this means the rolled over is not allowed. Multislot class type 2 UE doesn't have this limitation. Further if a UE supports 8 time slots this is not a limitation because the window size (45.002 B.1) can include all time slots. Releated: SYS#5073 Change-Id: I16019bdbe741b37b83b62749b840a3b7f4ddc6c7
2021-01-14Workaround ASan false positive runtime errors under some platformsPau Espin Pedrol2-4/+7
Under some platforms (RPI4, ARM) container older ASan, it will log false positive log errors which will make unit test fail because then output changes: """ pcu_l1_if.cpp:847:2: runtime error: member access within misaligned address 0xb3f0b78c for type 'struct GprsMs', which requires 8 byte alignment """ The pointer is indeed misaligned, but it's not actually a bug, because the pointer is never derreferenced. That happens during llist_for_each_entry operation where it does cast the pointer but it only checks if the list has actually reached the end. To workaround the issue, simply defer casting it by using llist_for_each instead, where the pointer is assigned only in the case it really points to a GprsMS struct. Change-Id: I149fb42706501eb33f9c6fe48f76a03ddee5954a
2021-01-13contrib/jenkins: don't build osmo-gsm-manualsOliver Smith1-1/+0
Related: OS#4912 Change-Id: If45bb7d4958b200ca6b5d1c5b8a52eba06944909
2021-01-13bts: fix uninitialized memaccess in BTS::send_gsmtap()Vadim Yanitskiy1-1/+1
Change-Id: I7c5105c9e8a2c680dc8b24cc5e3bda6f7405a3ee Fixes: CID#216511
2021-01-13bts: fix uninitialized memaccess in BTS::send_gsmtap_rach()Vadim Yanitskiy1-1/+1
Unfortunately, RACH.ind on the PCU interface contains no Uplink measurements: neiter RSSI nor C/I. In order to avoid sending garbage, let's zero-initialize 'struct pcu_l1_meas'. Change-Id: I8c3210c428da17d23d798f3ef9df941ded6e162a Fixes: CID#216512
2021-01-12gprs_ms: Mark ms_ctrg_desc staticPau Espin Pedrol1-1/+1
Change-Id: I3b1f0d0ee932a97414375a679962356c9178c2eb
2021-01-12AllocTest: Avoid queuing tons of to-be-freed msPau Espin Pedrol1-0/+6
When both TBFs (Dl, Ul), are detached, ms_detach_tbf() will call ms_start_timer() which will hold a reference of the MS (ms_ref()) and wait for X seconds (VTY config, T=-2030, 60 seconds by default) before unrefing the MS, which will trigger ms_update_status() finally (ref==0) and will in turn call cb.ms_idle(), which will tell the ms_storage to free the MS. This mechanism is used to keep MS objects around for a certain time so that when new TBFs are established, we have cached interesting information about the MS, ready to use. However, in AllocTest, tons of MS are allocated in a loop calling a function (such as test_alloc_b_ul_dl()). In that function, a BTS is allocated in the stack and at the end of the function BTS::cleanup() is called due to implicit destructor, which ends up calling ms_storage::cleanup() which removes all MS from its list and frees them *if they are not idle*. The problem here, is that due to T=-2030, an extra reference is hold and hence the ms is not considered idle (ms_is_idle() checks ms->ref==0). As a result, the MS is never freed, because we don't use libosmocore mainloop here (and in any case, it would take 60 seconds to free it). By setting the timeout of T=-2030 to 0, ms_start_timer will avoid using the timer and will also avoid holding the extra reference, hence allowing ms_storage to free the object during cleanup(). This fix really helps in improving performance for AllocTest specially after MS object contains a rate_ctr. As tons of MS objects were left alive, they stood in the rate_ctr single per-process queue, making the test last crazy amount of time and spending 50% of the time or more iterating the list full of MS related rate counters. Change-Id: I6b6ebe8903e4fe76da5e09b02b6ef28542007b6c
2021-01-12ms: Replace struct var with rate_ctrPau Espin Pedrol4-15/+33
Let's use usual osmocom rate_ctr instead of having one variable + setter/getter functions, so we can easily add new counters and also because it makes code more clear (no need to look at what the "update" function is doing). Using rate counter also provides info about how recently the MS has been interacting with the network. Related: OS#4907 Change-Id: I744507fde4291955c1dbbb9739b18a12a80145b1
2021-01-11tbf: remove 'software error' logs from tbf_freePau Espin Pedrol3-22/+0
It is expected that the tbf object is freed at any moment in time, for instance if osmo-pcu drops PCUIF connection with osmo-bts. I couldn't find any reason why it would e dangerous to free the tbf, so let's remove this message. related: OS#4779 Change-Id: I4ab5ccaa5bf6257b18d8fd5ba06baab083821817
2021-01-11tbf: add virtual destructorEric1-0/+1
This ensures spec compliance, because currently the base class destructor would be called through a base class pointer to derived class instead of the most derived one, which ist unexpected and actually undefined behavior in c++11 and beyond. Change-Id: Ic4abde1658a983bb0ccf9a526177dce50ff6dc23
2021-01-06gprs_rlcmac_sched: fix incorrect SBA frame number assignmentVadim Yanitskiy1-1/+1
There is a big difference between: if ((a = foo() != 0xffffffff)) { ... } and if ((a = foo()) != 0xffffffff) { ... } In the first case, 'a' is the result of '!=' operation, i.e. either 0 (false) or 1 (true). In the second case, 'a' will hold the value returned by foo(), and this is exactly what must have been used in gprs_rlcmac_rcv_rts_block(). The bug was there since SBA allocation feature was added in 2012. Change-Id: Ifd607ae8a33382e48f9d9e50a28a4bdf4eaf73a2 Fixes: 07e97cf8a551b05d7f5f3f9583b68b2eff0f1c23 Related: CID#215835
2021-01-05doc: Improve CS/MCS GPRS/EGPRS considerations in User ManualPau Espin Pedrol1-17/+127
Related: OS#4544 Related: SYS#4869 Change-Id: I7b205f5cab5862058a408f628925beb9f0f60a92
2021-01-05.gitignore: ignore files ending with ~Pau Espin Pedrol1-0/+1
I'm lately getting this kind of files in git after building: config.guess~ config.sub~ configure~ install-sh~ Let's ignore them. Change-Id: I976e3a33f638f4cd19650b9c799e61713d73bf8a
2021-01-05tbf: Fix wrong verb used in log messagePau Espin Pedrol1-1/+1
Change-Id: Id9f8df9a5c0e0f88a811c5d7f06821cb4f30ab93
2021-01-05Convert GprsMS and helpers classes to CPau Espin Pedrol32-1903/+1960
As we integrate osmo-pcu more and more with libosmocore features, it becomes really hard to use them since libosmocore relies heavily on C specific compilation features, which are not available in old C++ compilers (such as designated initializers for complex types in FSMs). GprsMs is right now a quite simple object since initial design of osmo-pcu made it optional and most of the logic was placed and stored duplicated in TBF objects. However, that's changing as we introduce more features, with the GprsMS class getting more weight. Hence, let's move it now to be a C struct in order to be able to easily use libosmocore features there, such as FSMs. Some helper classes which GprsMs uses are also mostly move to C since they are mostly structs with methods, so there's no point in having duplicated APIs for C++ and C for such simple cases. For some more complex classes, like (ul_,dl_)tbf, C API bindings are added where needed so that GprsMs can use functionalitites from that class. Most of those APIs can be kept afterwards and drop the C++ ones since they provide no benefit in general. Change-Id: I0b50e3367aaad9dcada76da97b438e452c8b230c
2020-12-30gprs_rlcmac_sched: don't leak a sched_dummy()Alexander Couzens1-1/+0
Change-Id: Iea0fc51809c78514c85e45e7f499a531c4ea1bcf
2020-12-17sched: Convert code handling next_list array to be size independantPau Espin Pedrol1-6/+5
Change-Id: Id209fe66f85501437a79f7ca0c8e3cf816177611
2020-12-17gprs_rlcmac_sched: Use helper structure to store several tbf pointer paramsPau Espin Pedrol1-41/+41
The resulting code is cleaner since it becomes clear the relation between all those pointers, which are set in one function and used in another one, passed through the caller of the former two. Moreover, if more tbf candidates are to be added for other type of actions, having them in a struct is much easier since only one pointer is passed. Change-Id: I55482aa5af7be5a176a7b4879a672ad37e618020
2020-12-16gprs_ns2: set default dialect to ipaccessAlexander Couzens1-0/+1
The default pcu dialect is ipaccess. Keep it that way. Fixes ttcn3 pcu testcases. Change-Id: I426f507fb8863abd8995bc615dc6a6fa7ae69217
2020-12-16ns2: follow ns2 sns api changesAlexander Couzens1-1/+1
Related: OS#4472, OS#4890 Depends: libosmocore.git I71cdbfb53e361e6112fed5e2712236d797ef3ab2 Change-Id: Id530e5497c17885817493f8a8a9436bc187c88aa
2020-12-16ns2: follow changes to add a unique name to all bindsAlexander Couzens1-1/+3
Related: OS#4472, OS#4890 Depends: libosmocore.git I8f1d66b7b3b12da12db8b5e6bd08c1beff085b3e Change-Id: I3638c7204db576116ba2e20dae27539ce6143bd7
2020-12-16ns2: follow ns2 dialect changesAlexander Couzens3-9/+13
NS2 introduce a ns dialect to differentiate between the 4 possible dialects. Related: OS#4472, OS#4890 Depends: libosmocore.git Ia118bb6f994845d84db09de7a94856f5ca573404 Change-Id: I16dc82c38eb75c2b9d1197640a955fec7df84efc
2020-12-12migrate to DLBSSGP as log sub-system for BSSGPHarald Welte5-12/+8
Change-Id: I94864c5fa2688fc91b8b6077a14ad098851afdc7 Depends: libosmocore.git Change-Id I506190aae9217c0956e4b5764d1a0c0772268e93
2020-12-12manuals/gb/ns.adoc: Update documentation regarding SNS capabilityHarald Welte1-14/+65
The SNS capability was added to our Gb stack quite some time ago, but it seems the manual was not updated. Let's update the document accordingly. The individual sub-sections about the SNS-* messages are empty as I think lynxis is currently most qualified to fill them in, I'll ask him to submit a follow-up patch. Related: SYS#5212 Change-Id: I21e891fc7662b582681cd9bd7568e4b65d357751
2020-12-11rlcmac: Fix typo in MT_PACKET_CELL_CHANGE_NOTIFICATION value_stringPau Espin Pedrol1-1/+1
Change-Id: I1b327bf955069ab10b2c6aa643ecf975fa23c1b5
2020-12-10gb manual: NS is implemented in libosmogb, not libosmocoreHarald Welte1-2/+2
Change-Id: Ie833370d9839017cbc508912992fb084ee879fe3
2020-12-10gb manual: 08.16 -> 48.016 / 08.18 -> 48.018Harald Welte3-67/+67
Change-Id: I10505d9aebe65e1f0952df75b13951e2b40d6997
2020-12-01Dl TBF: Get rid of LLC UI dummy blocks following other dataPau Espin Pedrol4-198/+170
According to: * 3GPP TS 44.060 version 16.0.0 "9.3.1a Delayed release of downlink Temporary Block Flow" * 3GPP TS 44.064 version 16.0.0 "6.4.2.2 Unconfirmed Information (UI) Dummy command" LLC UI Dummy frames are to be used when there no more data to send, only in order to delay the release of a TBF. Hence, while not incorrect per se, makes no sense to send those LLC UI Dummy frames inserted into rlcmac blocks which already contain other LLC frames, since the MS in that case is already being kept active. It only makes sense to send those LLC UI Dummy frames when we have nothing else to send, that is, alone inside a RLCMAC block without other LLC frames. Related: OS#4849 Change-Id: Ifae1a7b2b3dfad8df19585063088ba0df2749c8f
2020-12-01NS2: rework handling of unknown primitiveAlexander Couzens1-6/+10
Use prim_str() method to get the human readable string. Define unhandled events with a nop in the switch() Depends-on: Ibf610fbd929dddc4a4e235152447caff522d4eb2 (libosmocore) Change-Id: I50188afb83ac142e22d4bda4e8050eb4de962e70
2020-12-01Implement downgrade to DL MCS1-4 when USF for GPRS_only MSPau Espin Pedrol6-431/+463
In previous status, if USF for GPRS-only MS was selected, then EGPRS TBFs were skipped and either a GPRS TBF was selected or a Dummy Block was sent. That means the behavior was unfair towards EGPRS TBFs, because sometimes they were skipped in favor of GPRS ones. This patch imporves the situation in the above mentioned USF scenario, by first, under specific conditions, allowing selection of an EGPRS TBF and then forcing it to transmit in EGPRS-GMSK (MCS1-4) so that the USF-targeted MS can still decode the USF, while at the same time providing more fairness by allowing the EGPRS TBF to transmit data. The specific conditions mentioned above are, mainly, related to the fact that once a DL data block has been sent, and hence a BSN was assigned to it, it cannot be retransmitted later using another MCS, since lower MCS1-4 wouldn't be able to contain higher MCS RLC payload. The set of conditions could be expanded in the future by also selecting the EGPRS TBF if retransmition is required and the block to be retransmitted was originally transmitted as MCS1-4. Related: OS#4544 Change-Id: I9af23e175435fe9ae7b0e4119ad52fcd4707b9ca
2020-12-01tbf: Log previous TS when changing Control TSPau Espin Pedrol1-2/+2
Change-Id: I5f37f3512dde60e4eb1ccebbb2d96de24604d241
2020-11-26main: generate coredump and exit upon SIGABRT receivedPau Espin Pedrol1-2/+9
Previous code relied on abort() switching sigaction to SIG_FDL + retriggering SIGABRT in case the signal handler returns, which would then generate the coredump + terminate the process. However, if a SIGABRT is received from somewhere else (kill -SIGABRT), then the process would print the talloc report and continue running, which is not desired. Change-Id: I8f02925eedd8855bb58555df20b443f79d5c6da8 Fixes: OS#4865
2020-11-25gprs_bssgp_pcu: follow ns2 library changesAlexander Couzens1-1/+2
Depends-on: I18dfd40a2429cd61b7c4a3dad5f226c64296f7d8 (libosmocore) Change-Id: I056fe624160f2fe01d405690eba5cc0032780837
2020-11-24csn1: Log CSN_VARIABLE_ARRAY values as hexPau Espin Pedrol2-4/+4
Change-Id: If84c4b3cb870068a85405116f1d505ffcff9c26e
2020-11-24csn1: Fix readIndex pointer change in CSN_VARIABLE_ARRAYPau Espin Pedrol4-1/+11
There's actually 3 errors: * Its value should be updated, not the pointer itself * Value should be increased, not decreased * bitvec_read_field() API is already advancing it, no need to do it Fixes: OS#4838 Change-Id: I009abc373794e148091e637ffee80c6461960945
2020-11-23pdch: Log hexdump of decde failure for dl rlcmac blockPau Espin Pedrol1-1/+2
Change-Id: I591212a43bf92984348d1992df8c9b4fdddeba3b
2020-11-23pdch: packet_paging_request: Put back non-fitting paging entry where where ↵Pau Espin Pedrol1-1/+1
it was dequeue_paging() dequeues the first paging (at the start of the list). If a paging request is dequeued but later it cannot be added to the message being sent, it has to be re-added to the list for later processing on next message. However, existing code was enqueueing it at the end, which meant that paging request was delayed for no reason. Change-Id: Iad8e7045267d56e32f42db0fbb8448b1b1185f05
2020-11-17Support multiplexing of GPRS and EGPRS TBFs in one PDCHPau Espin Pedrol3-27/+94
There are some restrictions to have both GPRS-only and EGPRS MS attached to the same MS: * Any MS needs to be able to successfully decode a DL block at least every 18 DL blocks (360 ms). That means a Dl block with CS1-4 must be sent at least once during that time. * Any MS needs to be able to decode USF targeting it. GPRS-only MS can successfully decode USF from DL blocks using GMSK: CS1-4 and MCS1-4. In this patch, if USF of a GPRS-only MS is selected, then all DL EGPRS TBFs are discarded from data block selection. However, this logic can be further improved later by still allowing selection of DL EGPRS TBFs and then forcing construction of a DL EGPRS data block using MCS1-4. Sources: * 3GPP TS 03.64 version 8.12.0 "6.6.4.1.1.2 Multiplexing of GPRS and EGPRS MSs" * 3GPP TS 05.08 version 8.23.0 "10.2.2 BTS output power" Related: OS#4544 Change-Id: Ib4991c864eda6864533363443f76ae5d999532ae
2020-11-17sched: Use correct GMSTAP category for EGPRS DL data blocksPau Espin Pedrol1-5/+7
Change-Id: I3bd8b6a2328e13543b7d4c4a945e86f14ff35bda
2020-11-17sched: Fix sending GSMTAP DL data blocks with unset USFPau Espin Pedrol1-3/+7
Change-Id: Ib5ceb83a85b517ee9bf2c59cf27fe818373abe60
2020-11-17encoding: Fix duplicate word in log strPau Espin Pedrol1-1/+1
Change-Id: Ifb0b359c43e79bab5599625fae20750ae5a6ae54
2020-11-13Fix ctr reports: Remove ctr description from already removed counterPau Espin Pedrol1-1/+0
Recent commit removed the counter enum but forgot to remove the description, so the descriptions were all shifted by 1 counter. Fixes: 133fe4a852b9b6d153001c169c80e736900c9448 Change-Id: I82ee9f36d60a1fd129ae3a864508fcd886e4bfef
2020-11-11Use osmo_fd_*_{disable,enable}Harald Welte2-3/+4
Change-Id: I16563a1033ad12a32104bfee974045ac4302bc74 Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d
2020-11-10TLLI 0x00000000 is a valid TLLI, use 0xffffffff insteadVadim Yanitskiy16-101679/+101689
The assumption that TLLI 0x00000000 is invalid and can be used as the initializer is wrong. Similar to TMSI, 0x00000000 is a perfectly valid value, while 0xffffffff is reserved - use it. According to 3GPP TS 23.003, section 2.4, a TMSI/P-TMSI with all 32 bits equal to 1 is special and shall not be allocated by the network. The reason is that it must be stored on the SIM, where 'ff'O represents the erased state. According to section 2.6 of the same document, a local/foreign TLLI is derived from P-TMSI, so the same rule applies to TLLI. I manually checked and corrected all occurances of 'tlli' in the code. The test expectations have been adjusted with this command: $ find tests/ -name "*.err" | xargs sed -i "s/0x00000000/0xffffffff/g" so there should be no behavior change. The only exception is the 'TypesTest', where TLLI 0xffffffff is being encoded and expected in the hexdump, so I regenerated the test output. Change-Id: Ie89fab75ecc1d8b5e238d3ff214ea7ac830b68b5 Related: OS#4844
2020-11-06tbf_ul: Log mismatching TLLI on log messagePau Espin Pedrol1-2/+2
Change-Id: Ia2ac7062c1f3308a1485da6d769cb8a869fa8100
2020-11-05gprs_ms: Avoid enabling EGPRS if no MCS are supportedPau Espin Pedrol2-1/+8
This patch avoids enabling EGPRS on MS objects if BTS/VTY assigned no MCS supported/available for use. As a result, if NO MCS is enabled/supported EGPRS won't be used despite the MS announcing through EGPRS MS class that it supports EGPRS. Change-Id: Ib19e9e006d851c2147de15f4aec36ab65250bdd3
2020-11-05Fix mcs_is_valid(): UNKNOWN value is not a valid (M)CSPau Espin Pedrol3-1/+4
Also add a few more asserts to make sure a valid CS/MCS is passed in some placed where we expect (M)CS to be set. Change-Id: I0a973e10cd9477f72d8bd47a06048414b33ae96a
2020-11-04Fix configuration of initial_(m)csPau Espin Pedrol3-18/+43
Properly clip initial_(m)cs values to be lower-equal than maximum configured. Regarding initial_mcs, use values provided by BTS, which were not used before. Change-Id: Ifc6bc7c2734d1ae404adc2497afec5366e4f9e50
2020-11-04Get rid of bts->egprs_enabledPau Espin Pedrol6-26/+17
BTS simply notifies the PCU about the supported MCS, and PCU is responsible for providing correct data formatting supported for the BTS and the target MS. Related: OS#4544 Change-Id: Ifcf23771bd23afc64ca6fea38948f98f2d134ecb