Commit Graph

3619 Commits

Author SHA1 Message Date
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
Vadim Yanitskiy c56247071c trxcon/l1sched: tx_tch[fh]_fn(): fix sending idle CSD frames
In accordance with 3GPP TS 44.021, sections 8.1.6 and 10.2.3, the
transmission of idle frames to the DTE is mandated when no data is
received from the radio interface.  An idle frame has all data,
status, and E-bits to binary '1' (excluding the alignment pattern).

This requirement is currently implemented by osmo-bts for the Uplink,
and is going to be adopted for the Downlink (see the related patch).

This patch brings trxcon/l1sched in sync with osmo-bts-trx.

Change-Id: I7dea3dde46bc02814e99c3e873298cc7ed045a51
Related: osmo-bts.git I0b25cfac41b6d8dcf3bfd9d46d51a9665f1b047a
Related: OS#1572, OS#4396
2023-11-14 20:44:38 +00:00
Andreas Eversberg 3aa20b9959 ASCI: Notify talker in the VTY that he cannot leave the call while talking
Related: OS#5364
Change-Id: I497efc5bddc122cd5744de531917aad415ac1654
2023-11-10 12:14:13 +00:00
Vadim Yanitskiy efe2c7b7bd mobile: rename voice.[ch] to tch.[ch]
Also take a chance to change the 'tch_' prefix for all functions.

Change-Id: I05e1ae777add73672db61565c77c68d8ab2b08f0
Related: OS#4396
2023-11-03 13:34:02 +07:00
Vadim Yanitskiy b6083dcd13 mobile: cosmetic: rename gsm48_rr_tx_{voice->traffic}()
Not only this function can be used to transmit a voice frame,
but also a data frame during a CSD call.

Change-Id: I920300ae477e3c3d7c413cd1a35f2bc385266960
Related: OS#4396
2023-11-03 13:34:02 +07:00
Vadim Yanitskiy 2170887399 mobile: add params and VTY commands for data calls
Change-Id: If52fa70cb202f0736a17fe8eb63d226186637f62
Related: OS#4396
2023-11-03 13:32:58 +07:00
Vadim Yanitskiy 1c4a77adbf mobile: gsm_settings_init(): set TCH frame format explicitly
Change-Id: I4660b07977b6701ad5dc4bf25f12cba374101f8b
Related: OS#4396
2023-11-03 13:25:55 +07:00
Vadim Yanitskiy e80d302255 mobile: clarify TCH I/O {handler,format} naming
Before we add handling of TCH I/O for data calls, let's rename the
existing voice related symbols and struct fields to have 'voice'
in their names.

Change-Id: If6c799d11e225ad00ca5da5ae63dca20568a0ce0
Related: OS#4396
2023-11-03 13:23:06 +07:00
Vadim Yanitskiy 5bdebfaae3 mobile: rename 'audio' node to 'tch-voice' node
Change-Id: I2cab597c5de92ecb343cad7aaaa48035ca5f8365
Related: OS#4396
2023-11-02 15:15:45 +07:00
Vadim Yanitskiy e73a604de0 mobile: add support for Circuit Switched Data calls
This patch implements the signalling part for mobile originating
and mobile terminating CSD calls.  The user plane interface is
to be implemented in follow-up patches.

Change-Id: I1995fa0a7a68d9b980852b664d472d4633777ac6
Related: OS#4396
2023-11-02 14:41:23 +07:00
Vadim Yanitskiy 011308cbcc mobile: move 'struct gsm_call' from <mncc.h> to <mncc_ms.h>
The only file using this structure is mnccms.c.

Change-Id: Iaa43609849ac3c755d47258d3aca4bfe7a6b3a49
Related: OS#4396
2023-10-30 15:05:58 +07:00
Vadim Yanitskiy e1bcc5af88 mobile: cosmetic: use '#pragma once' in mncc.h
Change-Id: I2f350c5b67e57097b71b12ba42c90ce0941b8fea
2023-10-30 15:05:58 +07:00
Vadim Yanitskiy df8801bed6 layer23: rework L1CTL TRAFFIC.{ind,req} related logging
Make these Rx/Tx messages more informative.

Change-Id: I9c73db3c3650547030b8c354016e65195daebb62
Related: OS#4396
2023-10-30 15:05:58 +07:00
Andreas Eversberg 9d765a66fc ASCI: Correctly set and store 'uplink-release-local' flag
Also this option is enabled by default and show in the VTY if it is
disabled.

Change-Id: I6af44f0dd7ff842de633587fb0dcbe78126d30e1
Related: OS#5364
2023-10-27 09:12:28 +02:00
Andreas Eversberg d7e611472a ASCI: Add option to join voice group/broadcast calls without valid SIM
This option must be enabled in the VTY and is disabled by default.

