aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
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-12sched: Clean up helper function and improve loggingPau Espin Pedrol1-12/+9
Change-Id: I8c19d0924e73c324a36ea038cab7cc4e096b866b
2021-05-11encoding: Encode TA in UL ACK/NACK if availablePau Espin Pedrol1-2/+19
Change-Id: I3b060ee16aeac5f5d9b314b6bc46383f5e9c44c3
2021-05-11encoding: Use gsm48_ta_is_valid() APIPau Espin Pedrol1-1/+1
Change-Id: Ieaa4c2f926611576e22eaac8a7ac595135809e2c
2021-05-11Tx ul ack/nack: Avoid sending invalid/unknown TLLIPau Espin Pedrol1-4/+14
It could happen that if MS sends first UL blocks without TLLI (wrongly, due to being in contention resolution), the submitted UL ACK/NACK would contain an invalid TLLI. Related: OS#1940 Change-Id: Ibae5df6cfbb56f8f8007cb9fec9c29006d673b72
2021-05-11tbf_ul: Use is_tlli_valid() APIPau Espin Pedrol1-1/+1
Change-Id: I4abb46913b05d1e89ebe9e361b0a774880dee998
2021-05-11Implement T3141Pau Espin Pedrol6-5/+62
Related: OS#1940 Change-Id: I154984b835b2b436b1ebe4631a8afcebb7338c65
2021-05-11Split ul_tbf alloc on CCCH into new functionPau Espin Pedrol3-6/+20
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 Pedrol3-5/+5
Change-Id: I70ca0b5be0a29a05c6e65b9c92cc6d3b5c43d3dc
2021-05-10alloc_algorithm_b: Rearrange variable initializationPau Espin Pedrol1-9/+6
Untangle variable assignment at the start of the function. Changes end up in same kind of assignment, but are far easier to understand based on the variable use later on. * reserved_{dl,ul}_slots contain mask of TS either "previously-reserved" or "intended to be reserved now" based on MS's ms_class. * {dl,ul}_slots contain a derived mask from the one above, filtered further based on more factors like type of allocation requested (multi vs single), available USFs (UL), etc. Change-Id: If3cfa82f8b793a87e97145ee8a6fc0fe1a61add6
2021-05-10Simplify helper function tbf_select_slot_set()Pau Espin Pedrol1-6/+7
Store direction check to simplify the code. Get rid of 2-step LOGP to avoid multi-row logs in gsmtap log. Change-Id: Ia2e061da82ddce564b2d768d8ade1672c22934e2
2021-05-06rim: Constify param in funcPau Espin Pedrol1-1/+2
Change-Id: I47c471929a62d6a5340ae4a4ca88bd0b758c208d
2021-04-30sched: Rename func to describe its used only for RLCMAC CTRL blocks2021q1Pau Espin Pedrol1-2/+2
Change-Id: I20e15047af2aac4d51e1dae263ab16e479bb0c46
2021-04-30bts: constify arg in func bts_ms_store()Pau Espin Pedrol2-2/+2
Change-Id: I4cc8c4fc075cdd07e689511df8f1c267e5360014
2021-04-29vty: Add configuration for Gb DSCP and socket priorityHarald Welte4-0/+40
While libosmogb / ns2 supports that natively in the VTY, the PCU doesn't want to use the complexities of the full NS2 vty. Change-Id: I7bfbad46582e65e5ad2ac0cc66545538bc632df8 Related: SYS#5427
2021-04-26Clarify, document Assignment related timersPau Espin Pedrol4-7/+12
Related: OS#3928 Change-Id: Iad31a5c6f83cd78793adf05a6af782ceacae8b11
2021-04-26sched: Simplify else-if conditionPau Espin Pedrol1-6/+2
The code path running into first call of "create_packet_access_reject()" is a superset condition of the second one, so the second one will never be hit. As a result first, this block: """ else if (tbf == tbfs->ul_ass && tbf->direction == GPRS_RLCMAC_DL_TBF) if (tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ)) msg = tbfs->ul_ass->create_packet_access_reject(); else msg = tbfs->ul_ass->create_ul_ass(fn, ts); """ Can be simplified into: """ else if (tbf == tbfs->ul_ass && tbf->direction == GPRS_RLCMAC_DL_TBF && !tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ)) msg = tbfs->ul_ass->create_ul_ass(fn, ts); """ Next, one can see that previous condition still forces !tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ) to be always true if we ever reach that code, so it can be dropped. Change-Id: I62e2255e28fc4f43fe0a31259ebf18ad00e7e357
2021-04-26Make WaitIndication T3172 configurablePau Espin Pedrol4-9/+16
Tbftest expectatins need to change because 5000/20 = 250 < 255, hence the message is now sent as units of 20ms instead of seconds. Related: OS#3928 Change-Id: I48b34b94b1a5dfb046a3a6cf8a0d944a7c9b6754
2021-04-26ul_tbf: Clean up handle_tbf_reject()Pau Espin Pedrol3-21/+17
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-26Use negative numbers for non-spec osmo-specific timersPau Espin Pedrol2-5/+5
(values -1 and -2 cannot be used because they are already taken). Related: OS#3928 Change-Id: Ibcdb05ff5bb8efe6cb95cf94e2c8e418dc8deced
2021-04-26Make use of T3142 received from BTSPau Espin Pedrol3-9/+9
Related: OS#3928 Change-Id: I4e26f181db9693d3a267a879e2aebda12eab2a8c
2021-04-26Stop abusing T3169Pau Espin Pedrol2-5/+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-04-22pdch: tbf_by_tfi(): Allow returning TBFs in state RELEASINGPau Espin Pedrol1-8/+1
During RELEASING state the TFI, USFs, etc. are still reserved and assigned to the TBF, and hence the TBF may still use it. If callers of this function rely on not taking TBFs under RELEASING state, they should check that explicitly. It still makes sense being to operate on RELEASING TBFs, since under some circumstances the TBF may go under a previous state. See for instance 3GPP TS 44.060 sec 8.1.1.3a.2: """ If N3101 reaches the value N3101max, the network shall stop sending PACKET UPLINK ACK/NACK messages to the mobile station for that TBF and shall start timer T3169 for the TBF. If an RLC/MAC block is received from the TBF when timer T3169 is running, the network shall stop timer T3169 and resume sending PACKET UPLINK ACK/NACK messages to the TBF. When T3169 expires, the network may consider the TBF as released and reuse the TFI value. """ Change-Id: Ibb471e727388512d42794d3faa26597e2545b852
2021-04-22pdch: rcv_resource_request: Improve robustnessPau Espin Pedrol2-23/+60
Use recently added PDCH UL Controller to verify expectancies. Test test_packet_access_rej_prr is rewritten since it didn't make sense as it was before, since it relied on osmo-pcu not checking stuff properly to trigger the reject. The RACH requests are changed to allocate 8 SBAs (maximum of 7 concurrent USFs). Allocating the SBA doesn't reserve a USF, that happens at PKT RESOURCE REQUEST, hence we end up exhausting resources there and triggering the REJECT at that point. Previous version of the patch allocated TBFs directly through RACH req, and then submitted an extra PKT RESOURCE REQUEST which PCU didn't expect to trigger the reject. Change-Id: I157e72160317340ee7742c78c62a25d3d98fc01e
2021-04-22sba: Drop unused function find_sba_rtsPau Espin Pedrol2-14/+0
This function is not longer used since commit below, let's drop it. Change-Id: I633676fc3a573acd0dccdd035ffe557c9c71a56e Fixes: fd1fbdb8db4d76c2f50ccef01f99df0ef8bd8c74
2021-04-19RIM: Improve loggingPau Espin Pedrol1-5/+19
Change-Id: I0adbb8ea4480912463dc1dded6c06a1b8f7ed807
2021-03-31tbf: Get rid of attribute poll_tsPau Espin Pedrol4-19/+14
That field is not needed anymore, and it works only under the assumption that only 1 poll request can be active at a time per TBF, which is not true. Change-Id: I9b8bed7741d385bab4cd8c64b841a78a02a05fe1
2021-03-31tbf: Get rid of attribute poll_fnPau Espin Pedrol5-25/+18
That field is not needed anymore, and it works only under the assumption that only 1 poll request can be active at a time per TBF, which is not true. Change-Id: I63a34a702f028b871530fb7caeb13e8ea1cc78ac
2021-03-31Get rid of param 'poll' with constant valuePau Espin Pedrol4-7/+7
Value 'false' is always passed by all callers of the function, so there's no need to pass it. Furthermore, since it's false, there's no need to access poll_fn since RRBP will always be invalid. Change-Id: Ia48ce2a021865e76e813dedb22aca9c2522c5693
2021-03-31tbf: get rid of poll_state completelyPau Espin Pedrol4-37/+0
The poll_state logic was part of previous implementation (prior to pdch ul controller) where the ssumption was that TBF could only had 1 POLL request in transit, which is really not true. With current infrastructure we don't need this state tracking at all. Change-Id: Ie5b807ccd38aa736ae11b3310ca61ad0156ca4d4
2021-03-31Remove unneeded poll_state checkPau Espin Pedrol1-4/+2
The related ul_ass_state already implies polling is ongoing since we are waiting for an ACK to be received from MS. Hence there's no need to check poll_state there. Change-Id: I5e12280a6835407fa452bd4d5df799d2672790ec
2021-03-31tbf: Allow multiple concurrent pollsPau Espin Pedrol1-4/+0
There's no good reason to allow only for 1 concurrent POLL requested to a TBF, it was onyl done this was as an implementation limitation factor. It can well happen that several multiple POLLs may be in transit at the same time, eg to get DL ACK/NACK as well as to get a CTRL ACK for a Pkt Cell Change Continue (NACC). Change-Id: Ic4080db684a4626cae90dd574d123081981284ca
2021-03-31tbf: Get rid of unneeded poll_scheduled()Pau Espin Pedrol3-10/+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 Pedrol9-37/+42
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-31Drop unused function tbf_check()Pau Espin Pedrol1-9/+0
Change-Id: I90d75a75ae5b528c6ca7b409e60bd158d6043b35
2021-03-31pdch_ulc: Support picking RRBP other than N+13Pau Espin Pedrol3-11/+48
Current algo always tries to sched RRBP the soonest possible. Related: OS#5020 Change-Id: Ic6ddeea70e1f914cf423d0daab8fc492d0c992e2
2021-03-31Pick unreserved UL FN when allocating an SBAPau Espin Pedrol3-3/+30
Make sure an unreserved FN is picked and reserved when allocating and scheduling an SBA. In practice this has no change in behavior right now, since anyway using an offset of 52 FNs ensure no USF or POLL has alredy been scheduled that far in the future. Since it's also impossible to allocate more than 1 SBA per PDCH and RTS FN, we are also safe about multiple SBAs being allocated, because we use a hardcoded offset of 52. However, that could change in the future, when we dynamically tweak the current offset of 52 FN based on information from BTS about its AGCH queue load: * If load is high, we may need to increase the offset since it will take more time for the BTS to transmit the TBF and hence we must reserve a TBF starting time further in the future (higher FN). * If load turns low, we may schedule next SBA a bit more nearby in time than the previously allocated SBA, hence here there could be a collision. Related: OS#5020 Change-Id: I2d4e21e2307de6c17748e8da5c7e149c947a7eb9
2021-03-31pdch_ulc: Optimize rbtree FN searchPau Espin Pedrol1-6/+9
Use logarithmic lookup algo to find if FN is available instead of iterating over the whole tree. Change-Id: I2843aedb5ce74c909bde82d29269d0f956e9a093
2021-03-31sba: Document AGCH_START_OFFSET after some experimental testsPau Espin Pedrol1-2/+18
Related: OS#5020 Change-Id: Id1460207be25750aeb5c1d7af2fac6591cf5e424
2021-03-24Properly implement N3101Pau Espin Pedrol4-7/+18
N3101 is incremented by unanswered USF requests, not from unanswered POLLs. Related: OS#5033 Change-Id: I1a55bdd39db8843976915b9f74fadb0942298413
2021-03-24Track scheduled UL blocks through USFPau Espin Pedrol3-4/+38
This way PCU can now detect whether scheduled UL blocks through USF were never received. This allows in a follow-up patch to start increasing N3101 properly. Related: OS#5033 Change-Id: Ia99c9edad6e5bd837e9baeb4fb2683b227887957
2021-03-24pdch_ulc: Create helper API pdch_ulc_release_nodePau Espin Pedrol2-5/+9
Change-Id: I6362ad7382c2b73e6fedb11182964be96e5c8d35
2021-03-24pdch: Add mising pdch_ulc_release_node in Rx Cell Change NotifPau Espin Pedrol1-0/+2
All other RX CTRL block paths have it, this one was missing. Change-Id: Ief315d7b6d4fea946d43e5bd87cf8a0394adc855
2021-03-24Set matching USF if available when polling a UL TBFPau Espin Pedrol3-16/+23
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-03-24sched: Simplify usf selection codePau Espin Pedrol1-13/+6
Simply use the UL TBF pointer all along until the end, instead of setting both the UL TBF pointer plus the usf var. This commit is also a preparation for next commit which also selects UL TBF when a poll is available, to set its USF in the DL message instead of "USF_UNUSED". Change-Id: I3aa3886932ef87db18ed7ff6991ea315f481990b
2021-03-24sched: Fix scheduling UL TBF not matching conditionsPau Espin Pedrol1-3/+3
With previous code, a skipped TBF could be returned despite not matching the conditions, since at the end of the loop the tbf pointer was returned. Related: OS#5020 Change-Id: If6dccec86c7a655bf1c62f333cfbc8d2c507c94f
2021-03-24Fix: left shift cannot be repesented in type intPau Espin Pedrol1-1/+1
Caught by ASan: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Change-Id: I30aed795d027dc063f06e08c8455bad2dd92cf24
2021-03-23gprs_bssgp_pcu: add comments to the pcu statesAlexander Couzens1-0/+4
Related: OS#3879 Change-Id: Iccf6508ce46162e6dfd6b00abd44e24cb425b346