Commit Graph

350 Commits (master)

Author SHA1 Message Date
Pau Espin b0aae5bcd1 rlcmac: ul_tbf: Implement T3180
Related: OS#6209
Change-Id: I350b277532d36ed7928b33ee3b77d98d083a3179
2023-10-17 12:10:21 +02:00
Pau Espin 4db9154457 rlcmac: tests: Account for T3180 existance in test_ul_tbf_t3166_timeout
Test test_ul_tbf_t3166_timeout needs to be modified in order to avoid
triggering T3180 once it is implemented in a follow-up patch.
Both T3180 and T3166 are armed at the same time, so modify the scenario
to really scenify the case where T3166 matters: the MS keeps receiving USF
indications but the PCU doesn't see them and hence never sends a PKT UL
ACK/NACK.

Related: OS#6209
Change-Id: Ib84ccfd89773913703e0ab3e09d0ce9eb123e994
2023-10-17 12:10:18 +02:00
Pau Espin 72598d2c7f rlcmac: tests: Account for T3180 existance in test_ul_tbf_t3182_timeout
Test test_ul_tbf_t3182_timeout needs to be modified in order to avoid
triggering T3180 once it is implemented in a follow-up patch.
Both T3180 and T3182 are armed at the same time, so modify the scenario
to really scenify the case where T3182 matters: the MS keeps receiving USF
indications but the PCU doesn't see them and hence never sends a PKT UL
ACK/NACK acking the last block.

Related: OS#6209
Change-Id: I73b648bc04d863b9eb67093e5fa510ba88d712c8
2023-10-17 10:09:19 +00:00
Pau Espin 8d347143ba rlcmac: Avoid re-arming T3182 in TBF Acknowledged mode
Re-arming upon retransmission of block CV=0 is only described in the
unacknowledged mode of operation.

Change-Id: I532def7f87367b446b5370daf8c81f511e26eb5f
2023-10-17 10:09:19 +00:00
Vadim Yanitskiy 701cd26f4c sm_ms_fsm: fix double timer_cb assignment
sm_ms_fsm.c:287:14: warning: initializer overrides prior initialization
                             of this subobject [-Winitializer-overrides]
        .timer_cb = sm_ms_fsm_timer_cb,
                    ^~~~~~~~~~~~~~~~~~
sm_ms_fsm.c:284:14: note: previous initialization is here
        .timer_cb = sm_ms_fsm_timer_cb,
                    ^~~~~~~~~~~~~~~~~~

Change-Id: Ic1bffe410a4ce5ddafe740185a5a894e056d7879
2023-10-17 08:12:58 +07:00
Pau Espin 383150fe06 tbf_ul_fsm: Avoid freeing tbf after 4 CV=0 retrans in acknowledged mode
The restriction to only to transmit last data block (CV=0) up to 4 times
only applies in Unacknowledged mode of operation, which we don't
support. Hence, simply comment it out so that it can be enabled if
unacknowledge mode is ever supported.

Related: OS#6208
Change-Id: Ie7cdb286b9c7255e3fbf9f936f103fab04acf96a
2023-10-06 19:45:40 +02:00
Pau Espin df4f1cf0a3 rlcmac: tbf_ul_ass_fsm: Fix logic delay starting time
The previous logic was wrongly written. We want:
* If PKT UL ASS didn't have a tbf_starting_time but had an S/P+RRBP,
  it means we have to delay completing the FSM until we send the PKT CTRL ACK (next_blk)
* If it contained tbf_starting_time, if it happens before next_blk, still wait until next_blk