Calls can be joined when service is limited or normal. With that option
enabled, calls can be joined even with invalid SIM.

Talking is allowed when service is normal. With that option enabled,
talking is always allowed. It depends on the network, if it accepts the
talker.

Change-Id: I6ea851a8cb015ff685b985335968c6184beca816
Related: OS#5364
2023-10-27 09:12:26 +02:00
Andreas Eversberg bfebc81384 ASCI: Use correct mobile identiy in TALKER INDICATION message
Use TMSI only if valid in the current location area. If the MS moves to
a different location area and joins a group call before location update,
TMSI is not valid. Then use IMSI instead. If no IMSI/TSMI is available,
send mobile identity without IMSI/TMSI.

Change-Id: I299604a0e12d91e9133b70757826ac9637da0e3e
Related: OS#5364
2023-10-27 09:12:22 +02:00
Andreas Eversberg 8c190e6f92 ASCI: Handle rejection of voice group/broadcast call correctly
If joining a call gets rejected, the call must not be released, instead
it must return to U3 state (incoming call), because the call still
exists in the cell and it might possible to join it later.

If a call notification is gone, a new event is used in the state machine
to release incoming call.

Change-Id: I605387c6be409ef0e67caf7b9e2a83e1032b45f1
Related: OS#5364
2023-10-27 09:12:16 +02:00
Vadim Yanitskiy 1c7c713760 mobile: vty: rework support enable/disable commands
Change-Id: Ibfef31f6dd7694dad535ad07fdf47bd32571b7b2
Related: OS#4396
2023-10-18 20:46:35 +07:00
Vadim Yanitskiy 40609ca94b mobile: improve handling of Bearer Capability IE for MT calls
This patch prepares for adding MT data call support:

* Move handling of the Bearer Capability IE into a function.
* Check transfer mode and coding standard in the received BCap.

Change-Id: I3a5cac8c35ba6b7bdc5fcb077690b32848747756
Related: OS#4396
2023-10-18 20:46:35 +07:00
Vadim Yanitskiy 292f39900c mobile: fix mncc_get_bearer(): return -1 straightaway
Even though the function works as expected and *can* return -1,
which is first casted to unsigned and then back to signed, let's
make the code less confusing by returning -1 straightaway.

Change-Id: I3206fcfa9ab4cac85a1f0f2a4de3250b25f9058f
Related: OS#4396
2023-10-18 20:46:35 +07:00
Vadim Yanitskiy 9130b2d8f5 mobile: cosmetic: improve mncc_{get,set}_bearer()
Change-Id: I5647bdf58cbf58065dbe8eebe16f330d98fd0d22
Related: OS#4396
2023-10-18 20:46:35 +07:00
Vadim Yanitskiy 7a413ffb26 mobile: mnccms: use constants from libosmogsm (gsm_04_08.h)
Change-Id: I5ce59db39ad865620aaed2d778bc3710cf37bc3b
Related: OS#4396
2023-10-18 20:46:35 +07:00
Andreas Eversberg 162398a0d9 ASCI: Register state machines only once, when the application starts
Related: OS#5364
Change-Id: I46d68e31e0bfd6a64c190e439f45b24502dd1f30
2023-10-18 08:08:25 +02:00
Andreas Eversberg 014646fc66 ASCI: Change state correctly when leaving group mode
Use new_mm_state() to leave group mode. This will trigger IMSI detach
when returning to IDLE mode, if it has been delayed.

Related: OS#5364
Change-Id: I3c83c9e0fe10b35d60d125df6929fcb5ddc35f1a
2023-10-18 08:08:24 +02:00
Andreas Eversberg 86fed8fc97 ASCI: Select correct state when returning to idle or group receive mode
This fixes I05957182a57423ad947ab200b52f65fde859e110.

Related: OS#5364 and OS#6214
Change-Id: I626195161b987f1ba0065134afcf3936c9c090eb
2023-10-18 08:08:18 +02:00
Andreas Eversberg e45abc96ec ASCI: Ignore cell selection event during group receive mode
Cell selection is not supported during group receive mode. If it
happens anyway, give an error message and select correct sub-state.

This fixes I05957182a57423ad947ab200b52f65fde859e110.

Related: OS#5364 and OS#6214
Change-Id: Iea6fe623956003130000c59ec0e1b24b3177052d
2023-10-18 08:08:14 +02:00
Andreas Eversberg 2c0f71ac43 ASCI: Join a group/bcast call in correct MM states only
These states are:
	GSM48_MM_SST_NORMAL_SERVICE
	GSM48_MM_SST_ATTEMPT_UPDATE
	GSM48_MM_SST_LIMITED_SERVICE
	GSM48_MM_SST_LOC_UPD_NEEDED
	GSM48_MM_SST_PLMN_SEARCH  (limited service)
	GSM48_MM_SST_PLMN_SEARCH_NORMAL

