Commit Graph

2146 Commits

Author SHA1 Message Date
Pau Espin 1a1557a60a Move TBF list from BTS to the TRX structure
The TBFs are managed per TRX. Move the global list from BTS to TRX.

Related: OS#1541
Change-Id: Id3c59c11d57d765fe68aaebaac94290c0d84feb2
2021-05-19 12:50:25 +02:00
Pau Espin f62b0ec37d tbf: Log error path in setup() failing to assign control TS
Change-Id: I047209dfe139e37a80878318cca75cb50905536e
2021-05-19 12:50:25 +02:00
Pau Espin 9d2fd018ff bts: Use ms_store when calculating set of target PDCHs for Pkt Paging Request
The ul_tbfs/dl_tbfs lists will become per-trx. Since in this case we
want to operate on the BTS globally, let's iterate over MS objects
instead. This makes more sense too since here we really aim at reaching
a MS (subscriber) instead of specific TBFs. Later on the code can be
optimized easily to schedule a Pkt Paging Request for only 1 of the TBFs
of each MS instad of scheduling it for each TBFs in the MS.

Change-Id: I671e531921bbea2f5cc0f2bfcb8a39ea5c6673b8
2021-05-19 12:50:21 +02:00
Pau Espin bd54205475 Optimize PAGING-CS PDCH set selection when target MS is known
Before this patch, when a PAGING-GS was received in PCU from SGSN, it
would always forward the paging request to all PDCHs in all TRXs of all
BTS (well, it did some heuristics to avoid sending it in some PDCHs
where onyl repeated TBFs would be listening).

The previous behavior, didn't make much sense in the case where the PCU
is asked to page an MS which it knows (ie in which PDCHs is listening
to). Hence, in that case it makes sense to simply send the paging
request on 1 PDCH where the MS is listening, instead of sending it in a
big set of different PDCHs.

This commit also splits the old get_paging_mi() helper which was
erroneously created to parseboth CS/PS-PAGING requesst, since they
actually use a different set of target subscriber information (for
instance, CS-PAGING provides optionally a TLLI, and one provides P-TMSI
while the other provides TMSI).

In this patch, the handling of CS paging request is split into 2 parts:
1- A new helper "struct paging_req_cs" is introduced, where incoming
CS-PAGING requests (from both SGSN over BSSGP and BTS/BSC over PCUIF)
are parsed and information stored. Then, from available information, it
tries to find a target MS if avaialable
2- bts_add_paging() is called from both BSSGP and PCUIF paths with the
helper struct and the target MS (NULL if not found). If MS exists,
paging is forwarding only on 1 PDCH that MS is attached to. If no MS
exists, then the old heursitics are used to forward the request to all

Change-Id: Iea46d5321a29d800813b1aa2bf4ce175ce45e2cf
2021-05-19 12:46:00 +02:00
Pau Espin 4c51eaf05b Use LOGPDCH macro in bts_add_paging()
Change-Id: I58daab719924d70de121f7a5f2cc1f122f8840af
2021-05-19 12:02:34 +02:00
Pau Espin 6e25119c18 Clean false positive in newer GCC version checking guard of else clause
Got this today with newer gcc (11.1.0) after system upgrade:
egprs_rlc_compression.cpp:693:9: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]

The indentation was indeed wrong, provoking a warning in GCC. From code
flow point of view, however, the previous state was fine too, so no
logical change is involved in this commit.

Change-Id: I37bfc8e85daaabbbf10dfd907b305e3e0ec31863
2021-05-19 11:58:57 +02:00
Pau Espin c43570c351 RIM: Refactor Rx path to decode stack in proper order
Previous implementation of the Rx path was first checking the APP ID
before checking the lower layer (container type), which was confusing
because the information is then not verified in ascending order in the
protocol stack.

Let's instead, first, pass the pdu to the correct container type
handler, and only once there, let each container type handler verify the
available applications.