Change-Id: I60cdc0315e28f71843c51eba88acc78780c6ab43
2023-10-05 17:49:01 +02:00
Pau Espin 7475f79fb5 rlcmac: tbf_ul_ass_fsm: Fix 'sba' field wrongly reset to true
Change-Id: Ibf0c60516c337f4428ff33afbfb65a39a37a3719
2023-10-05 15:14:14 +02:00
Vadim Yanitskiy 5162449b71 rlcmac: migrate from fn_cmp() to gsm0502_fncmp()
Change-Id: I3030d00c6881713a088b1739b2b5ba77bac84e46
Depends: libosmocore.git I9590f2e836fc48650decf1564b6ab46306c4fe2d
Depends: libosmocore.git Ie8bb9c49c6f81b8f4a1766547d6943f9880d1186
2023-10-04 11:40:57 +00:00
Pau Espin f81a7389f1 rlcmac: tbf_ul_ass_fsm: Fix state not reset after first UL-TBF re-assignment
The FSM can be reused several times to assign a UL TBF over its
lifespan, eg. if a DL TBF DL ACK/NACK is reuse to request allocation of
a UL TBF several times.

Some state like ctx->tbf_starting_time_exists was being left as =true
during the initial run of the FSM, and as a result subsequent runs going
through the check delaying completing after sending the PKT CTRL ACK.

Change-Id: Iaddbd1e3924036be1cf6eed41367031d3e127f57
2023-10-04 10:15:44 +00:00
Pau Espin 0e62f970dc rlcmac: tbf_ul: Fix wrong field assignment (no bug in practice)
Fixes following warning detected by clang:
"""
tbf_ul.c:1118:37: warning: implicit conversion from enumeration type
'enum gprs_rlcmac_rlc_egprs_ul_reseg_bsn_state' to different enumeration type
'enum gprs_rlcmac_rlc_egprs_dl_reseg_bsn_state' [-Wenum-conversion]
blk->spb_status.block_status_dl = reseg_status;
"""

In practice it's not much of a problem since both fields are put
together in a union, so it ends up in the same place in memory.

Change-Id: Iccd57b74640754f2aebf81a149a633f141c6e38f
2023-10-03 13:48:05 +02:00
Pau Espin 99d44fa8d7 rlcmac: Fix compilation error 'rlcmac_prim may be used uninitialized'
Change-Id: Ica93447bc1f2e60984be7c9c73b153b4eb508aaa
2023-09-26 14:41:00 +02:00
Vadim Yanitskiy fef4af9381 rlcmac: deal with RACH retransmissions (drop rach_req_ra)
The RA value does change during RACH retransmissions, so we cannot
expect a specific value in gprs_rlcmac_handle_ccch_imm_ass_ul_tbf()
anymore.  Offload checking it to the lower layers.

* Rename submit_rach_req() to submit_packet_access_req().
* Get rid of gen_chan_req(), indicate only the access cause.

Ideally, we should also rename the OSMO_GPRS_RLCMAC_L1CTL_RACH
to something like OSMO_GPRS_RLCMAC_L1CTL_PKT_CHAN_ACCESS, but
let's better do this separately.

Change-Id: If0de3ed86b1e2897d70183f3b0f4fbfd7d2bda80
Related: osmocom-bb.git Iab6d9147f6e0aeb99239affacf318a3897fd6ffe
Related: OS#5500, OS#6131
2023-09-23 03:28:31 +07:00
Pau Espin 5d806d88e3 rlcmac: tbf_dl: Log with FN request of UL TBF through PKT DL ACK/NACK
Change-Id: Ib81f1003361ca6501ce5a0e16ab2cdafc8ed66d3
2023-09-05 19:03:52 +02:00
Pau Espin 330b7c078f rlcmac: Log RTS.ind
Change-Id: I678f2aaea419a0cb5dad58610784144538914cf5
2023-09-05 17:23:30 +02:00
Pau Espin f815b8f690 tbf_ul_ass_fsm: Listen only on 1 TS for PKT UL ASS when assignment done from DL TBF
This also fixes a memcpy writing out of bounds reported by Coverity
CID#323120 in gprs_rlcmac_tbf_ul_ass_start_from_dl_tbf_ack_nack(), due
to the difference of size between struct gprs_rlcmac_ul_tbf_allocation
and struct gprs_rlcmac_dl_tbf_allocation.
While fixing it, actually properly implement passing of the 1 only
interesting TS to the tbf_ul_ass_fsm at that point in time.

Change-Id: I89b15982b73f00599183981142495d7b9befbb78
2023-09-05 11:55:25 +02:00
Pau Espin 5eafbdcafe rlcmac: Several fixes and improvements to have 2phase access working
Some solutions are not meant to be final ones, but some small
workarounds to have the whole thing running until the lower layers are
fixed/improved.

