Commit Graph

3475 Commits (master)

Author SHA1 Message Date
Vadim Yanitskiy 9978b00ea0 modem: grr: implement RACH.req retransmission
Sometimes sending one Access Burst is not enough, so we need to repeat
sending it a few more more times changing the 3 LSBs randomly.  This
is what we already do in the mobile app, but not in the modem app.

* Rename VTY command 'grr tx-chan-req' to 'grr start-chan-access'.
* Add an intermediate state GRR_ST_PACKET_ACCESS.
** The GRR_EV_CHAN_ACCESS_REQ transitions to this state.
** One RACH.req gets transmitted when entering this state.
** The GRR_EV_CHAN_ACCESS_CNF confirms transmission of a RACH.req.
** Upon the timeout (300 ms) expiry, a loop state transition happens.
** After 3 loop-transitions, transition to GRR_ST_PACKET_NOT_READY.

Change-Id: Iab6d9147f6e0aeb99239affacf318a3897fd6ffe
Related: libosmo-gprs.git If0de3ed86b1e2897d70183f3b0f4fbfd7d2bda80
Related: OS#5500, OS#6131
2023-09-23 03:22:12 +07:00
Vadim Yanitskiy 57b0908a71 modem: grr: clarify a comment in forward_to_rlcmac()
Change-Id: I11286777c70c776c9f6990be988401ebd5b84f0f
2023-09-23 01:52:08 +07:00
Vadim Yanitskiy 05ddc05233 trxcon: handle_tbf_cfg_req(): properly set TSC for lchans
Before this patch all Uplink PDCH bursts were using TSC=0.

Change-Id: I58b2da0d285b9a3e444374a30276fbaab3b784ac
Related: OS#5500
2023-09-05 18:42:29 +00:00
Vadim Yanitskiy 9a71f0a18b virt_phy: fix wrong pointer being checked
Change-Id: I2f845b0335d2d9818aa15c30f8621acd120e82d4
Fixes: fa833e40 "l1gprs/l1ctl: Decouple RTS.ind from DL_BLOCK.ind"
Fixes: CID#323121
2023-09-06 01:08:32 +07:00
Pau Espin fa833e4095 l1gprs/l1ctl: Decouple RTS.ind from DL_BLOCK.ind
Before this patch, the RTS:ind was crafted up in the stack when
receiving the DL_BLOCK.ind. This created some problems since the
internal low level state has to be updated in between signalling
DL_BLOCK.ind and RTS.ind, as there's a fn-advnace of one block between
those 2 signals (hence the timeslot allocation has to be applied at the
time when the fn-advance is applied).
This is actually not fixing the whole issue, since there's several
timeslots and hence the following events will have the internal timeslot updated
during the event in the middle, hence potentially causing problems in the
remaining TS:
DL_BLOCK.ind(FN=N, TS=1),  RTS.ind(FN=N+4, TS=1), DL_BLOCK.ind(FN=N, TS=2)

In any case, this decoupling already improves the situation and is step
needed anyway towards fully fixing the problem (by, for instance,
maintaining a timeslot state duplicated both for DL and Ul directions,
since they drive based on differnet FN time (1 PDCH block).

Change-Id: I1494e0aac7555f6e01b4b435b77140afc42c098e
2023-09-04 22:34:08 +00:00
Mychaela N. Falconia 59e649dbf1 firmware: board: add support for TR-800 target
iWOW TR-800 is a packaged GSM modem module based on Calypso+Iota+Rita
chipset; it is fully quadband, and reverse engineering of its PCB
confirms that this module is nothing but a mass-produced version of
the core of TI's legendary Leonardo+ reference platform.  The same
module is also known as FreeCalypso Tango - a rebranded version of
the same hardware module with different firmware and a different
Responsible Party for official support.

FreeCalypso HQ is contributing OsmocomBB support for this Calypso
modem module for two reasons:

1) Harm reduction - sooner or later someone in Osmocom universe is
   going to run OBB firmware on TR-800 once they lay their hands on
   this hardware, and the resulting operation will be less harmful /
   closer to correct if we provide the basic board support patch.

