aboutsummaryrefslogtreecommitdiffstats
path: root/tests/llc
AgeCommit message (Collapse)AuthorFilesLines
2023-06-29Reestore last LLC frames never completely acked when freeing DL TBFPau Espin Pedrol1-5/+4
Scenario: A DL TBF is assigned over PCH (CCCH) and we start transmitting DL data blocks blindly after X2002, but at the same time the MS start packet-access-procedure to request an UL TBF. Right now osmo-pcu correctly detects the MS is available in PDCH and re-assigns a DL TBF using PACCH, but the LLC frames it transmitted in the old PCH-assigned DL TBF get lost when that older TBF is freed (because the DL blocks were removed from the GprsMs llc_queue). This issue is now more frequent since X2002 timer was added recently to delay starting requesting USF for a UL TBF, hence the contention resolution in general takes more time and hence the PACCH assignment of the DL TBF takes more time too, so more DL data blocks are transmitted to the DL TBF assigned over PCH during that time. This patch improves the situation to at least recover the DL blocks transmitted if the DL TBF is freed (due to MS merge trigger by scenario mentioned above), where no DL ACK/NACK was ever received by the MS. Ideal solution would be to have complete tracking of which LLC PDUs from the llc_queues were completely ACKed at RLC/MAC level, but that really requires a lot of work and major refactoring, which are left as a future improvement. Change-Id: I9be4035fb2cf2b3ee56e91dcc12cc8c24028b4aa
2023-05-03pcu_l1_if_phy: fix API function namesPhilipp Maier1-2/+2
The functions l1if_open_pdch and l1if_close_pdch have a misleading naming since what they actually do is opening and closing the TRX since they return and accept a context (obj) that is valid for a whole TRX. This also explains why the other functions accept a timeslot as parameter in addition to the context. Let's rename those functions so that it is clear what they do. Related: OS#6022 Change-Id: I395a60b2fba39bac4facec78989bac20f0cef0d3
2023-04-21ms: Hold a reference during ms_allocPau Espin Pedrol1-3/+3
Make the caller hold a reference to the MS object just allocated, so that it hs to explicitly unref it and, in turn, if no new references were added during its use, trigger release of the MS object. This is useful to avoid leaking MS object if it was allocated and then no TBF is attached to it because allocation of TBF failed. Related: OS#6002 Change-Id: I2088a7ddd76fe9157b6626ef96ae4315e88779ea
2023-04-20Merge bts_alloc_ms() and ms_alloc()Pau Espin Pedrol1-3/+3
gprs_default_cb_ms_idle() is changed to have the same implementation as previous bts_ms_idle_cb(), since that's the only one being used in osmo-pcu code. It makes no sense to use different callback logic in unit tests. This is another step towards simplifying the code and getting rid of the idle/active_cb(). Change-Id: I2a06d17588572a21dc5a14ddbde83766076b446d
2023-04-20ms: Drop setting (egprs_)ms_class during bts_alloc_ms()Pau Espin Pedrol1-3/+3
That information is not required during allocation of the object, and most times it is not known. Defer setting it only to meaningul values in paths obtaining the information from peers. Change-Id: I36f07dc389f7abe205fc4bcddbde93735f5d5cfc
2023-02-27pcu_l1_if_phy: add new PHY API function to disconnect PDCHPhilipp Maier1-0/+1
There is a function l1if_connect_pdch, but no complementary function like we have it with l1if_open_pdch and l1if_close_pdch. The reason for this is that the PHY implementations that rely on a femtocell DSP do not need to disconnect the pdch explcitly. However, the planned support for the E1 based Ercisson RBS CCU will require an explicit disconnect. So lets add a function call for this. Change-Id: Ied88f3289bda87c48f5f9255c4591470633cc805 Related: OS#5198
2022-04-05tests/llc: Add test_llc_codel2022q1Pau Espin Pedrol3-0/+82
Related: OS#5508 Change-Id: I9c87b65496a6fe0187a1bc9f3419e2d7269e66f0
2022-04-05tests/llc: Add test_llc_meta_pdu_life_expirePau Espin Pedrol3-0/+44
Related: OS#5508 Change-Id: I7ba6be32778e2c2b22723db10fa66655812c8452
2022-04-05llc_queue: Refactor to handle codel_state per prio queue internallyPau Espin Pedrol1-61/+76
A CoDel state per prio queue is needed, otherwise the sojourn time state is not properly reset when a high prio packet is dequeued. If we have a global codel state shared for all prio queues of an MS, then basically high prio (GMM) packets will "never" be dropped because they are handled/dequeued way quicker, so it's sojourn time will be below the threshold most probably, stopping the "dropping" state for the rest of lower prio packets. The handling of different codel states is moved from MS object to the llc_queue, also offloading already loaded dl_tbf.cpp in the process. This will also allow in the future setting different CoDel parameters for different priority queues if needed. Tests need to be adapted since now the CoDel and PDU lifetime are incorporated into the llc_queue_dequeue(). Also because dequeue now also accesses related MS fields. Related: OS#5508 Change-Id: I2bce2e82ab6389d8a70130a5c26a966a316b0fa4
2022-03-31llc: Convert to CPau Espin Pedrol1-2/+2
There's no real reason (other than historical) why code in llc should be kept as c++ code. Let's rewrite it as C so that it can be included by existing C code without having to add C->C++ shim, ifdefs all around, etc. This simplifies code and easies modification/improvement of the related objects. Change-Id: I250680ba581167d7398b2f734769c756cbb61c48
2021-02-19tests: Replace deprecated API log_set_print_filenamePau Espin Pedrol1-1/+1
Change-Id: Idcc4875592c81f17ac98c4f6098492b3d9dd33d2
2021-01-05Convert GprsMS and helpers classes to CPau Espin Pedrol1-40/+40
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-03-16Use clock_gettime(CLOCK_MONOTONIC) and timespec everywherePau Espin Pedrol1-19/+21
We should really be using monotonic clock in all places that gettimeofday is used right now. Since clock_gettime() uses timespec, let's move all code to use timespecs instead to avoid having to convert in several places between timespec and timeval. Actually use osmo_clock_gettime() shim everywhere to be able to control the time everywhere from unit tests. Change-Id: Ie265d70f8ffa7dbf7efbef6030505d9fcb5dc338
2020-03-11tests/llc: Change unrealistic time jump to avoid runtime error under ARMPau Espin Pedrol1-2/+2
When running the test under a RaspberryPI4: +../../../src/llc.cpp:216:29: runtime error: signed integer overflow: 864197544 * 1000 cannot be represented in type 'long int' 864197544 comes from comparing initial insertion time and dequeue time (test does a big jump in time): 987654321 - 123456777 let's use more realistic time changes, since the current one account for about 37 years. Change-Id: I28abc9192e0e7c590bc1c3c88950627cf669ffaf
2020-03-02llc_queue::{dequeue,enqueue}() refactorPau Espin Pedrol1-36/+44
As seen in OS#4420, setting the MetaInfo.recv_time outside of llc_queue before calling llc_queue::enqueue() and later on using that value in llc_queue itself at dequeue time is not a good idea, since it can provoke errors if the recv_time was not set correctly. For instance, LlcTest was not setting the value for recv_time on some test, which ended up with a huge millisec value when substracting now() from it: """ llc.cpp:215:29: runtime error: signed integer overflow: 1582738663 * 1000 cannot be represented in type 'long int' """ This issue only appeared when started building on a raspberrypi4. Let's better set/store the MetaInfo.recv_time internally during llc_queue::enqueue(). Then, enqueue() only needs the MetaInfo.expire_time, so let's change its arg list to only receive that to avoid confusions. Take the chance to move the llc_queue APIs to use osmo_gettimeofday, since we need to fake the time now that the API itself sets that time. Also take the chance during this refactor to disallow passing null pointer by default since no user needs that. Finally, update the LlcTest accordingly with all API/behavior changes. Related: OS#4420 Change-Id: Ief6b1464dc779ff22adc2b02da7a006cd772ebce
2019-08-05Remove undefined param passed to {logging,osmo_stats}_vty_add_cmdsPau Espin Pedrol1-1/+1
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its parameter removed (c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7). However, definition in C file doesn't contain "(void)", which means number of parameters is undefined and thus compiler doesn't complain. Let's remove parameters from all callers before enforcing "(void)" on it. API osmo_stats_vty_add_cmds never had a param list but has seem problem (no "void"), so some users decided to pass a parameter to it. Related: OS#4138 Change-Id: Ic1ac815eafab49577ff883a5d700ecca5936d216
2019-03-06Use msgb_eq_data_print() in testsMax1-6/+3
This allows to see exact byte which differs with expected output in case of test failure. Change-Id: If1285649b27843d68dfaa6f6dd3b80deee9aa148
2018-04-01use osmo_init_logging2() with proper talloc ctxNeels Hofmeyr1-1/+1
There is a duality of initialization: early_init() in bts.cpp wants to init logging even before static instances get initialized. Make sure that tall_pcu_ctx is initialized during early_init() as well. There is a build context that does not seem to include bts.cpp (osmo-pcu-remote), so to be sure, init tall_pcu_ctx as NULL and both in early_init() as well as pcu_main.cpp, init both tall_pcu_ctx and logging if it is still NULL. Change-Id: I2199b62d0270bd35dec2283e8f5b364b7c63915b
2018-03-11implement support for 3-digit MNC with leading zerosNeels Hofmeyr1-0/+1
Receive the mnc_3_digits flag from the PCU interface. Bump the PCU interface to 9. This is one part of the three identical pcuif_proto.h patches: - I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts) - I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu) - I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc) Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout the code base to be able to handle an MNC < 100 that has three digits (leading zeros). Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore), Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore) Change-Id: I787fed84a7b613158a5618dd5cffafe4e4927234
2017-10-29tests: Don't use private version of log_info but global gprs_log_infoHarald Welte1-18/+3
There's no need for each test case to carry their own log_info and filter function. They can simply use the global gprs_log_info and configure the stderr log verbosity according to their needs. Change-Id: I8706a624e5d06e062d1198711aa197fbd0860769
2017-02-08Fix dozens of compiler warnings across the boardNeels Hofmeyr1-2/+2
Change-Id: I166109dc05d3323b92cd2a42f0c7e6009950e15d
2015-08-21llc: Add move_and_merge method to llc_queueJacob Erlbeck3-0/+58
This methods takes all LLC frames from the old LLC queue and moves them into the current. If both queues are ordered chronologically (recv_time), the resulting queue is also ordered. Sponsored-by: On-Waves ehf
2015-06-29llc/test: Use a portable way to set timeval variablesJacob Erlbeck1-8/+12
Using complex initialiser lists doesn't seem to work well with Debian Squeeze. This commit changes the initialisation to use separate assignments instead. Fixes: Jenkins #601, #602 Addresses: CXX LlcTest.o ../../tests/llc/LlcTest.cpp: In function 'void test_llc_meta()': ../../tests/llc/LlcTest.cpp:137: error: expected primary-expression before '.' token ../../tests/llc/LlcTest.cpp:137: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x Sponsored-by: On-Waves ehf
2015-06-22llc: Move storage of timestamps into gprs_llc_queueJacob Erlbeck3-25/+58
Currently the receive and expiry timestamps are prepended to the LLC msgb before it is passed to gprs_llc_queue::enqueue(). Since this meta information should not be counted as LLC octets, the gprs_llc_queue needs to known about this (unless the correction was done in the LLC layer). This commit moves the meta information storage code into gprs_llc_queue. The meta data is now stored in the control block (cb) area of the msgb. Note that the info pointer that is returned from the dequeue method is only valid if that method returns a (non-NULL) msgb. It must not be used after that msgb has been modified or freed. Sponsored-by: On-Waves ehf
2015-06-22llc: Keep track of the number of stored LLC octetsJacob Erlbeck1-0/+7
To get the number of LLC octets that are stored in the queue, this commit adds a m_queue_octets member along with a octets() method. This value is updated similarly to m_queue_size on each modifying method call. Sponsored-by: On-Waves ehf
2015-06-22llc/test: Add test program for LLC related testsJacob Erlbeck3-0/+179
Sponsored-by: On-Waves ehf