Commit Graph

2984 Commits

Author SHA1 Message Date
Vadim Yanitskiy 2950c0363d osmo-bts-trx: handle MTS 0b0110 indicating an Access Burst
The PCU may poll the MS requesting an ACKnowledgment message to be
sent in form of four Access Bursts instead of Normal Bursts.  The
BTS has no prior knowledge of the Uplink burst type, so a new MTS
value was specified in order to prevent the BTS from trying to
decode Access Bursts as a PDTCH block.

This patch implements parsing of the new MTS value 0b0110.
Signalling RACH.ind to the PCU is to be implemented.

Change-Id: I0fbb63006797e6be386d1f76ed97fff098c036fc
Related: OS#4006, SYS#4794
2022-10-04 16:33:10 +00:00
Vadim Yanitskiy 493ff0000b osmo-bts-trx: rx_rach_fn(): properly detect handover RACH
Checking if (bi->chan != TRXC_RACH) is not enough to detect HANDOVER
ACCESS.  Receiving this message is only possible on CS channels.

Change-Id: Ice1674fd4fed8c54d605ff19d568f6e46b4c5783
2022-10-04 14:57:57 +00:00
Pau Espin 8396471638 osmux: Close osmux socket when bts is freed
Related: SYS#5987
Change-Id: Ibd3faa33b28d45048c340b177f13d5685f41a784
2022-10-04 16:12:38 +02:00
Pau Espin 0db38d6521 osmux: Skip lchans in lookup which still have no remote associated
Lchans which are marked as non-connected have not yet received
information about its remote peer, hence they may not have some fields
available yet. Let's skip them to avoid accessing such fields
(lchan->abis_ip.osmux.in).

Related: SYS#5987
Change-Id: Id53822c4a0486b0090df2db3d185e047d14fc90a
2022-10-03 18:54:11 +02:00
Pau Espin 943ef9665e osmux: nullify osmux.rtpst after freeing it
Change-Id: I806cbe42cfc8fe59134ae842f3d7398acb1a1848
2022-10-03 18:43:52 +02:00
Pau Espin 65f63a55c7 osmux: Lower log level when osmux batch received for unknown CID
This is actually quite common, since our peer may be sending some osmux
packets to us a while after we have closed the conn on our side,
specially if latency is high in the network (eg satellite links).

Related: SYS#598

Change-Id: I102047685b9b9f4cba43970945f955c4fe9c4c95
2022-10-03 18:29:34 +02:00
Pau Espin b73c46ae97 osmux: Log remote address upon rx of osmux pkt
Related: SYS#5987
Change-Id: I391bc02a16eae1602680cb96128252f262852e14
2022-10-03 18:26:00 +02:00
Pau Espin 3fd60a5784 osmux: Match remote address in osmux_lchan_find()
Related: SYS#5987
Depends: libosmo-netif.git I95433b18802f73fa70e758f4aa02128eee940d88
Change-Id: I6813686b55fc3a74f1676a7965186e1e5fa00481
2022-10-03 18:24:36 +02:00
Pau Espin 53e566247d osmux: Drop logging of osmux internal counters
This way we have no more access to internal osmux structures.
If those counters are needed in the future they can be counted by
osmo-bts by means of adding rate counters to the caller of
osmux_xfrm_input() and deliver_cb.

Change-Id: Ib952437ea3aa2770c96bddb667491e7675a6a06e
2022-09-29 14:38:57 +02:00
Pau Espin fd356bdcd2 Allocate struct osmux_in_handle through new libosmo-netif APIs
Depends: libosmo-netif.git I752ab031f935f04731bb1a354333f1682a1aa5bd
Change-Id: I132a7c03213cb20dfe118616c8cfd7032b075507
2022-09-29 14:25:04 +02:00
Philipp Maier ae6ae89a19 pcu_sock: fix sourcecode formatting
Change-Id: Ib88173363fc11ad44a5bdbcd85ea8ca075db7997
2022-09-26 13:02:34 +02:00
Pau Espin 8cfb8bcc6c vty: Print Osmux CID on lchans using Osmux
Related: SYS#5987
Change-Id: Ide6edefda828e9ce04fbb60cf547857f322d5f40
2022-09-22 13:26:44 +02:00
Pau Espin ff5c8787dd vty: Fix SPEECH_MODE printed with hex prefix but dec value
Change-Id: I597ff582f47b00d895611eae8a810fe3ebfe8339
2022-09-22 13:25:49 +02:00
Pau Espin bbec5df6c7 lchan: Reset Abis RTP/Osmux config during lchan release
Otherwise some shared variables used by both Osmux and RTP was left set,
like connect_ip and connect_port, and next time the lchan was selected,
those were already configured even if they didn't come in IPAC CRCX.
This is specially bad if the channel was reused to set up an Osmux call,
since the osmux code path relied on those fields being properly reset
until set by IPAC CRCX.