2) There exists a large surplus of FreeCalypso Caramel2 development
   boards that are based around FC Tango modules.  Having this hw
   supported by both firmwares will hopefully increase the chances
   that these boards will find loving homes, as opposed to continuing
   to gather dust in a cardboard box.

Legal and ethical disclaimer: OsmocomBB firmware running on ANY
Calypso+Iota+Rita target is *known*, through confirmed observations
with a measuring instrument (R&S CMU200), to put out radio transmissions
that are *severely out of spec*, and this defect does NOT go away
with the present patch which merely adds support for a different C+I+R
board target.  The present patch has been produced as a harm reduction
measure, to reduce (but not to zero) the harm that will be caused
by parties who run OsmocomBB firmware on C+I+R hardware despite having
been advised not to.  As the party seeking to reduce rather than cause
that harm, Mother Mychaela and her related business entities explicitly
disclaim all liability for damage that will be caused by parties who
continue running OsmocomBB firmware despite having been repeatedly
advised to switch to manufacturer-approved published-source firmware

Change-Id: I84d564f052f12a25ea3bfb9c78860e9dc6262be8
2023-09-04 20:19:12 +00:00
Pau Espin c20f3f3f19 trxcon: Print fn in prim_enqueue()
Change-Id: I3725a77cbfb116697c1287edbac9068e64768a19
2023-09-04 16:58:55 +02:00
Vadim Yanitskiy 096a3cc6f3 trxcon/l1sched: refactor l1sched_mframe_layout()
Change-Id: Ie1c3679879ef97d42237d6723d1619ac0ef97f6b
2023-08-27 16:10:38 +00:00
Vadim Yanitskiy a93785bf43 trxcon/l1sched: implement CSD scheduling support
This patch adds support for TCH/[FH]2.4, TCH/[FH]4.8, TCH/F9.6 and
TCH/F14.4 (including FACCH).  Additional changes made:

* enlarge the maximum TCH burst buffer size to 24 * (2 * 58) bytes;
* enlarge per-l1cs UL/DL burst masks to hold up to 32 bits;
* enlarge per-l1cs DL meas ring buffer to 24 entries;
* enlarge L1SCHED_PRIM_TAILROOM from 256 to 512 bytes;
* enlarge L1CTL_LENGTH from 256 to 512 bytes;

Change-Id: I0d7389a9a5f7019b9316ab1c0115797ff54a0e41
Depends: libosmocore.git Ib482817b5f6a4e3c7299f6e0b3841143b60fc93d
Depends: libosmocore.git I0c7a9c180dcafe64e6aebe53518d3d11e1f29886
Depends: libosmocore.git I4685376c8deb04db670684c9ebf685ad6fc989fa
Related: OS#4396, OS#1572
2023-08-27 07:14:54 +00:00
Vadim Yanitskiy d130d9d7b1 layer23: modem: pass TBF starting time from CFG UL/DL TBF Req
Change-Id: Iae53c6e704a5b868a265216d4cb48b1edc2d7e61
Depends: libosmo-gprs.git I27a7a896fe3839fa4f9b8cd9500c4ab7867bbaa0
Related: OS#5500
2023-08-24 15:47:54 +02:00
Pau Espin a98f0bd930 l1gprs: Log slotmask when logging TBF
Change-Id: Ib96b01c591dbcc6aa9e0527e0be499ef8aee2863
2023-08-24 15:47:54 +02:00
Pau Espin 9fcf7a45b2 l1gprs: Improve logging fn and tn in BLOCK.req
Change-Id: Iba29d88770e79fee0e4ac3c8f4e833907afa5b52
2023-08-24 15:47:54 +02:00
Vadim Yanitskiy 71e39bccf1 l1gprs: implement TBF starting time support
Change-Id: I174e3c43d2f4c828a528710b284e62c9bb794122
Related: OS#5500
2023-08-24 15:47:54 +02:00
Pau Espin 13b1946fa7 layer23: modem: Pass fn from lapdm to L1CTL-CCCH_DATA.ind
Change-Id: I7a9f31ae363fe7de019ff1a906f3978ff3074036
2023-08-24 15:47:51 +02:00
Vadim Yanitskiy fb384998fb trxcon: properly handle PDCH slotmask in UL/DL TBF CFG.Req
Change-Id: I4c2ff25217fba0b6b4704f023071b86ed9afb55c
Related: OS#5500
2023-08-11 19:47:32 +02:00
Pau Espin 3ac817108e l1gprs: Fix slotmask update on already registered tbf
Change-Id: I5d64488d2aa740e91e01fad17f2af3ded24b12ef
2023-08-11 18:04:18 +02:00
Vadim Yanitskiy 8b4640ec19 l1ctl_proto: add 'start_fn' field to UL/DL TBF CFG.req messages
Change-Id: Ibb6a05165fe1c81268fb0e3674adae4065e78171
Related: OS#5500
2023-08-10 15:16:49 +02:00
Pau Espin 8bbd0d173f l1ctl: Fix fill ph_data_param fn field
This commit fixes recent previous commit filling in the fn field. The
dl->frame_nr is network order, and we want to pass a host order integer
in the primitive. Use the tm.fn which already includes the proper value
calculated from dl->frame_nr.

