Commit Graph

648 Commits

Author SHA1 Message Date
Eric Wild c03b7e04ee ipc: fix driver test restart
Change-Id: Id21f773d365f2e70129e1d463cf87b1213718be7
2020-08-26 17:35:18 +02:00
Eric Wild bf64d887a8 ipc: remove uhd dep
Change-Id: I950b9bd3cb52caf83c469fc424783d21750baa2a
2020-08-26 17:35:18 +02:00
Eric Wild 056c5d8fab ipc: manually poll chan sock fds
We can't wait, we're in select, but we need to wait for a response from
the other side of the ipc interface -> only select our channels, so
other registered osmo fds are left alone, and we don't accidentally
handle stuff that should happen afterwards.

Change-Id: I4ffc8d825e5b4eba0fca8ea821b1d84e2b923266
2020-08-26 17:35:18 +02:00
Eric Wild 6ada823b1a devices: reset internal smart sample buffers upon stop
They are too smart, they keep the timestamps.

Change-Id: Idb4b8f03eb5ffdfd6d3fdbc137b20e3ddc4cfa65
2020-08-26 17:35:18 +02:00
Eric Wild a8d3e91590 ipc:remove unused function
Change-Id: Ie5c3828df5187f0e93970bd05c82d97ef1d51102
2020-08-26 17:35:18 +02:00
Eric Wild cf9883b131 ipc: print initial ts
Change-Id: I9be02583e54592f27748918c16a7fa502bf88c47
2020-08-26 17:35:18 +02:00
Eric Wild 2336ff6540 ipc: device, reorder includes
Change-Id: Iefb2298bcf89ee6e19a825b4774f9d6de9bff48b
2020-08-26 17:35:18 +02:00
Eric Wild 2016e46064 ipc: shm unused cleanup
Change-Id: I7a68a0325ec788823c5d984efff03ee68a1b6f4d
2020-08-26 17:35:18 +02:00
Eric Wild 443810195a ipc: increase read timeout, flush proper buf number
The other side might want to do a PPS sync on startup which is cutting
it close with one second of read timeout.
Additionally the number of buffers read to ensure proper flushing was
previously not updated with the actual number of buffers, which led to
stale buffers with wrong timestamps being stuck in the ipc interface.

Change-Id: I2ec8d422ef31f45e97d9091e5d814429b101ffe8
2020-08-26 17:35:18 +02:00
Eric Wild 7434d0ec3b ipc: proper tx attenuation
Change-Id: Ifac4d689d1007e021cf6765bba1bbef1fde19bb2

squashme2

Change-Id: I1bb22a8f722b49e7f71d4d993957a6f26c420552
2020-08-26 17:35:18 +02:00
Eric Wild 218d6fccff ipc: fix per channel start/stop, ipc uhd backend
Start/stop was previously fixed to channel 0, so proper multichannel
operation without using the mcbts mode was not possible.
UHD multichannel is rather annoying due to the alignment dance which
returns 0 reads, which may not be submitted to the ipc interface, since
empty buffers are treated as errors.

Change-Id: I441b1977e30a6c6c96b2e0543cedb3ce54d3ce31
2020-08-26 17:35:18 +02:00
Eric Wild d703fe43f3 ipc: fix the log messages for the channels
Change-Id: If9a4eab0dccfde6740a3669a7c1d34226b3912d1
2020-08-26 17:35:18 +02:00
Oliver Smith d1cc8b928e IPCDevice.h: remove limesuite include
Change-Id: I3808dcc69dd3ccc8372852c622660b7056c1be8a
2020-08-26 17:35:18 +02:00
Eric Wild 7a8b9cdbf0 ipc: add master socket number/path parameters
osmo-trx-ipc needs to know which master socket it should talk to, so
pass this path in the config device args like this:
dev-args ipc_msock=/path/to/socket

Additionally, add a master socket suffix number parameter to the ipc
backend,
ipc-driver-test -n 0 to start serving /tmp/ipc_sock0

