aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_rlcmac_sched.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-12-05bts: rename struct member gen_idle_blocks to gen_idle_blocks_C0Philipp Maier1-1/+1
The struct member gen_idle_blocks controls whether the the PCU has to generate dummy blocks to fill idle periods or if this task is left to the BTS hardware. Since idle dummy blocks only have to be transmitted on the C0 carrier, we should rename the gen_idle_blocks struct member to gen_idle_blocks_C0. Related: OS#6198 Change-Id: If9511ed911f9c5d6d463881a387a9e7d11a15465
2023-11-24gprs_rlcmac_sched: fix condition for generating dummy blocks on idlePhilipp Maier1-5/+4
When a PDCH is idle, then the gaps are filled with dummy blocks. OsmoPCU supports generating the dummy blocks locally, so that a continous stream of PDCH blocks is sent to L1. However, some BTS models (the OsmoTRX based models in particular) are able to generate the idle blocks locally. In this case the PCU should leave the genration of the dummy blocks to the BTS in order to save processing time and load on the PCUIF interface. In gprs_rlcmac_sched we already have a flag to skip idle frames in case we do not use the so called "direct phy access". A similar mechanism also exists in pcu_l1_if.cpp in function pcu_rx_rts_req_ptcch(). Unfortunately this check is not implemented correctly. The flag gets set when the ENABLE_DIRECT_PHY define constant is set. However, this does not say anything about whether the BTS model supports the generation of idle blocks or not. The define constant is intended to be used to disable direct phy related code in on platforms where no direct phy code is used or cannot be used. We must instead check the BTS model (bts->bts_model) in order to decide whether this particular BTS type requires the generation of dummy blocks or not. Related: OS#6191 Change-Id: I7a08d8cc670fa14f7206ffffdbc22351f3668a17
2023-01-27cosmetic: Remove unneeded curly bracesPau Espin Pedrol1-2/+1
Change-Id: I6d87f11ff749d027685bf539a81f43d35ff98e9a
2022-12-16Pass gprs_rlcmac_pdch to create_dl_acked_block()Pau Espin Pedrol1-2/+1
This allows having full TS information, not only ts_no, which will be needed later on followup patches. Change-Id: I1efccb32c5afa4fe62233bf114ea95b6fbbe1a06
2022-12-13sched: Pass pdch to *_create_rlcmac_msg() functionsPau Espin Pedrol1-8/+7
The pdch pointer contains more info than just timeslot number. For instance, it contains information about the TRX owning the TS. Change-Id: Ic31a7360a29e61f70bb1338ddab6f5f31aa8b26e
2022-12-13Move control_ts explicit checks out of the scheduler implementationPau Espin Pedrol1-15/+8
Let each subsystem handle that internally. Change-Id: Ifaf7dde651d56942779d84aa9135fc8c974b6f26
2022-12-12Pass pdch ptr to tbf_compute_priorityPau Espin Pedrol1-6/+6
Change-Id: Idbac59343c4bac3214ecd8a14c201b4e42c74557
2022-12-12Pass gprs_rlcmac_pdch to tbf_is_control_tsPau Espin Pedrol1-5/+6
This will allow also validate easily the TRX is the correct one too, not only the TS number in any random TRX. Change-Id: Ib1a62b6e7b465253ee7cba63bf5e277f8aa8eaea
2022-11-18Refactor tbf_is_tfi_assigned() to avoid accessing tbf->state_fsmPau Espin Pedrol1-2/+2
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-10-28Rename as_{dl,ul}_tbf -> tbf_as_{dl,ul}_tbfPau Espin Pedrol1-4/+4
Prefix the function accordingly to specify the input object. Change-Id: I225568fe2cb5236817cdd9609354c24c66723606
2022-10-04Make linter happy: fix coding style issuesVadim Yanitskiy1-1/+1
Change-Id: I6672fcd13d9617f054ab295232cfe486f5f17035
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-10-20pcuif: Submit data_req with len=0 as idle framesPau Espin Pedrol1-19/+19
This way PCU always answers DATA.ind and the BTS can still clearly identify idle frames. It also simplifies testing and verification of correct behavior. Related: SYS#4919 Change-Id: Ife718eeed2af011479c03099ea109518f04567bc
2021-10-11sched: Rename functionPau Espin Pedrol1-3/+4
Properly describe that function is aimed at selecting a DL data block. Change-Id: Ic0680d15edf70449e66f40eab1ead97313631cbb
2021-09-20scheduler: Skip Tx DL idle blocks in TRX0 when not in DIRECT_PHY modePau Espin Pedrol1-1/+7
We also want to avoid sending idle blocs in TRX0 to the BTS, so that the BTS can be aware of blocks being idle and then submitting dummy blokcs by itself applying required BCCH Carrier power reduction. Related: SYS#4919 Change-Id: Idd58d2a09c3947098b960cfcb5cd1b7b7bca3d84
2021-08-31sched: Lower log level of RTS on disabled pdchPau Espin Pedrol1-1/+1
These messages are expected under some circumstances, such as when direct phy is used and a chan is disabled (eg. dyn TS). This happens because PCU asks for chan de-activation through PCUIF while at the same time marking the PDCH locally as disabled. Hence, in the time the BTS manages to disable it on the lower layers, the phy still sends us RTS indications. Let's keep it under NOTICE to avoid clogging the logs in production setups which are usually using global level of NOTICE or ERROR. Related: OS#5222 Change-Id: Iab9e1590b504bf05dc693e27550b30db0dffcbc7
2021-08-31Use LOGPDCH macro to standarize log linePau Espin Pedrol1-2/+1
Change-Id: If815779b2e2e56707f36c72dbdbfd4c5b07165ed
2021-08-26sched: energy saving: Avoid Tx dummy blocks on empty PDCH TSPau Espin Pedrol1-6/+22
Related: SYS#4919 Related: OS#4772 Change-Id: I8d66dd5e838748611e7b77b504fc86295f02c019
2021-08-25cosmetic: Fix typo in commentPau Espin Pedrol1-1/+1
Change-Id: I423410416e572141fc2b44c81215b8f41c13f2c6
2021-08-23Move tbf ul_ack_state to osmocom FSMPau Espin Pedrol1-2/+2
Related: OS#2709 Change-Id: Icf23bf5a4b85fbcbf1542cebceb76b9ba7185d30
2021-08-23tbf_dl: Clarify requirements for DL ACK/NACKPau Espin Pedrol1-1/+1
Method is renamed since it clearly relates to getting DL ACK/NACK, no CTRL ACK. use same methods in both scheduler and internal use since they are expectd to be run in the same code path by the scheduler. This way we make sure the same conditions apply and it's clearer when looking at the code. Change-Id: Ib0e9b9547f5292b95064bab2dc182fdf659f0518
2021-08-23Move timer X2002 to tbf_fsmPau Espin Pedrol1-4/+0
Related: OS#2709 Change-Id: I94b71c60ed49d51ebdf6d6b428056b4b94354676
2021-08-23replace dl_ass_state with osmocom FSMPau Espin Pedrol1-4/+4
Related: OS#2709 Change-Id: Ia33418478e17986a316ffda48b091030f53fa371
2021-08-23Replace ul_ass_state with osmocom FSMPau Espin Pedrol1-8/+6
Related: OS#2709 Change-Id: Id414eafe9c04a9a8759c6fb1a483bf2ee093a4d2
2021-08-23Revert "fix: handle NULL return of as_dl_tbf() and as_ul_tbf()"Pau Espin Pedrol1-8/+4
This reverts commit d8e8ea9c8f16e0a1d09c2ea4395e15eac7358ed2. Change-Id: I8000e78515b25b9be5c28a249bde330dac915dcb
2021-08-17fix: handle NULL return of as_dl_tbf() and as_ul_tbf()Neels Hofmeyr1-4/+8
Go through all callers of as_dl_tbf() and as_ul_tbf(), and make sure they can handle the possible NULL return value. OS#5205 reports a NULL deref crash of osmo-pcu at pdch.cpp:525. The immediate cause is that as_dl_tbf() may well return NULL, which this caller does not handle and instead dereferences immediately. This is a code path that apparently assumes that a DL-TBF should always be present. The higher level cause for the NULL DL-TBF has not been identified. Related: OS#5205 SYS#5561 Change-Id: I8ce21be6836549b47a606c00b793d6f005964c5c
2021-06-21gprs_rlcmac_sched: fix incorrect length for CTR_RLC_DL_BYTESVadim Yanitskiy1-1/+1
msg->data_len is the total number of bytes available in the buffer, while for CTR_RLC_DL_BYTES we need to count size of the actual payload within the buffer. A consequence of this bug: osmo-pcu was counting more Downlink bytes than it's actually transmitted. Change-Id: I6884d220f3d06a79b16c18ccc2d2a6cd047b8251
2021-06-04Use new stat item/ctr getter APIsPau Espin Pedrol1-1/+1
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-4/+4
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-7/+6
The TBFs are managed per TRX. Move the global list from BTS to TRX. Related: OS#1541 Change-Id: Id3c59c11d57d765fe68aaebaac94290c0d84feb2
2021-05-12sched: Clean up param passing and improve loggingPau Espin Pedrol1-5/+6
Change-Id: If137a2aaac7744e60564ca833a1b5564ed7d93bb
2021-05-12sched: Clean up helper function and improve loggingPau Espin Pedrol1-12/+9
Change-Id: I8c19d0924e73c324a36ea038cab7cc4e096b866b
2021-04-30sched: Rename func to describe its used only for RLCMAC CTRL blocks2021q1Pau Espin Pedrol1-2/+2
Change-Id: I20e15047af2aac4d51e1dae263ab16e479bb0c46
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-03-24Track scheduled UL blocks through USFPau Espin Pedrol1-2/+2
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-24Set matching USF if available when polling a UL TBFPau Espin Pedrol1-14/+18
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-15sched: Use new PDCH UL ControllerPau Espin Pedrol1-24/+14
Take the time to also do small refactorings to clarify and simplify the function, by using rts_next_fn() already available in pcu_utils.h and getting rid of poll_tbf from tbf_candidates, which clearly follows another objective. Using PDCH UL Controller has the advantage that we don't need to check poll_scheduled() on each TBF, but only do the query once. Related: OS#5020 Change-Id: Ia60bb5249a9837dec1f42180e44d9848334d86d6
2021-03-15Add new PDCH UL Controller, drop SBAllocator classPau Espin Pedrol1-5/+4
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-03sched: sched_select_downlink(): Clean up param list and improve loggingPau Espin Pedrol1-9/+10
Passing TRX and TS is redundant since the info is contained in pdch object. Change-Id: I1b154d82c4a3e09f7fe7ef771de2abca0160cc7b
2021-03-03sched: sched_select_ctrl_msg(): Clean up param list and improve loggingPau Espin Pedrol1-12/+11
Passing TRX and TS is redundant since the info is contained in pdch object. Change-Id: Ic3ec7547cae2ddd0f9c33b82e15ec83cd941e6c8
2021-02-18sched: Avoid selecting TBF to tx NACC Dl msg if no TFI is assignedPau Espin Pedrol1-4/+4
The DL NACC related message (PKT Cell Neighbor Data/Change Continue) are filled with the TFI of the target TBF. Hence, only select the tbf for NACC transmission if the related TBF already has a TFI assigned. Otherwise, "OSMO_ASSERT(tbf_is_tfi_assigned(tbf));" in nacc_fsm.c when generating messages may be hit. Related: SYS#4909 Change-Id: I72b2dff28aacdb04909c098c94834ff79f55b31d
2021-02-18cosmetic: fix line indentationPau Espin Pedrol1-1/+1
Change-Id: Ia8335ce5c005885e4db1864faf775c4bff509c53
2021-02-03nacc: Implement Pkt Cell Change Continue retransmissionPau Espin Pedrol1-1/+1
Use the fact that the MS must answer the RRBP of the Pkt Cell Change Continue with a CTRL ACK to find out whether the message was received successfuly or a retransmission is potentially required. 3GPP TS 44.060: """ When the mobile station receives the PACKET CELL CHANGE ORDER or the PACKET CELL CHANGE CONTINUE message the mobile station shall transmit a PACKET CONTROL ACKNOWLEDGMENT message in the specified uplink radio block if a valid RRBP field is received as part of the message; the mobile station may then switch to a new cell. """ Related: SYS#4909 Change-Id: I7cc28922e71699598da0ef6eb90136a47d3c002f
2021-02-01Drop comment about an already implemented TODOPau Espin Pedrol1-1/+0
The comment target is already implemented just above it. Change-Id: I05534bbbad24ad8ba602244b834cdbadcabcc7ec
2021-01-29Introduce NACC supportPau Espin Pedrol1-1/+12
A new nacc_fsm is introduced per MS object, with its partner priv structure struct nacc_fsm_ctx, which exists and is available in the MS object only during the duration of the NACC procedure. The NACC context is created on an MS whenever a Pkt Cell Change Notification is received on Uplink RLCMAC, which asks for neighbor information of a given ARFCN+BSIC. First, the target ARFCN+BSIC needs to be translated into a CGI-PS (RAC+CI) address. That's done by asking the BSC through the Neighbour Resolution Service available in osmo-bsc using the CTRL interface. Once the CGI-PS of the target cell is known, PCU starts a RIM RAN-INFO request against the SGSN (which will route the request as needed), and wait for a response containing the SI bits from the target cell. After the SI are received, the scheduler is instructed to eventually poll a TBF for the MS originating the CCN, so that we can send the SI encapsulated into multiple Packet Neighbor Cell Data messages on the downlink. One all the SI bits are sent, the scheduler is instructed to send a Packet Cell Change Continue message. Once the message above has been sent, the FSM autodestroys itself. Caches are also introduced in this patch which allows for re-using recently known translations ARFCN+BSIC -> CGI-PS and CGI-PS -> SI_INFO respectively. Change-Id: Id35f40d05f3e081f32fddbf1fa34cb338db452ca
2021-01-26sched: Avoid picking TBF with nacked dl blocks when GMSK is requiredPau Espin Pedrol1-3/+28
Sine we don't yet implement properly all resegmentation of blocks from same MCS family type, when requiring a GMSK DL block (due to GPRS+EGPRS multiplexing limitations) we need to skip retransmitions, otherwise we'd be incorrectly picking a DL block which was already built with a potentially higher MCS value. The "DL_PRIO_NEW_DATA" prio serves two purposes: * There's new data to send * There's some nacked data to be retransmitted The 2nd purpose has, later on, more priority over the 1st one when the tbf is selected (see gprs_rlcmac_dl_tbf::take_next_bsn()). Until now we were handling correctly the case where the tbf was skipped in case the prio was to resend unacked data (DL_PRIO_SENT_DATA), but was incorrectly selected when it'd send nacked data. Let's fix it by specifically checking w->resend_needed() < 0. Change-Id: I253de8e1a190a9adb56160f38892c9e43e2c0272
2021-01-25sched: Check if egprs is enabled in TBF rather than MS being egprs capablePau Espin Pedrol1-1/+1
It could happen as of current implementation that a TBF was created as GPRS due to the MS being non-egprs, and later on the MS was upgraded to EGPRS due to newly received information from the MS. Hence, in order to infer if the data block is EGPRS or GPRS, let's better check for the TBF info, which is the one really mandating the kind of dl block to generate. Change-Id: I49720fb3a69ca972cd1973de937ac8ee77615431
2021-01-20Allow multiple bts objects in PCUPau Espin Pedrol1-2/+2
This patch doesn't really tests whether osmo-pcu can work on a multi-bts environment, but it prepares the data structures to be able to do so at any later point in time. Change-Id: I6b10913f46c19d438c4e250a436a7446694b725a