aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2022-11-21Convert gprs_debug.cpp to CPau Espin Pedrol4-8/+8
Change-Id: I142b870abda36950db5ff296c7c22228b0b11f55
2022-11-18Split tbf_fsm as tbf_{ul,dl}_fsmPau Espin Pedrol15-100908/+1472
The 2 types of TBF share some parts of the implementation, but actually half of the code is specific to one direction or another. Since FSM are becoming (and will become even) more complex, split the FSM implementation into 2 separate FSMs, one for each direction. The FSM interface is kept compatible (events and states), hence code can still operate on the tbfs on events and states which are shared. Test output changes are mainly due to: * FSM instance now created in subclass constructor, so order of log lines during constructor of parent class and subclass slightly changes. * osmo_fsm doesn't allow having 2 FSM types with same name registered, hence the "TBF" name has to be changed to "DL_TBF" and "UL_TBF" for each FSM class. * FSM classes now use DTBFUL and DTBFDL instead of DTBF for logging. Some tests don't have those categories enabled, hence some log lines dissappear (it's actually fine we don't care about those in the test cases). Change-Id: I879af3f4b3e330687d498cd59f5f4933d6ca56f0
2022-11-18Refactor tbf_is_tfi_assigned() to avoid accessing tbf->state_fsmPau Espin Pedrol3-14/+15
The state_fsm field will be moved to subclass (DL_TBF/UL_TBF) in a follow up commit when splitting the tbf_fsm.c implementation per subclass. Rearrange a bit the code to access the using the subclass pointer in the only sublcass where it needs to be used (DL_TBF). Change-Id: I360485c73be8636565f89ba29796d84ac94fd94e
2022-11-18tbf: Add tbf_as_{ul,dl}_tbf_const func helpersPau Espin Pedrol4-0/+18
This way we can easily get the subclass from the parent if the pointer is const. Similar to what we already have for the opposite direction {ul,dl}_tbf_as_tbf_const(). Change-Id: I35e650d13ecf3a5020d136e7d8d99837786503e2
2022-11-18tbf: Drop unused functionPau Espin Pedrol1-11/+0
Change-Id: I5d4b411585321d94fefdd01f22c62932d4a8f83a
2022-11-18tbf_fsm: Move osmo_fsm_inst fi out of struct tbf_fsm_ctxPau Espin Pedrol9-38/+39
This is a preparatory step towards splitting tbf_fsm.c into tbf_ul_fsm.c and tbf_dl_fsm.c. In order to accomplish it, the struct tbf_fsm_ctx will also be duplicated (and each one will contain a explicit ul_tbf/dl_tbf pointer). Hence, a DL_TBF will have a struct tbf_dl_fsm_ctx and a UL_TBF will have a struct tbf_ul_fsm_ctx, since those hold implementation specific state. However, the FSM interface will be partly shared (events, states), and hence we want to keep the "fi" pointer into the "tbf" parent class so that it can be used regardless of the tbf direction type. Change-Id: I03e691ccf6a94431caa55653349158f5b85db017
2022-11-18tbf_fsm: Move tbf_fsm_state_chg macro to .c filePau Espin Pedrol2-10/+9
It is nowadays only used internally, hence it can be moved to the .c file to better describe its scope. Change-Id: I23cfa5b7efbeb6a58855099780749741c9c947e9
2022-11-17constify pdch_ulc_get_next_free_fn() parameterMax2-2/+2
Change-Id: I91738f951f57bd171d8cbd66fe5e5c46e6fa953b
2022-11-17cosmetic: drop duplicated commentMax1-1/+1
Change-Id: Id349fbfe683b7b63ac9076d2e9998f7c3ecea112
2022-11-17cosmetic: drop unused field from struct pdch_ulcMax1-1/+0
Change-Id: Icf6204d99f91531f5ecad05e3f9f89406e5d12b5
2022-11-14Update and document realtime scheduling priority in service fileMax1-3/+4
Related: OS#5687 Change-Id: I1694af74eee2624709ad6cebbc4fb37320e2ef9d
2022-11-11update horribly outdated copyright statement on VTYHarald Welte1-2/+2
Change-Id: I26cda7826e9d648ea086bb408293e431a9cac206
2022-11-09Makefile.am: drop unneeded '-ldl -pthread' from AM_CXXFLAGSVadim Yanitskiy1-1/+1
Change-Id: I833864aa51059be9c97c16329bc16913c53e171d
2022-11-03Disable logging fsm addressesPau Espin Pedrol1-0/+1
FSM IDs are properly updated now, so there's no need for the pointer address to properly follow them. Change-Id: Ia48c6d5afcdd95e32c7c9b327774f78f07342a0f
2022-11-03Improve MS loggingPau Espin Pedrol7-51446/+51455
Use same formatting similar to what's now used in TBF, which is far more easy to grep and follow. This way one can easily follow what happens to a given IMSI, a give TFI, a given TLLI, etc. Change-Id: If9b325764c8fd540d60b6419f32223fd7f5a5898
2022-11-03Improve TBF loggingPau Espin Pedrol9-303588/+303611
use a format in tbf::name() which is sanitized (osmo_sanitize) and hence can be used both in regular log as well as for its internal FSM ids. Until now, the FSMs contained a small amount of information with different formatting than the regular LOGPTFB(), which made it difficult to grep or follow a TBF through its lifetime looking at logs. The new unified format makes that a lot easier. Extra information is now printed if available, such as IMSI. Furthermore, the TFI is updated to include BTS and TRX, since the TFI is unique within the scope of a TRX. Change-Id: I3ce1f53942a2f881d0adadd6e5643f5cdf6e31da
2022-11-01tbf_ul: Assign DL-TBF if needed after UL-TBF has gone over contenion resolutionPau Espin Pedrol1-0/+6
If data received from SGSN is waiting to be sent to the MS, we may have created a DL-TBF assignment over PCH if the MS was not in packet-active mode. If the MS instead reaches back to the PCU asking for an UL-TBF, the PCU has to wait until Content Resolution of the UL-TBF has succeeded in order to attempt now to assign the DL-TBF over PACCH. The delay was already there, but the trigger to attempt the DL-TBF assignment upon UL-TBF contention reslution success was missing. Related: OS#5700 Change-Id: Ib8f7ad2390485ce9fd76a9de6cd349a5f4037568
2022-10-31tbf_fsm: Introduce new event to act upon contention resolution successPau Espin Pedrol5-9/+22
This is a preparation towards fixing MS not recreating a DL-TBF (being assigned on CCCH) when MS starts an UL-TBF and finishes contention resolution. A counter is removed which was counting contention resolution (MS) on the wrong place. Change-Id: I8b9555864d3615ce0a024b641c67921f82273a8d
2022-10-31Avoid losing DL-TBF during MS mergePau Espin Pedrol5-26/+81
It is desired to free pending DL-TBF under some scenarios, which somehow are related to those where we call the ms_merge() procedure since it's at time an MS can be identified when coming from packet-idle state. Until now, the freeing of those DL-TBFs happen because the ms_merge() procedure doesn't migrate DL-TBF from "old_ms" to "ms". This was done manually under the cases where it was deemed necessary before calling the ms_merge() procedure 8because old_ms and its tbfs are gone after returning from it). This logic, though convinient for the specific cases at hand, is quite confusing for readers and program execution since one would expect the ms merge to, well, merge everything. Therefore, this patch changes the ms_merge() logic to always merge the DL-TBF, and only under the specific cases where it makes sense to free it, do so explicitly after MS merge, where all the info has been updated and united. 2 code paths are now explicitly freeing the existing DL-TBF when needed: - TBF_EV_FIRST_UL_DATA_RECVD: 1st data (containing TLLI) is received from MS, hence identifyng the MS and potentially having been merged with some old MS which used to have a DL-TBF, most probably in process of being assigned through CCCH (PCH). This event is triggered during MS using 1phase-access, and we should drop the exsitng DL-TBF because MS just came from packet-idle mode (CCCH). - rcv_resource_request(): PktResourceRequest is received at an scheduled SBA, meaning the MS is doing 2phase-access, meaning MS also came from packet-idle mode (CCCH), so previous DL-TBF can be dropped. Related: OS#5700 Change-Id: I29f4ffa904d79d58275c6596cc5ef6790b6e68c6
2022-10-31tbf_fsm: Introduce new event TBF_EV_FIRST_UL_DATA_RECVDPau Espin Pedrol5-5/+27
This allows easier tracking of this event. It will also extended later on with more logic which is better placed in tbf_fsm. Change-Id: I5c935914e13db3928c32621ec04eb2760367615d
2022-10-31Rework tbf::update_ms()Pau Espin Pedrol10-44/+63
That function was pretty confusing since it used a "enum gprs_rlcmac_tbf_direction dir" param (whose type is expected to describe the data direction of a TBF) to describe the direction of the the packet which triggered its call. The parameter was actually always called with "GPRS_RLCMAC_UL_TBF" which in this case meant "uplink direction" which meant "TLLI was updated from the MS, not the SGSN". The DL direction was only used in unit tests, which can hence be simply replaced by ms_confirm_tlli(), which this commit does. So this update_ms() function was actually used in practice in osmo-pcu to trigger update of TLLI and find duplicates only when an RLCMAC block (control or data) was received from the MS. Therefore, this function is renamed in this patch and moved to the gprs_ms class, since it really does nothing with the TBF. Related: OS#5700 Change-Id: I1b7c0fde15b9bb8a973068994dbe972285ad0aff
2022-10-31Rename tbf_alloc_ul_tbf -> ul_tbf_allocPau Espin Pedrol6-13/+13
Use proper prefix according to the type being allocated. Change-Id: Ic98c3c852c96c3f52f1c8f531b8d0fd28ce5aef5
2022-10-31gprs_ms: Add comment warning the user that a ptr may be freed after call to funcPau Espin Pedrol1-0/+1
Change-Id: Ifa3d6b38fca89500ef02c9b972f514ceaf8fe83b
2022-10-31Join ms_merge_and_clear_ms() and ms_merge_old_ms()Pau Espin Pedrol2-11/+14
While at it, improve logging of the merge action Change-Id: I39d9eac159448fc3c3a4db9e1b9c5364e906a78f
2022-10-31update_ms(): Set TLLI of new MS object before merge with old MSPau Espin Pedrol2-8/+9
This way it becomes clearer in logs that we are merging MS which contains the same TLLI. Change-Id: Ifd232daa4219e1726c30449d647312a3a226a61d
2022-10-31Move UL allocation&assign functions to gprs_ms.cPau Espin Pedrol9-54/+69
Similar structure as what we have with DL-TBF. Change-Id: I256aeede2a2678c9738539fb6ec4db9766fa85e4
2022-10-31tbf_fsm: Identify several events as Dl-TBF onlyPau Espin Pedrol1-0/+7
This will help in the future when splitting tbf_fsm into different FSMs for UL-TBF and DL-TBF, since only some of the events and states are shared. That means we can keep a single state and event enum, but the FSMs can be implemented separately in different files, easing a lot extending and understanding the logic. Change-Id: Id97f0d532d2d7ab2791a35c1f836d7c8da050124
2022-10-31ul_tbf: Define m_contention_resolution_done as boolPau Espin Pedrol3-5/+5
Change-Id: Ief048cc1b5e8a18ceaeb5432415d14f5ef7ee0ea
2022-10-28Replace tbf->establish_dl_tbf_on_pacch() refactoring GprsMs functionsPau Espin Pedrol8-106/+92
ms_new_dl_tbf_assignment() is split into 2 functions, one to allocate+assign on PACCH and another one for PCH. This makes a lot clearer the aim of each caller of the function. Once this is done, it becomes obvious tbf->establish_dl_tbf_on_pacch() is basically doing the same as ms_new_dl_tbf_assigned_on_pacch() so drop it. Change-Id: I610210e3120c962d91ce8ff94c66161e086761ba
2022-10-28Rename function tbf_dl_request_dl_ack() -> dl_tbf_request_dl_ack()Pau Espin Pedrol3-3/+3
Use the dl_tbf prefix which is usually used to easily distinguish from "ul_tbf" specific APIs and "tbf" generic (parent class) APIs. Change-Id: Ibf6ae20da99866af5f2b6e12184f3145d1fc0bbf
2022-10-28Refactor and clarify tbf->triger_ass() codePau Espin Pedrol6-28/+43
Split the function into 2 functions, one for assignment on PACCH and one for assignment on PCH. This makes code calling this API far more clearer on what is the exact aim when assigning the TBF. Change-Id: Ic92867e55337b0bd6b5bfc97f13b7982eedb1cb7
2022-10-28Delay ImmAss(PCH, PktDlAss) if waiting for PKT_CTRL_ACK answering ↵Pau Espin Pedrol10-72/+237
UL_ACK_NACK (FinACK=1) In that state (ul_tbf=TBF_ST_FINISHED), we are unable to reach the MS to assign a new DL TBF. * MS Is not available in CCCH because it's attached the PDCH. * MS won't be able to PKT_CTRL_ACK a PktDlAss on PACCH, because next thing it will do is to PKT_CTRL_ACK the UL_ACK_NACK(FINACK=1) we already polled it for, and immediatelly after that it will release the UL TBF on its side and go back to packet idle mode. Hence, we must wait for MS to send the PKT_CTRL_ACK to us in order to be able to assign the DL TBF in PCH (CCCH). Related: OS#5700 Change-Id: I7a30db9cc7dae70e04054f1a4dba004bd1780d4a
2022-10-28rcv_resource_request(): Update meas before allocating and assigning new UL TBFPau Espin Pedrol2-19/+20
Those power params are applied in the Pkt Ul Ass sent to the MS. In practice it doesn't matter much because the Pkt Ul Ass message is created later asynchronously by the scheduler (event CREATE_RLCMAC_MSG). Still it's much cleaner applying the information before allocating the UL-TBF, since that's an extra independent step. Change-Id: I63133aa42dcf27a86437b1bc8dc83c30d6718028
2022-10-28encoding: Use MT_PACKET_UPLINK_ASSIGNMENT define instead of hardcoded valuePau Espin Pedrol1-1/+1
Change-Id: I05b39d3183fdf741d648a15ff803d20e324443af
2022-10-28rcv_resource_request(): Validate expected message before MS lookup & allocationPau Espin Pedrol1-7/+7
There's no sense if doing the lookup and allocation if the message is not expected, it will be unrefed (freed) afterwards anyway. Moreover, this way we avoid doing stuff for the WIP code paths which act on different request ID than TLLI. Change-Id: I4be8858230a2eebdb33260093d082a005cb9fcd4
2022-10-28pdch: Use helper function tbf_as_ul_tbf()Pau Espin Pedrol1-1/+1
Change-Id: Ie2a0af7928578823e944b85781ce284722547661
2022-10-28use new {dl,ul}_tbf_as_tbf(_const) helper functionsPau Espin Pedrol4-27/+27
Change-Id: I223d9d5823c90ff31089420d35a7bf0fe1ebf870
2022-10-28tbf_ul_ack_fsm: get ul_tbf base class only when neededPau Espin Pedrol1-8/+8
Otherwise it may give the wrong impression that the FSM can be used by both DL TBFs and UL TBFs, which is not the case (only used by UL TBFs). Change-Id: I788eae58248fa21732efe802344aa3c0c5031b5a
2022-10-28Rename as_{dl,ul}_tbf -> tbf_as_{dl,ul}_tbfPau Espin Pedrol13-37/+37
Prefix the function accordingly to specify the input object. Change-Id: I225568fe2cb5236817cdd9609354c24c66723606
2022-10-28Fix mess with struct tbf types passed to LOGPTBF macroPau Espin Pedrol8-14/+35
It is quite common in all osmo-pcu code to have to convert between parent class "tbf" and children "dl_tbf"/"ul_tbf", or other way around. This commit adds new helper static inline functions to cast between those while doing type checks. This is used by new LOGPTBFDL and LOGPTBFUL macros to now expect the proper subclass and cast securely inside the macro itself, hence sparing all code calling those macros to have to cast explicitly the pointer to the parent "tbf" class. Change-Id: I7e4489ad4b93c9c8442213947e53c10b61fdc5e9
2022-10-28tbf_dl: Make dl_tbf_alloc API available in C codePau Espin Pedrol2-4/+4
It will called by GprsMs (C code) in a follow-up patch. Change-Id: Ib586894bc5834c33d38d23b7194f6dfadf9bc375
2022-10-27pcuif_proto: cosmetic: rename gsm_pcu_if_info_ts to gsm_pcu_if_info_trx_tsPhilipp Maier2-3/+3
The struct gsm_pcu_if_info_ts is named "gsm_pcu_if_info_trx_ts" in osmo-bts. Lets rename it since the definition in osmo-bts is newer. Change-Id: If8b50181d3b609612aa8433b635052aadddd3484
2022-10-27pcuif_proto: cosmetic: rename struct member "h" to "hopping"Philipp Maier2-2/+2
struct gsm_pcu_if_info_ts has a struct member "h", which controls frequency hopping. This struct member is named "hopping" in osmo-bts, so lets rename it here as well to be consistent. Change-Id: I3156b39cc91da07ee3f97e8c8be60fc989cf112b
2022-10-27Rename tbf_alloc_dl_tbf() -> dl_tbf_alloc()Pau Espin Pedrol8-20/+20
Rename it so that it follows the usual prefix for the type it allocates. Change-Id: I7d30a85fefaa61d100fbd51af4601a3cf7de2159
2022-10-27tbf_ul_ack_fsm: Pass ul_tbf instead of generic tbfPau Espin Pedrol2-14/+12
The UL_ACK_NACK FSM is only used in Uplink TBFs. Change-Id: Ic9893d274f4b6fafc75a615f7d6dcb9433b94ace
2022-10-27Move LLC enqueuing and retransmit timer to MS objectPau Espin Pedrol8-202/+216
The LLC queue is already in the MS object. The LLC timer and most of the logic to enqueue its data is independent from the TBF. Change-Id: I56b89fcac838d8eb732b629734d5e458e9c806d1
2022-10-26bts: bts_snd_dl_ass(): use GSM_TDMA_FN_SUM() macroVadim Yanitskiy1-1/+2
Change-Id: If363e3320372c798b9b16274327fa8041358e350
2022-10-26bts: bts_snd_dl_ass(): clarify the meaning of last_rts_fn + 21216Vadim Yanitskiy1-2/+5
Change-Id: I8127e17607426443bb95b42873b580fc9f400af9
2022-10-21gprs_ms: Move creating string name of object to a functionPau Espin Pedrol2-5/+21
This way it can be used outside of LOGPMS(). Change-Id: I8ab713154c8f308878f3e85b6f7e8afc5c4be249
2022-10-21Call ms_store->get_ms() with GSM_RESERVED_TMSI instead of 0Pau Espin Pedrol6-15/+15
That's the special value checked in the implementation of get_ms() to skip lookups based on TLLI. This should save some cicles trying to match TLLI 0. Change-Id: I364d238ff8a82abb14281140fe18b273c0e8f541