Change-Id: I414bd0bc801451357bb45b89197a95e51b7c97f1
2022-09-20 17:33:07 +02:00
Pau Espin 9108eed3e4 osmux: Log sendto() error
Change-Id: I195ebe0fdb05195a7f3b1390630e83084b5dea3a
2022-09-20 16:55:42 +02:00
Pau Espin cd3d71b318 abis: Avoid TCP/IPA RSL sockets continue conn establishment while shutting down
when something fails in osmo-bts during startup and it goes into SHUTDOWN state,
it is desirable to close new RSL links (sockets) which are in progress to connect,
while it waits for a while to complete shutdown (power ramping down, etc.).
This way we don't end up with new interactions and new state against a BSC if we
are shutting down.

The new libosmo-abis API is used since the higher layer struct e1inp_sign_link assigned
to each struct gsm_bts_trx is not provided to the osmo-bts code layer by libosmo-abis API
until the TCP+IPA handshake in the socket becomes fully established (sign_link_up()
callback).

Depends: libosmo-abis.git Ia6418321f3b6f1f7274efd414625a4b10a09a362
Change-Id: I599d074f51f490b43c9a89b105d1823391926947
2022-09-16 20:56:00 +02:00
Max e826d78399 Document realtime options in .service units
It's not immediately obvious what numeric values mean for CPU scheduling policy.
Let's document this and add doc reference.

Related: OS#4107
Change-Id: Ib047762a336851e6205d77c83068a99d8a868e8b
2022-09-16 01:16:29 +00:00
Max 9b7a48421c Don't manually create pid file
Previously osmo-bts created /var/run/osmo-bts.pid which
isn't used by anything and makes it hard to run as non-root
user. Let's get rid of this pre-systemd relic.

Related: OS#4107
Change-Id: I86bcaedbc8cb1297476ad741eaa45585fea3c380
2022-09-14 08:30:11 +00:00
Pau Espin 2201900f94 Introduce Osmux support
Related: SYS#5987
Requires: libosmo-netif.git Change-Id I632654221826340423e1e97b0f8ed9a2baf6c6c3
Change-Id: Ib80be434c06d07b3611bd18ae25dff8b14a7aad9
2022-09-13 17:32:22 +02:00
Pau Espin 0908c7da22 oc2g: Makefile.am Fix typo in LIBOSMONETIF_LIBS
Change-Id: I6d316ffaff0ad7881b694f4d6427434bb9a0684c
2022-09-12 17:35:01 +02:00
Pau Espin d48d4beb56 tests/*/Makefile.am: Add missing libosmo-netif cflags
Change-Id: I7a2a846c2d68a4d6d77c4be62969238069d6cf95
2022-09-12 13:29:52 +02:00
Pau Espin 1176d1a626 tests/*/Makefile.am: Fix typo in LIBOSMONETIF_CFLAGS
Change-Id: I29d52bdacdebc0495d11425399e796fa7aef3ac4
2022-09-12 12:51:30 +02:00
Max 0ccd8781b1 Set working directory in systemd service file
By default systemd will execute service with root directory
(or home directory for user instance) which might result in
attempts to create files in unexpected place. Let's set it
to 'osmocom' subdir of state directory
(/var/lib for system instance) instead.

Related: OS#4821
Change-Id: I4b7bcd441e5da81c4c5267715675041171a1ce1e
2022-09-09 20:46:33 +07:00
Pau Espin e9bdd73fdc Clarify RTP AMR header offset in TCH enc/dec
This helps understand the origin/purpose of those 2 bytes and
what's contained in them.