If the service is limited, group/bcast calls can be joined, but uplink
access is not allowed.

Related: OS#5364
Change-Id: I2f8ff65f6e101972f9b1760013983d00ae6e7760
2023-10-18 08:08:10 +02:00
Vadim Yanitskiy 026f113280 mobile: clean up call related VTY commands
Change-Id: I8bccdf776ad541932ad4a6d6a68426a6ab856e08
Related: OS#4396
2023-10-16 14:14:28 +07:00
Vadim Yanitskiy 8f1091ee4b mobile: separate 'call MS_NAME NUMBER' command
This will allow us adding an optional switch for data calls.

Change-Id: I5d2332df09a81cb0747ecd9d95351ab59f99358e
Related: OS#4396
2023-10-16 14:14:28 +07:00
Vadim Yanitskiy b525577a5e mobile: mncc_call(): make *number argument const
Change-Id: I4558ce1313b8e9aadd73474a6514c136aa512de3
2023-10-16 14:14:28 +07:00
Vadim Yanitskiy 8d18e106a9 mobile: mncc_recv_internal(): make struct gsm_mncc ptr const
Change-Id: I0a5522b7df112bfaefc684c872a618c1e9118e61
2023-10-16 14:14:25 +07:00
Vadim Yanitskiy ed9e949dd9 mobile: fix AUDIO_IOH_LOOPBACK mode: pull DL info header
The loopback mode is currently broken because the DL info header
remains present, thus becoming a bogus "part" of the speech frame.

Change-Id: I1af187b4bc5f5a99bc7f7634d90bf14ad3db0e49
Related: OS#4396
2023-10-16 14:10:21 +07:00
Vadim Yanitskiy 069b627abe firmware/layer1: handle CSD related channel modes
Change-Id: Ib73210b273826ded56d42c41ffeb835eef96dd2b
Related: OS#4396
2023-10-16 14:10:21 +07:00
Vadim Yanitskiy a6d0a3e170 firmware/layer1: emit TRAFFIC.ind even if B_BFI is set
Even if the DSP marks a traffic frame as bad (B_BFI), we still want
to deliver something to the upper layers, just like we do for FACCH.

Change-Id: I559793a3506089b1c1758ee7022cceb7753afb30
Related: OS#4396
2023-10-16 14:10:21 +07:00
Vadim Yanitskiy 7286560a33 firmware/layer1: fill-in DL info for L1CTL TRAFFIC.ind
Change-Id: I1c9727b183214f3d1a4f9a48489479f8435a4c5a
Related: OS#4396
2023-10-16 14:10:21 +07:00
Vadim Yanitskiy 5523c0084d firmware/layer1: fix l1s_tch_resp(): use the right A_DD header
Change-Id: Idd48438e47ac3ef1172621e77688d094cdcdbf34
Related: OS#4396
2023-10-16 14:10:21 +07:00
Vadim Yanitskiy f492a99d36 firmware/layer1: clean up l1s_tch_resp()
* Reset both A_DD_0 and A_DD_1 headers, like in the case of FACCH.
* Reduce nesting, fix minor coding style issues.
* Add a FIXME for proper B_BFI checking.

Change-Id: Ie4faf386f54720888e73171bee26f93dfa0562d5
Related: OS#4396
2023-10-16 14:10:19 +07:00
Vadim Yanitskiy c6c392aafd firmware/layer1: cosmetic: labels should not be indented
Change-Id: Ie32501df19cc2eedd1042c9917583d7386a665bc
Related: OS#4396
2023-10-16 14:06:56 +07:00
Vadim Yanitskiy 8a2422db1f firmware/layer1: clean up l1s_tch_cmd(): reduce nesting
Change-Id: If4f0bb37cb3e12e09078027461cd5040524e43b2
Related: OS#4396
2023-10-16 12:21:40 +07:00
Vadim Yanitskiy 79baca14d4 firmware/layer1: mute UL/DL vocodec if it's not needed
The upper layers usually request either of the two configurations:

* (AUDIO_TX_MICROPHONE | AUDIO_RX_SPEAKER) - in this configuration
  the phone (PHY) is both the origin and the destination of the TCH
  frames.  DL frames are played via the built-in speaker; UL frames
  recorded using the built-in microphone.

* (AUDIO_TX_TRAFFIC_REQ | AUDIO_RX_TRAFFIC_IND) - in this case
  the upper layers (host side) become the origin and the destination
  of the TCH frames.  The built-in speaker and microphone are
  expected to be disabled.

However, when using the second configuration, one can still hear
DL TCH frames being played by the built-in speaker.  The built-in
microphone does not seem to be causing any issues, but still we
definitely don't want the vocoder to interfere with the host.

Change-Id: I390db1889f079dea8112794c3e039a9136b897df
Related: OS#4396
2023-10-16 12:21:40 +07:00