Fixes: d524c17d90
Related: OS#3626
Change-Id: Id96015c8b419932abb8095c6cb85aceef34e366f
2023-08-10 14:28:06 +02:00
Pau Espin d524c17d90 l1ctl: Fill ph_data_param fn field
Related: OS#3626
Change-Id: I3317296b2bda1088a2af81ba9b135714f8393afd
2023-08-09 16:38:06 +02:00
Andreas Eversberg 845ad38328 Fix VTY command to set IMEISV.
The pointer and size must given for the SV portion of the character
array only.

Fixes: CID#314049, CID#314048
Change-Id: Ieff4ca886dec71aae1b6ecf2b623d600426580da
2023-08-08 04:30:33 +00:00
Pau Espin 171ba46382 layer23: modem: gmm: Adapt log string about no TLLI found
During initial GMM Attach, the GMM layer generates an internal
local TLLI and uses it to do the GMM Attach. Only at the time it
receives the GMM Attach Accept with the assigned TLLI from the network
then explicitly informs other layers about the TLLI update.
Hence, the GMMREG user doesn't really know about the TLLI in use until
the GMM Attach success happens (gmmreg-attach.cnf).
During that time, the TLLI at the app is basically unassigned
(0xffffffff). Hence, during that same time a TLLI update hook in
GMMRR-Assign.req will not work since the app is unaware of the remporary
local TLLI, so no match can be done.
In that specific scenario, that's fine, since anyway it is waiting to
receive the GMMREG-Attach.cnf, which will indicate the assigned TLLI to
In summary, not being able to match the TLLI in GMMRR-Assign.req is not
bad per se, so soften the log error there.

Change-Id: I31c04288789393391084000fbdbcdcedb11d0b68
2023-07-31 18:12:57 +02:00
Pau Espin e2fd48e7d7 layer23: modem: gmm: Log allocated TLLI on Attach Success
Change-Id: I29242873ebec173c430e6d413e6c533ec1e2b97a
2023-07-31 18:03:19 +02:00
Pau Espin c8b951e276 layer23: modem: Fix newline character typo in log line
Change-Id: I3ff9b71ff469e339aadff643b582efb06d5efb6c
2023-07-31 17:46:15 +02:00
Pau Espin 33dd069aa8 layer23: modem: Validate IP version of UL data packets from tun match PDP context setup
Change-Id: I3fe56fcbdbb6be3366829a14a433b735f7f9d43c
2023-07-27 21:25:32 +00:00
Vadim Yanitskiy 3f409eb94e trxcon/l1sched: emit DATA.cnf early (on bid=0)
trxcon's scheduler is currently emitting DATA.cnf whenever the last
burst of a DATA.req has been transmitted.  This sounds logical, but
makes the implementation quite complex.  It's even harder to implement
sending of DATA.cnf properly for CSD specific channel modes, which are
to be implemented in a follow-up patch.