Related: SYS#5987
Change-Id: I607fdf6d627242e010fba35be1b9b0ffde820d08
2022-09-07 10:22:01 +02:00
Pau Espin a2dc808acc Depend on libosmo-netif
This library will be used soon when adding Osmux support to osmo-bts.
Furthermore, it nice to have it available to make use of other general
interfaces to create connections, primitives, RTP and AMR related
functionalities, etc.

Related: SYS#5987
Change-Id: I49db4de715065c083e1249cbeae6298d6868e229
2022-09-06 09:14:40 +02:00
Pau Espin ebecff4a5a cosmetic: Fix formatting of if-else block brackets
Change-Id: Ifec6674ba04109f6b8a039679caff08f060d83d9
2022-09-01 17:05:20 +02:00
Vadim Yanitskiy 52da5b6f64 osmo-bts-trx: fix handling of ciphering params in PRIM_INFO_MODIFY
The PRIM_INFO_MODIFY is sent on receipt of the RSL MODE MODIFY message,
which may optionally contain new ciphering parameters.  Before this
patch, osmo-bts-trx would ignore the new parameters and continue using
the old ciphering key/algorithm.

* Modify l1if_set_ciphering() to allow updating ciphering params.
* Call l1if_set_ciphering() when handling PRIM_INFO_MODIFY.

This problem was uncovered by BTS_Tests.TC_rsl_modify_encr, which has
been failing ever since it was introduced [1].  This patch makes it pass.

Change-Id: I2278703b487374c0de4cfc42b22e70aaf6548589
Related: [1] I4cbea499bb6a331d314e6573548a4540945208b5 osmo-ttcn3-hacks.git
Related: OS#3750
2022-08-27 18:56:33 +07:00
Pau Espin 755546028e Move lchan_dl_tch_queue_enqueue to lchan.c and make it public
It will be used too by osmux code present in another file. This is a
preparation commit to simplify the one adding osmux support.

Change-Id: Ie7fa57bb04db9ad9b03971467e12ee7b8e4c190a
2022-08-11 23:04:46 +02:00
Pau Espin fff806bc92 rsl: Reduce scope of variable
The function is long/complex enough, so having one extra struct in_addr
declared the function top only used in one specific small path to print
the variable is unnecesary.
Let's move it to the conditional path where it is used to print the
ip address.

Change-Id: I4c16bbca6a6779537517b6b196828b47eddaa516
2022-08-11 23:04:46 +02:00
Pau Espin 7593cc743d Use libosmocore API msgb_queue_free() to free lists
There's no need to maintain a duplicate msgb_queue_flush(), which
returns the amount of freed messages (feature not used at all by the
callers).

Change-Id: I9841e18ca0b7b852130bbb02a510e43a3b3fd93f
2022-08-11 23:04:46 +02:00
Pau Espin 9ea93c7e20 Avoid counting lchan->dl_tch_queue length every time a msg is enqueued
The queue_limit_to method iterates the entire list of messages every
time a new message is added. Let's use msgb_{enqueue,dequeue}_count()
APIs to do that in constant time. It is true that since the queue is
limited to 1, there's usually at most 1 item in the queue so it's not a
real problem. However, when we add Osmux in the future, we may need to
tweak the amount of messages which can be in the list, due to Osmux
batching mechansim which may be more bursty sometimes.
In any case, this change doesn't make things worse for sure.

The patch also takes the chance to group the queue_limit_to + enqueue
into one function to avoid having the code spread several times.

Change-Id: I61818a3bb521c27bd21a8b6fa70581d27638ec9b
2022-08-11 23:04:35 +02:00
Pau Espin 5a1b14fa4f Split out lchan rtp socket creation from rsl handling code
This makes the code more clear, as well as allows adding Osmux in the
future.

Change-Id: Iade43fde7f6113f9d68539f7d6cc9843783c2b3f
2022-08-11 21:02:06 +02:00
Pau Espin d9f2cf2df6 Clean up osmo-bts-*/Makefile.am
Make them more easy to read and edit by splitting to one element per
line when several elements are present.

