aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf_ul.cpp
AgeCommit message (Collapse)AuthorFilesLines
2021-08-12Revert "Stop abusing T3169"neels/ul-tbf-leakNeels Hofmeyr1-0/+4
This reverts commit 846fd248dc49c06441da6d7c3cd85df479810f1a. Change-Id: I99a7d2ddf68a76739ce2db1d6a44967dd97667b0
2021-08-11Add counters: pcu.bts.N.pch.requests.timeoutOliver Smith1-0/+2
Implement T3113 for paging over PCH with default value of 7s (same as T3113 in OsmoBSC). Increase the new counter on timeout. Related: SYS#4878 Change-Id: I97475c3dbe2cf00b9cbfec39e93a3c65cb7f749f
2021-06-04Use new stat item/ctr getter APIsPau Espin Pedrol1-13/+13
Patch mostly done with the help of several small spatch snippets. Change-Id: I600c7a8725f5b229b1a2feb879da7c3b2dce4505
2021-05-19tbf: Move existing tbf_state implementation to osmo_fsmPau Espin Pedrol1-7/+7
This is only an initial implementation, where all state changes are still done outside the FSM itself. The idea is to do the move in several commits so that they can be digested better in logical steps and avoid major break up. Related: OS#2709 Change-Id: I6bb4baea2dee191ba5bbcbec2ea9dcf681aa1237
2021-05-19Move TBF list from BTS to the TRX structurePau Espin Pedrol1-2/+2
The TBFs are managed per TRX. Move the global list from BTS to TRX. Related: OS#1541 Change-Id: Id3c59c11d57d765fe68aaebaac94290c0d84feb2
2021-05-12ul_tbf: Fix accessing zeroed block when checking if transfer is completePau Espin Pedrol1-2/+3
The logic checking whether the UL TBF had already been sent all the data (and hence was marked as finished and requesting UL ACK to be sent) was not taking into account the case where there was still no valid block stored, ie. when the first received UL data block was discarded for some reason (ex: because TLLI was not set during content resolution). Related: OS#1940 Change-Id: I739e67ae1bb40555a362170f26fb98ac69caabb2
2021-05-12ul_tbf: Simplify function rcv_data_block_acknowledgedPau Espin Pedrol1-14/+6
Let's avoid different code paths in the loop based on is_tlli_invalid. Instead, always do the proper storing of the block, and if later on the corner case is found (no TLLI received while in Content Resolution process) when checking tlli related stuff, then simply invalidate the block. Related: OS#1940 Change-Id: I77afaa617d7ce045c0f6d994fc0d8e03fe69de53
2021-05-12Drop existing tbf->ms() check conditionPau Espin Pedrol1-2/+1
Since a while ago, tbf should always have an MS attached since its creation, so there's no sense to check for it here. Change-Id: If056a3fb83b43a48c2a6382fc30c6c81fe2b2651
2021-05-11tbf_ul: Use is_tlli_valid() APIPau Espin Pedrol1-1/+1
Change-Id: I4abb46913b05d1e89ebe9e361b0a774880dee998
2021-05-11Implement T3141Pau Espin Pedrol1-3/+41
Related: OS#1940 Change-Id: I154984b835b2b436b1ebe4631a8afcebb7338c65
2021-05-11Split ul_tbf alloc on CCCH into new functionPau Espin Pedrol1-0/+18
This allows more easily finding when this specific scenario happens, and can easily be compared against the PACCH one. Change-Id: I609792a40fda2a798ca71a0e9f5639d0a0f011d7
2021-05-11Rename function s/tbf_alloc_ul/tbf_alloc_ul_pacch/Pau Espin Pedrol1-1/+1
Change-Id: I70ca0b5be0a29a05c6e65b9c92cc6d3b5c43d3dc
2021-04-26ul_tbf: Clean up handle_tbf_reject()Pau Espin Pedrol1-18/+15
Document the function, make it look similar to usual TBF creation path tbf_alloc_ul()->tbf_alloc_ul_tbf->tbf::setup(), which it mimics with some differences. Get rid of unneeded stuff like creating MS and settings its TLLI (that's already done in only caller of the function). There's no need for calling update_ms() either. Change-Id: I61df2e4f0f0df1f8db941741a2d35a2319252c5e
2021-04-26Stop abusing T3169Pau Espin Pedrol1-4/+0
Now that we finally handle N3101 and N3103 correctly, we can fix abuse of T3169 we were doing to make sure TBFs were freed. According to 3GPP TS 44.060, T3169 should be armed: * N3101_MAX reached * N3103_MAX reached Furthermore, when T3169 is enabled, the tbf should be in state RELEASING so that its USF is not used. See full description: https://osmocom.org/issues/5033#note-2 Related: OS#5033 Change-Id: I2cec531e2633281b88f69ba065c0105580c81076
2021-03-31tbf: Get rid of unneeded poll_scheduled()Pau Espin Pedrol1-1/+1
This API is not really needed anymore, since anyway it works under the assumption there can only be 1 POLL in transit per TBF, which isn't necessarily true. Change-Id: I875f51cade95faeb2d79dcebfead4c83e23a731b
2021-03-31pdch_ulc: Store TBF poll reasonPau Espin Pedrol1-3/+3
This allows easily checking the initial reason to trigger the poll when either it is received or times out. Later on this reason can be transformed into an FSM event and sent to the related FSM. Related: OS#5020 Change-Id: Ie8fefd1f47ad674ce597a8065b15284088956bde
2021-03-24Properly implement N3101Pau Espin Pedrol1-0/+14
N3101 is incremented by unanswered USF requests, not from unanswered POLLs. Related: OS#5033 Change-Id: I1a55bdd39db8843976915b9f74fadb0942298413
2021-03-24Set matching USF if available when polling a UL TBFPau Espin Pedrol1-1/+1
When the scheduler detects it's time to receive a UL block due to a scheduled poll, if that polling is done on a UL TBF, then use its USF if available instead of using USF_UNUSED (=7) when sending a DL block on that same FN. This is not really needed for correct work, since MS take care themselves of scheduling a UL block when they receive the poll (RRBP) some time before, and don't check the USF at the time of transmitting. In any case, it helps understand better when looking at pcap traces that indeed it a UL block from that MS was requested, instead of setting USF to 7. Related: OS#5033 Change-Id: I2ad9d8ea6afc8f83192033470bd27010a7474430
2021-02-26tbf: Improve logging when TBF being allocated or no TBF availPau Espin Pedrol1-4/+3
Change-Id: I68491fe2c643262e35b4d4f1ecac34afcf61848f
2021-01-21Get rid of singleton gprs_bssgp_pcu_current_bctx()Pau Espin Pedrol1-1/+1
Access it from existing pointers instead. Change-Id: I77455da5221090ebea142ecd49d5dba0065bfc5c
2021-01-19Unify BTS into a C usable structurePau Espin Pedrol1-27/+27
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-1/+1
Change-Id: I997bc52f0d924c8f2a0b1d6cf23af98828ad4258
2021-01-05Convert GprsMS and helpers classes to CPau Espin Pedrol1-11/+19
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-11-10TLLI 0x00000000 is a valid TLLI, use 0xffffffff insteadVadim Yanitskiy1-4/+5
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-06tbf_ul: Log mismatching TLLI on log messagePau Espin Pedrol1-2/+2
Change-Id: Ia2ac7062c1f3308a1485da6d769cb8a869fa8100
2020-11-04tbf_ul: Allow non-egprs phones if EGPRS is enabledPau Espin Pedrol1-6/+0
We'll be able to still serve GPRS-only phones if EGPRS is enabled. Related: OS#4544 Change-Id: I2e01b9d0de7506e0c0960342d73dba29187fe61f
2020-10-24Move ul_tbf allocation code to correct filePau Espin Pedrol1-0/+158
Change-Id: Ifd98abbcce49e4605c764267965903fbf9f35867
2020-10-24tbf: Set MS during constructor timePau Espin Pedrol1-2/+2
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
2020-10-24tbf: Make window() available to tbf base classPau Espin Pedrol1-1/+1
Return an interface to the window base class so that the tbf base class can access the common window methods, such as set_ws(). It will be used in next commit to get rid of duplicated function enable_egprs in both dl_tbf and ul_tbf subclasses. The user of the function can then decide to access more specific functionaltiites of the window class by static casting it to the specific direction (which is known by the caller since it operates on a ul_tbf or a dl_tbf). Change-Id: Ia2e1decf91be1184668e28297c2126affb9c7ae4
2020-10-24Move gprs_rlcmac_ul_tbf::window to correct filePau Espin Pedrol1-0/+5
It wasn't move when all the UL specific code was moved to a separate file. Change-Id: I6f8c2d568ffdea3826ec1e11358d24eea6c9335b
2020-06-26tbf: Drop unneeded method set_tlli_from_ulPau Espin Pedrol1-1/+1
Since commit 322456ed474a733094c9f3e240295b469023ad14 (and previous one), it is expected that a tbf object ALWAYS has a MS object referend to it, even if it's a temporary copy which will later be merged when TLLI/IMSI is retrieved and it is found that several MS objects relate to the same MS. The purpose of set_tlli_from_ul was mainly to update TBF's ms() to old_ms before going through usual tbf->update_ms() path. That's not really needed since ms() is already always set and TBFs for old_ms are already freed in update_ms() and children function. Change-Id: Ie8795e7a02032336e53febb65c11f9150c36d2a0
2020-05-20Get rid of class GprsCodingSchemePau Espin Pedrol1-3/+2
We have same kind of object splitted into two layers, in coding_scheme and gprs_coding_scheme. Let's merge them together and get rid of the class, which is not really useful because it's only a set of functions operating on one enum value. This change also fixes gcc 10.1.0 error about memseting a complex type in rlc.h init(). Change-Id: Ie9ce2144ba9e8dbba9704d4e0000a2929e3e41df
2020-05-19tbf_ul: Fix UL ACK not sent to MS if intermediate UL block is lostPau Espin Pedrol1-14/+18
In normal conditions ACKing of UL blocks is only sent every SEND_ACK_AFTER_FRAMES (20) frames. Which means if CV=0 is received (and hence no more packets are received) less than 20 frames before a lost, the PCU won't ask for a retransmission and wait there until some timer destroys the TBF. This issue is shown by TTCN3 test PCU_Tests.ttcn TC_ul_intermediate_retrans. Unit tests triggering this condition are adapted. Some similar tests are not triggering it because BSN/CV relation being used is totally wrong (like CV=0 being sent on a BSN with previous value than others). Change-Id: I9b4ef7b7277efa645bdb5becf2e9f6b32c99a9b1
2020-05-15pcu: tbf_ul: Clean up maybe_schedule_uplink_acknack()Pau Espin Pedrol1-28/+33
Get rid of checking all conditions twice, and update one log message. Change-Id: I95831991b01961e4b7faddb08d27133acb0ab4d4
2020-05-14bts: Drop specific functions to add values to countersPau Espin Pedrol1-2/+2
It's super annoying seeing lots of functions being called everywhere only to find out they are only incrementing a counter. Let's drop all those functions and increment the counter so people looking at code doesn't see dozens of code paths evyerwhere. Most of the commit was generated by following sh snippet: """ #!/bin/bash define_pattern="^CREATE_COUNT_ADD_INLINE" generic_func="do_rate_ctr_add" grep -r -l "${define_pattern}" . | xargs cat | grep "${define_pattern}("| tr -d ",;" | tr "()" " " | awk '{ print $2 " " $3 }' >/tmp/hello while read -r func_name ctr_name do #echo "$func_name -> $ctr_name"; files="$(grep -r -l "${func_name}(" .)" for f in $files; do echo "$f: $func_name -> $ctr_name"; sed -i "s#${func_name}(#${generic_func}(${ctr_name}, #g" $f done; done < /tmp/hello grep -r -l "void ${generic_func}" | xargs sed -i "/void ${generic_func}(CTR/d" grep -r -l "$define_pattern" | xargs sed -i "/$define_pattern/d" """ Change-Id: I966221d6f9fb9bb4f6068bf45ca2978008a0efed
2020-05-14bts: Drop specific functions to increase countersPau Espin Pedrol1-16/+16
It's super annoying seeing lots of functions being called everywhere only to find out they are only incrementing a counter. Let's drop all those functions and increment the counter so people looking at code doesn't see dozens of code paths evyerwhere. Most of the commit was generated by following sh snippet: """ #!/bin/bash grep -r -l ^CREATE_COUNT_INLINE . | xargs cat | grep "^CREATE_COUNT_INLINE("| tr -d ",;" | tr "()" " " | awk '{ print $2 " " $3 }' >/tmp/hello while read -r func_name ctr_name do #echo "$func_name -> $ctr_name" files="$(grep -r -l "${func_name}()" .)" for f in $files; do echo "$f: $func_name -> $ctr_name"; sed -i "s#${func_name}()#do_rate_ctr_inc(${ctr_name})#g" $f done; done < /tmp/hello grep -r -l "void do_rate_ctr_inc" | xargs sed -i "/void do_rate_ctr_inc(CTR/d" grep -r -l "CREATE_COUNT_INLINE" | xargs sed -i "/^CREATE_COUNT_INLINE/d" """ Change-Id: I360e322a30edf639aefb3c0f0e4354d98c9035a3
2020-04-20TBF/UL: fix rcv_data_block_acknowledged(): print the actual TLLIVadim Yanitskiy1-1/+1
Change-Id: I71b5c656d4b318d11bd5fe2b5d163c3a06e09a6a
2019-09-26Move tbf_{dl,ul} child constructors to respective .cpp filesPau Espin Pedrol1-0/+11
Fixes: 9d1cdb1f697057033394590a9b2815efe6c08cd9 Change-Id: Id258589d46de42ad4e27889bc396f930b7f94b79
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-25cosmetic: fix whitespacePau Espin Pedrol1-1/+1
Change-Id: I45bbe4d3c69d573aaff010d16f338c7ec3eaf08a
2019-09-12Introduce osmo_tdef infra and timer VTY commandsPau Espin Pedrol1-1/+1
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-06-24Encoding: drop struct gprs_rlcmac_bts* from all functionsAlexander Couzens1-1/+1
The bts is not used at all. Change-Id: Ia07755e825913a16352ab13f6cf55f2918de8681
2019-04-08cosmetic: use const pointer for bts_dataMax1-2/+3
It's used several time for logging so let's call it once to make code easier to follow. Change-Id: Icfd9e5603a5d8701f487f17e9c0335d458e9e80b
2019-03-27TBF: update MCS countersMax1-62/+57
* use enum CodingScheme directly instead of converting it to class and back * drop useless mode check * log errorneous update attempt Change-Id: I763136c2f356d63aa3d28d09c57fd5faf5336258
2019-03-26MCS: add mcs_is_*() helpersMax1-1/+1
In preparation for Channel Coding Command encoder in follow-up patches let's add necessary helpers. Those are similar to previously used helpers from GprsCodingScheme class but without CamelCase and with less typo chances between Gprs and Egprs cases. Change-Id: I6699cbc8d7ae766fa4d2b3d37e5f9ff1cf158b7e
2019-03-19MCS: use value_string for conversionMax1-4/+5
Change-Id: I212ebb892ab162821633974d5a6c7e315d308370
2019-03-12MCS: move Coding Scheme enum outside of class definitionMax1-21/+21
Move generic MCS enum to C header file to simplify further modifications to GprsCodingScheme class in follow-up patches. This also allows us to use standard libosmocore value_sting functions in upcoming patches for IA Rest Octet encoding/decoding. Related: OS#3014 Change-Id: I993b49d9a82b8c7ad677d52d11003794aeabe117
2019-02-19Add define for dummy burst stringMax1-2/+1
Change-Id: I464920b3d6d47bb1c797a4ce06230f005a2e06a0
2018-02-20TBF: make network counters internalMax1-1/+1
* store N310* counters in shared array similar to corresponding timers * add functions to increment/reset counters This avoids direct access to TBF counters from PDCH. Change-Id: I8ffff9c7186f74bde7e6ac5f6e98f0b3e4c35274 Related: OS#1539
2018-02-19Update header includesMax1-1/+10
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