The DATA.cnf prims trigger sending of L1CTL DATA.cnf/TRAFFIC.cnf,
which are interpreted as Ready-to-Send by the upper layers (layer23).
Additionally DATA.cnf prims trigger sending of GSMTAP PDUs containing
the respective Uplink frames.

This patch changes the l1sched logic, so that a DATA.cnf primitive
is emitted whenever the respective DATA.req is dequeued and encoded
using the lchan specific channel coding function.  This simplifies
the code a lot and prepares for the upcoming CSD support.

As a bonus, this patch fixes an inconsistency between TDMA FNs reported
in Uplink and Downlink GSMTAP PDUs.  Now we're indicating the first Fn
in both cases, so Uplink is consistent with Downlink.

Change-Id: Ie09a24cd950a93edd871a9fbc5b47ec96c24cceb
Related: OS#4396, OS#1572
2023-07-27 20:34:37 +00:00
Pau Espin 89ef574fe2 layer23: modem: Avoid direct transition ST_PACKET_TRANSFER->ST_PACKET_IDLE
Right now the existing code is switching to state IDLE and hence running
grr_st_packet_idle_onenter() which attempts stuff like starting an attach.
This is all done while the L1CTL RESET + FBSB is still in progress. We
should instead wait to receive confirmation from those.
As an easy implementation for now, simply switch to the
GRR_ST_PACKET_NOT_READY state, which will move to GRR_ST_PACKET_IDLE
once it starts receiving CCCH blocks (aka it will already have gone
through L1CTL RESET + FBSB completely).

Change-Id: Ie797b36701d10c6052500c637a08b061bb1e4bd7
2023-07-24 14:00:47 +02:00
Pau Espin 345d03a6f6 layer23: modem: Delay using cell until fully synced to it
Change-Id: If306d82879281bb540c5cdee2eaf354858c8d24b
2023-07-24 14:00:47 +02:00
Pau Espin 0a6ad6bbf8 layer23: modem: Submit L1CTL-CCCH_READY.ind
Signal RLC/MAC layer that the lower layers is in packet idle mode ready
to use CCCH (such as packet-access-procedure).

Change-Id: I05050e840a3b267b3b3a278588ee113b45bfbd4c
2023-07-24 14:00:47 +02:00
Vadim Yanitskiy e9bfff30ac trxcon: trx_if_cmd_poweron(): send CMD POWERON unconditionally
This works-around a race condition happening when the upper layers
are sending L1CTL RESET.req immediately followed by L1CTL FBSB.req.
The problem is that the TRXC logic is considering the transceiver
powered on until a response to CMD POWEROFF is received.

Change-Id: I967ce047eb198f1eaf8446bb4c1f87a98d3de264
Related: OS#5500
2023-07-24 14:00:47 +02:00
Vadim Yanitskiy 5462ad040c modem: handle OSMO_GPRS_RLCMAC_L1CTL_PDCH_{ESTABLISH,RELEASE}
Change-Id: Ic39ce696834943dc661c85cbf3d54ccd598b60ce
Depends: libosmo-gprs.git I2568c58646ce7511367275ac96cd55e7fdd7ec18
2023-07-24 14:00:47 +02:00
Vadim Yanitskiy 3f0f1a4214 layer23: modem: implement GPRS-RR FSM
Change-Id: I8a7d85df7b07d85ac86e0b7e340f6bbacc65e1bc
2023-07-24 14:00:41 +02:00
Pau Espin 19450eb435 layer23: modem: gmm: Update own TLLI copy though GMMRR-Assign.req hook
This is needed in order to provide updated TLLI when submitting new user
data from the tundev to the SNDCP layer.