Related: OS#5500
Change-Id: I94bd0de6917b004cba73d2fffc7cf69b3b5c305d
2023-09-04 16:56:15 +02:00
Eric Wild 55dcfd0730 configure.ac: fix libtool issue with clang and sanitizer
[this fix already exists in most of the other repos]

As pointed out at https://github.com/libexpat/libexpat/issues/312
libtool does not play nice with clang sanitizer builds at all.
For those builds LD shoud be set to clang too (and LDFLAGS needs the
sanitizer flags as well), because the clang compiler driver knows how
linking to the sanitizer libs works, but then at a later stage libtool
fails to actually produce the shared libraries and the build fails. This
is fixed by this patch.

Addtionally LD_LIBRARY_PATH has no effect on conftest runs during
configure time, so the rpath needs to be set to the asan library path to
ensure the configure run does not fail due to a missing asan library,
i.e.:

SANS='-fsanitize=memory -fsanitize-recover=all -shared-libsan'
export CC=clang-10
ASANPATH=$(dirname `$CC -print-file-name=libclang_rt.asan-x86_64.so`)
export LDFLAGS="-Wl,-rpath,$ASANPATH $SANS $LDFLAGS"

Change-Id: I577e7d7b07acf76e5d97dcce5da206d10f5e2aeb
2023-08-24 13:04:17 +02:00
Pau Espin 1e2779652b rlcmac: Move FN related helper functions to private header inside libosmo-gprs
These may be handy in other tests or inside the library.

Change-Id: I87393239b05a1c11498323139866aec9f6550f3b
2023-08-21 18:10:02 +02:00
Pau Espin ffb7833ce7 tbf_ul_ass: Don't check USF during SingleBlock Allocation
Change-Id: Icc2c17dc1933ad95da1b6b050f38a769909b23e5
2023-08-21 18:10:02 +02:00
Pau Espin 7419d04213 rlcmac: ul_tbf: Implement TBF_Starting time (phase1)
This is unfortunately not yet working since lower layers are always
sending hardcoded fn=0 and hence ctx->tbf_starting_time calculated in
handle_imm_ass()->TBF_StartingTime_to_fn() is wrong.

Related: OS#6130
Change-Id: If6b7766ee1ba6667db4e54e897f376f5b27ad73d
2023-08-21 18:10:02 +02:00
Pau Espin 7c6773f6ff rlcmac: ul_tbf: Factor out function configuring TBF to lower layers
This code part will also be used by tbf_ul_ass_fsm.c to temporarily
configure lower layers with ctx->phase1_alloc in order to receive RTS
indications which the RLC/MAC uses to tick the FSM in state
GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_TBF_STARTING_TIME1.

Change-Id: I174327b25b726662a6b5902008e205ddb3de2fe0
2023-08-21 18:10:02 +02:00
Vadim Yanitskiy 9fd9d34e44 rlcmac: l1ctl_prim: add 'start_rfn' field to cfg_{ul,dl}_tbf_req
Change-Id: I27a7a896fe3839fa4f9b8cd9500c4ab7867bbaa0
Related: OS#5500
2023-08-21 18:10:02 +02:00
Pau Espin fe2a399be6 rlcmac: Fix Starting Time rfn->fn calculation
The Starting time contains a "frame number, FN modulo 42432", aka RFN.
The translation to absolute FN was missing.

