Commit Graph

3608 Commits

Author SHA1 Message Date
Vadim Yanitskiy aab5d12bdd layer23/modem: handle and forward L1CTL UL BLOCK.cnf
Change-Id: I9255ac17529b5ac260f9a0f141f3af6b3b72a802
Depends: libosmo-gprs.git I145b9586f83ae0235b4648916bd44996e8dc57f0
2024-02-05 15:34:28 +00:00
Vadim Yanitskiy bec5f4c4f8 layer23: cosmetic: clarify GPRS related L1CTL logging
Change-Id: Idcde85c132a52b7bc6c3f2f58c2eac0a509b7b43
2024-02-05 15:33:54 +00:00
Vadim Yanitskiy fc02727700 trxcon/l1sched: trigger sending UL BLOCK.cnf for PDTCH
In tx_pdtch_fn(), delay sending DATA.cnf until bid=3.  Otherwise we
send it too early (at bid=0) and trick the upper layers (RLC/MAC)
to believe that the whole block (all bursts) has been transmitted.

Change-Id: If32fafeef0ea347ed3800e6b67349bf12e66047f
2024-02-05 15:33:54 +00:00
Vadim Yanitskiy a6c837cd98 l1gprs: implement UL BLOCK.cnf (L1CTL_GPRS_UL_BLOCK_CNF)
Change-Id: I56e0b5631c7446390adbfc5664e56f56ebb88cc1
2024-02-05 15:33:54 +00:00
Pau Espin cf32f34292 modem: Improve logging when forwarding data to GRR
Change-Id: Idf80c0fa1c8293afbe354442a72f5b1c5a84f9e1
2024-02-05 15:27:25 +00:00
Pau Espin 1df9fecf16 apn_fsm: Set default timeout for APN activation to 65s
The current timeout is too low, taking into account that SM PDP
Activation timeout is already 30. When SM fails, it will retry sending
PDP Context Activation Req. Hence, give it enough time to at least retry
once, plus some extra buffer time (eg to go through GMM attach once).

Change-Id: I34f9b0a5ad5767155dc3e4c0ac1c4bf1521be596
2024-02-05 15:27:25 +00:00
Vadim Yanitskiy e344d6b7c2 l1gprs: minor changes to l1gprs_handle_rts_ind()
* assert() the given TDMA Tn before accessing gprs->pdch[]
* do not check TDMA Fn, as there can be no RTS.ind for PTCCH/U
** unlike PTCCH/D, we send Access Bursts on PTCCH/U

Change-Id: Ie74d1c4123715d61875c4c956eb4a1ce97ed5f24
2024-02-05 12:55:31 +00:00
Vadim Yanitskiy e2529ea58f mobile: fix -Wmaybe-uninitialized in tch_csd_rx_{to,from}_l1()
It's unlikely to happen as long as all TCH_DATA_IOF_* variants are
handled in the switch statements, but still gcc does complain.

Change-Id: I0a81d5c4f11feb7cf73771c23848dee9ce6ec620
2024-02-03 02:38:24 +07:00
Vadim Yanitskiy ff0e47de6b trxcon/l1gprs: print msgb hexdump in prim_dequeue_pdtch()
Change-Id: I1f82d53a46017c805c70b9dcccad058048549220
2024-02-02 00:09:28 +07:00
Vadim Yanitskiy 006bfe5c3a trxcon/l1gprs: print dropped prims in l1sched_reset_lchan()
Change-Id: Iaa11b5cee16dc43ef01c38be756864c2b3b57835
2024-02-02 00:09:24 +07:00
Vadim Yanitskiy 57ef3dea1b mobile: VTY: store/read data call params to/from config file
We already have VTY commands to configure data call parameters at
run-time, but so far there was no way to save and restore them.
This commit adds the respective commands to TCH_DATA_NODE.

Change-Id: I4453f2e7e048b3f3ebb1727f6d26f018c792c92d
Related: OS#4396
2024-01-26 14:29:44 +00:00
Vadim Yanitskiy 4b496a8c1c mobile: fix rate adaption checking for MO/MT CSD calls
Currently we unconditionally expect the rate adaption (octet 5) in
the Bearer Capability IE to be GSM48_BCAP_RA_V110_X30.  This is
correct for UDI (GSM48_BCAP_ITCAP_UNR_DIG_INF), but not for 3.1 kHz
audio (GSM48_BCAP_ITCAP_3k1_AUDIO) and fax (GSM48_BCAP_ITCAP_FAX_G3)
calls.  For the later two it should be GSM48_BCAP_RA_NONE.

