Commit Graph

115 Commits

Author SHA1 Message Date
Vadim Yanitskiy cce691d19e rlcmac: do not attempt to decode PTCCH/D blocks, discard them
PTCCH/D blocks use different encoding than PDTCH/D blocks, and passing
them to gprs_rlcmac_handle_gprs_dl_block() results in decoding errors:

  DRLCMAC NOTICE rlcmac.c:496 Failed decoding dl ctrl block:
  7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 2b 2b 2b 2b 2b 2b 2b

We don't implement PTCCH yet, so discard these blocks starting at
Fn=12 within the period of 104 frames (see 3GPP 45.002, table 6).

Change-Id: I555004987cf2daa995b9ea21c90ac699199c4e9a
2023-03-17 09:06:03 +07:00
Vadim Yanitskiy 2057567ce9 rlcmac: fix handling of TIMESLOT_ALLOCATION in handle_pkt_dl_ass()
The TIMESLOT_ALLOCATION is a timeslot mask with MSB=TS0 and LSB=TS7:

  0 1 2 3 4 5 6 7  TS# in TIMESLOT_ALLOCATION
  0 1 2 3 4 5 6 7  'i' value in the loop, current rshift
  7 6 5 4 3 2 1 0  correct rshift in the loop (this patch)

The current logic checking state of each timeslot is wrong, we
actually need to shift by (7 - N) to check state of timeslot N.

Change-Id: I36c52e282ee02c5136a645eb73a9631b95355c34
Related: OS#5500
2023-03-17 08:20:37 +07:00
Vadim Yanitskiy 4d19c93334 rlcmac: cosmetic: use ARRAY_SIZE() in handle_pkt_dl_ass()
Change-Id: I98cff9c38ef8d44669ae233f2cf1c7d815e27ff8
2023-03-17 07:39:26 +07:00
Vadim Yanitskiy 939c5ca6e6 rlcmac: cosmetic: use ARRAY_SIZE() in dl_tbf_dl_slotmask()
Change-Id: I3e0ac847e1fc5af190ffd38e04e3745ab68e4ec5
2023-03-17 07:05:32 +07:00
Pau Espin 146643b0f3 Create skeleton for libosmo-gprs-gmm
The library itself only contains a bunch of boilerplate to build the
library and have usual initialization, logging, prim APIs.
There's not yet much logic specific in it yet, but will make next
commits easier to review.

Related: OS#5501
Change-Id: Ie098576954a55e5046c2463390ab7133511c1eb3
2023-03-15 10:43:49 +01:00
Vadim Yanitskiy d7b4030361 {rlcmac,llc,sndcp}: AM_LDFLAGS shall not contain *_LIBS
The LDFLAGS is for stuff like: '-Wl,--wrap=foo', '-version-info',
'-no-undefined', '-no-install', etc. but not for libraries.

Change-Id: Ib211c37419a8c6a0bdfc202f6f91b255cc8420e2
2023-03-13 10:46:01 +00:00
Pau Espin 7361945383 rlcmac: tbf_ul_ass_fsm: Fix missing break statement
Fixes: Coverity CID#310974
Change-Id: I44b3a367ec1c889168dd08700e62afd938590f00
2023-03-10 14:36:37 +01:00
Pau Espin 66d7bc2bae sndcp: Avoid propagating rc=1
Those functions guarantee to the caller that the prim is always freed,
and hence returning 1 has not meaning there.

Fix similar to bab234c2ea in rlcmac layer.

Change-Id: If3c9287d839198dc079993c4d32780fb1c2bc6fd
2023-03-09 19:00:02 +01:00
Pau Espin 45c9641dca llc: Avoid propagating rc=1
Those functions guarantee to the caller that the prim is always freed,
and hence returning 1 has not meaning there.

Fix similar to bab234c2ea in rlcmac layer.

