aboutsummaryrefslogtreecommitdiffstats
path: root/src/bts.cpp
AgeCommit message (Collapse)AuthorFilesLines
2020-05-11fix egprs_mslot_class_from_ra(): multislot class may not be presentVadim Yanitskiy1-1/+2
For more details, see 3GPP TS 44.060, table 11.2.5a.2. Change-Id: Iba0466b29afd26cff317ed4fb6749f8a3079f16a Signed-off-by: Vadim Yanitskiy <axilirator@gmail.com> Related: OS#1548
2020-05-08bts: Return uint8_t in egprs_mslot_class_from_ra()Pau Espin Pedrol1-2/+2
MultislotClass is 5 bit long, so an uint8_t is enough. In most places we are already storing multislot class as uint8_t. Change-Id: I1dcaff9d69379453a0b794e5f36b820f5f78531f
2020-05-08bts: Fix Decoding EGPRS MultislotClass from 11-bit EGPRS PACKET CHANNEL REQUESTPau Espin Pedrol1-1/+1
In osmo-pcu datatructures, the variables holding multislot classes simply contain an integer referring to the multislot class number, instead of coding from 3GPP TS 44.060 Table 11.2.5.3 and Table 11.2.5a.3. So coding Multislot class 3 is stored as 0x03 in osmo-pcu variables, while in 3GPP TS 44.060 coding it's coded as 0x02 (N-1). This allows us using value 0x00 to designate a "yet unknown (EGPRS) Multislot class". Hence, we need to add 1 to the decoded value to match our data structures. Change-Id: Id3b121272bb7e84c0542ae9b4ce09598c6054edd
2020-05-08bts: Rename mslot_class_from_raPau Espin Pedrol1-5/+13
This function is actually returning an EGPRS multislot class, so let's update naming. The variable using the return value was already being passed as egprs_ms_class to tbf_alloc_ul_tbf(). Change-Id: Idb51836c8c9dd4e865bf2cb0b0c24155662f2ae8
2020-01-06Pass paging group instead of imsi where later is not neededPau Espin Pedrol1-2/+2
Change-Id: Id0663a81f439f2d0b893b0d34f85a6db1927ef8e
2020-01-01Split identity_lv param into mi+mi_lenPau Espin Pedrol1-3/+4
It's not really needed to have those together in some function calls, and makes it more difficult to follow the code. Furthermore, new callers not having content already aligned (len+value) will be using these functions in forthcoming commits. Change-Id: Ifb9d3997bfb74b35366c3d1bc51ce458f19abf16
2019-11-23PTCCH: properly handle RACH.ind for PCU_IF_SAPI_PTCCHVadim Yanitskiy1-0/+47
Change-Id: I482d60a46b9d253dfe0b16140eac9fea6420b30c Related: OS#1545
2019-11-17PTCCH: implement basic message codec and APIVadim Yanitskiy1-0/+1
Change-Id: Id79e95aafdde4a71977c64385fce48b729a51ca9 Related: OS#1545
2019-09-30Log RACH Requests using GSMTAPPau Espin Pedrol1-0/+3
Change-Id: Ib686a49e8c630808c30bede5810cd65fc045954a
2019-09-25Move out tbf subclasses from tbf.h to their own headersPau Espin Pedrol1-0/+1
It's a good start towards clearing current mess between parent and the 2 children classes. Change-Id: Ibc22ea2e02609af7ee058b8bc15df2115d4c6f60
2019-09-17Use osmo_tdef to implement dl-tbf-idle-timePau Espin Pedrol1-0/+1
Change-Id: I5e4f0d2f90e643600b7752525d6c2830856c9d3b
2019-09-17Use osmo_tdef to implement ms-idle-timePau Espin Pedrol1-1/+2
This commit would also remove the option from config_write_pcu() since it's automatically filled in by osmo_tdef, but there was actually a bug because that param was never printed when saving the config... Change-Id: Id8e70b0f44ef2f7e20ecdb3fd8ca93ae2a05b9a3
2019-09-16Use osmo_tdef to implement T3190Pau Espin Pedrol1-0/+1
Change-Id: I0c767c526398d98ca47ef98fdaccfc23af11fb0d
2019-09-16Use osmo_tdef for BSSGP T1 and T2Pau Espin Pedrol1-0/+2
Change-Id: I477e5b702c8b956136d93fc1cee01991233e381f
2019-09-14Forward ETWS Primary Notification to MSOliver Smith1-0/+6
Receive an Application Information Request from the BTS via PCU interface. Construct a Packet Application Information message from it (3GPP TS 44.060 11.2.47) and send it to all MS with active TBF. The TTCN-3 test infrastructure to test this feature is not quite ready yet, so I've added C unit tests instead. Related: OS#4048 Change-Id: Ie35959f833f46bde5f2126314b6f96763f863b36
2019-09-13bts.cpp: Fix osmo_tdef initialization on older g++ compilersPau Espin Pedrol1-2/+2
Fixing errrors spotted: bts.cpp:78:1: error: uninitialized const member 'osmo_tdef::T' }; ^ bts.cpp:78:1: error: uninitialized const member 'osmo_tdef::default_val' bts.cpp:78:1: error: uninitialized const member 'osmo_tdef::unit' bts.cpp:84:1: error: uninitialized const member 'osmo_tdef::T' }; ^ bts.cpp:84:1: error: uninitialized const member 'osmo_tdef::default_val' bts.cpp:84:1: error: uninitialized const member 'osmo_tdef::unit' Change-Id: I2dfecf22516f52cc19e0a0442e70dbc4dbc61336
2019-09-12Introduce osmo_tdef infra and timer VTY commandsPau Espin Pedrol1-2/+21
This will allow for configuration of some of the timers by the user, and allow him to inspect current values being used. It will be also useful for TTCN3 tests which may want to test some of the timers without having to wait for lots of time. Timers are splitted into 2 groups: BTS controlled ones and PCU controlled ones. The BTS controlled ones are read-only by the user (hence no "timer" VTY command is provided to change them). TbfTest.err output changes due to timers being set up correctly as a consequence of changes. Other application such as pcu_emu.cpp and pcu_main.cpp had to previosuly set the initial values by hand (and did so), but apparently TbfTest.c was missing that part, which is now fixed for free. Depends: libosmocore.git Id56a1226d724a374f04231df85fe5b49ffd2c43c Change-Id: I5cfb9ef01706124be262d4536617b9edb4601dd5
2019-09-11tbf_dl: make preemptive retransmission optionalOliver Smith1-0/+1
Since [1], OsmoPCU already starts to retransmit downlink blocks before the MS has had a chance to receive them and/or send the related acknowledgement in uplink. Make this optional with the new VTY option "no dl-tbf-preemptive-retransmission". [1] e25b5b91f60f20f61096bc6199a05b58ee6c6328 ("tbf: Only create dummy frames if necessary") Related: OS#2408 Change-Id: Id08aed513d4033aa0d4324c6ce07cbb2852f2f92
2019-07-24ubsan: fix shiftEric Wild1-1/+1
Ubsan complains about shifts into the sign bit due to automatic int promotion, so cast explicitly. Change-Id: I6387c7313832f6c7c920e1016b74562b66d6b68e Related: OS#4029
2019-07-17fix spelling errors detected by lintianThorsten Alteholz1-1/+1
Change-Id: I381618eb55cc513cfa9c2e384c27cead0935c8bf
2019-07-11bts.cpp: ensure left-shift operation does not exceed uint32_tAlexander Couzens1-1/+1
Found by Asan Relates: OS#4029 Change-Id: I21640e40e689016d6fb80a8db4257b22e85b303b
2019-03-19Explicitly clean up BTS singletonMax1-3/+19
Add method to explicitly cleanup BTS singleton similar to GprsMsStorage class and use it from main(). The destructor becomes trivial wrapper around cleanup() method. This prevents annoying SIGABRT on exit of OsmoPCU caused by rate_ctr_group_free() being called after talloc_free() which removes the context in which counter group is allocated. Change-Id: I796d56a7de3f3a1f9d59708995c8e3e9b05a2747
2019-02-19Clarify write_immediate_assignment() signatureMax1-10/+10
* remove unused variable * use bool for boolean types * add clarification comments Change-Id: I363445063e2d873d9194b2a5924b9e59b8b7ea53
2018-04-01use osmo_init_logging2() with proper talloc ctxNeels Hofmeyr1-1/+4
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-02-19Move PDCH-related functions into separate filesMax1-899/+1
The PDCH class and corresponding functions are rather self-contained and independent from BTS implementation. Let's move them into separate file to make bts.cpp more manageable. As additional benefit it allow us to somewhat untangle all the different cross-dependent includes. Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683 Related: OS#1539
2018-02-19Update header includesMax1-3/+6
Many files include unnecessary headers and don't include headers which are actually used. Because of that combined with the fact that OsmoPCU is a mixture of C and C++, it makes it hard to modularize code. Fix this (using iwyu [1] tool): * add missing headers * remove unused headers [1] https://include-what-you-use.org/ Related: OS#1539 Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
2018-02-19Move paging generation into PDCHMax1-11/+13
Previously paging was prepared inside BTS function and than handed over to PDCH function. Move the actual preparation into PDCH to better decouple PDCH from BTS. Related: OS#1539 Change-Id: I389fb16b6e54040770c21f88edbcb8e045636928
2018-02-07RACH: improve single block detectionMax1-44/+28
Replace unreadable if-else ladder in is_single_block() with regular switch-case. This enables implementation of 11-bit RACH support in follow-up patches. Related: OS#1548 Change-Id: I9180478152f9341f11bb3dffe61671da683f24d8
2018-02-03TBF: add helpers for assignment type handlingMax1-2/+2
* add function to set/unset given assignment type * log assignment type flag changes * update tests output with additional logs This enables us to carefully track the TBF assignment type transitions. Change-Id: I3fe9d52472be8b7f257e8326b2f84e8e7d7bd1f4 Related: OS#1759
2018-01-31TS alloc: print suggested TRX on allocation errorsMax1-1/+1
If TS allocation fails due to unavailable TFI, print TRX which was suggested to allocator. This simplifies allocator debugging but requires cosmetic modifications to test output. Change-Id: Icaf97d71d71985d52dc0bda448c26b19fe5645e7 Related: OS#2282
2018-01-26Simplify TS alloc: adjust function signaturesMax1-3/+2
* document used parameters and return values * use consistent formatting * constify function parameters where appropriate (adjusting parameter types if necessary) Change-Id: I211b10b4da59c73d509b719346774515c761886a Related: OS#2282
2018-01-26Simplify TS alloc: use defines for constantsMax1-1/+1
* define and use constant for occupied TFI instead copying the same magic number all over the place * use libosmocore's define for bit pretty-printer Change-Id: I2699ceebf0cbec01652a02fa68ccc9e9419d0293 Related: OS#2282
2018-01-26Simplify TS alloc: fix allocation callsMax1-1/+1
Using the semantic patch below, adjust allocation-related calls to match updated allocator signatures. // spatch --c++ --dir src -I src --sp-file callfix.spatch --in-place --recursive-includes // spatch --c++ --dir tests -I src --sp-file callfix.spatch --in-place --recursive-includes @@ expression A, B, C, D, E; @@ tbf_alloc_ul_tbf(A, B, C, D, E, ( - 1 + true | - 0 + false ) ) @@ expression A, B, C, D, E; @@ tbf_alloc_dl_tbf(A, B, C, D, E, ( - 1 + true | - 0 + false ) ) Change-Id: I43c76cb49093b40eb854d324e898e821270053dc Related: OS#2282
2018-01-24TBF: make poll state internalMax1-2/+2
* add functions/macros for setting TBF's poll state * add function for checking TBF's poll state Change-Id: I6db1c4e7bd0a49aeb5e391afe371c36b96c6a702 Related: OS#1539
2018-01-24TBF: make UL/DL state internalMax1-7/+7
* add functions/macros for setting TBF's UL/DL state * add functions for checking TBF's UL/DL state * move pre-free check into separate function N. B: this should not be confused with TBF-UL or TBF-DL state. Change-Id: Idcbf5775d17b1247f2ed01788f9b0788ce66e871 Related: OS#1539
2018-01-17TBF: log source of state transitionsMax1-3/+3
We use the same approach for osmo_fsm: when state transition happens, it's not very useful to always log the transition function itself, it's much more useful to see where the actual transition comes from. Change-Id: I348ba89bdda2b44c7019e9c893c764ee08c80bec Related: OS#1759
2018-01-12TBF: move window parameters to UL/DL levelMax1-4/+4
The UL and DL TBF use different classes implementing window management. Hence it's better to use it explicitly instead of using the common window management superclass inside common TBF superclass. While at it, also remove the direct access to window class - use accessor functions instead. Related: OS#1759 Change-Id: I0b55aa8947db65f7206adcf53ea32b74a831d9e6
2018-01-12Clarify RACH-related interfacesMax1-79/+86
* make is_11bit parameter into bool * remove is_single_block() from public interface and mark it as static * move logging outside of if ladder * move side-effects from is_single_block() into separate static functions * simplify UL-TBF allocation in case of 11-bit RACH This immediately makes it obvious that priority is never actually used despite being computed - seems like a leftover from merge of incomplete patch series. Change-Id: If189b7166a29a87ffb17a7a9bc560f674851fd53 Related: OS#1548
2018-01-12TBF: cleanup state flag handlingMax1-12/+5
* introduce generic function to check whether particular flag was set for'a TBF and clear it if necessary. Use this instead of clear_poll_timeout_flag() * add function to explicitly set assignment and appropriate state flags Overall this makes the code easier to read and debug. Related: OS#1759 Change-Id: Ic4560280c72f91700f2e19c6c7f6658dc29625c2
2018-01-02TBF: log timer invocation sourceMax1-2/+2
When troubleshooting TBF timers we're not only interested in timer duration but also in the code which triggered it. Let's use LOGPSRC to log it: wrap t_start() in a macro for convenience. Change-Id: If5f883ae52c469e5158bad24da9904fdc455582f Related: OS#2407
2018-01-02TBF: unify timer handlingMax1-2/+2
Use generic timer handling infrastracture to handle assignment/reject internal timer. Rename timer array accordingly. Use defines with explicit second/microsecond values to make it more readable. Change-Id: I63fb7e6f0695383a83472c836a381a055f64690b
2017-12-21Fix warningsMax1-2/+2
Fix warnings detected by compiler and coverity scan. Change-Id: If463c7f8769e18d3df74837f0cb0f545cca9b23e Fixes: CID181479
2017-12-20TBF: add N3101 counterMax1-0/+19
Properly reset the counter when receiving valid RLCMAC block and update it when no data is received as per 3GPP TS 44.060 §8.1.1.1 Change-Id: I2f79c6153dc4073c9d293b2824979e6381576682 Fixes: OS#2407
2017-12-20TBF: implement independent T31xx timersMax1-1/+1
Previously TBF got single timer so the pending timer was automatically cancelled when new one was scheduled. Let's make it more robust by implementing independent T31 xx timers from 3GPP TS 44.060 §13.2 with corresponding start/stop functions and counters. The semantics of the timers is preserved as before: pending timers are restarted unconditionally. It might be neecessary to change this later on after spec review. N. B. T0: used for assign/reject timeouts, have to be properly attributed and documented first. Change-Id: I0305873ca47534f53441247217881da59625e1f7 Related: OS#2407
2017-12-20Introduce LOGTBF* for consistent loggingMax1-47/+33
When troubleshooting complex issues with TBF lifecycle, it's much easier to follow the logs which are consistently formatted. Add LOGTBF*() macro similar to struct-specific log routines we use in other Osmocom project and use it to log TBF-related messages in a unified way. Tweak test output accordingly. Related: OS#2407 Change-Id: I388249afefc32d2f6e5cb5e5abc6daf4dbd284ea
2017-12-18Fix tests after rate_ctr changeMax1-1/+9
Recent change lin libosmocore disallow registering rate_ctr with the same name and indexing multiple times. To accommodate to this check if rate counters arealready allocated (by static allocator of BTS singleton for example) and register rate counter with different index. This fixes the tests for now but eventually we'll remove the BTS singleton which will allow us to remove this hack. Change-Id: I7c552ce653b44ec3a31049641728926adc07361d Related: OS#2757
2017-12-05TBF: expand timer loggingMax1-3/+3
* log timer values * log start/stop cause * update test output as necessary This simplifies debugging issues with TBF timers. Related: OS#2407 Change-Id: Ib8e537416af9bec5d447356286f44e9e8bbf1b7a
2017-11-21Replace '.' in counter names with ':'Max1-85/+85
The '.' is an illegal character in counter names, as they are exported via CTRL interface, where '.' has a special meaning that cannot be used by strings comprising the variable name. Change-Id: I5ef60152a31dea25cb839c47edc93d5337ec3a3e
2017-11-16PCU: Fix TA adjustmentMinh-Quang Nguyen1-7/+49
Promblem: TA provided from L1 PH-DATA-IND is a relative amount of TA adjustment to actual TA being used for given TBF. The current TA update algorithm in PCU simply applies the relative amount of TA to given TBF but does not take into account of current TA. As a result, the PCU will request wrong TA jump for given TBF if the MS is moving away from BTS more than 2 km. Related issue: http://osmocom.org/issues/2611 Fixes: - The PCU needs increase or decrease current TA of given TBF on receiving of relative amount of TA adjustment provided by PH-DATA-IND from L1 - The PCU needs to set absolute TA of given TBF on receiving absolute TA provided by PH-RA-IND from L1. Change-Id: I65212f8203f1a35278890f51db038d689b2493d5
2017-10-29Call osmo_init_logging() before static BTS constructorHarald Welte1-0/+11
The BTS constructor uses functions of libosmocore that could in turn want to log something. This requires the logging to be initialized before. The only way to achieve this is to add an __attribute__((constructor)) function *before* the BTS constructor is being run. This solution might not be elegant, but I guess it's the only way to initialize a C library before calling C++ constructors of global static instance of a class. In case anyone comes up with a better / cleaner approach, we can always change later. This change requires libosmocore >= 0.10.1, as only that permits multiple calls to osmo_init_logging() which may now occur. Change-Id: I28dc4f0db229518348c92413959fed5ae85d753d