Change-Id: I24ecfa1167b806dcb3a5a0c00343299df842a78b
2022-08-11 21:02:00 +02:00
Pau Espin 311f9ffcf8 logging: Move category descriptions to be in order with enum
Change-Id: I3a1922fcd695e08ca42ece8cf0a1804d1a00f450
2022-08-10 18:12:44 +02:00
Pau Espin db8a676844 rsl: rx ipac crcx/mdcx: Log payload_type2
Change-Id: Id3afee50aa112051aacb9016183a78374e5ba7fc
2022-08-10 16:25:48 +02:00
Vadim Yanitskiy 541b7525ae osmo-bts-trx: amr_loop: trigger the loop unconditionally
The logic responsible for enabling and disabling the loop appears
to be broken: during my experiments trx_loop_amr_set() was never
called with loop=1.  It's not clear what's the motivation behind
this breaker, so I propose to rip it out for now.  This patch
finally makes the loop work (confirmed with a TEMS phone).

Change-Id: I09b649973d4269c4082a4fafa493c37825f95a9c
Related: SYS#5917, OS#4984
2022-08-08 05:43:20 +00:00
Vadim Yanitskiy a5a150c7ee osmo-bts-trx: call osmo_timer_del() unconditionally
osmo_timer_del() does check if a timer is active internally.

Change-Id: I16dca28120061ffc1f118d1e4a1ea986c1639bf7
2022-07-22 03:42:28 +07:00
Pau Espin 7243cada6a Bump version: 1.4.0.103-b8ae-dirty → 1.5.0
Change-Id: I920a834912cd6da66daae6a896f0789059698ba0
2022-06-29 09:41:38 +02:00
Pau Espin b8ae49d0ca bts-sysmo: Replace use of deprecated ipa_client_conn_create API
"""
osmo-bts/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c:544:9: warning:
‘ipa_client_conn_create’ is deprecated: Use ipa_client_conn_create2()
instead [-Wdeprecated-declarations]
"""

Change-Id: Ief4d629f366e4f69ccd489198302568a919b2f0c
2022-06-21 09:38:42 +00:00
Harald Welte b90e1ef2d0 update git URLs (git -> https; gitea)
Change-Id: Ibd00975142ee6a2ca96453d7baf5b7164ccdd289
2022-06-18 11:39:25 +02:00
Vadim Yanitskiy 2baf54dd46 Revert "osmo-bts-trx: rx_tchf_fn(): do not treat AFS_SID_UPDATE as SUB frame"
This reverts commit 1f9fbd8816, which
was a workaround rather than a proper fix.  The root problem has
been fixed in libosmocoding [1], so ~50% BER is not the case for
AFS_SID_UPDATE frames anymore.

Related: I813081a4c0865958eee2496fe251ae17235ac842 (libosmocore.git)
Change-Id: Iebe139632daf1d1f72e39fe9d1497059f68625b9
2022-05-17 03:32:21 +03:00
Vadim Yanitskiy 1f9fbd8816 osmo-bts-trx: rx_tchf_fn(): do not treat AFS_SID_UPDATE as SUB frame
We have two similar values in enum gsm0503_amr_dtx_frames:

  * AFS_SID_UPDATE - precursor of SID UPDATE,
  * AFS_SID_UPDATE_CN - the actual SID UPDATE.

The former is internally used by libosmocoding to mark the current
frame as a precursor of the actual SID UPDATE frame - the later.

  +---+---+---+---+---+---+---+---+
  | _ | _ | _ | _ | a | b | c | d |  AFS_SID_UPDATE
  +---+---+---+---+---+---+---+---+
  | a | b | c | d | _ | _ | _ | _ |  AFS_SID_UPDATE_CN
  +---+---+---+---+---+---+---+---+
  ^
  |
  | We're here.

Do not treat the precursor frames as a SUB frames, as they contain
no information (rc=-1) and usually have *expected* BER ~50%.  This
fixes unexpected RXQUAL-SUB > 0 in the Uplink measurements during DTX.

Change-Id: I46f32bbbcb6284615d05b8703945c5ca4da55b92
Related: SYS#5853
2022-05-15 08:10:10 +00:00
Vadim Yanitskiy 284f16e7d7 measurement: fix matching of SUB frames by TDMA FN
3GPP TS 45.008, section 8.3 defines active TDMA frame subsets for
TCH channels, which shall always be transmitted even during the
silence periods in DTX mode of operation.  Each frame number
listed in this section corresponds to a single burst.

