Commit Graph

162 Commits

Author SHA1 Message Date
Eric Wild cca5d93f66 transceiver: add experimental viterbi equalizer support
The VA is already being used by the ms side and is part of the original
gsm design. It only works for gmsk, 4sps, and needs a bit of rx burst
scaling and burst shifting.

Change-Id: I9d7a4ff72e323832a94d885d5714fcde01ceeb3d
2023-08-25 13:18:04 +00:00
Eric Wild 8c1d59086e trx: fix dev-args issue
osmo_talloc_replace_string used by the vty needs a talloc string.

Change-Id: Ifed8fd42dc7464899de69985f3b5f5b47c88a7d1
2023-08-24 11:43:47 +02:00
Eric Wild f8c7a52521 devices: add freq/gain override for uhd
This allows using arbitrary gain and frequencies.

Change-Id: I3c1b9a067cafc6d696b9aa2da8ee0480ec1e094f
2023-07-25 18:25:49 +02:00
Eric Wild 19e134a626 transceiver: pass cfg struct instead of args
Passing 7 args is a bit much, just pass the config struct instead.

Change-Id: I48386900d15ff4d770c70a4efc246d32f921904b
2023-07-25 18:25:49 +02:00
Vadim Yanitskiy 874542ca7c CommonLibs: clean up and fix Makefile.am
* Do not hard-code '-O3' and '-g', let the user decide on them.
* Move '-lpthread' to LIBADD, it shall not be in CFLAGS.
* Also add '-Wall' to AM_CFLAGS.

Change-Id: Ia971fc4124b405514792e5309d42936aaebdc8c1
2023-03-14 13:16:09 +00:00
Vadim Yanitskiy f476a6755b CommonLibs: remove unused *trx in cfg[_no]_ctr_error_threshold_cmd
Compilation fails when building with -Wall and -Werror:

trx_vty.c: In function ‘cfg_ctr_error_threshold’:
trx_vty.c:469:18: error: unused variable ‘trx’ [-Werror=unused-variable]
  struct trx_ctx *trx = trx_from_vty(vty);
                  ^~~
trx_vty.c: In function ‘cfg_no_ctr_error_threshold’:
trx_vty.c:501:18: error: unused variable ‘trx’ [-Werror=unused-variable]
  struct trx_ctx *trx = trx_from_vty(vty);
                  ^~~

Change-Id: I3d74c3f38aa03608a32b9dee472e49236543c87f
2023-03-14 13:16:09 +00:00
Eric Wild 5561f1129d clean up mutex, scopedlock, and signal classes
This also uncovers very interesting design decisions like the copying of
mutexes and condition vars depending on recursive locks that were
previously hidden by shady c function calls..
We have perfectly good c++11 versions for all of that.

While we're at it, also use the initialization list for the other (still
copy constructable) vectors, which cleans up the radio interfaces.

Change-Id: Idc9e3b1144c5b93f5dad2f8e0e30f1058477aa52
2022-12-23 13:41:30 +00:00
Vadim Yanitskiy 19faae85c6 threshold_timer_update_intv(): call osmo_timer_del() unconditionally
osmo_timer_del() does check if a timer is active internally.

Change-Id: Icaf6f31a3235a3fb6993fa2bb35190150e35c2c2
2022-08-06 05:03:00 +07:00
Oliver Smith 424c74d006 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I8ba71ab9ccde4ba25151ecbeb2a323f706b57d43
2021-12-14 12:23:00 +01:00
Vadim Yanitskiy 5e40d92400 trx_rate_ctr: use thread safe strerror() in device_sig_cb()
Change-Id: Ibd52af22bbe99652f402ada87410de167a124b73
2021-10-25 12:56:44 +03:00
Eric Wild 0c34c64a16 vty: printing fn offset should be signed
...because it is usually negative