Depends: libosmocore.git Change-Id Ib71e8da976f6cc84c3a4ab17b0a8c2101492e243
Change-Id: I00741289333853a8db472950ee2ac38dc2c74fd3
2023-08-21 18:09:45 +02:00
Vadim Yanitskiy a4a34acd91 README.md: upade the list of libraries
Change-Id: I0572e9435330c15469f6609505867c21be9c3483
2023-08-13 18:17:38 +07:00
Pau Espin a1f0842b38 llc,sndcp: Add missing hex prefix to log line printing TLLI
Change-Id: I8d31ed7cf89555a1ec3cbd91a77cc00cc42b546f
2023-07-31 18:24:10 +02:00
Pau Espin 200725e609 rlcmac: rx pkt_uk_ack_nack: Use correct field containing UL TFI
Change-Id: If0bbd9989413a550243a6496bce16b6eb04508db
2023-07-31 18:24:10 +02:00
Pau Espin eb2e073db9 llc: Silently discard UI Dummy commands
Change-Id: I807e140b96de7140d8f6922417f3eaf0eadeed84
2023-07-31 18:24:06 +02:00
Pau Espin dee6d1b43f llc: Log rx PDUs with invalid FCS
Change-Id: Ie52ced7e074a3d4451447551e1ac166397ee8a48
2023-07-31 16:22:29 +02:00
Pau Espin 58342fdbe2 rlcmac: keep looking up GRE based on old TLLI
This is needed after RAU Update since the PCU may still be using the old
TLLI to reference the MS for a while until it finds out about the TLLI update.

Change-Id: I2653db3dac58342df02a1b4d0c76e69e0e8d583f
2023-07-31 16:12:58 +02:00
Pau Espin 0f51adb03e rlcmac: Fix OSMO_GPRS_RLCMAC_GMMRR_LLC_TRANSMITTED declared in wrong offset
This enum should match osmo_gprs_gmm_gmmrr_prim_type, and I placed that
osmocom-specific enum at the wrong place in the rlcmac counterpart.

Change-Id: I3f198c756866417f8f975373f84fd3ec4da608fa
2023-07-31 14:55:25 +02:00
Pau Espin b4a6069f82 gmm: Several fixes for radio_prio
The "Radio Priority" received in GMM Attach Accept are for SMS and TOM8
SAPs only. For GMM/SM unitdata transferred to LLC, use highest
radio_prio=1.

Change-Id: Ie583c433547fb5ecbb6b6077c39a157961f73cfc
2023-07-31 14:37:34 +02:00
Pau Espin acec4a7fc4 llc: Fix potential null ptr dereference in LL-Xid.Ind
Closes: Coverity CID#322365
Change-Id: Icc65af3ea9a44a5daf80e47717564f6adf37444b
2023-07-31 10:42:24 +02:00
Pau Espin ee091182c5 rlcmac: Initial selection of packet-access-procedure mode based on originating cause
Change-Id: I930a1fcf23506f75562a6795f9a6e42b187d2974
2023-07-28 17:56:45 +02:00
Pau Espin 27bbb88d27 rlcmac: Use enum gprs_rlcmac_radio_priority internally everywhere
This simplifies the array handling in the LLC queue, and moves param
checking to the rx rlcmac_prim path instead of deep in the llc_queue
enqueuing code.

This commit also fixes the RADIO_PRIORITY field in the Channel Request
Description section of PKT DL ACK/NCK, since
gprs_rlcmac_llc_queue_highest_radio_prio_pending() now returns the enum
normalized 0..3 as expected by the field format (before it was returning
1..4).

Change-Id: If2d1946522bc4a1c19d65acb23605f1a3f05ab45
2023-07-28 13:49:49 +02:00
Pau Espin 8b1e4cbae6 sndcp: Forward QoS params from SM to LLC
Change-Id: I70e355ef27d24bdaf00e54f0e7126193f5bbf19f
2023-07-28 13:49:49 +02:00
Pau Espin bd7964f101 sm: Introduce APIs to enc/dec QoS Profile
Ported from  open5gs.git/lib/gtp/v1/types.{c,h} 5764f7267d16a8ea6aeedc6c227552575915def5,
for which I was the author too.
The ARP extra byte field at the start of the IE val which is introduced in the
GTP variant is dropped when porting to SM, since it's not present there
(and offsets/sizes are adjusted).

The QoS code is moved is moved into a common/ directory where a new
libosmo-gprs-common.la private static library is created.
This is done in order to be able to resuse the QoS dec/enc code in
several libraries since it's actually planned to use it in SNDCP and SM
layers.
The most natural place to add the APIs is SM, and that's where the
public API to accees the enc/dec is provided, since the user app will
have to use them in the SM SAP.
However, the SNDCP will also have to decode the QoS recived by SM
through the SNSM SAP, and we don't really want libosmo-gprs-sndcp depend
on libosmo-gprs-sm. This way libosmo-gprs-sndcp will be able to use the
private APIs directly in a follow-up commit.