Change-Id: I5c6a2c371ae6d65bf4fe23e665ec939da37112be
2023-07-20 12:36:21 +02:00
Pau Espin 3a031345e1 layer23: modem: llc: Forward LL-Assign.req to SNDCP
Depends: libosmo-gprs.git Change-Id I924dcf3ac9cbb15e26a5e9376f89ca098ab49e0b
Change-Id: I0b0f025a0cd356c997fc4620f2d6be4792fc1d29
2023-07-20 12:09:37 +02:00
Pau Espin 7e262322d1 layer23: modem: gmm: Forward GMMSM-Modify.ind to SM layer
Depends: libosmo-gprs.git Change-Id Ic765b7a565cac4abcf34d8c6868e103971d17822
Change-Id: I3cd90ad85fb77b09c3300e87e454c4fe641edc88
2023-07-20 12:09:29 +02:00
Vadim Yanitskiy 0cfd0bbe80 trxcon/l1sched: transmit dummy speech blocks with inverted CRC3
In case when an Uplink TCH/[FH]S frame needs to be transmitted, but
there is no frame available in the Tx queue, transmit an intentionally
invalid block with inverted CRC3.  This will induce a BFI condition in
the BTS side receiver.  See also the related osmo-bts-trx patch.

Change-Id: I16ff09a220da13c2c76538bc43354afc4e688794
Depends: libosmocore.git Iade3310e16b906efb6892d28f474a0d15204e861
Related: osmo-bts.git I78106802a0aa4af39859c75d29fe0e77037899fe
2023-07-12 03:52:34 +07:00
Vadim Yanitskiy fd8962e891 trxcon/l1sched: do not craft artificial BFI frames on TCH
Whenever decoding fails or a FACCH setaling happens, simply send an
empty DATA.ind to the upper layers.  On the Uplink path, use a dummy
LAPDm func=UI frame (with random padding) whenever possible.