Change-Id: I8297dbb0fec25720e73d59fd8e38834029154405
2021-06-16 15:20:51 +02:00
Pau Espin 0a038223d0 Use new stat item/ctr getter APIs
Change-Id: I1fdfdae2810c3c82ff62fe725ffa364df4ebeff5
2021-06-04 17:21:42 +02:00
Eric Wild c27fe60a25 add hidden fn adjustment command
This is only useful if the rf path delays the signal by at least one
frame, and therefore a fairly experimental command that might be removed
or reworked in the future and should not be relied upon.

Change-Id: I29964acffad5bad4f5bcad7f631e435a72979c46
2021-05-05 17:34:28 +02:00
Pau Espin 17ce7740e5 Threads: Avoid printing pthread_self()
The type used to represent a thread ID is implementation
specific, and may be an opaqe structure, making it unsuitable to be
printed by standard means. Let's use osmo_gettid() instead.

Change-Id: Iaa4d0eaf52b901fff06cc67f8dd8b61ac6084911
Related: OS#5032
2021-03-01 16:35:42 +01:00
Pau Espin d06259f348 Drop logging pthread ID
new libosmocore osmo-trx already depends on does support printing thread
ID as prefix to all messages (confgiurable through VTY), so there's no
use in printing it in osmo-trx unconditionally.

Moreover, The type used to represent a thread ID is implementation
specific, and may be an opaqe structure, making it unsuitable to be
printed by standard means, so in any case we should be better printing
system's TID instead.

Related: OS#5032
Change-Id: Ie98a21246230c946afc47f4f5b9c6618eefde494
2021-03-01 16:35:42 +01:00
Pau Espin 6c646c35b9 Threads.cpp: Fix missing extern C around libosmocore include
Change-Id: I76975ed71382ff2afa8cfaff2950e23ff750201e
2021-03-01 16:35:35 +01:00
Vadim Yanitskiy 3b8f7c4d97 Add a (hidden) VTY parameter for Rx/Tx freq. shifting
Change-Id: I360e8ba91471757210c7f096c04928a6fbb91c61
Related: SYS#4454
2021-02-21 12:01:16 +01:00
Pau Espin 5738940535 Replace my_gettid with libosmocore osmo_gettid API
The API was moved to libosmocore, let's use it instead of defining our
own here with all the complexity in build system involved.

Depends: libosmocore.git Change-Id Id7534beeb22fcd50813dab76dd68818e2ff87ec2
Related: OS#5027
Change-Id: I19e32fbc47bd88a668e0c912e89b001b0f8831dd
2021-02-17 18:27:41 +01:00
Pau Espin cec9eda227 Threads.cpp: Use already existing gettid wrapper function
A wrapper function with better support already exists in debug.c and
announced in debug.h. Let's use that one instead.

Related: OS#5027
Change-Id: I2ccf94f95a531d5873da2a4681cf89cbc5b31422
2021-02-17 17:28:06 +01:00
Vadim Yanitskiy 1587307a99 vty: fix swapped documentation for 'filler type' command
vty_cmd_string_from_valstr() expands the given 'struct value_string'
sequentionally, so the order of entries in both filler_{types,docs}
shall match (regardless of the value assigned).

Change-Id: Ieb3bbc4fb30f303c47555ca77d03a9e965bc72b5
2020-12-08 15:38:00 +01:00
Vadim Yanitskiy faacb1987e vty: fix documentation for 'ext-rach (disable|enable)'
Do not use 'extended' because it's not the same 11-bit Access Burst,
as it was assumed before.  Add missing docs for 'enable'/'disable'.

Change-Id: I80b5a584e554eb7cc2416017b10fee032202b372
2020-11-04 19:29:45 +00:00
Vadim Yanitskiy c0e7ce922a vty: auto-generate cmd and doc strings for cfg_filler_type_cmd
Change-Id: I7fb228c63f3246f443ece67106abba0432b1659e
2020-11-02 09:28:19 +00:00
Vadim Yanitskiy ab6e7f35ab vty: remove groundless statement about filler type 'dummy'
Dummy bursts have nothing to do with A5/x encryption, and I see
no reason why (and how?!?) would using that filler type break
encryption in osmo-bts-trx.  I asked the author of this code
back in August 2020 [1], and so far didn't get any response.