Change-Id: Icdee1cac4df970ae2ee7539d72c5a82667016160
2023-03-09 18:57:23 +01:00
Pau Espin 9eb8ef1c3f rlcmac: Implement DL TBF CCCH & PACCH allocation with TBF Starting Time
Change-Id: Idafb4e37971e93c7e8667b8669a29755485e95bb
2023-03-09 10:25:37 +01:00
Pau Espin 8efb05eaca rlcmac: Log sched of PktCtrlAck requested by UL ASS poll
Change-Id: I81ac177d7abdcd49d2b231ae059ec859b433dd03
2023-03-09 10:24:56 +01:00
Pau Espin e0ec0a3fcc rlcmac: Move create_pkt_ctrl_ack() to tbf base class
The code to generate a PKT CTRL ACK is the same for a DL TBF and an UL
Move it to the generic base class in order to be able to generate it for
a DL TBF in a follow up patch.

Change-Id: I767696b445842ebc32b35c320273b13f63076ca4
2023-03-09 10:24:56 +01:00
Pau Espin bab234c2ea rlcmac: gprs_rlcmac_prim_call_down/up_cb(): Avoid propagating rc=1
rc=1 Only has meaning in call to rlcmac_down_cb().
gprs_rlcmac_prim_call_down_cb() called by internal rlcmac code
guarantess the prim is always freed, and hence returning 1 has not
meaning there.

Same applies for up direction.

Change-Id: Ibd9c44150e8dbec5fbaa98e14aa16703935dac71
2023-03-09 10:24:56 +01:00
Pau Espin 441fdec9d4 rlcmac: Log tx of primitive to lower layers
Change-Id: Ifc3a71c2177657f17020b5ad87c43598942edf76
2023-03-09 10:24:56 +01:00
Pau Espin 0985d6decd rlcmac: rlcmac_dec.c: Add missing headers
Change-Id: Ie7fc1a8b101d8ee978a6a770ffe0190fb0de605a
2023-03-09 10:24:56 +01:00
Pau Espin 154ff41292 rlcmac: ul_tbf: Implement support for TBF Starting Time
While reworking tbf_ul_ass_fsm, avoid being in "ASSIGN" state while
waiting to send Pkt Ctrl Ack. The PCU is free to ask the TBF to transmit
data before receiving Pkt Ctrl Ack; the time where it can start
transmitting data is actually controlled by TBF Starting Time.

Change-Id: Id81f16743f2c464e01caf27ba2eb8c0fc715fe8a
2023-03-09 10:22:04 +01:00
Pau Espin ef3c599b98 rlcmac: Lower logging rx prim from lower layers
Let's set it as DEBUG, since that code path can be called quite a lot.

Change-Id: I0b13fa374003a7c48bc259a8c45227b86beca454
2023-03-09 10:19:21 +01:00
Pau Espin f41223d479 rlcmac: Ignore DATA.ind with len=0
Change-Id: I342c7999261832a5d981e5831e428d2cbd82729e
2023-03-09 10:19:18 +01:00
Vadim Yanitskiy da3360390c rlcmac: ignore PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK
It's expected to receive dummy DL blocks when listening to PDCH,
so do not spam the logging with errors:

  DRLCMAC ERROR rlcmac.c:392 TS=7 FN=3035694080
    Rx Pkt DL Dummy Ctrl Block NOT SUPPORTED! ignoring

Change-Id: I6a40e2795adc71b9312d39c96b01aba9a258da42
Related: OS#5500
2023-03-07 16:47:27 +01:00
Pau Espin fe52a342aa rlcmac: Fix several ptr bugs looking up ul tbf upon rx PktUlAss
Related: Coverity CID#310957
Change-Id: I0b031761dbbc93c1c06ba94967e91180062613fd
2023-03-07 15:22:56 +01:00
Pau Espin 99d0b6f2f9 rlcmac: tbf_ul_ass_fsm: Drop dummy event GPRS_RLCMAC_TBF_UL_ASS_EV_FOOBAR
This was used during initial writing of all boilerplate code