Crafting TCH frames with zeroes is not really needed and moreover makes
it hard to distinguish between valid speech frames and BFIs.  This also
used to be the case for osmo-bts-trx, but not anymore (see the related

Change-Id: I20391b860fbc2ce8f0f03d7ba95ef7a098c0f9db
Related: osmo-bts.git I8f9fb5b8c5b2cad4b92ac693c0040779f811981a
2023-07-12 03:52:34 +07:00
Vadim Yanitskiy 44282c0fe8 trxcon/l1sched: simplify and unify prim_dequeue_tchf()
Make it easier to read and more similar to prim_dequeue_tchh().

Change-Id: Ie79069e5cc8acd193a326ac9d334fe070552e320
2023-07-12 03:52:34 +07:00
Vadim Yanitskiy 21aacfe709 trxcon/l1sched: peoperly prioritize FACCH/H over TCH
Unlike FACCH/F, which steals one TCH frame, FACCH/H steals two TCH
frames.  This is what prim_dequeue_tchh() aims to implement, but
the current implementation is not 100% correct.

The problem is that we're attempting to dequeue and drop two TCH frames
in one go, whenever we get a FACCH/H frame.  Most likely, there will be
no 2nd TCH frame in the Tx queue at that time, so it will never be
dropped and will clog the queue.

Let's replicate what osmo-bts-trx does:

* dequeue and drop the 1st TCH frame when sending 1st/6 burst of FACCH,
* dequeue and drop the 2nd TCH frame when sending 3rd/6 burst of FACCH.

Change-Id: I513d6805ddf97783c002be285fb3ca7893e42377
Related: OS#4396, OS#1572
2023-07-12 03:52:34 +07:00
Vadim Yanitskiy a22acea3a9 trxcon/l1sched: rework dequeueing of Tx prims
Centralized dequeueing of Tx prims in l1sched_pull_burst() is a working
approach, but doing this in each logical channel handler individually
is a lot more flexible.  This is how it's done in osmo-bts-trx, and
this allows implementing FACCH support for CSD channels.

Change-Id: I3d6c2136ff1855ab0aa9062b20b2a64fd0e5fe28
Related: OS#4396, OS#1572
2023-07-12 03:52:34 +07:00
Vadim Yanitskiy 58bd4e712a trxcon/l1sched: remove unused vars in l1sched_lchan_amr_prim_is_valid()
Change-Id: I57e18866addc2245c017e354eab218f56583026c
Related: OS#4396
2023-07-12 03:49:51 +07:00
Vadim Yanitskiy d84b2ed6ed trxcon/l1sched: fix handling of UL FACCH on TCH/A[FH]S
In ad8f7794 I changed both tx_tch[fh]_fn() to use a switch statement
and introduced a regression by removing special treatment of FACCH:

@@ -238,10 +237,16 @@ int tx_tchf_fn(struct l1sched_lchan_state *lchan,
-       if (msgb_l2len(lchan->prim) == GSM_MACBLOCK_LEN) {
-               /* Encode payload */
-               rc = gsm0503_tch_fr_encode(buffer, msgb_l2(lchan->prim), GSM_MACBLOCK_LEN, 1);
-       } else if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) {
@@ -459,10 +458,15 @@ int tx_tchh_fn(struct l1sched_lchan_state *lchan,
-       if (msgb_l2len(lchan->prim) == GSM_MACBLOCK_LEN) {
-               rc = gsm0503_tch_hr_encode(buffer, msgb_l2(lchan->prim), GSM_MACBLOCK_LEN);
-               lchan->ul_facch_blocks = 6;
-       } else if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) {

Now if the channel mode is GSM48_CMODE_SPEECH_AMR, UL FACCH/[FH] frames
will be fed to osmo_amr_rtp_dec(), which is definitely wrong.  Fix this
by doing all AMR specific checks in a separate function, which is
called only for speech frames.

Change-Id: Ie217bbb389b5abb95d241781ffe3f5c7b1c188c0
Fixes: ad8f7794 "trxcon/l1sched: remove redundant TCH/[FH] prim length checks"
Related: OS#4396
2023-07-12 03:49:51 +07:00
Vadim Yanitskiy 60215bc051 modem: properly handle Dedicated mode or TBF IE
We need to distinguish between Uplink and Downlink TBF assignment in
grr_rx_imm_ass(), because matching the Request Reference IE makes
sense only for the Uplink TBF assignment.

Uplink TBFs are requested by the UEs by sending RACH, while Downlink
TBFs are assigned by the network itself.  The Request Reference IE
is only valid for Uplink assignments and shall be ignored in messages
assigning Downlink TBFs.

Change-Id: Idb9b3203147be3b42256c0bcab3ecdabcf2d2fa9
Related: OS#5500
2023-07-04 01:43:33 +07:00
Vadim Yanitskiy 9f61426a15 layer23: use gsm0502_fn2ccch_block() from libosmogsm
Change-Id: I652a2ab9ddb3cb5082cce911a5cdb4cf8abcf552
Depends: libosmocore.git I8cbd31226754e95887358ed83a928e2f567f4cf3
2023-06-23 00:01:24 +07:00
Vadim Yanitskiy bc04784b14 layer23: cosmetic: move <lapdm.h> to other libosmo* imports
Change-Id: Id4d8df3f230729dc2c65e1bedea705e28feaa029
2023-06-22 23:32:35 +07:00
Vadim Yanitskiy 3211489649 modem: cosmetic: fix formatting in modem_gmm_prim_up_cb()
Change-Id: I1498b92f2dc3d056ca69072dfb077cba65b86b6e
2023-06-17 01:40:39 +07:00
Vadim Yanitskiy 749f0a461c layer23: fix handling of logging category mask (-d option)
In change 67943df4 I broke handling of the logging category mask in
the mobile app.  Adding this option results in a segfault:

  ERROR: osmo_log_info == NULL! You must call log_init() before
         using logging in log_parse_category_mask()!
  Assert failed osmo_log_info src/libosmocore/src/core/logging.c:329

As can be seen, the problem is that we are calling
log_parse_category_mask() before initializing the logging.

As possible solution, I could rearrange the code to parse command
line options after calling osmo_init_logging2().  This would fix
the segfault, but would not fully solve the problem.

If we call log_parse_category_mask() before parsing the config file,
then logging configuration in the config file overwrites the logging
configuration specified via the command line.  But we want the
opposite: the command line setting should overwrite the config file
parameters.  This is handy because there is no need to edit the
config file if you quickly need to test something.

So let's call log_parse_category_mask() after parsing the config file.

Change-Id: I1b2b7804bf99b71f96e9197f7824cfd20431e8a1
Fixes: 67943df4 "layer23: fix parsing of command line options"
2023-06-16 06:51:59 +07:00
Harald Welte df900478de layer23: Update to libosmocore osmo_auth_gen_vec2
libosmogsm has recently deprecated the use of osmo_auth_gen_vec
and the osmo_sub_auth_data structure in favor of newer versions
of this API. Let's migrate to it

Change-Id: I1d9751c5f74a59e7310d07d54a3fdbac213324bd
Depends: libosmocore.git Ie775fedba4a3fa12314c0f7c8a369662ef6a40df
2023-06-15 09:23:45 +00:00
Vadim Yanitskiy 96fec1646d mobile: fix -Wlogical-not-parentheses in gsm48_cc_init()
Found by clang:

  gsm48_cc.c:54:6: warning: logical not is only applied to the left
                   hand side of this comparison [-Wlogical-not-parentheses]
        if (!cc-> == 0)
            ^                      ~~

Change-Id: Ic7ffd3aa25339e24a31bae1b7428f1f93e261858
2023-06-14 20:53:41 +07:00
Vadim Yanitskiy 923e9b0b90 trxcon: do not advance Uplink TDMA Fn by default
The idea behind advancing Uplink TDMA Fn is to give the transceiver,
which is usually a separate process, some additional time to receive
and prepare Uplink bursts for transmission.  This comes at a price
of having an additional delay between Uplink and Downlink.

Given that trxcon, as a standalone application, is primarily used in
conjunction with for running ttcn3-bts-test against
osmo-bts-trx, there is no reason to advance the Uplink TDMA Fn.

Change-Id: I838b1ebc54e4c5d116f8af2155d97215a6133ba4
Related: OS#5500
2023-06-11 19:25:31 +00:00
Vadim Yanitskiy 45c821aee0 trxcon: get rid of the timer driven clock module
trxcon was heavily inspired by osmo-bts-trx, and among with many other
scheduling related parts also inherited the timer driven clock module.

This clock module is driving the Uplink burst scheduling, just like it
does drive the Downlink burst scheduling in osmo-bts-trx.  Just like
in osmo-bts-trx, the clock module relies on periodic CLCK indications
from the PHY, which are needed to compensate for the clock drifting.

The key difference is that trxcon is using Downlink bursts as the CLCK
indications, see 'bi.fn % 51' in trx_data_rx_cb().  This is possible
because the MS is a clock slave of the BTS: the MS PHY needs to sync
its freq. and clock first, and only after that it can Rx and Tx.

So far we've had no problems with the clock module in trxcon until we
started adding GPRS support and integrated the l1gprs.  While the CS
domain is quite flexible in terms of timings and delays, the PS domain
is a lot more sensetive to the timing issues.

Sometimes it happens that the trxcon's clock module is ticking quicker
than it should, resulting in Uplink PDCH blocks being scheduled earlier
than the respective Downlink PDCH blocks are received:

20230502021957724 l1sched_pull_burst(): PDTCH/U Tx time (fn=56103)
20230502021957744 (PDCH-7) Rx DL BLOCK.ind (fn=56103, len=23): ...
20230502021957747 l1sched_pull_burst(): PDTCH/U Tx time (fn=56108)
20230502021957765 l1sched_pull_burst(): PDTCH/U Tx time (fn=56112)
20230502021957767 (PDCH-7) Rx DL BLOCK.ind (fn=56108, len=23): ...
20230502021957768 (PDCH-7) Rx UL BLOCK.req (fn=56112, len=54): ...
20230502021957784 l1sched_pull_burst(): PDTCH/U Tx time (fn=56116)
20230502021957784 TS7-PDTCH dropping Tx primitive (current Fn=56116, prim Fn=56112)

This is impossible in reality, because Uplink is intentionally lagging
behind Downlink by 3 TDMA timeslot periods.  In a virtual setup this
causes sporadic dropping of Uplink PDCH blocks, as can be seen from
the logging snippet above, and significantly degrades the RLC/MAC
performance for GPRS.

Let's remove the internal clock module and trigger the Uplink burst
transmission each time we receive a Downlink burst.  This helps to
overcome the GPRS scheduling issues and replicates the approach of
osmo-trx-ms more closely.

Change-Id: Ic8a5b6277c6b16392026e0557376257d71c9d230
Related: OS#5500
2023-06-11 19:25:31 +00:00