The Uplink measurements always contain TDMA FN of the *first* burst
of a block, so it does not make sense to match the given FN against
all FNs in the respective subset.  Instead, we should match only
specific FNs in accordance with the block mapping rules defined in
3GPP TS 45.002, section 7, table 1.

In the active subset for TCH/F there is only one *complete* block
starting at FN=52.  Incomplete blocks {52, 53, 54, 55} and {56, 57,
58, 59} contain only 50% of the useful bits (partial SID) and thus
~50% BER, so we don't treat them as SUB.

In the active subsets for TCH/H there are two *complete* blocks
for each sub-slot.  Their respective first FNs can be efficiently
defined in a lookup table (see ts45008_dtx_tchh_fn_map[]).  Note
that we can use a single lookup table for both sub-slots of TCH/H
because their TDMA FNs do not overlap.

This patch fixes unexpected SUB-RxQual values > 0 on TCH channels
with DTXu enabled and other than AMR (HR, FR, EFR) codec in use.

Change-Id: I8cc3a755a8ad4dc564439aab2298c1e97ac0592d
Related: SYS#5853
2022-05-10 16:49:16 +03:00
Vadim Yanitskiy 991f3f64d9 measurement: move SACCH detection to process_l1sap_meas_data()
SACCH detection can be simplified by checking the RSL Link ID in
process_l1sap_meas_data().  This eliminates the need to lookup
the multiframe position by calling trx_sched_is_sacch_fn(), which
definitely takes more CPU time than just L1SAP_IS_LINK_SACCH().

Calling trx_sched_is_sacch_fn() is still required for BTS models
reporting the measurements via PRIM_MPH_INFO (legacy way),
separately from the related Uplink blocks.

This patch can be summarized as follows:

* detect SACCH and set .is_sub=1 in process_l1sap_meas_data();
** for PRIM_MPH_INFO use trx_sched_is_sacch_fn();
** for PRIM_PH_DATA use L1SAP_IS_LINK_SACCH();
* do not call trx_sched_is_sacch_fn() from ts45008_83_is_sub();
* modify the unit test - test_ts45008_83_is_sub_single();
** remove test_ts45008_83_is_sub_is_sacch().

Change-Id: I507e96ee34ac0f8b7a2a6f16a8c7f92bc467df60
Related: SYS#5853
2022-05-10 16:30:39 +03:00
Vadim Yanitskiy 0ad31d8956 measurement: log SUB/FULL as text in lchan_new_ul_meas()
Change-Id: Idfaf8ad2ac0fd4da57a0981563e6ad6104fa4e41
Related: SYS#5853
2022-05-10 01:19:18 +03:00
Vadim Yanitskiy 7bf970ede4 tests/meas: improve test_ts45008_83_is_sub_is_sub()
This function should also take lchan type into account.

Change-Id: I6920a04e0a6c846647fa1b6b3a3c80bbd6617b99
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy d399f49261 tests/meas: improve logging in test_ts45008_83_is_sub_single()
* Print unexpected TDMA FNs, each on a separate new line.
* Do not abort() on mismatch, keep running.

Change-Id: I32c104b139f32a39c8347de19de6ad7caec811de
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy 523b6de593 struct bts_ul_meas: reflect C/I units in field name s/c_i/ci_cb/
Change-Id: If07f7f2a3ea996cbfc6a9087fa34402e38a7fd9f
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy cf09b0cb50 scheduler: trx_sched_is_sacch_fn(): make ts pointer const
Change-Id: I48a1a549d7c1553bccaa01cdc818873a4c6cdf0a
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy 8aab8d484b osmo-bts-trx: drop Uplink loss detection from Downlink path
Attempting to detect missing Uplink frames in the *Downlink* path
is an ugly hack, that was needed before we had proper per-lchan
detection of missing bursts and NOPE indications in TRXDv1.

* [1] per-lchan detection of missing bursts was fixed in Aug 2018.
* [2] TRXDv1 support was introduced in Jul 2019.

Today is 2022 and it makes no sense to keep this hack.  Even if
the transceiver does not support TRXDv1, per-lchan detection
will compensate the missing Uplink bursts.

Change-Id: Ic292d180ba64206fb4d88adb284f9f9d058b4587
Related: [1] I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Related: [2] If61c71d20d590bf07bfd019afb33000a0b6135bd
2022-05-06 12:55:18 +00:00