[1] https://lists.osmocom.org/pipermail/openbsc/2020-August/013208.html

Change-Id: Iae513d7acbb8ef682e1744ac8726cbd6ece8bd87
2020-11-02 09:27:59 +00:00
Vadim Yanitskiy 5d6504c45a vty: fix documentation for 'multi-arfcn (disable|enable)'
Change-Id: Id653ee058b208ddc105947319adad8da667be11f
2020-11-02 09:27:14 +00:00
Vadim Yanitskiy c620ced36d vty: cosmetic: use VTY_IPV4_CMD in 'bind-ip' / 'remote-ip'
Change-Id: I8e44f771cbd03629c066bc24c3186997761f93f1
2020-11-02 09:27:08 +00:00
Vadim Yanitskiy ef79fd9b95 vty: fix documentation for 'rx-sps (1|4)' and 'tx-sps (1|4)'
Change-Id: I70d9b16fd2b1c2cbaafc978724369cd2c9679cbd
2020-11-02 09:27:02 +00:00
Vadim Yanitskiy e0bdb6b47b vty: fix documentation for 'egprs (disable|enable)'
Change-Id: I7a28bede8fd7d68b3afe9deec381fc93e46d65a9
2020-10-30 04:17:39 +07:00
Vadim Yanitskiy 948b4e4096 vty: fix documentation for 'swap-channels (disable|enable)'
Change-Id: Idca1a2beab07ef4df9ae5c55658cab80f7cc7565
2020-10-30 04:17:39 +07:00
Pau Espin e91544d740 Calculate RSSI offset based on RxGain configuration
Prior to this patch, osmo-trx relied totally on proper VTY configuration
being set in "rssi-offset" together with the RxGain set through TRXC in
order to provide correct Uplink RSSI measurements to bts-trx.

With this patch, RSSI is now by default calculated (in LMS and UHD
backends) based on the currently set RxGain, by providing empirically
discovered values. Still, for backward compatibility, the old
"rssi-offset" command will overwrite completely the per-default
calculated rssi offset.
A new optional parameter "relative" is added at the end of the
"rssi-offset" VTY command to flag the value as relative to the newly
per-default calculated value. This way specific setups (like adding a
LNA / RF fronted) can still be expressed while still keeping the
automatic per-default offset.

Related: OS#4468
Change-Id: I8ef78fd20c22c60d61bfb18d80a4a36df4fd6c20
2020-10-14 12:53:04 +02:00
Pau Espin 93fee1f163 Transceiver: Pass config struct instead of large list of params
Change-Id: Ifb43cb11f3e7a69b0a88f632f0a0c90ada7f939e
2020-10-14 12:52:04 +02:00
Philipp Maier 30863e8720 vty: add attributes to VTY commands indicating when they apply
Change-Id: I6dfdedc081eb8c3d53913f6fa38591920c8b3b43
Related: SYS#4937, OS#1601
2020-10-08 19:36:35 +02:00
Vadim Yanitskiy 4d43684194 vty: add multi-ARFCN specific warning for chan N > 0
Change-Id: I12d7c466a9a428a384233c4377627e262f165401
Related: OS#4636
2020-09-12 14:39:20 +07:00
Eric Wild 7a52e42ee0 transceiver: optimize code if optimizations are enabled
There is no point in checking basic stuff ten thousand times per second
since the sizes never change, so it's enough to enable the
checks/assertions for unoptimized (debug) builds.

This significantly decreases branch mispredictions.