Change-Id: Ibe017c1a6e789f45d74c4a5f5f4608298c8c9f91
2021-05-17 14:21:21 +02:00
Pau Espin c48d27b57b pdch: Use llist_first_entry() API
Change-Id: I96e7188ecf7d2cfc54598975f8d538e7aa94401a
2021-05-13 15:58:55 +02:00
Pau Espin 48517620b9 sched: Clean up param passing and improve logging
Change-Id: If137a2aaac7744e60564ca833a1b5564ed7d93bb
2021-05-12 14:24:02 +02:00
Pau Espin 9b63cd04e4 ul_tbf: Fix accessing zeroed block when checking if transfer is complete
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-12 14:24:02 +02:00
Pau Espin 58916318ef ul_tbf: Simplify function rcv_data_block_acknowledged
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

Related: OS#1940
Change-Id: I77afaa617d7ce045c0f6d994fc0d8e03fe69de53
2021-05-12 14:24:02 +02:00
Pau Espin f53815f2fc Drop existing tbf->ms() check condition
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-12 14:24:02 +02:00
Pau Espin 632542348a sched: Clean up helper function and improve logging
Change-Id: I8c19d0924e73c324a36ea038cab7cc4e096b866b
2021-05-12 14:23:59 +02:00
Pau Espin c432e062ea encoding: Encode TA in UL ACK/NACK if available
Change-Id: I3b060ee16aeac5f5d9b314b6bc46383f5e9c44c3
2021-05-11 13:24:13 +02:00
Pau Espin 6bab522e90 encoding: Use gsm48_ta_is_valid() API
Change-Id: Ieaa4c2f926611576e22eaac8a7ac595135809e2c
2021-05-11 13:01:53 +02:00
Pau Espin eb13c79cc0 Tx ul ack/nack: Avoid sending invalid/unknown TLLI
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-11 12:55:44 +02:00
Pau Espin faf0ccb241 tbf_ul: Use is_tlli_valid() API
Change-Id: I4abb46913b05d1e89ebe9e361b0a774880dee998
2021-05-11 12:55:44 +02:00
Pau Espin 4b6f0bfe69 Implement T3141
Related: OS#1940
Change-Id: I154984b835b2b436b1ebe4631a8afcebb7338c65
2021-05-11 11:32:44 +02:00
Pau Espin 20271c421c Split ul_tbf alloc on CCCH into new function
This allows more easily finding when this specific scenario happens, and
can easily be compared against the PACCH one.

Change-Id: I609792a40fda2a798ca71a0e9f5639d0a0f011d7
2021-05-11 11:32:44 +02:00
Pau Espin c6571b5581 Rename function s/tbf_alloc_ul/tbf_alloc_ul_pacch/
Change-Id: I70ca0b5be0a29a05c6e65b9c92cc6d3b5c43d3dc
2021-05-11 11:32:38 +02:00
Pau Espin 50272a4776 alloc_algorithm_b: Rearrange variable initialization
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-10 12:25:24 +02:00
Pau Espin 393484a5d0 Simplify helper function tbf_select_slot_set()
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-10 11:21:52 +02:00
Pau Espin 0e35aee194 rim: Constify param in func
Change-Id: I47c471929a62d6a5340ae4a4ca88bd0b758c208d
2021-05-06 19:47:15 +02:00
Pau Espin c6dcfe32f3 sched: Rename func to describe its used only for RLCMAC CTRL blocks
Change-Id: I20e15047af2aac4d51e1dae263ab16e479bb0c46
2021-04-30 17:42:25 +00:00
Pau Espin 4b7a71f93f bts: constify arg in func bts_ms_store()
Change-Id: I4cc8c4fc075cdd07e689511df8f1c267e5360014
2021-04-30 17:42:25 +00:00
Harald Welte 292d04d19d manual: Include QoS chapter and add osmo-pcu specific example
Change-Id: I4d409b55861f05ba229dc5cb97f99370356e3dbd
Requires: osmo-gsm-manuals.git Id344c29eda2a9b3e36376302b425e9db1f6c0f28
2021-04-29 22:16:49 +02:00
Harald Welte d9367e34db vty: Add configuration for Gb DSCP and socket priority
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-29 22:13:05 +02:00
Harald Welte 4e453b41f3 manual: Update copyright years
Change-Id: Ia0dde7100dd90c6ad6279efbaf02b9bd3f868635
2021-04-29 22:07:10 +02:00
Harald Welte fa48b4b720 manual: remove revhistory, as we don't maintain it manually anyyway
Change-Id: Ibbe08cac143f4bff6192125940ef190cc943d307
2021-04-29 22:07:10 +02:00
Pau Espin f593fc5cbb doc/tbf.txt: Update and improve some information
Change-Id: I3cd643ef462637708c69895c62c488554a428571
2021-04-27 12:01:52 +02:00
Pau Espin 039ee8200a Clarify, document Assignment related timers
Related: OS#3928
Change-Id: Iad31a5c6f83cd78793adf05a6af782ceacae8b11
2021-04-26 18:49:58 +02:00
Pau Espin 34f61af3d0 sched: Simplify else-if condition
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();
        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 &&
        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-26 18:02:54 +02:00