Change-Id: I6c0676e55bb1f0f424f41d8d04d4f5e5bf376f4f
2023-07-28 13:49:46 +02:00
Pau Espin 3ad76e16ef llc: Set proper Radio Priority when submitting GRR-UNITDATA.req
Change-Id: I2ace165003469c2a43d7333634171896699d5a5d
2023-07-28 13:48:25 +02:00
Pau Espin f79a8d8499 sndcp: Use radio_prio assigned by SM when submitting LLC unitdata.req
Change-Id: I632329bb1f34efb4d9263241e2cda5b559f1ff59
2023-07-28 13:48:25 +02:00
Pau Espin b3e506b38c sm: Forward RadioPrio & QoS in SNSM-Activate.ind
Change-Id: Ia8226f6e687f86b2502b27f9979dce13cf751c01
2023-07-28 13:48:25 +02:00
Pau Espin b59dfd4de9 cosmetic: sm: Fix wrong reference in comment
Change-Id: I8828e0019f6446c3a17d09e8483573bf752c159f
2023-07-28 13:48:25 +02:00
Pau Espin f37d91072f sndcp: Initialize N201-U & N201-I to default settings
LLC is only expected to signal new values if SNDCP XID params are
received, or if the default N201 values change.

Change-Id: I68f54d329b326895ed8f010cf50f20fa30948d30
2023-07-28 13:48:25 +02:00
Pau Espin d8d592db54 llc: Set proper SAPI when transmitting UNITDATA.req to GRR/BSSGP
Change-Id: I962e25789849f89c532f5ede386fa029600d9901
2023-07-28 13:48:25 +02:00
Pau Espin 9b50028192 sndcp: Update n201_u & n201_i indicatd by LLC layer
Change-Id: I7429701ae49c2a694dcad3e3d5ec639ab9927f5b
2023-07-28 13:48:25 +02:00
Pau Espin 6e1a35bab7 llc: Submit LL-XID-IND to L3 if N201-U or N201-I changes
Change-Id: I8135c5cef4df69a7c3a540050da0837bf2059df2
2023-07-28 13:48:22 +02:00
Pau Espin 5aa16e1c8d llc: Apply N201-I & N201-U requested by the network
Change-Id: I2f2cb8b831266b8e4251c2832e6545bef776658c
2023-07-26 20:23:00 +02:00
Pau Espin 7a75a16350 llc: Introduce function to log XID fields and use upon Rx/Tx
Change-Id: I8c6b07305c0bcecb4e1681967884a3e62c813592
2023-07-26 20:22:56 +02:00
Pau Espin f4fca416e2 llc: xid: Introduce some helper internal functions to make code easier to follow
Take the chance to fix wrong indentation on related function parameter.

Change-Id: I8c0163583efc2720a4b2675ce93293c184f80d0c
2023-07-26 19:00:32 +02:00
Pau Espin 678daf22ca rlcmac: recalculate CV as needed when already in Countdown procedure
Getting out of contention resolution means we may have to update our
calculated CV state because we are no longer sending TLLI.

Same happens if a new tx CS is provided by the network, since different
block size means different CV.

In this commit only code paths for the state where already in Countdown
Procedure are added. If TBF has to enter Countdown Procedure due the
above mentioned changes, it will do so using regular path where a new
RLC block is created.

Related specs: TS 44.060 9.3.1
Related: OS#6018

Change-Id: I6ca88c005060ba1302d46717e45b0d9731d86d8d
2023-07-24 16:36:52 +02:00
Pau Espin 459383d531 rlcmac: Apply tx_cs requested by the network through PKT UL ACK/NACK
Recalculating CV when in Countdown Procedure will be implemented in a
follow-up commit.

Related: OS#6108
Change-Id: I1e7b28c2e5f1d77a962ec3070f3a027b8f66a69e
2023-07-24 13:52:51 +02:00