Change-Id: Iebd9e91b3c7f37f2dc646d3017c45139977e4d15
2020-08-25 01:00:19 +02:00
Pau Espin 553a25033e Use new libosmovty cpu sched config features
Using the new libosmovty features allow for:
* Setting different cpu-affinity masks for each thread in the process,
  both at startup through .cfg file as well as changing it at runtime.
* Unified VTY interface to change the scheduling policy of the process
  inherited by all osmocom processes enabling the feature.

Depends: libosmocore.git Change-Id If76a4bd2cc7b3c7adf5d84790a944d78be70e10a
Depends: osmo-gsm-masnuals.git Change-Id Icd75769ef630c3fa985fc5e2154d5521689cdd3c

Related: SYS#4986
Change-Id: I3798603779b88ea37da03033cf7737a6e4751d6e
2020-07-31 13:54:35 +02:00
Pau Espin 1d165a043e Transceiver: Add several rate_ctr for rx error conditions
Since there's now a rate counter, we can drop log level for those events
which can be bursty and hence print lots of output in short periods of
time, which may affect performance. This way setting them to INFO it's
enough to avoid getting them in stderr unless explicitly configured by
the user (for instance to debug stuff), while still allowing a good
enough level to be enabled for other targets such as gsmtap.

Related: OS#4679
Change-Id: I000f7112e35ac68d3d922444f78468b1ea74cbba
2020-07-27 11:52:46 +02:00
Pau Espin 761da1a08a Introduce CTR log category
This way i most usual rate_ctr related internal logging is disabled by default
(notice), and it can b eeasily enabled by switching the category to info
or debug.

Change-Id: Id6c36432da7e7ce673c585bcae6772a695028ec5
2020-07-17 18:29:26 +02:00
Pau Espin 9032c87d80 trx_rate_ctr: Lower some log levels
Change-Id: I1b5a63e6cc09ac02305c31ea7e94aff53ac0e5c2
2020-07-17 18:22:18 +02:00
Pau Espin 1d0c6fe752 Add rate counter for missing Txbursts when scheduled towards the radioInterface
Related: OS#4487
Change-Id: Ibb2c492b3c67cbab11fbb936ae3a090fb5756aa8
2020-07-10 17:32:03 +02:00
Pau Espin c0d6fd27ff Introduce rate counters to detect issues in received Dl bursts from TRXD
This ones together with rate counters already available in lower layers
allows to understand better the source of the problem with stalled tx
bursts.

Change-Id: Ia34f7e7d780ad1e12f24638a07f05fe91f2afea5
2020-07-10 17:32:03 +02:00
Pau Espin 032c1d8da9 trx_rate_ctr: Fix locking wrong mutex
It was notcied due to sometimes causing deadlock at shutdown time.

Fixes: 92ba59dacf
Change-Id: I49bea4b0ae469794b5c80ee8fa4f275914a5194c
2020-07-10 17:31:10 +02:00
Pau Espin 92ba59dacf Introduce rate counter tx_stale_bursts
This allows checking if there's timing issues on the downlink side
between osmo-bts-trx and osmo-trx. This counter is useful to find
information about osmo-bts-trx 'fn-advance' setting, since this counter
basically counts if burstrs from it arrived too late to osmo-trx.

Change-Id: Id6df00da81f6d6884f4dddc5a2c4b354dca3af97
2020-06-29 17:08:37 +02:00
Pau Espin 6a3a2b8647 Rename device specific rate counter multi-thread helpers
RadioInterface ones will be added in next commit, so let's differentiate
the structs required for each one.

Change-Id: Ib0e142a1dd4bedefdb4c5f15c34132da872c0975
2020-06-29 16:51:08 +02:00
Pau Espin fb96767ac5 trx_rate_ctr: Fix immediate rescheduling on per-sec thresholds
For instance, use in VTY:
"ctr-error-threshold tx_underruns 5 per-second"