Change-Id: I24ce93c994a3128262d806b585d7dff62ee3f159
2023-03-06 14:36:51 +01:00
Pau Espin 9a212cc2b6 rlcmac: dl_tbf: Improve logic requesting a new UL TBF
Change-Id: I702872ba32a410bb5f09943af3cdadca482562db
2023-03-06 07:59:03 +00:00
Vadim Yanitskiy eb622ef09c rlcmac/sched: use TDMA Fn macros from libosmogsm
Change-Id: I536a0d2ae9b5dabcd3976f5aeb15069bd03e6aa9
2023-03-03 07:35:53 +00:00
Pau Espin 42f302a4f9 tbf_ul: Fix contention_resolution check for 2phase access
Change-Id: Ia20bcf99f4ece17b33048930ded50e703d7b7461
2023-03-02 19:13:14 +01:00
Pau Espin c25b28c809 rlcmac: tbf_ul: Fix TI bit never set when encoding the block
The TI bit was correctly set (together with the TLLI) in
create_new_bsn(), but was not properly propagated later on in
create_ul_acked_block() to the intermediate struct before the final
encoding to the packed structure containing the final message

Change-Id: I6ba361bc9bc47230954cca19c7f2f8cf74d8278e
2023-03-02 16:28:34 +01:00
Pau Espin c7a55b3c4a rlcmac: Fix gprs_rlcmac_ul_tbf_in_contention_resolution() for 1phase access
Change-Id: I7d08be3d8fa584ebad98d3548c05bd1ff284ba7e
2023-03-02 16:28:26 +01:00
Pau Espin aef4114abb rlcmac: Fill radio_priority in Dl Ack/Nack Channel Request Description
Change-Id: I740fac72cb418d4b61499990b13208fcd4bb922f
2023-02-27 17:12:51 +01:00
Pau Espin 9a44df6084 tbf_dl: Fix state_fsm instance not freed
Change-Id: I2f89810dd346cee904dcff0b598e229bd5f84a9f
2023-02-27 16:22:16 +01:00
Pau Espin 294b886be6 rlcmac: Implement T3182
Related: OS#550
Change-Id: I4fe9523af1b53c826ccfdd8700bab2a9e1413662
2023-02-21 19:44:43 +01:00
Pau Espin 6f87373fc0 rlcmac: ul_tbf_fsm: rework Rx UL ACK/NACK fsm events
We'll need to get one event for each Pkt UL ACK/NACK the UL TBF receives
in order to implement T3182 properly in a follow-up patch, hence rework
the events sent to the FSM (merge events about Final ACK and Contention
Resolution in one generic UL ACK/NACK event with some data parameters).

Change-Id: I4420abd69a318bd93fde73a67239456466071497
2023-02-21 19:38:18 +01:00
Pau Espin 184fcce168 rlcmac: ul_tbf: Fix ul_state wrong check
This error was introduced when importing and rerwitting code from

Fixes: 8c2734fa43
Change-Id: Id4d7ad5fb393580a2e760513bb513ba968d2c1ef
2023-02-21 19:38:18 +01:00
Pau Espin 4486aa276c rlcmac: Use finished UL TBF to request a new one after Final UL ACK/NACK
Change-Id: I4eb873250f5ee7eafb5b6126382ce088091d0447
2023-02-21 19:38:15 +01:00
Pau Espin 13c2601974 rlcmac: ul_tbf: Fail if data block CV=0 retransmitted > 4 times
Change-Id: I1a2e1bca296591c34e25faca3f9048e0274ebbd1
2023-02-21 17:27:46 +01:00
Pau Espin 4da257390f rlcmac: ul_tbf: Submit event FIST_UL_DATA_SENT before LAST_UL_DATA_SENT
If there's only 1 block to be sent, the LAST_UL_DATA_SENT was being sent
before the FIRST_UL_DATA_SENT one, which created problems in the FSM
(when adding more logic later).

Furthermroe, this change also makes it send retransmission events, which
makes it similar for both FIRST and LAST events. This will also be
needed for T3182.