Change-Id: I24857fbb74e5fc808b2a218957c723291de2ba04
2020-08-26 17:35:18 +02:00
Eric Wild 6f20791120 shm: fix alignment
Change-Id: I8b593d792a992973e76dd19f7b678c9caa9c5e16
2020-08-26 17:35:18 +02:00
Eric Wild 2845dc741c ipc: gain setting
Change-Id: I674d51fdcab2691853681f661b441364ed75207a
2020-08-26 17:35:18 +02:00
Eric Wild 1067cb70a4 ipc: make ipc server uhd output more verbose
Change-Id: I9f2c15adff96e71a806ef09f17152c11d7c043aa
2020-08-26 17:35:18 +02:00
Eric Wild eb4a94241b ipc: print received path delay value
Change-Id: Ib072b01451084e055882d2867b558a5f8ede95ea
2020-08-26 17:35:18 +02:00
Eric Wild 572eeda79c ipc: adjust over/underflow reporting
Change-Id: Iec2ca94ed8b6cf96d8797540cff43af6542e6437
2020-08-26 17:35:18 +02:00
Eric Wild 39ae5730cd v1
Change-Id: I057e272623b41421f442206f550bcc8c60f4a747
2020-08-26 17:35:18 +02:00
Eric Wild 4e131b2dd4 spawn the client as a thread
Change-Id: I86cd659e74ebdbf43c4352e83e5adb78f8fe6de5
2020-08-26 17:35:18 +02:00
Eric Wild 37aa2ee85d silence warnings
Change-Id: I01b2dce8e04cdc21872e5bbc3eec7e0a5e3d1b0b
2020-08-26 17:35:18 +02:00
Eric Wild eed524b09e no undefined behavior by adding/substracting values != 0 from null ptr
Change-Id: Id2dc21e884991b3cca9f617aece12ac35959c1b2
2020-08-26 17:35:18 +02:00
Eric Wild 218f968684 shm: fix warnings
Change-Id: I0e56539f699c39ab6e3546c96973184552da4d5f
2020-08-26 17:35:18 +02:00
Eric Wild 62dfcac2f0 ipc: fix shm size calculation
Total size was previously only as large as sizeof(struct
ipc_shm_raw_stream) + sizeof(uint32_t)*num_buffers....

Change-Id: I1205b56a4b11bdf32fbdbfb82b67da36965a7981
2020-08-26 17:35:18 +02:00
Pau Espin b49c8ab965 WIP: comments
Change-Id: Ia2631a869e23af520b9eade192dfdb032174c689
2020-08-26 17:35:18 +02:00
Pau Espin d5ff10069c WIP: osmo-trx-ipc
Change-Id: Ice63d3499026293ade8aad675ff7a883bcdd5756
2020-08-26 17:35:18 +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 199a306d27 Transceiver: Check log level before generating burst str representation
Avoid entering the logRxBurst() function and running a long loop even if
not used.

Change-Id: I67408bc8643d5d97355f277c4a2007064a83ae90
2020-07-27 10:58:54 +02:00
Pau Espin c249ce2a58 Transceiver: Lower some log levels which have an associated counter
They are left as INFO instead of DEBUG since they show possible
timing/performance issues in the setup.

Change-Id: I8aab10054ac89c29b871259fdbe59636723ddfb6
2020-07-17 18:33:13 +02:00
Pau Espin df675784a7 Transceiver: Restrict conditions where FN gaps are detected
In pushRadioVector, like we did for driveTxPriorityQueue already, gaps
are possible in any channel for TRX!=0, since TRX0 is the only one
expected to be always transmitting.

Since we always need to transmit there, it makes no sense to check for
channel being not NONE.

Change-Id: I3b4b85b9100f69dfa113c54a4357120bd11ec86f
2020-07-17 14:12:37 +02:00
Pau Espin 99330740dd Transceiver: Use already obtained value from Rx msg structure
Change-Id: I3854f284e6d6a561b3816b467985f59e690a282b
2020-07-15 14:06:03 +02:00
Pau Espin b70686c13d Transceiver: Provide initial value for TransceiverState::mFiller in constructor
Fixes: Coverity CID#211258
Change-Id: Ic00cc5939ca46407cb5bf8b6fcbcf3dc677041a2
2020-07-15 13:57:06 +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 8b0c5368f5 Transceiver: Fix race condition obtaining Dl burst from Upper layer
The queue was being accessed sequentially obtaining and releasing the
mutual exclusion zone twice. First in getStaleBurst() dropping all
FN<currTime, then in getCurrentBurst() trying to obtain FN=currTime.

However, since in between the mutex is released, it could happen that
for instance upper layer would introduce currTime-1 in the queue, which
would make then getCurrentBurst() detect that one instead of potential
currTime in the queue and return NULL.

By holding the mutex during the call to both functions we make sure the
state is kept during the whole transaction.

Related: OS#4487 (comment #7)
Change-Id: If1fd8d7fc5f21ee2894192ef1ac2a3cdda6bbb98
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 a71c5d073f TransceiverState: Initialize ctrs field in constructor
Coverity dixit:
"Non-static class member field "ctrs.tx_stale_bursts" is not initialized
in this constructor nor in any functions that it calls."

Fixes: CID#211258
Change-Id: I4643a0500e9cad09938c05fab2f358167f72ffa9
2020-07-01 11:50:03 +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
Vadim Yanitskiy 68d8db4d8c UHDDevice: catch LookupError/IndexError in set{Rx,Tx}Antenna()
Currently configuring 3 channels in multi-ARFCN mode makes the
process crash during the Rx/Tx antenna configuration due to
uncaught UHD specific LookupError/IndexError exceptions:

  terminate called after throwing an instance of 'uhd::index_error'
    what():  LookupError: IndexError: multi_usrp:
      TX channel 2 out of range for configured TX frontends