Pau Espin 2ab840a1fa Make WaitIndication T3172 configurable
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-26 17:53:09 +02:00
Pau Espin 54742f287c ul_tbf: Clean up handle_tbf_reject()
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-26 17:19:07 +02:00
Pau Espin 14339f6fac Use negative numbers for non-spec osmo-specific timers
(values -1 and -2 cannot be used because they are already taken).

Related: OS#3928
Change-Id: Ibcdb05ff5bb8efe6cb95cf94e2c8e418dc8deced
2021-04-26 14:15:08 +02:00
Pau Espin 25ebf3c8f9 Make use of T3142 received from BTS
Related: OS#3928
Change-Id: I4e26f181db9693d3a267a879e2aebda12eab2a8c
2021-04-26 14:10:11 +02:00
Pau Espin 846fd248dc Stop abusing T3169
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:

Related: OS#5033
Change-Id: I2cec531e2633281b88f69ba065c0105580c81076
2021-04-26 11:20:19 +02:00
Pau Espin 710e0e9ad8 pdch: tbf_by_tfi(): Allow returning TBFs in state RELEASING
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

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-22 21:07:06 +02:00
Pau Espin 434799720c pdch: rcv_resource_request: Improve robustness
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
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-22 20:28:40 +02:00
Pau Espin ffc533b1af sba: Drop unused function find_sba_rts
This function is not longer used since commit below, let's drop it.

Change-Id: I633676fc3a573acd0dccdd035ffe557c9c71a56e
Fixes: fd1fbdb8db
2021-04-22 19:46:54 +02:00
Pau Espin ab3aca65c5 RIM: Improve logging
Change-Id: I0adbb8ea4480912463dc1dded6c06a1b8f7ed807
2021-04-19 17:47:26 +02:00
Pau Espin 16e1678bfc tbf: Get rid of attribute poll_ts
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

Change-Id: I9b8bed7741d385bab4cd8c64b841a78a02a05fe1
2021-03-31 17:39:50 +02:00
Pau Espin 58046e45d1 tbf: Get rid of attribute poll_fn
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

Change-Id: I63a34a702f028b871530fb7caeb13e8ea1cc78ac
2021-03-31 17:39:50 +02:00
Pau Espin 2c0931cedc Get rid of param 'poll' with constant value
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-31 17:39:50 +02:00
Pau Espin 127e7392f6 tbf: get rid of poll_state completely
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-31 17:39:50 +02:00
Pau Espin feee2b9b83 Remove unneeded poll_state check
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-31 17:39:50 +02:00
Pau Espin 42445ea944 tbf: Allow multiple concurrent polls
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-31 17:39:50 +02:00
Pau Espin ed066b5328 tbf: Get rid of unneeded poll_scheduled()
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-31 17:39:50 +02:00
Pau Espin 86580e1966 pdch_ulc: Store TBF poll reason
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-31 17:39:50 +02:00
Pau Espin b5ae0811d1 Drop unused function tbf_check()
Change-Id: I90d75a75ae5b528c6ca7b409e60bd158d6043b35
2021-03-31 17:39:50 +02:00