If the condition becomes true (eg 5 underruns happened in one sec), the
statement inside OSMO_MAX would become -1, but it was being handled as
an unsigned when doing the OSMO_MAX internal comparison. As a result,
OSMO_MAX((unsigned)-1, 1) was returning -1 (unsigned) stored in
threshold_timer_sched_secs which then became and int -1, which was
handled by osmo_timer_schedule as a 0, hence having an immediate
trigerring all the time.

While at it, make threshold_timer_sched_secs unsigned since it doesn't
make sense to have it as signed anyway.

Change-Id: I6ea3d64dff189a5bc924e72d846e02d50536a8ea
2020-06-29 16:51:08 +02:00
Pau Espin 394053e599 cosmetic: trx_rate_ctr: Fix whitespace
Change-Id: I4dc8220a6813d6ff30f1b241cc46b801adec4057
2020-06-29 16:51:08 +02:00
Philipp Maier 748d8edbf8 debug: use LOGL_NOTICE for log category DDEV
The log category DDEV ueses LOGL_INFO as debug level. This is too
verbose, lets use LOGL_NOTICE instead

Change-Id: I56d45ce5c3f55574491ffa6e4d902d6ba7499d46
Related: OS#2577
2020-03-25 12:36:15 +01:00
Pau Espin 93707d0227 cosmetic: fix several typos found by codespell
Change-Id: Id1f6766572fd313463201e6d03964965f227db25
2020-02-25 17:03:00 +01:00
Pau Espin 5291e8a654 debug.h: Fix print format of chan in CLOGCHAN
Under armv7l arch, size_t is actually an unsigned int and not a long
unsigned int, and compiler errors:

CommonLibs/debug.h:28:24: error: format ‘%lu’ expects argument of type
‘long unsigned int’, but argument 8 has type ‘size_t {aka unsigned int}’ [-Werror=format=]

Change-Id: I7f6ded5a984570b5267916d6c84eb7d019db73a8
2020-02-19 18:08:20 +01:00
Pau Espin 7a07de1efd debug.h: Avoid printing pthread_t type
Using %lu for pthread_t was wrong on armv7l arch. Even worse, according
to pthread_self() man page, pthread_t cannot be assumed to be of a simple
type and hence printable:
"""
POSIX.1 allows an implementation wide freedom in choosing the type used
to represent a thread ID; for example, representation using either an
arithmetic  type  or a structure is permitted.
"""

Let's use gettid() instead. According to glibc documentation:
"""
The pid_t data type is a signed integer type which is capable of
representing a process ID. In the GNU C Library, this is an int.
"""
It may not be the same on other libc's though, so let's better cast to a
long int just in case.

Accordign to gettid() man, the libc function was only added recently
during glibc 2.30, however the system call has been around for quite
some time (linux 2.4.11). Let's accomodate use udner non-glibc or older
versions of it by having a direct syscall fallback.

Change-Id: I40265fd4c62e550014ba3ff3335ca053c5bc01f2
2020-02-19 18:08:20 +01:00
Pau Espin a7bf6cd8a4 lms: Store device type specific parameters in one place
Add an enum containing each supported device type (LimeSDR-USB,
LimeSDR-Mini and LimeNet-Micro) plus "unknown", to leave some room for
yet-to-come devices to run with some generic parameters without
rebuilding osmo-trx.

Each device type is assigned a dev_desc structure, and all of them are
put in HashMap, similar to what's already done in UHDDevice.cpp.

Device type is infered from string provided by LMS_GetDeviceInfo(), as
it was already done before in several places. From now on, we only need
to parse the string once since we store the device type after first
during open time.

Later on, more fields will be moved to device-type specific structure,
such as Tx timing offset, clock rate, etc.

Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
2020-01-15 15:45:29 +01:00
Pau Espin 84231bd8b7 uhd: Use DEVDRV log category and support UHD >=3.11 logging framework
Change-Id: I36f1ff7d425a2144fb512ff393af02741eb4a3d4
2020-01-07 16:04:04 +01:00