Let's catch them and terminate gracefully.

Change-Id: If66305f2787c6292375e4bfbd60c1d3d764cffd4
Related: OS#4636
2020-06-29 12:43:06 +00:00
Pau Espin 58d80a014e {UHD,LMS}Dervice: Log expected resulting TxPower when setting device specific TxGain
Change-Id: I3c54c61cd6dd7e40bb2831fd4962ff72130b390d
2020-06-25 13:07:22 +02:00
Pau Espin 5bd3d4263b Drop old TxGain APIs from parent radioDevice abstract class
All radioDevice subclasses except USRPDevice have already been reworked
to use the new SetPowerAttenuation() methods, hence we can drop the
compatibility layer that was added to transition from the old API to the
new one, and move those functions to USRPDevice.

This way we simplify the parent abstract class with methods not needed
by most devices and not used anymore by external users of those classes.

Change-Id: Ice005cd0a07c49b6e212c06f1228ef93c24db727
2020-06-25 13:07:22 +02:00
Pau Espin f68f19b110 LMSDevice: Compute TxGain on LimeSuite API based on expected Tx output power
Right now, according to a few measurements taken on LimeMicro devices, we
expect the Tx Gain at UHD level to relate 1:1 with the slope in Tx output
power given a specific band.

If more fine-grained results are wanted or some device doesn't follow a
1:1 slope relationship, functions TxGain2TxPower and TxPower2TxGain need
to be adapted/improved.

This patch is basically doing the same thing as was done previously for
UHDDevice in 992c9bd1ce.

Related: OS#4583
Change-Id: If154fe4d4cd118aa30ea43c22ee7119117b77da6
2020-06-25 11:05:36 +00:00
Pau Espin 405f17a98c Transceiver: Allow sending negative nominal tx power in RSP NOMTXPOWER
Some SDR devices under some bands may provide only under 0 dBm Tx Power.

Change-Id: I8cecb7a37eb80db341a624eb7b826180eac4a1d4
2020-06-22 10:11:58 +00:00
Pau Espin b536ab9bdf proto_trxd: Fix UndefinedBehaviorSanitizer from ubsan
From UBSan:
proto_trxd.c:65:18: runtime error: 128 is outside the range of representable values of type 'char'.

Fixes: OS#4507
Change-Id: I71f815fe794a00934ee0e876848af56f30a21bfe
2020-06-19 18:31:05 +02:00
Pau Espin b899c19f1f UHDDevice: Compute TxGain on UHD API based on expected Tx output power
Right now, according to a few measurements taken on B210, we expect the
Tx Gain at UHD level to relate 1:1 with the slope in Tx output power
given a specific band.

If more fine-grained results are wanted or some device doesn't follow a
1:1 slope relationship, functions TxGain2TxPower and TxPower2TxGain need
to be adapted/improved.

Change-Id: I6f432465dce5c6ec1f1bc4653f6149efb18c3f43
2020-06-15 10:41:16 +02:00
Pau Espin 992c9bd1ce radioInterface: Operate on real Tx power attenuation rather than on device specific gains
All the Tx gain related APIs are left out of reach from radioInterface,
and in there we simply interact with radioDevice passing the attenuation
received from TRXC.

Prior gain logic is moved in base radiodevice class, with the idea that
the setTxGain() and related functions will be dropped over time in each
sublcass in favour of an specific implementation of the
SetPowerAttenuation API.

Change-Id: I4f8a1bcbed74aa9310306b97b0b1bfb02f7855e6
2020-06-09 11:43:32 +02:00
Pau Espin 056ce136e6 UHDDevice: Implement getNominalTxPower() based on TxFrequency
The table with nominal UHD Tx Gains and real transmit power is filled
with values measured experimentally. More information can be found in
OS#4583.

Related: OS#4583

Change-Id: If7ef5bf95ffe4afe5864c0f051853aa38b9639eb
2020-06-09 11:43:24 +02:00
Pau Espin 0e09e7c98a Transceiver: Implement TRXC cmd NOMTXPOWER
It allows the BTS to retrieve the nominal transmit output power value of
each TRX in order to compute attenuation later on and apply it through
SETPOWER or ADJPOWER TRXC commands.

Change-Id: I1d7efe56e008d8d60e23f9a85aa40809f7f84d9c
2020-06-08 15:49:36 +02:00
Pau Espin 1b3a8881eb Transceiver: Fix extra space in RSP NOISELEV error
Change-Id: I35c2f3b3b9358ddb64a53f36969621d45bb243f8
2020-05-29 16:15:18 +02:00