Change-Id: I70d36b3540ed2469068e050809a17ed07b434ad7
Related: OS#4396
2024-01-26 14:29:44 +00:00
Vadim Yanitskiy 8fa524c397 mobile: properly handle different TRAFFIC.{ind,req} formats for CSD
So far we supported the Texas Instruments format (TCH_DATA_IOF_TI),
which is used by Calypso based phones (e.g. Motorola C1xx), but not
the format that trxcon speaks/understands (TCH_DATA_IOF_OSMO).

Change-Id: Ib17e800e91ad536db53aa55661076089f0ce34b0
Related: OS#4396
2024-01-26 14:29:44 +00:00
Vadim Yanitskiy 17c3cbdb09 mobile: VTY: disable DATA_CALL_TR_V34_9600 (not supported)
We cannot initiate V.34 data calls because gsm48_encode_bearer_cap()
does not support octet 6d.  This variant should not be selectable.

Change-Id: Ibafb9a693654672fb9a6abf665c500a27c87bf22
Related: OS#4396, OS#6344
2024-01-26 14:29:44 +00:00
Vadim Yanitskiy b4cb78a9d9 modem: fix assigning .timer_cb twice (-Winitializer-overrides)
Change-Id: Id2d565a5035c47053c0dfa5ad9be3378471b6e14
2024-01-26 01:22:22 +07:00
Vadim Yanitskiy 2cb3b7adbb mobile: VTY: rework data type/rate configuration commands
Change-Id: I7393fce82613a57275033f5c47e16bbf708a3bfb
Related: OS#4396
2024-01-24 23:41:56 +07:00
Vadim Yanitskiy aae93c2163 mobile: VTY: make soft-UART parameters configurable
Change-Id: I48bb58aaf1101fbc0e58db3fb1100927e506ede2
Related: OS#4396
2024-01-24 23:41:56 +07:00
Vadim Yanitskiy 3c54d77b12 mobile: VTY: use 'enum gsm48_bcap_transp' from libosmogsm
Change-Id: Iebc0692f17a5a5d04e57d74a720db52775937bdd
Related: OS#4396
2024-01-24 23:41:56 +07:00
Vadim Yanitskiy 8ebaeca991 mobile: handle V.24 line status updates from V.110 TA
Change-Id: I05ba2e10fefe3cae687831b5ced971aa244ad336
Related: OS#4396
2024-01-24 23:41:53 +07:00
Vadim Yanitskiy f35414b75e mobile: add a separate logging category for CSD
Change-Id: If9db0759aeb4324ace9ae258c852787f37897d83
Related: OS#4396
2024-01-24 07:04:57 +07:00
Vadim Yanitskiy 17ea9530b9 doc/examples/mobile: add tch-{data,voice} sections
Change-Id: I9e53d4c429445ded07d77b27b6a31aa404b00e27
Related: OS#4396
2024-01-24 00:04:36 +00:00
Vadim Yanitskiy 149da511d4 firmware (libosmocore): fix gsm48_chan_mode for TCH/[FH]2.4
This is basically a back-port of the fix that was merged to
libosmocore.git back in 2013.  Our ancient copy of libosmocore,
which is used for building the firmware, predates this commit.

