aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_utils.h
AgeCommit message (Collapse)AuthorFilesLines
2023-06-03Document pcu_lsb() functionPau Espin Pedrol1-0/+3
While at it, fix a typo in the test output. This function is nowadays only used in ms_current_pacch_slots(), which is used only to print the PACCH TS (the first common UL & DL TS). Change-Id: Id1d0b681f6866618f9f3a8c64d6a6c809ca50ea7
2023-06-03pcu_utils.h: Replace software based bitcount impl with gcc builtinPau Espin Pedrol1-9/+2
The cast for different types it's not really needed, simply use the unsigned long long version to make sure we don't drop 1s, in any case __builtin_popcountll() will be quicker than what we used to have. Change-Id: I80ae72d34d53564fc3da1601ee48c8b2ffe79735
2023-05-31Use always RFN when handling RACH indicationsPau Espin Pedrol1-0/+6
The previous code was really confusing, passing full FNs as RFNs under certain external conditions, and then assuming the RFN input of rfn_to_fn() function could actually be a FN. As a result, we had a lot of code behaving slightly different depending on whether the incomding FN from pcuif was filled in by a BSC or a BTS. Avoid this b ehavior differentiation and always assume the most restricted one, aka RFN. Change-Id: Ib3b5702168195b595711cd0ff32c211b9aba429d
2021-12-14treewide: remove FSF address2021q4Oliver Smith1-4/+0
Remove the paragraph about writing to the Free Software Foundation's mailing address. The FSF has changed addresses in the past, and may do so again. In 2021 this is not useful, let's rather have a bit less boilerplate at the start of source files. Change-Id: I4a49dbeeec89b22624c968152118aecf8886dac6
2021-03-31pdch_ulc: Support picking RRBP other than N+13Pau Espin Pedrol1-0/+6
Current algo always tries to sched RRBP the soonest possible. Related: OS#5020 Change-Id: Ic6ddeea70e1f914cf423d0daab8fc492d0c992e2
2021-03-15bts: Detect FN jumpsPau Espin Pedrol1-0/+15
Change-Id: I29fb27981597edc69abb976049ba41aa840488cb
2021-03-15Add new PDCH UL Controller, drop SBAllocator classPau Espin Pedrol1-0/+10
Right now we handle different types of UL allocations in different classes like PollAllocator and SBAllocator, and they usually don't take into account the other one in most cases. Furthermore, those objects are usually per-BTS object, instead of per PDCH object. This is a first step towards having a unified per-PDCH controller which takes care of controlling what is scheduled and hence expected on the uplink. Each PDCH has a UL Controller which keeps track of all reserved uplink frame, be it SB, RRBP poll or USF assigned, all under the same API. As a first step, only the SBA part is fully implemented and used (being it the easiest part to replace); TBF poll+usf will come in follow-up patches later on. As a result, the SBAllocator per-BTS class dissappears but some of its code is refactored/reused to provide more features to the gprs_rlcmac_sba object, which is also further integrated into the new UL Controller. Related: OS#5020 Change-Id: I84b24beea4a1aa2c1528f41435f77bd16df2b947
2021-03-11pcu_utils.h: Fix trailing whitespacePau Espin Pedrol1-1/+1
Change-Id: I113766e342a00f61f9894dee1bb89b8ae8354007
2021-01-05Convert GprsMS and helpers classes to CPau Espin Pedrol1-5/+18
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-3/+4
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
2018-02-19Use explicit type for pcu_lsb()Max1-2/+1
It's only used for byte-long input so we can specify input and output types explicitly. Change-Id: Id0bef691e17e4331c7c4b491661e36173d85388a
2017-12-22Add tests for pcu_lsb()Max1-0/+4
This utility functions is used by TBF allocation routines and only tested indirectly through allocation test. Let's add proper exhaustive test which checks all uint8_t values. This also requires adding missing include to pcu_utils.h Change-Id: If08a7f0d31f0e5ad8a5efa5885880aed19c329ab
2017-05-26Cleanup FN schedulingMax1-0/+5
* replace magic number with defined constant * move copy-pasted code to inline functions * remove unused code Change-Id: I6fee0714453d0c3c3f3f875f88daea2d9c477331 Related: OS#1524
2016-02-08utils: Add pcu_bitcount and pcu_lsbJacob Erlbeck1-0/+16
These functions are currently defined in src/gprs_rlcmac_ts_alloc.cpp but will be needed elsewhere. Turn them into template functions to support different types and move them to pcu_utils.h. Sponsored-by: On-Waves ehf
2015-04-02tbf: Use a hysteresis when discarding DL LLC framesJacob Erlbeck1-0/+5
Currently single LLC blocks are discarded when the PDU lifetime expires. If an IP packet has been fragmented either on the IP or on the LLC layer and is therefore distributed over several LLC frames, the kept fragments are transmitted and then discarded by the MS because of the missing PDU. This can cause massive IP packet loss when there are many fragmented packets (e.g. when trying 'ping -s1800' or if the GGSN chops downlink IP packets into several SNDCP packets). On the other hand, discarding too many packets might disturb the congestion handling of TCP. Dropping plain TCP ACKs might also hinder flow control and congestion avoidance. This commit adds a hysteresis algorithm to the LLC discard loop. If an LLC message's age reaches the high water mark, further message's with an age above the low water mark are discarded, too. This is aborted, if a GMM, a non-UI, or a small message is detected. In these cases, that message is kept. The following VTY commands are added (pcu config node): - queue hysteresis <1-65535> set the difference between high (lifetime) and low watermark in centiseconds - no queue hysteresis disable this feature (default) Since the SGSN will most probably send all fragments of a single N-PDU without much delay between them, a value slightly above the average transmission delay jitter between SGSN and PCU is probably a sensible value to discard all fragments of a single IP packet. This is an experimental feature that might be replaced by more advanced means of active queue management in the future. Sponsored-by: On-Waves ehf
2015-03-25tbf: Implement delayed release of a downlink TBFJacob Erlbeck1-0/+21
Currently a DL TBF is immediately closed, when the LLC queue is drained. This will lead to a new DL assignment if data is received afterwards. In addition, it is not possible to keep the PACCH open to poll the MS for UL establishment requests there. GSM 44.060, 9.3.1a suggests to delay the release of an inactive TBF for some time (max 5s). This commit mainly changes create_new_bsn() to send LLC dummy commands as filler if no LLC data is available until keep_open() returns false. The keep_open() functions returns true unless a configurable time has passed after the LLC data store drained. By default, that time is not set which causes keep_open() to always return false, so that delayed release is effectively disabled. The following VTY commands are added: - dl-tbf-idle-time <1-5000> to set the delay in ms - no dl-tbf-idle-time to disable delayed release Ticket: #556 Sponsored-by: On-Waves ehf