aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2021-02-26Remove uneeded ms param from alloc_algorithm_func_t funcPau Espin Pedrol1-5/+2
Since a while ago, the data architecture was changed so that TBF is guaranteed to always have a MS object associated. Hence, it makes no sense to pass the MS object as a separate param as we can take it from tbf object and makes code less confusing. Change-Id: Idc0c76cf6f007afa4236480cdad0d8e99dabec5f
2021-02-26tbf: Improve logging when TBF being allocated or no TBF availPau Espin Pedrol3-50853/+50853
Change-Id: I68491fe2c643262e35b4d4f1ecac34afcf61848f
2021-02-26pdch: Standarize and improve loggingPau Espin Pedrol2-462/+462
Change-Id: I1686a72eb9f9014ed3365376bc43d59d60bee8a5
2021-02-25tbf: Log timeslot allocation failurePau Espin Pedrol2-0/+40
Change-Id: I48fc1eac37eeb74649bfc0888e06afc0079a58f8
2021-02-24Support uplink multi-slot allocationsPau Espin Pedrol3-8622/+7457
Before this patch, allocate_usf() was implemented to only allocate 1 USF per TBF, regardless of the available ul_slot mask. As a result, only 1 slot at max was allocated to any TBF. That's a pity because usual multislot classes like 12 support up to 2 UL slots per TBF (in common TS with DL). This patch reworks allocate_usf() to allocate as many UL multislots as possible (given mslot class, current USF availability, TFI availability, related DL TBF slots for the same MS, etc.). As a result, it can be seen that AllocTest results change substantially and maximum concurrent TBF allocation drops under some conditions. That happens due to more USFs being reserved (because each TBF has now more UL slots reserved). Hence now USF exhaustion becomes the usual limitation factor as per the number of concurrent TBFs than can be handled per TRX (as opposed to TFIs previously). Some of the biggest limitations in test appear though because really high end multislot classes are used, which can consume high volumes of UL slots (USFs), and which are probably not the most extended devices in the field. Moreover, in general the curren timeslot allocator for a given multislot class will in general try to optimize the DL side gathering most of the possible timeslots there. That means, for instance on ms class 12 (4 Tx, 4Rx, 5 Sum), 4 DL slots and 1 UL slot will still be selected. But in the case where only 3 PDCHs are available, then with this new multi-slot UL support a TBF will reserve 3 DL slots and 2 UL slots, while before this patch it would only taken 1 UL slot instead of 2. This USF exhaustion situation can be improved in the future by parametrizing (VTY command?) the maximum amount of UL slots that a TBF can reserve, making for instance a default value of 2, meaning usual classes can gather up 2 UL timelosts at a time while forbidding high-end hungry classes to gather up to 8 UL timeslots. Another approach would be to dynamically limit the amount of allowed reservable UL timeslots based on current USF reservation load. Related: OS#2282 Change-Id: Id97cc6e3b769511b591b1694549e0dac55227c43
2021-02-22Use ALPHA value received in SI13 from PCUIFPau Espin Pedrol1-1/+0
The old VTY command is marked as deprecated and still overrides the use in case it's used. Related: SYS#5358 Depends: libosmocore.git Change-Id I74fb0a3afc1ac4aadbfc609b882d929401f790eb Depends: osmo-bsc.git Change-Id I8b97ea11bad5fe05f2f634945b5703ee9abde81d Change-Id: I46f2a955b157a409055fca7fb917dc4f75482426
2021-02-19tests: Replace deprecated API log_set_print_filenamePau Espin Pedrol11-11/+11
Change-Id: Idcc4875592c81f17ac98c4f6098492b3d9dd33d2
2021-02-19tests: Explicitly drop category from logPau Espin Pedrol7-1/+14
Let's disable category here since we don't care about its formatting here. In any case, every test relying on logging output validation should always explicitly state the config to avoid issues in the future if default values change. Change-Id: I7f9c56313cfaa74ebe666f44763a83d8102f5484 Related: OS#5034
2021-02-16gprs_bssgp: rename gprs_ns_config -> gprs_ns_update_configAlexander Couzens1-1/+1
Improve the naming of the function to match it's purpose. Related: SYS#5354 Change-Id: Ib8e4ae734503fd6f6695d9d6767d809e1bf79d22
2021-01-30tests/rlcmac: add more test vectors for Packet Resource RequestVadim Yanitskiy3-0/+47
All vectors should be valid, since they were generated by an MS. As can be seen, osmo-pcu fails to decode one of the vectors. Change-Id: I37a2ddd394eeffa1cae0f3e419eeee0200a57fcf OS#4955 Change-Id: Ib5677048f5668185ffe752f97c97d5612eee4d72
2021-01-29Introduce NACC supportPau Espin Pedrol1-1/+13
A new nacc_fsm is introduced per MS object, with its partner priv structure struct nacc_fsm_ctx, which exists and is available in the MS object only during the duration of the NACC procedure. The NACC context is created on an MS whenever a Pkt Cell Change Notification is received on Uplink RLCMAC, which asks for neighbor information of a given ARFCN+BSIC. First, the target ARFCN+BSIC needs to be translated into a CGI-PS (RAC+CI) address. That's done by asking the BSC through the Neighbour Resolution Service available in osmo-bsc using the CTRL interface. Once the CGI-PS of the target cell is known, PCU starts a RIM RAN-INFO request against the SGSN (which will route the request as needed), and wait for a response containing the SI bits from the target cell. After the SI are received, the scheduler is instructed to eventually poll a TBF for the MS originating the CCN, so that we can send the SI encapsulated into multiple Packet Neighbor Cell Data messages on the downlink. One all the SI bits are sent, the scheduler is instructed to send a Packet Cell Change Continue message. Once the message above has been sent, the FSM autodestroys itself. Caches are also introduced in this patch which allows for re-using recently known translations ARFCN+BSIC -> CGI-PS and CGI-PS -> SI_INFO respectively. Change-Id: Id35f40d05f3e081f32fddbf1fa34cb338db452ca
2021-01-25Fix Dl EGPRS data blocks being generated occasionally on GPRS TBFsPau Espin Pedrol1-3/+3
Under some circumstances, it could happen that a DL TBF is created as a GPRS TBF due to not yet having enough information of the MS, and only after the TBF is created the PCU gains that information and upgrades the MS mode to "EGPRS". Hence, there's the possibility to run into a situation where a GPRS TBF is attached to a EGPRS MS. It may also happen sometimes that despite the TBF and the MS be EGPRS, there's need to further limit the DL MCS to use, eg. MCS1-4 (GMSK). As a result, when asking for the current DL (M)CS to use, we must tell the MS which kind of limitations we want to apply. The later reasoning was already implemented when GPRS+EGPRS multiplexing was added, but the former was not being checked. Hence, by further spreading through the call stack the "req_kind_mode" we match both cases. Related: OS#4973 Change-Id: Ic0276ce045660713129f0c72f1158a3321c5977f
2021-01-25ms: Properly handle EGPRS_GMSK mode in ms_max_cs_dl/ul()Pau Espin Pedrol1-2/+2
Change-Id: Ied3e02a12145112fafa12282ed7aefa5b0fa6eb6
2021-01-25ms: Set proper initial MCS values setting mode EGPRS_GMSKPau Espin Pedrol1-2/+2
Before this patch, shared logic with EGPRS case would allow keeping MCS>4. Change-Id: I94cbf0c120fd37deb2dfd077d35b3811c7da0675
2021-01-20Allow multiple bts objects in PCUPau Espin Pedrol9-95/+70
This patch doesn't really tests whether osmo-pcu can work on a multi-bts environment, but it prepares the data structures to be able to do so at any later point in time. Change-Id: I6b10913f46c19d438c4e250a436a7446694b725a
2021-01-19Convert osmo_bts_sock.cpp to CPau Espin Pedrol1-1/+1
There's no real point in using C++ there, and using C++ makes the compiler fail to use llist_head in multi-bts patches added later due to: """ 'offsetof' within non-standard-layout type is conditionally-supported """ Change-Id: I8965b5cc5a713e64788b5b6aa183d3035341ddbb
2021-01-19Convert gprs_bssgp_pcu.cpp to CPau Espin Pedrol2-10/+10
There's no real use of C++ in that file, and it causes problems when using llist_head entry macros in future patches adding initial support for multiple BTS in PCU object, so let's move it to plain C. Change-Id: Ic771a89fd78b5e66151a5384f0ff6a8895589466
2021-01-19Get rid of bts singletonsPau Espin Pedrol1-1/+1
There's no BTS single global object anymore, get rid of those APIs. Move users to use "pcu->bts", which will evolve to a linked list in the future. Change-Id: I9cf762b0d3cb9e2cc3582727e07fa82c8e183ec5
2021-01-19Unify BTS into a C usable structurePau Espin Pedrol9-488/+449
Previous work on BTS class started to get stuff out of the C++ struct into a C struct (BTS -> struct gprs_glcmac_bts) so that some parts of it were accessible from C code. Doing so, however, ended up being messy too, since all code needs to be switching from one object to another, which actually refer to the same logical component. Let's instead rejoin the structures and make sure the struct is accessible and usable from both C and C++ code by rewriting all methods to be C compatible and converting 3 allocated suboject as pointers. This way BTS can internally still use those C++ objects while providing a clean APi to both C and C++ code. Change-Id: I7d12c896c5ded659ca9d3bff4cf3a3fc857db9dd
2021-01-18Move ws_* fields from BTS to PCUPau Espin Pedrol1-10/+8
Change-Id: I997bc52f0d924c8f2a0b1d6cf23af98828ad4258
2021-01-18tests/tbf: Allocate PCU per test instead of globallyPau Espin Pedrol1-33/+58
Otherwise some state may be left from one test to another. Change-Id: I18e2fe7dd1cc5940570252a2a6a106de49d8a7dd
2021-01-18Move fc_* fields from BTS to PCUPau Espin Pedrol1-1/+1
Change-Id: I816d49e732d0fc7a3c9aa1f0e9a83b83d25e6a32
2021-01-18Move cs_downgrade_threshold field from BTS to PCUPau Espin Pedrol2-9/+5
Change-Id: I3e1c65eb3cccff565d5d84588bdce93a47909a0f
2021-01-18Move cs_adj* fields from BTS to PCUPau Espin Pedrol1-1/+1
Change-Id: I2b00a83279dccd4feeeeb95e34878c4405e7972c
2021-01-18Move dl_arq_type field from BTS to PCUPau Espin Pedrol1-10/+4
Change-Id: I0b82ab59edd58d60e5581c707dc49f58de0ba203
2021-01-18Move alpha,gamma fields from BTS to PCUPau Espin Pedrol1-1/+1
Change-Id: I2fdd9c8a7393157183fff64084bb10e2a3b1dc63
2021-01-18Move T_defs_pcu from BTS to PCU objectPau Espin Pedrol1-12/+9
Change-Id: I0cac5c12dff2e90b52d00383a00b4b94a9603a0a
2021-01-18Split PCU global PCU object from BTS objectPau Espin Pedrol10-524/+618
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 Couzens2-15675/+15675
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-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-11tbf: remove 'software error' logs from tbf_freePau Espin Pedrol1-5/+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-05Convert GprsMS and helpers classes to CPau Espin Pedrol8-417/+421
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-12migrate to DLBSSGP as log sub-system for BSSGPHarald Welte1-2/+1
Change-Id: I94864c5fa2688fc91b8b6077a14ad098851afdc7 Depends: libosmocore.git Change-Id I506190aae9217c0956e4b5764d1a0c0772268e93
2020-12-01Dl TBF: Get rid of LLC UI dummy blocks following other dataPau Espin Pedrol1-138/+78
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-01Implement downgrade to DL MCS1-4 when USF for GPRS_only MSPau Espin Pedrol1-411/+411
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-11-24csn1: Log CSN_VARIABLE_ARRAY values as hexPau Espin Pedrol1-2/+2
Change-Id: If84c4b3cb870068a85405116f1d505ffcff9c26e
2020-11-24csn1: Fix readIndex pointer change in CSN_VARIABLE_ARRAYPau Espin Pedrol3-0/+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-10TLLI 0x00000000 is a valid TLLI, use 0xffffffff insteadVadim Yanitskiy7-101654/+101654
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-04Get rid of bts->egprs_enabledPau Espin Pedrol3-14/+0
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
2020-11-04tbf_dl: Don't fake EGPRS MS class when no related info is availablePau Espin Pedrol2-4/+22
For instance if PCU received DL data to be sent to an MS from an SGSN, and the MS is not currently cached in the PCU (because there's no TBF active for it), it will page it and transmit the DL data to it. The SGSN is capable of sending (EGPRS) MS Class information in that same DL data message, so it's the one responsible for providing that information if not available at the PCU. In the PCU if we don't have information about that MS and SGSN didn't provide us information about it, we cannot assume the MS is going to be EGPRS capable and even less expecting a specific EGPRS MS class. So let's drop this code. Related: OS#4544 Change-Id: Icce66cadb51af25ae0c3b3719940eccb548fe33b
2020-11-04Move EGPRS MS mode set to gprs_ms.cppPau Espin Pedrol5-62/+65
Some tests were wrong (TypesTest) and required modification, since they were setting a EGPRS MS but then expecting a GPRS assignment. Change-Id: I9d3ee21c765054a36bd22352e48bde5ffca9225a
2020-11-04pcuif: Improve BTS-supported CS/MCS handlingPau Espin Pedrol1-1/+1
Take into account the MCS values supported by the BTS. In osmo-bts, in general all MCS are enabled if "mode egprs" is selected in BSC, and none otherwise. Change-Id: Ie8f0215ba17da1e545e98bec9325c02f1e8efaea
2020-11-04Move BTS initial values inside bts.cppPau Espin Pedrol5-257/+59
This way everytime any program or test initiates a BTS object, the bts_data structure has the same values. Change-Id: Iffd6eecb1f08bda0091f45e2ef7c9c63b42e10b3
2020-10-30cosmetic: tests: pcu_emu: fix trailing whitespacePau Espin Pedrol1-1/+1
Change-Id: I889498c75a78fd8aa406cff5600e4773785782de
2020-10-29tbf_dl: Update (egprs_)ms_class for already known MSPau Espin Pedrol1-7/+7
If SGSN provides us with MS class information upon DL data, let's use it and set it in an already existing MS object if not yet known. Also remove all unneeded code passing ms_class to append_data() which would simply try to (again) set the ms_class. Change-Id: I4979c9344bffd3ba7657bbab94981d233eab801f
2020-10-29bts: define egprs_enabled as boolPau Espin Pedrol1-12/+12
Change-Id: I66a8254ee392ad75226c58b7df5746f409463f0f
2020-10-29alloc_algo_b: Select TRX with least assigned TFIs during TBF allocPau Espin Pedrol2-90/+46
Before this patch, it would always allocate all TBFs on the first TRX until all TFIs were filled, then second, and so on. But it would actually fail around 8th MS requesting an UL TBF because despite a TFI was successfuly assigned, because all USFs were already exhausted for that PDCH. Related: OS#1775 Change-Id: Iccfc8acfbfdc258ed16cc5af01f12b376fe73b72
2020-10-29tbf: Clean up gprs_rlcmac_dl_tbf::handle()Pau Espin Pedrol2-231/+233
Avoid passing tons of params to internal helper function tbf_nel_dl_assignment() in order to either fetch again the ms object or create a new one. Let's instead create the ms function earlier if needed and fill it with all the discovered information prior to calling the helper function. This provides cleaner code and also better log output. This way we also avoid trying to fill the MS twice and unneeded getter+setter for TA. tbf::imsi(): There' always an ms, so simply forward call to ms()->imsi(). We can also get rid of assign_imsi, since the modified code is the only place where it's used and there's already some code in place there to update the MS. We instead merge it with set_imsi and keep the duplication code to catch possible bugs from callers. Move merge_and_clear_ms from tbf class to GprsMS, where it really belongs. Change-Id: Id18098bac3cff26fc4a8d2f419e21641a1f4c83b
2020-10-26tests: ms: Pass correct pointer in constructor instead of NULLPau Espin Pedrol1-1/+1
The BTS field will be used in code paths after next patch changes, otherwise the test fails accessing the NULL pointer. Change-Id: I5098292bdafa9f4f70fef1a053b80a33deca722c
2020-10-24tbf: Set MS during constructor timePau Espin Pedrol4-12990/+12995
This is another step forward towards a more clear data model where a TBF always has a MS object (which may be lacking some information, and at a later point when more information is found, it may actually be a duplicated MS object and hence one duplicate removed and the TBF moved to the object being kept). This helps for instance in removing duplicated information stored in the TBF which is really per MS, like ms_class, ta, etc. Since there's always a MS object there's no need to keep a duplicate in both classes in case there's no MS object. It can already be seen looking at unit test logging that this kind of data model already provides better information. Some unit test parts were needed to adapt to the new model too. Change-Id: I3cdf4d53e222777d5a2bf4c5aad3a7414105f14c