Ideally, we should rip off this ancient copy and build the firmware
against recent master (see OS#2378).  But for now, let's just fix
our local copy.  Otherwise TCH/[FH]2.4 support is broken.

Change-Id: I99f528f3e1cd4c04ebb9d8becf1572688dd531ae
Related: libosmocore.git 31e844bfe2
Related: OS#4396
2024-01-24 00:01:50 +00:00
Vadim Yanitskiy 088ddb23c4 mobile: fix unsupported data rate (UR/IR) messages
Change-Id: I4f68cc999cb7bf9c5a17c8650de0411248420c1e
Related: OS#4396
2024-01-20 07:36:33 +07:00
Vadim Yanitskiy 4371181456 mobile: implement sending CSD data over UNIX socket
Change-Id: Id054af7b3d9d0a41715f7981deb420f6e09bf30c
Related: OS#4396
2024-01-20 07:36:15 +07:00
Vadim Yanitskiy caa0065824 mobile: integrate V.110 TA & soft-UART from libosmocore
Change-Id: I7ac9c0e5010730fa4d8bc7a7a3c7ff85e11731c0
Depends: libosmocore.git I6d2f8e250df31c233a2741163113dc07515409ae
Depends: libosmocore.git I5716bd6fd0201ee7a7a29e72f775972cd374082f
Depends: libosmocore.git I2ca95963fd5852ddb89bdd35b86b31489127fe84
Related: OS#4396
2024-01-20 06:08:06 +07:00
Vadim Yanitskiy f147776e47 mobile: split voice specific TCH handling into its own file
Change-Id: Ib917d95fe77da3e60bc932cce56714d81095c7d4
Related: OS#4396
2024-01-20 06:08:03 +07:00
Vadim Yanitskiy 0829246a22 mobile: rename tch_send_voice_{msg,frame}() functions
These functions can also be used for sending data frames (CSD).

Change-Id: Ib55b4405847f2efb583f3a379ff4b6929d6d6c5b
Related: OS#4396
2024-01-18 03:54:15 +07:00
Vadim Yanitskiy 129d0ea802 mobile: init/deinit GAPK I/O based on CC transaction events
Change-Id: I28f87f6a6de673611aa02a24e8985aee23d4498b
Related: OS#4396
2024-01-18 03:51:35 +07:00
Vadim Yanitskiy 4038d3e42f mobile: cosmetic: use consistent naming for gapk_io_state
Change-Id: I96a995bdf20c95a15271de68fbf434e101047313
Related: OS#4396
2024-01-17 22:52:41 +07:00
Vadim Yanitskiy a8c3e6eb0e mobile: store MNCC Bearer Capability in CC transaction
We will need to know the current Bearer Capability of a CC
transaction in the upcoming patches adding CSD support.

Change-Id: Ifc3ecf832a552c65444f49711ac836b6cd984715
Related: OS#4396
2024-01-17 22:52:41 +07:00
Vadim Yanitskiy c3a1f4a39b mobile: add generic signals for CC/SS/SM transactions
This allows driving logic in other modules based on transaction
related events, such as allocation, deallocation, or a state change.
These new signals will be used in the upcoming CSD implementation.

Change-Id: Idae5da24cb517878a26cc14b2ba6976e60f0b31b
Related: OS#4396
2024-01-17 22:52:41 +07:00
Vadim Yanitskiy 1f0ce9c9ab fixup: mobile: always check return value of tlv_parse()
Fix a regression: check if Location Area Information IE fits.

Change-Id: I51e2ae1be1c51a6359f8b0faad56f654251f1413
Fixes: bb0ac02e "mobile: always check return value of tlv_parse()"
Fixes: CID#341618
2024-01-17 05:02:12 +07:00
Vadim Yanitskiy 5a1d79e587 mobile: gsm48_mm_data_ind(): check if struct gsm48_hdr fits
A similar check was recently added to gsm48_cc_data_ind().

Change-Id: Ibc5153df41e2c6365a3c65b1906d440a1074514b
Related: 273d412a "mobile: gsm48_cc_data_ind(): check if struct gsm48_hdr fits"
2024-01-17 05:02:12 +07:00
Vadim Yanitskiy 8d4c4d649d mobile: mncc_recvmsg(): fix 'msg_type' param type
Change-Id: I5146637f1c45044d0df258aa3d82fa9454898c92
Related: OS#4396
2024-01-16 03:03:36 +07:00
Vadim Yanitskiy 273d412ad7 mobile: gsm48_cc_data_ind(): check if struct gsm48_hdr fits
Change-Id: I06c1877f603d3de0210dee7033ef163637c22054
Related: OS#4396
2024-01-16 03:02:49 +07:00
Vadim Yanitskiy bb0ac02ecf mobile: always check return value of tlv_parse()
Change-Id: Id02fc0b1af6da939cb72f327c7d2ddca484ca063
2024-01-16 01:37:02 +07:00
Vadim Yanitskiy 83e36c0caf layer23: drop unneeded forward declaration
Change-Id: I75bd08c1a88ad75d93a519422dfb7922c37a27a3
2024-01-16 01:37:02 +07:00
Vadim Yanitskiy ca183f79d8 mobile: fix segfault on empty TRAFFIC.ind
The L1 PHY may emit empty TRAFFIC.ind in case of decoding errors.
Abort execution of pq_audio_sink early, otherwise we hit an assert.

Change-Id: Ice11b72ddfd51fbfb17a4c609c664b86a8f69591
2024-01-16 01:36:44 +07:00
Vadim Yanitskiy 697e259dc4 firmware: fix shebang in solve_envs.py: s/python/python3/
This patch fixes [currently missing] Jenkins build verification.
Currently it's just skipping the firmware due to errors:

make -C target/firmware CROSS_COMPILE=arm-none-eabi-
make[1]: Entering directory '/build/src/target/firmware'
/usr/bin/env: 'python': No such file or directory
/usr/bin/env: 'python': No such file or directory
/usr/bin/env: 'python': No such file or directory
/usr/bin/env: 'python': No such file or directory
/usr/bin/env: 'python': No such file or directory
/usr/bin/env: 'python': No such file or directory
...

Change-Id: Ibfcc17ca2736da82d60db3b0e350b74e788031b0
2024-01-10 23:01:56 +07:00
Harald Welte 2a688ec5e9 layer23/ccch_scan: use osmo_mobile_identity API
* Migrate from deprecated gsm48_mi_to_string() API.
* Take a chance to unfify printing of mobile identity.
* Use osmo_load32be() for printing TMSI - this is what
  the osmo_mobile_identity API does internally.

Change-Id: Ida67adaa61689c55505a89e1a1bebde041c91139
Depends: libosmocore.git If4f7be606e54cfa1c59084cf169785b1cbda5cf5
2024-01-08 22:51:45 +07:00
Harald Welte 49d5ffb120 layer23/mobile: use osmo_mobile_identity API
Migrate from deprecated gsm48_mi_to_string() API.

Change-Id: Ib0d7f76cd635e8d1092ffc1d07ecb29ec0435dda
Depends: libosmocore.git If4f7be606e54cfa1c59084cf169785b1cbda5cf5
2024-01-08 22:34:35 +07:00
Vadim Yanitskiy 22b8076619 virt_phy: use osmo_init_logging2() to init logging
Change-Id: Iaaaa3b0c1aaea8d96b760938a4638eaa0dd65bc7
Related: OS#6299
2023-12-10 18:18:12 +07:00
Vadim Yanitskiy 2242dbfcc6 virt_phy: fix checking stderr_target in ms_log_init()
Checking the stderr makes a little sense, since it's an integer
value (usually equal to 2).  The actual intention, most likely,
was to check 'stderr_target' against NULL.

Change-Id: Id597f766142f928135f9fd2b7cf4d69de7bc72f0
Related: OS#6299
2023-12-10 18:17:57 +07:00
Vadim Yanitskiy 08109f5fee layer23: fix incorrect check in gsm_arfcn_refer_pcs()
Change-Id: I1f4107bdbb0f696ed3bd3cceaa94353ebe69f78f
Fixes: 046ee64e3d
Fixes: CID#336542
2023-12-09 05:07:45 +07:00
Andreas Eversberg 1641e07c98 Correctly assemble measurement result into MEASUREMENT REPORT
After adding the strongest cell to the measurement report, the variables
'strongest' and 'strongest_i' are used to prevent that already added
cells are added again.

Please note that there are no neighbor cell measurements available,
because current layer 1 does not report BSIC of neighbor cells. This
means that there is no neighbor cell reported.

Related: OS#6280
Change-Id: Iaeeaf978da31611c47a20af41790bfa6640dcffd
2023-12-04 16:35:21 +01:00
Andreas Eversberg 058a17db20 Correctly initialize neighbor cell measurement list from SI5*
A wrong index was used, causing the first neighbor cell to be
uninitialized. This uninitialized neighbor cell was reported by
MEASUREMENT REPORT.

Related: OS#6280
Change-Id: I192c0777450cbe24abb3c7c8736c678b97725e9f
2023-12-04 16:34:41 +01:00
Andreas Eversberg 046ee64e3d mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810
While it is correct to use the band indicator from SI1 rest octets,
it may only be applied for ARFCN values in the range 512..810.

The function gsm_refer_pcs() is used to determine, if the cell (which
'talks' about ARFCNs) refers to them PCS or DCS channels. It returns
true, if it refers to PCS, but this only means that ARFCNs in the range
512..810 are PCS channels, not all ARFCNs.

The new function gsm_arfcn_refer_pcs() is used to add the PCS flag to an
ARFCN, if the given cell refers to PCS and the given ARFCN is in the PCS
range 512..810.

Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007
Related: OS#6078
2023-11-27 10:49:26 +01:00
Andreas Eversberg 520dd66bdb LAPDm: Enable flag to prevent sending two subsequent REJ frame
Setting the flag was not required in earlier versions of libosmogsm,
because this feature was enabled by default.

The roundtrip delay for a LAPD link must be less than T200.

Osmocom-bb runs LAPDm on the host machine via serial interface and USB
interface that may cause a roundtrip delay that exceeds T200. Also
osmo-bts may have that problem, due to latency between physical
interface and osmo-bts software.

What may happen:

An I frame gets lost.

The sending side transmits the next I frame. The receiving side detects
the send-sequence error and responds with a REJ frame.

Due to the round trip delay, the T200 expires on the sending side and
causes the I frame to be retransmitted with the P bit set, it enters
the timer recovery state. The receiving side detects the send-sequence
error and responds with a REJ frame with the F bit set.

The sending side will then receive two REJ frames. The first REJ frame
will clear the timer recovery state. The second REJ frame (with F bit
set) is received when not in timer recovery state, causing an
MDL-ERROR-INDICATION.

The layer 2 connection is broken.

Early tests with osmocom-bb in a real network showed exactly this
problem.

The solution is to suppress every second REJ frame at the receiving
side, until the sequence error condition is cleared. If the first REJ
frame gets lost, the sending side would retransmit the I frame again
after another expiry of T200. Then the receiving side would respond
with a REJ frame again.

Relates: OS#5969
Depends: libosmocore.git I93994dbbd1fc2c9edb8f3015c6b18ecd0fce0565
Change-Id: Iaa1645fb1970fe513d71bc1b03f7c5eac62f35d7
2023-11-27 10:44:24 +01:00
Harald Welte 818133cd23 firmware: -nostartfiles -nodefaultlibs are not flags of LD but flags of GCC
It seems that those flags have always been gcc flags, and not ld flags.

After decades of tolerating this, binutils 2.36.x no longer tolerates
those flags but prints an error:

arm-none-eabi-ld: Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?)