Change-Id: I701dbe00ff2af62c45d862a9211b5b1120f3efa3
2023-02-21 17:27:46 +01:00
Pau Espin 46a4f3ed66 rlcmac: Implement T3168 (Pkt Res Req timeout 2phase access)
Change-Id: Ibf011ca94e50542b67353cd8f7f74c5be955af34
2023-02-21 17:27:46 +01:00
Pau Espin 96fe992644 rlcmac: Fix null ptr access in dl_tbf object
Fixes: Coverity CID#310022
Change-Id: I3817d9e77a440682fa2c538e0fbee295ffdbcfff
2023-02-21 17:27:46 +01:00
Pau Espin f15ee0daa5 rlcmac: tbf_dl: Fix msgb null ptr access if dl block contains several LLC frames
Fixes: Coverity CID#310023
Change-Id: I627724fda5b9ffcf13433ea69af908d725e94299
2023-02-21 17:27:46 +01:00
Pau Espin 5daf94b203 rlcmac: ul_tbf: Answer Pkt Ul Ack/Nack poll with Pkt Ctrl Ack
Related: OS#5500
Change-Id: I833d0f189c06d093ce9bd4c36c37024cf5cb6446
2023-02-21 17:27:43 +01:00
Pau Espin bf1f5f3613 rlcmac: ul_tbf: Append TLLI when in contention resolution
Change-Id: I4023f21930e93c8cc10befc92f917139b656175a
2023-02-21 17:11:04 +01:00
Pau Espin a9da84ac9f rlcmac: Implement N3104
Related: OS#5500
Change-Id: Ia8c35aad7a537ab76447187847f8cee8c379352c
2023-02-21 17:11:00 +01:00
Pau Espin 7ff9597b43 rlcmac: tbf_ul: Allow sending UL data if in state FINISHED
This can happen for instance if MS sent al the data but PCU didn't
receive it all (some it was lost) so it can still keep asking the MS to
submit data. In this case, the MS shall attempt retransmit of some
unacked data.

Change-Id: I2333a0a432c0c6f223bc1043ddb0d9c34842a5a3
2023-02-20 13:28:55 +01:00
Pau Espin dfe49c5f44 rlcmac: Handle SI13 from L1CTL
Change-Id: Ifaddf0e6e5cad7ea25672804c83c254579874813
2023-02-20 12:31:25 +01:00
Pau Espin 175d251fb7 rlcmac: Implement T3166
Change-Id: I58dd757cbb5d8279fdf7fbdfb6f38ec0119c6156
2023-02-20 12:31:25 +01:00
Pau Espin 6a90da108a rlcmac: Implement T3164
Change-Id: I1a3d7b552b36b84d84ca27572ce313265810fd3d
2023-02-20 12:31:25 +01:00
Pau Espin b9e06c9955 rlcmac: tbf_*: Unlink the freeing tbf from its gre
Change-Id: I2079c4440a05f4b44c9b7bece383c69e84198302
2023-02-20 12:31:25 +01:00
Pau Espin b853424a28 rlcmac: tbf_ul: Fix wrong function called looking up msg size
Change-Id: I9d5afee36a633c311b5657181d0de7cbddd593e0
2023-02-20 12:31:25 +01:00
Pau Espin 8c2734fa43 rlcmac: Implement Rx of UL ACK/NACK
Related: OS#5500
Change-Id: I5e3d8e77042d3ad1618e6b62bc1a377a93239580
2023-02-20 12:31:25 +01:00
Pau Espin b3b0388f6b rlcmac: llc_queue: Fix access to null msgb during dequeue
Change-Id: I513aaef6ad0f44b5a6d32be512bdd8b4fdabb4e7
2023-02-20 12:31:25 +01:00
Pau Espin 4113903f63 rlcmac: Implement Tx of DL ACK/NACK
Measurement related functionality is not yet implemented and hence the
related fields cannot be filled in yet.

Related: OS#5500
Change-Id: I6ae2df07929fb6c4733e87b18cebe75a6f24f520
2023-02-20 12:31:25 +01:00
Pau Espin cccba723b4 rlcmac: Introduce initial poll answer infrastructure
This commit imports pdch_ul_controller.{c,h} from osmo-pcu.git
d8cea3c618dbd2a343e6c012e5545006d44fc244 and adapts it to be of use on
the MS side.

Related: OS#5500
Change-Id: I9d38a8de4240e65585cc8bbe3c044473af5a83e5
2023-02-20 12:31:25 +01:00