See also https://github.com/apache/nuttx/issues/3826 and the related
https://github.com/apache/nuttx/pull/3836 how this was solved in another
project - I adopted that solution here 1:1

Change-Id: Id199e4d03d5aae07a347c98f47791f42c12008c6
2023-11-22 14:12:26 +01:00
Vadim Yanitskiy 7c60c5d6d9 firmware/layer1: avoid 'for' loop initial declarations
As was reported by roox, osmocom-bb currently fails to build on OBS:

https://build.opensuse.org/build/home:mnhauke:osmocom:nightly/openSUSE_Tumbleweed/x86_64/osmocom-bb/_log

[   24s] layer1/prim_tch.c: In function 'l1s_tch_meas_avg':
[   24s] layer1/prim_tch.c:183:2: error: 'for' loop initial declarations are only allowed in C99 mode
[   24s] layer1/prim_tch.c:183:2: note: use option -std=c99 or -std=gnu99 to compile your code

We don't specify the C standard explicitly, so let's move the variable
declaration out of the for-loop in l1s_tch_meas_avg().

Change-Id: I6c65fbead4e612c81728e9c6601d5f2107616ee6
Fixes: 7286560a3 "firmware/layer1: fill-in DL info for L1CTL TRAFFIC.ind"
2023-11-21 17:04:10 +07:00