Commit Graph

541 Commits

Author SHA1 Message Date
Pau Espin 8c1d157643 bts-trx: trx_if.c: Improve parsing of received RSP messages from TRX
First the cached CMD sent (struct trx_ctrl_msg) is reworked to have the
cmdname and the params in different buffers for easier comparison with
RSP later.

For the receive path (trx_ctrl_read_cb), new function helpers are added
to parse the buffer into cmdname+params+code (parse_rsp) and to compare
if a given RSP matches the current CMD we sent (cmd_matches_rsp).

The reasoning behind this patch is that a way to check for parameters
when receiving a RSP will be needed in future work, as before this patch
checking of parameters is ignored. This commit is a preparation for commit
to check for duplicated responses.

Change-Id: I2474cbc3e4457cf04f78e1c168768295e1132034
2018-01-19 15:41:19 +01:00
Pau Espin 1f80e9815f bts-trx: trx_if.c: trx_ctrl_read_cb: Move error handling to end of func
The move includes a small logic change: If there's a mismatch between
the rsp and the cmd, now we bts_shutdown instead of blindly skipping
expected RSP and continuing with sending the next CMD in the queue. The
change is specially not a problem since next patches are improving the
logic furthermore to account for duplicates, different parameters, etc.

Change-Id: I7018ded23fe51f364f248ade111aaa80ef46187e
2018-01-19 15:41:19 +01:00
Pau Espin 9a57c7bed4 bts-trx: trx_if.c: Log timedout+retransmitted CMD
Change-Id: Ib573c86a1640640c2a61e80fe1f1412b30342b1a
2018-01-19 15:41:19 +01:00
Pau Espin 4b4c2ec4b3 bts-trx: Avoid enqueueing consecutive duplicate messages to TRX
While debugging other protocol/timing issues between osmobts-trx and osmo-trx,
I found that sometimes two consecutives "POWER OFF" commands are
enqueued and sent to osmo-trx.
There's no point in doing so, as the write queue already maintains state
and retries the command until a RSP is received, then goes for the next
one.

With this change we hence improve timing response as we don't need to
wait for the second command to be processed, and on top we get cleaner
logs and simplified states which are easier to debug.

Change-Id: Ib6a5e7bfac8bc5e1b372da6a1f801c07a3d5ebb7
2017-12-10 14:05:57 +00:00
Pau Espin 62b575db67 bts-trx: trx_ctrl_cmd: Simplify var assignment logic
Change-Id: I9250e3003cff24035440bbba3e1171650dc83209
2017-12-10 14:05:36 +00:00
Harald Welte 70c4dc8d70 osmo-bts-trx: Fix reported frame number during PRIM_INFO_MEAS
The upper layers (L1SAP, the common part of L1) *always* require frame
numbers in the uplink direction to be reported as the frame number of
the *first* burst, not the last burst of a given block.

This is particularly important in the case of passing up measurement
information, as we use this frame number to detect if the measurement
interval for that specific timeslot has just ended (and hence we must
process the measurements and send an uplink measurement report to the
BSC.

Before this patch, the measurement results were reported with the *last*
frame number, which caused the common/measurement.c code never detect
the end of a measurement window.

On TS2, tons of the following log messages were observed:
<0004> measurement.c:199 (bts=0,trx=0,ts=2,ss=0) no space for uplink measurement, num_ul_meas=104

With this patch, it behves as expected:  the measurements of 25 blocks
(= 100 bursts) are aggregated, after which point the report is computed
and sent.  Subsequently, num_ul_meas is reset to 0 and the cycle
restarts.

Related: OS#2329
Change-Id: I1065ae9c400bb5240a63ab8213aee59aeb9ceeff
2017-12-04 13:25:34 +00:00
Harald Welte cbcd3c5034 scheduler_trx: L1P is for PH (data), L1M for MPH (control)
Almost all log statements in scheduler_trx.c were using the wrong
logging subsystem.  Let's fix this.  Also, make it more obvious from
the log subsystem help text

Change-Id: I4312f8ab0414eb38db0d62f05c95ab961f500c14
2017-12-02 21:05:34 +01:00
Harald Welte 62a6a2680f scheduler: Harmonize log line format; Always print TS name + decoded FN
Change-Id: I5703b46c8a59fe00a3cdc063bcf72872980ec5e5
2017-12-02 21:05:34 +01:00
Harald Welte bb8037b7eb trx: Don't assume phy_instance_by_num() returns non-NULL
In trx_clk_read_cb(), when calling phy_instance_by_num(), that
function might in error cases return a NULL phy-instance. Let's
put an OSMO_ASSERT() there as safeguard to avoid NULL dereference
when dereferencing pinst->trx->bts.

Fixes: Coverity CID#178657
Change-Id: If6b6b45380368e9ee9e03ca1eb7ac56c21e72b03
2017-11-06 03:00:08 +09:00
Harald Welte 8e202b595c trx: Don't call osmo_fr_check_sid with negative 'rc'
In rx_tchf_fn(), if gsm0503_tch_fr_decode() returns a negative
result, we cannot use that result as length argument to
osmo_fr_check_sid()

Change-Id: Ic4080b5bf6c865be3333f923f19a2340e1e272c8
Fixes: Coverity CID#178659
2017-11-06 02:56:41 +09:00
Harald Welte d8d402099f trx: Avoid NULL+1 dereference in trx_ctrl_read_cb()
We unconditionally pass "p+1" into sscanf() despite not knowing
if 'p' is NULL or not.

Change-Id: I40a49c3feb3b55ef577eebd7d567afdbcfe0d624
Fixes: Coverity CID#178661
2017-11-06 02:54:36 +09:00
Harald Welte 6733906f62 trx: Better be safe than sorry before calling strlen
There's a lot of pointer arithmetic in trx_ctrl_read_cb which is
not so nice.  While I believe the current code is safe, Coverity
raises "CID 178665:  Insecure data handling  (INTEGER_OVERFLOW)"
regardin the use of rsp_len in the strcmp().

Let's put some OSMO_ASSERT() in front and hope that makes Coverity
happy.

Change-Id: I5a9b3307f83cdde7c8e9f66932446604f5623b05
2017-11-06 02:50:21 +09:00
Neels Hofmeyr 0c9bc5422a osmo-bts-trx: vty: various fixes of 'write file' and doc
On 'write file':
- Write 'osmotrx' before 'maxdly' and 'maxdlynb' (broken since "Introduce new
  phy_link and phy_instance abstraction"
  d784e50747)
- Fix indenting of 'write file' output, command 'osmotrx timing-advance-loop',
  had a stray space in case there is not a 'no' preceding it.

Add some missing instances of OSMOTRX_STR doc strings.

examples/osmo-bts.cfg:
- Drop 'settsc', the command no longer exists.
- Fix indenting of 'osmotrx rx-gain' command.

osmo-bts does not feature VTY tests, so it is pointless to add example files to
test these fixes. We should probably add VTY tests separately.  However, I have
briefly tested manually (and hence found all of these issues).

Change-Id: I018eaef40345bfa26e12eb7d09e83a52596c1000
2017-10-18 14:02:30 +00:00
Max ec33b0397f Remove build dependency on legacy OpenBSC
* copy-paste gsm_data_shared.* from OpenBSC master
* remove corresponding configure check and option
* remove .deb dependency

Actual refactoring with removal of unnecessary structures/parts, moving
common OpenBSC/OsmoBSC parts into libraries etc. are left for further
patches.

Current patch will make coexistence with *BSC easier and will simplify
our build infrastructure.

Change-Id: I9f004fb5c4c1db29d4792dfd281d388c7063da13
Related: OS#1923
2017-10-08 18:40:09 +02:00
Max 9e36dca82a trx: avoid deactivating lchan on LCHAN_REL_ACT_REACT
* do not deactivate lchan when called with LCHAN_REL_ACT_REACT
* add fixme comment

It's unclear yet if any special steps are required for osmo-bts-trx so
let's just make it compatible with setups [1] using BS_AG_BLKS_RES != 1
for now.

Background: CCCH is auto activated by some OsmoBTS - before we receive
SI3, see 4a85828462. To accommodate for
that we deactivate CCCH in common/rsl.c, which triggers BTS-model
specific callback sapi_deactivate_cb() which updates parameters and
activates it again.

In case of osmo-bts-trx there is no auto-activation and (seems to be) no
need in special interaction with hw to activate channel (no
lchan_activate()) hence we can just skip entire
deactivate/setup/activate again routine.

[1] "channel-descrption bs-ag-blks-res N" in OpenBSC config file.

Related: OS#1575
Change-Id: I20b89ba1e43d1414180b083cd1e085eeffe5d513
2017-09-02 19:44:54 +00:00
Pau Espin 8876a507ff osmo-bts-trx: Relax validation to allow TRX data bursts without padding
Original OpenBTS transcievers add 2 bytes of padding to the end of data
bursts, having in total 158 bytes. As those two extra bytes are being
ignored after the initial validation, let's relax this validation a bit
in order to accept transcievers that decide no to send these two extra
bytes.

Change-Id: I94c3cb160bfed0ba9c41ed7ef5f8d8a65b81ad07
2017-08-25 09:34:51 +00:00
Max aa11997480 osmo-bts-trx: remove global variables from loops
* move TA related globals into phy_link
* move power loop related globals into phy_link
* prefix corresponding vty vars with osmotrx

Change-Id: I01d7c1abad67e51b886a4ecf2de072929d67da27
Related: OS#1848
2017-08-24 19:06:48 +00:00
Max 9a30b77813 osmo-bts-trx: fix 'osmotrx legacy-setbsic'
It was introduced in fe6c75d24a1751341bcee91cb45c7ac7f5d07da3:

* fix typo in config write
* add missing vty help string

Change-Id: Id42359dfbb8ad02f34dd2540db66f3ed69ad5181
2017-08-24 19:06:48 +00:00
Alexander Chemeris 2bbf98afa3 Fix static build of osmo-bts-trx and osmo-bts-virtual.
New libosmocore has some plugin system which requires dlopen(). So we need
to make sure we always link with libdl, even when building statically.

Note that this doesn't fix static build of tests - they are still failing
with some errors.

Change-Id: I8315d6e032e34528def268a49fd88d07bc06ab2e
2017-08-20 19:29:30 +00:00
Alexander Chemeris ed662e0799 osmo-bts-trx: Increase a maximum allowed MS power reduction step from 2dB to 4dB.
We tend to start MS with high power to make sure distant phones get good QoS,
but this also means that we need to reduce their power rather quickly. OTOH
we can't make this step too high because this may lead to power output
oscillation. From my (manual, limited) testing 4dB looks like a reasonable
compromise.

Change-Id: I58785513e5739474b881ed7f2a312ecc690e7e60
2017-08-20 01:45:29 +03:00
Alexander Chemeris b0578dda95 osmo-bts-trx: Remove an unused variable. Resolves a compiler warning.
Change-Id: I2464e872f81021cbc3ccbc4e2e32c394d6afcf70
2017-08-19 22:38:20 +00:00
Alexander Chemeris d4450051fc osmo-bts-trx: Fix MS power control loop.
The following two commits from 2014-12-06 introduced a new variable to control
MS power - ms_power_ctrl, but kept the old ms_power variable in place. They
have also changed the meaning of the ms_power variable - it now keeps original
RSL configured value. So when much later osmo-trx-bts code was merged to master
the code was compiling fine and this change in the meaning was overlooked.

In osmo-bts:
579651bf30 power/sysmobts: Add a manual ms power level control
In OpenBSC:
f6f86b0eec18da165db136b14bf2db87fde4b4ac osmo-bts: Introduce new struct for a power loop in the BTS code

Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1
2017-08-19 22:35:10 +00:00
Pau Espin 506a7f98b2 osmo-bts-trx: Enable osmotrx tx-attenuation oml by default
There are currently two ways to specify power reductions to be sent to
osmo-trx from osmo-bts-trx:
* osmotrx tx-attenuation oml
* osmotrx tx-attenuation <0-50>

None of them is enabled by default, which means if none of them is
specified in the config file of osmo-bts-trx, SETPOWER cmd won't be sent
to osmo-trx, which in turn won't turn on the transciever.

Let's enable osmo tx-attenuation oml by default and leave it up to the
bsc to decide which power reduction to use. If the user wants to
configure a specific tx-attentuation, it can still do so in exactly the
same way he used to do it.

Change-Id: Ia8640751630ee37e5f5d1f470bad892a08e80654
2017-08-15 14:59:04 +02:00
Harald Welte fe6c75d24a TRX: Remove global variables, move SETBSIC/SETTSC handling into phy_link
Whether or not we are talking to an OpenBTS (SETBSIC) or OsmoTRX
(SETTSC) transceiver is a property of the phy_link, and not a property
of the BTS.  Also, we *really, really* should never use global
variables. I'm very happy this is being cleaned up, finally.

Change-Id: I51aeb17661dfd63ff347f7b2c0d7ffa383ec814c
2017-08-09 13:03:33 +00:00
Harald Welte cd1b08b14f TRX: Remove bogus extern global variable declarations
Those global variable declarations for non-existing variables were
introduced in 8a8d73a691, let's remove
them again.  The source / destination IP address is a parameter of the
phy_link, and not a global variable.

Related: OS#1848
Change-Id: I94b5f934fc3bd00b0467d90029d3053b16594186
2017-08-09 11:18:46 +00:00
Harald Welte d6da809d2f TRX / VIRT-PHY: Make check for BCCH/CCCH more specific
In bts_model_l1sap_down() we want to identify BCCH/CCCH channel numbers,
but our check is a bit non-specific.  Let's make the check more specific
to only cover the BCCH, Uplink CCCH and Downlink CCCH C-bits as defined
n 3GPP TS 08.58 Section 9.3.1

Change-Id: Ia20ab09b96c87c0dfbfaf98e5b2a8d36423fac67
2017-07-30 17:38:37 +02:00
Pau Espin db4ab8e5ce cosmetic: Move error goto path to the end of the function
Change-Id: I3ad15a9edbfe74de3deb7298441d54fd9d0178ad
2017-07-24 22:00:00 +00:00
Pau Espin 69de62a573 cosmetic: scheduler_trx.c: Add function to get rid of ugly goto path
Change-Id: I9c2e166e6f182f703ccf49aa883c223e377c8421
2017-07-24 22:00:00 +00:00
Pau Espin 9dccaa2064 cosmetic: scheduler_trx: Remove trailing whitespace
Change-Id: Ib057b5e5219ad2acfaee2dcc9ade098daa9ac985
2017-07-24 21:59:59 +00:00
Harald Welte 9b97d0f683 TRX: permit transmission of all-zero loopback frames
For some reason, osmo-bts-trx attempted to interpret/validate the
contents of the downlink TCH block that it was about to transmit.  If
such checks are made, they should clearly be in the common part above
L1SAP, and not in the bts-model specific part.

Also, having the checks in place didn't allow us to send an all-zero
downlink block, as is required for detection of uplink FER in a loopback
testing setup, e.g. with CMU-300.

Change-Id: I6388de98e4a7e20843a1be88a58bba8d2c9aa0d5
2017-07-02 07:02:29 +00:00
Harald Welte cc1602f592 TRX: don't free l1h in trx_phy_inst_close()
l1h is allocated in bts_model_phy_instance_set_defaults() and not in
trx_phy_inst_open().  Hence, trx_phy_inst_close() should not free() it!

Change-Id: I0ac4e57a882e5a31143499c1662d8d8e52320938
2017-07-01 07:38:03 +00:00
Harald Welte f2eaba8869 TRX: merge/simplify l1_if and trx_if code
Related code / function structure still dates back to the pre-phy_link
days.  Let's clean this up to make things less convoluted and reduce the
number of non-static symbols needed between code split over two files.

Change-Id: I1f30ae1f547a5c01c516d4a05032193294c25f2d
2017-07-01 07:38:01 +00:00
Harald Welte cdf20fec7c TRX: Rename trx_if_data() -> trx_if_send_burst()
The new name makes it clear what the function actually does: Send burst
data via the trx interface.

Change-Id: I5031541d4ae4244a62a18acf71139db2874927fa
2017-07-01 07:38:01 +00:00
Harald Welte bb71947829 trx_if: Improve error handling
There ware some error conditions that the previous code didn't catch
and/or report, such as unparseable TRX control strings, non-terminated
buffers, ...

Change-Id: I354d0c121880553ce1bd59b7394d52b104b7d6da
2017-07-01 07:38:01 +00:00
Harald Welte c19ab9ed2f TRX: trx_if: Improve code description / comments
Change-Id: I4e19d68782a12e52ba1d3ba2665060275d04866c
2017-07-01 07:38:00 +00:00
Philipp Maier b7425f3642 osmo-bts-trx: fix missing frame number in MEAS IND
The layer 1 interface (l1_if.c) for osmo-bts-trx does not include
the frame number into the measurement indications it forwards
to higher layers. The frame number is required to properly
detect the end of a measurement period.

Change-Id: Ife3c791ff50e8a866a97b9783ac7ef3ef2402a70
2017-06-29 17:29:56 +02:00
Harald Welte 53ce11ab95 TRX: Use timerfd and CLOCK_MONOTONIC for GSM frame timer
using gettimeofday() is not suitable for the GSM frame timer, as it
relies on the normal 'wall clock' system time, which may be adjusted by
ntp, gps or other means at runtime.

Switching to a different clock source means we cannot use
osmo_timer_list anymore, but timerfd integrates just fine with our
libosmocore select() loop handling.

Change-Id: I51b19adde14ebb7ef3bb863d45e06243c323e22e
Closes: #2325
2017-06-28 23:43:28 +00:00
Vadim Yanitskiy 0b7a3e9f62 scheduler_trx.c: strip unused variable
Change-Id: I870dad2a00f68cca1c31a719221fc30a07b30c20
2017-06-15 14:40:21 +00:00
Vadim Yanitskiy 0227e4d04c cosmetic: fix some typos
Change-Id: Ib9172735bc7a05d9d7425a0e66dd90ff2569ee05
2017-06-15 14:40:21 +00:00
Max de9357251c Set and report BTS features
Set (possibly incomplete) list of BTS model-specific features and report
them in response to attribute request via OML.

Change-Id: I5f8a6681c3562ec261441e84dde6e085b516d92f
Related: OS#1614
2017-06-15 12:55:16 +00:00
Pau Espin e3a3906ee9 trx: Save osmotrx base-port vty properties
Change-Id: I0898a8c4eb3899fc1c0f6b17da33b8c7851b90d6
2017-06-06 19:48:53 +00:00
Pau Espin 8a8d73a691 trx: Allow BTS and TRX to be on different IPs
Depends on libosmocore I3c655a4af64fb80497a5aaa811cce8005dba9cd9

Change-Id: I0bd34b7b02c1a9b0c6f6f89f327b486e5620c8d5
2017-06-06 19:23:18 +00:00
Harald Welte 43c763f5af osmo-bts-trx: Remove duplicate parsing of NM_ATT_CONN_FAIL_CRIT
For some reason, osmo-bts-trx did another take at parsing
NM_ATT_CONN_FAIL_CRIT and storing the second octet in
btsb->radio_link_timeout, just like the generic code already does in
oml_rx_set_bts_attr(), but without proper checking and any error
message.  Let's remove it.

Change-Id: Idb0179e1443c0b5a97e59919dba684a001e90192
2017-05-29 19:55:30 +00:00
Harald Welte 05ba5c2a10 Consistently check for minimum attribute/TLV length in RSL and OML
Make more use of TLVP_PRES_LEN() instead of plain TLVP_PRESENT() and
implicitly assuming a certain length of the information element.

What this obviously doesn't introduce is some kind of error
generation/reporting in case the minimum length is not fulfilled.  An IE
that's too small is silently ignored by TLVP_PRES_LEN() and treated as
if the IE wouldn't exist in the first place.

Change-Id: If5c4eee65711c49bc8ba4675221b1d5fd16198e9
2017-05-29 19:55:30 +00:00
Harald Welte ed9e022eb4 rx_tchh_fn(): Avoid copy+pasting formula to determine odd-ness of fn
Change-Id: Ic2a0bdaa70cc28c1ce8237351b0a0c6b998cf0a3
2017-05-27 08:24:05 +00:00
Harald Welte a493ce9e66 scheduler_trx: Avoid copy+pasting determining CMR from FN
instead, let's introduce a specific function for that.  Also, as this
can be easily determined from the frame number, skip one argument to
tx_tch_common().

Change-Id: Ibbb9b685cf0b6a45339b0874438a500dd6254bc2
2017-05-27 08:24:05 +00:00
Harald Welte 031e8fedac scheduler_trx.c: Avoid code duplication for BER10k computation
Use an (inline) function rather than code copy+pasting

Change-Id: I42e76a4707968e428cbd2e43d5df71ef445efece
2017-05-27 08:24:05 +00:00
Harald Welte b4c9c8f35d scheduler_trx.c: Fix typos, improve comments, cosmetics
Change-Id: I5e2ce70aea8d62657ce3a7d6c16e5a7f8b76c22f
2017-05-27 08:24:05 +00:00
Harald Welte ed51c3d145 Remove unusued left-over gsm0503_conv.c
gsm0503_conv.c should have been removed as part of
efbef50efc but somehow was left here. It's
not referenced/compiled by the Makefile anymore, and the gsm053_conv.c
in libosmogsm has superseded it anyway.

Change-Id: Icdcca1bc55a83c76ec47918dc4dd301155210091
2017-05-27 08:24:05 +00:00
Max efbef50efc osmo-bts-trx: use libosmocoding
Remove built-in functions and use libosmocoding instead.

Change-Id: I1b41bb1a8de655639107ec1f3b75afc240fd316f
2017-05-22 09:37:26 +00:00
Max 8913b29be2 Set BTS variant while initializing BTS model
This will allow proper BTS attribute reporting via OML in follow-up
patches.

Change-Id: I1c49d6c39fb4dac7a46ee25ceacf4c6ef0f0b736
Related: OS#1614
2017-05-10 07:50:00 +00:00
Vadim Yanitskiy 028820510e osmo-bts-trx/l1_if.c: cosmetic: drop double check
Change-Id: I25a8f85ee65e1c0dd54049ffacc039702ca36c8f
2017-05-09 22:18:19 +00:00
Vadim Yanitskiy 957843959d osmo-bts-trx/l1_if.c: use channel combination III for TCH/H
Currently the channel combination II is used for TCH/H, which
allows only one lchan to be allocated. The reason is that it
saves a bit of CPU by disabling UL burst detection on lchan 1.

There is also the channel combination III, which allows to
increase channel capacity, providing two lchans on a single
TCH/H timeslot.

Ideally we should implement some dynamic II <-> III switching
depending on the network load level. But for now this change
replaces the channel combination of TCH/H by III, until dynamic
switching is implemented.

Fixes issue: https://osmocom.org/issues/1795

Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810
2017-03-23 11:35:05 +00:00
Max a80c7024f8 osmo-bts-trx: fix scheduling of broken frames
* DTXu: don't set marker for broken frames
* do not attempt to send 0-length bursts to avoid flood of errors after
  bts startup

Change-Id: Icb536f951386b9abe34c0dacbb203f3db1e41bb3
2017-03-23 10:03:27 +00:00
Ivan Klyuchnikov 70c68853c2 osmo-trx-bts: Fix incorrect bts shutdown procedure in case of clock loss from osmo-trx
This issue occurs in case of osmo-trx restart which leads to losing clock from osmo-trx.
Function bts_shutdown from common/bts.c should be used in this case for proper bts shutdown.

Change-Id: Ie65cf2e8f98cb8bf3314a00048aa53c1f8cd4c25
2017-02-19 08:58:20 +00:00
Ivan Klyuchnikov c4ac69dcc2 osmo-trx-bts: Fix incorrect bts shutdown procedure in case of abis connection closure
This issue occurs in case of osmo-nitb restart which leads to abis connection closure.
Function bts_shutdown from common/bts.c should be used in this case for proper bts shutdown.

Change-Id: Id025e703dd5c91896d450d200e88e46552f178f0
2017-02-14 16:50:11 +00:00
Max b390dfb90d Fix typo in TCH/H interleaving table
According to Table 4 in 3GPP TS 45.003 j=11, b=3 case corresponds to
k=91 and not j=12 as was previously used.

Change-Id: Iad3cf545b2f7e16276466cc37dd7a1e7858467e5
2017-02-10 16:43:44 +01:00
Ivan Klyuchnikov 0418ef588c osmo-trx-bts: Fix osmo-bts-trx crash on startup during reading phy instance parameters from config file
pinst->u.osmotrx.hdl should be allocated before reading phy_instance parameters from config file and applying them.
So allocation of pinst->u.osmotrx.hdl should be moved from l1if_open function to bts_model_phy_instance_set_defaults function,
which is proper place for this allocation according to start-up procedure of osmo-bts.

Change-Id: I6e23f92644400acb268818c9373a8fb10c003da1
2017-02-10 13:37:50 +00:00
Ivan Klyuchnikov e2e0ed5a89 osmo-trx-bts: Fix incorrect setting of RXGAIN and POWER parameters on second channel (TRX1) of osmo-trx
Move rxgain and tx-attenuation (power) parameters from phy_link layer to phy_inst layer.
Rxgain and tx-attenuation parameters should be set for each phy_inst and send for each osmo-trx channel accordingly via control commands.

Change-Id: I4861a59d10d1ef91954e0c6ea265e66dec08844f
2017-02-10 13:35:41 +00:00
Max 2c95ae6a09 osmo-bts-trx: fix lchan deactivation
Use chan_nr for deactivating lchan instead of lchan->nr: chan_nr is the
RSL Channel Number IE value, a bitfield aggregation of lchan type
bits (cbits) and lchan number (lowest three bits). The error was
introduced in 36153239bf.

Change-Id: I6dd7060422ab9d18743c1ff2ab419e3e7299d74d
2016-12-12 12:36:28 +01:00
Max 960dd993cd TRX: prevent segfault upon phy init
Previously if multiply phy instances were configured but not used
osmo-bts-trx would segfault. Terminate with clear error message instead
so user can correct configuration. Example configuration which caused
problem:
...
phy 0
 instance 0
 instance 1
...
 trx 0
  phy 0 instance 0

Note the 2nd instance of phy 0 which is not used in trx later on.

Change-Id: Id979506731ea92401458f1060e87aeb690901539
2016-12-05 18:55:49 +00:00
Max 36153239bf Remove duplicated code
Remove lchan deactivation related code duplication to facilitate future
use for dynamic CCCH re-activation.

Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9
2016-12-01 15:20:42 +00:00
Alexander Chemeris f4b238f91e trx: Add "maxdlynb" VTY command to control max TA for Normal Bursts.
Originally `maxdly` command in osmo-trx was contrlling max TA for Normal Bursts.
This was not a proper behaviour, because it was used to "control maximum
distance a handset can attach from" which is controlled by Access Bursts max TA.
Osmo-trx was corrected to apply `maxdly` to Access Bursts and a new command was
introduced to contrl max TA for Normal Bursts - `maxdlynb`. This patch adds
support for this configuration command into osmo-bts-trx.

If you wonder why would you need that - some test equipment (namely R&S CMD57)
has really bad timing sync and can generate signal a few symbols off. That
prevents osmo-trx from properly receiving otherwise perfectly good bursts
generated by CMD57. This configuration is a solution for this.

Change-Id: Ib5d255299668ac1ef9f0ce95e016f55ba3c82277
2016-12-01 14:49:15 +00:00
Neels Hofmeyr 6f4ce14ed7 osmo-bts-trx: remove obsolete include of netif/rtp.h
Change-Id: Idf364fd7d69446a7a996062f71d701d9c6cca84c
2016-11-29 22:41:59 +01:00
Max 66325aee71 Replace link_id constant with define
Instead of using constant for link_id directly, use shared define value.

Change-Id: Ibf3d439d8893bd994ba089796175b6c635db2cf8
2016-11-11 15:52:49 +01:00
bhargava 38843fbf48 Initialize parameters in osmo-trx for 11bit RACH
The parameters related to support 11bit RACH are initialized in
osmo-trx. These parameter determaine the type of the RACH received
in osmo-pcu.

Change-Id: I164d449303373d0757719d5204f4716975fb517a
2016-11-08 11:56:08 +05:30
Max ebb483b69a Replace magic number with define
SDCCH occupy lchan 0..3 in combined configuration so for CCCH we've
always used lchan[4] - replace it with CCCH_LCHAN define and add
comment.

Change-Id: Ic5d742c292d638f119c6b4672120c1950adeb7f0
2016-10-18 08:08:25 +00:00
Max de9dbe7958 TRX: fix building with latest DTX changes
Bring up-to-speed with latest changes in OpenBSC.

Change-Id: I16b24b2cd09600e215de163e7b5baae329887c9e
2016-10-13 11:45:56 +02:00
Neels Hofmeyr 67a056c122 dyn TS: complete for TRX
Apply similar fixes as for TCH/F_PDCH also for TCH/F_TCH/H_PDCH:

Detect dyn TS in PDCH mode in ts_is_pdch().

In trx_set_ts(), enhance the "if (TCH_F_PDCH)" to a switch statement including
both dynamic channel types. Adjust the comment to include both kinds.

Change-Id: I6669739cd08780cd9ffb9451cdae9f6b9704c4fe
2016-08-10 18:06:20 +02:00
Mike McTernan ef8e2ef681 osmo-bts-trx: log decoder bit errors as DEBUG, not NOTICE
It is not an exceptional situation if the air-interface is experiencing
non-recoverable decoding errors.  At bad signal conditions and/or
interference, this is perfectly normal.  Let's use DEBUG instead of
NOTICE log level.

Change-Id: Ifd39c53ec22f57cdb5299e5d76ff6ff1482d3beb
2016-08-08 17:46:34 +00:00
Mike McTernan b7cdd381d6 osmo-bts-trx: Fix PCS1900 operation
As the ARFCN numbers in DCS (1800) and PCS (1900) are not unique,
we need to specify the band in the upper bits of the ARFCN value before
calling gsm_arfcn2freq10().

Change-Id: I637b76bc1fc749eed8e364412d76606589991c02
2016-08-08 17:45:25 +00:00
Max 4b76a323b3 Fill measurements data for L1SAP
Fill in values for BER, BTO, Link quality in L1SAP and send them to
PCU. Note: this increases the version of BTS <-> PCU protocol. It also
requires corresponding changes in libosmocore.

All BTS models provide measurements data unless direct DSP access for
PCU is enabled. For BTS-specific notes see below.

Octphy: conversion from sSNRDb to Link Quality uses formulae which works
in practice instead of what's documented for sSNRDb value. Subject to
change in future revisions.

TRX: C / I link quality estimator is not computed.

Change-Id: Ic9693a044756fb1c7bd2ff3cfa0db042c3c4e01c
Related: OS#1616
2016-08-08 17:41:27 +00:00
Tom Tsou d6920df630 trx: Fix coverity BER calculation NULL dereference
Allow output of encoded bit count or error count on BER calculation
without requiring both pointers to exist.

Change-Id: I2c78fa6a92a3b3da4aad8f70353e5a43451b0aa5
Fixes: Coverity CID 137963
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-28 11:48:25 -07:00
Neels Hofmeyr af3443385b dyn PDCH: trx l1_if.c: drop fixme, add comment
Change-Id: Ib240f21f4d460524767f4273fc9077617d1ffb43
2016-07-28 17:58:40 +02:00
Neels Hofmeyr 0d4b37d641 dyn PDCH: complete for trx: implement bts_model_ts_[dis]connect()
bts_model_ts_disconnect() has nothing to do.

bts_model_ts_connect() merely sets the new pchan on the ts.

Change-Id: Ieb66935d6efc26854e95d238e810c4f8b16cfa88
2016-07-28 17:58:05 +02:00
Neels Hofmeyr 45d3bbfb44 dyn PDCH: trx l1_if.c: factor out trx_set_ts_as_pchan() from trx_set_ts()
To be able to set a specific pchan type for dynamic channels, have the
trx_set_ts_as_pchan() function with an explicit pchan argument instead of
using ts->pchan.

Keep trx_set_ts() as a thin wrapper to use ts->pchan directly.

Change-Id: I9eeef05d2a6763f86a5b89ee7c3b4211f6736e4d
2016-07-28 17:58:05 +02:00
Tom Tsou dab54b9178 trx: Enable EGPRS handling through burst lengths
Existing interfaces are coded with the implicit expectation of using
a burst sequence length of 148, which is constant with GSM and GPRS.
That changes with EGPRS, where the burst length may be 444 due to
the use of 8-PSK instead of GMSK modulation.

Setup the interface to accept and return a length value with the
burst sequence. This allows 444 length bit vectors to/from the
EGPRS decoder/encoder. Length is explicitly used as a identifier for
8-PSK vs. GMSK modulated sequences.

Change-Id: I90b46b46b11b6ce280e7f8232d5a2fccec2d4f18
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-28 06:18:12 +00:00
Tom Tsou 9407e644b0 trx: Add EGPRS coding and decoding procedures
Handles uplink decoding and downlink encoding procedures for MCS 1-9.
Includes Type 1, 2, and 3 headers and tables from 3GPP TS 44.060 in
order to independently recover coding and puncturing scheme (CPS)
parameters for each coded message.

Change-Id: I0f059ae34c6f36179553cbc972f8becf8179eb55
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-28 06:18:12 +00:00
Tom Tsou 73cb583e51 trx: Add EGPRS tables, sequences, and mappings
Includes EGPRS specific convolutional codes, interleaving tables
and functions, burst mappings, training sequences, and parity
checks from 3GPP TS 44.060 needed to handle MCS codings 1-9.

Change-Id: Ie270398dd7a72f282ba53e646853d8de1eabee93
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-25 18:36:29 +00:00
Neels Hofmeyr 2ed03cd640 osmo-bts-trx: init OML only once by sending AVSTATE_OK with OPSTATE_ENABLED
When receiving an OPSTART for the BTS object, also set the availability state
to OK.

Before, the availability would remain at NM_AVSTATE_DEPENDENCY, which caused an
unfortunate chain reaction resulting in osmo-bts-trx going through the
initialization sequence twice:

  BTS    BSC
   |<-----|   SITE_MANAGER OPSTART
 n |----->|   BTS state change: OPSTATE_DISABLED, AVSTATE_DEPENDENCY
 o |      |     This signals to nm_statechg_event() in bts_ipaccess_nanobts.c
 r |      |     to (a) Set BTS Attributes and (b) send BTS OPSTART
 m |<-----|   Set BTS Attributes (a)
 a |      |     When osmo-bts-trx receives a Set BTS Attributes, it sends
 l |----->|   CHANNEL state change: OPSTATE_DISABLED  x8
   |      |     This signals the BSC to Set CHANNEL Attributes and OPSTART
 i |<-----|   Set CHANNEL Attributes  x8
 n |<-----|   CHANNEL OPSTART  x8
 i |----->|   CHANNEL state change: OPSTATE_ENABLED, AVSTATE_OK  x8
 t |      |
   |<-----|   BTS OPSTART (b)
   |      |     osmo-bts-trx immediately replies with:
   |----->|   BTS state change: OPSTATE_ENABLED, AVSTATE_DEPENDENCY
   |      |     Unfortunately, availability is left at DEPENDENCY,
   |      |     and the NM_OC_BTS case in nm_statechg_event() only
   |      |     checks for availability, not for the opstate.
   |      |     Hence nm_statechg_event() again feels inclined to
   |      |     to (a) Set BTS Attributes and (b) send BTS OPSTART,
   |      |
 --+------+----- This is where the second round starts
   |      |
 s |<-----|   Set BTS Attributes (a)
 e |      |     When osmo-bts-trx receives a Set BTS Attributes, it sends
 c |----->|   CHANNEL state change: OPSTATE_DISABLED  x8
 o |      |     All channels are disabled again, and then re-launched:
 n |<-----|   Set CHANNEL Attributes  x8
 d |<-----|   CHANNEL OPSTART  x8
   |----->|   CHANNEL state change: OPSTATE_ENABLED, AVSTATE_OK  x8
   |      |
 i |<-----|   BTS OPSTART (b)
 n |      |     osmo-bts-trx again sets the OPSTATE_ENABLED, but since
 i |      |     this time it was already enabled, no further state change
 t |      |     is sent back to the BSC.

This nightmare pivots on two hinges:

1. osmo-bts-trx fails to set BTS availability to AVSTATE_OK.
2. nm_statechg_event() fails to heed the OPSTATE_ENABLED of the BTS state
   change.

Note, the configured channels from the first round were not actually taken
down, only the OML OPSTATE_DISABLED were sent.

In this commit, fix the osmo-bts-trx side: send AVSTATE_OK for the BTS object
upon sending OPSTATE_ENABLED, so that only the part marked "normal init" above
is run.

This change applies the same fix to other OML objects, which should make sense
in the same manner, within the current hackish OML implementation:
* NM_OC_BTS
* NM_OC_SITE_MANAGER
* NM_OC_BASEB_TRANSC
* NM_OC_GPRS_NSE
* NM_OC_GPRS_CELL
* NM_OC_GPRS_NSVC

This means that the NM_OC_CHANNEL case just above is identical, and thus
collapse NM_OC_CHANNEL onto the other cases. Drop the comments from
NM_OC_CHANNEL since they merely rephrase the commands themselves.

See OS#1770 for BTS and NITB logs.

Fixes: OS#1770

Change-Id: I08aa861f6100568c79750f4fbc9a32e1557b9304
2016-07-14 03:40:50 +02:00
Neels Hofmeyr cff0d44e53 log: osmo-bts-trx: change PDTCH block logs to DEBUG level
Many erratic PDTCH blocks are expected. To not bloat the log,
notifications for this should be on debug level.

See http://lists.osmocom.org/pipermail/openbsc/2016-June/009457.html
(Thu, 30 Jun 2016 01:49:33 +0300 / Alexander Chemeris
<alexander.chemeris@gmail.com> / Re: GPRS on osmo-trx not working)

Change-Id: Ie318248aa2b8de455174e72a63c602c7aeae312c
2016-07-09 19:52:18 +00:00
Neels Hofmeyr b8f5f4e176 log: osmo-bts-trx: change access burst logs to DEBUG level
Many erratic bursts are expected. To not bloat the log, notifications for this
should be on debug level.

See http://lists.osmocom.org/pipermail/openbsc/2016-July/009482.html
(Tue, 5 Jul 2016 15:38:27 -0700 / Tom Tsou <tom@tsou.cc>
/ Re: osmo-bts-trx error logs -- was: GPRS on osmo-trx not working)

Change-Id: If591c087ba8fd48564139e32930050ee8ab07001
2016-07-09 19:50:50 +00:00
Neels Hofmeyr b151301c6c cosmetic: osmo-bts-trx: add comment, fix comment typo
Change-Id: Iea62bd98954d0219ba597613cea6db63f7a6b396
2016-07-09 19:50:50 +00:00
Max d5f95c308b TRX: add Uplink DTX support for FR/HR
* detect SID and set RTP Marker accordingly (emulate ONSET events)
* set proper FN in TCH_IND
* detect speech pause and do not send dummy 'bad' frames during that
  time

Change-Id: Id518e5c667df7773c281effb9e75b66bf898f6fc
Related: OS#1750
2016-06-27 09:37:11 +00:00
Max 5c0d88e69d Make get_lchan_by_chan_nr globally available
* Remove static qualifier
* Remove duplicated code - use generic function instead

Change-Id: I37a312648771f58d3087471083cfcebbd97ccf1d
2016-06-23 20:00:44 +00:00
Max 724412a49a Clarify logging message
Change-Id: I3c7be592f4cbdd553f07c4a7084478706a7bd644
Related: OS#1648
2016-06-22 23:24:43 +00:00
Max dd084e6e57 Use libosmocodec functions for AMR
Switch to using libosmocodec functions as a preparation step for DTX
support as they expose necessary bits.

Change-Id: Ie7423032fd06779d78876182ee63538d98906328
Related: OS#1750
2016-06-21 17:24:50 +02:00
Neels Hofmeyr 9375aa9a68 dyn PDCH: add bts_model_ts_connect() and _disconnect() stubs
Enhance bts_model_ API in preparation of dyn PDCH switching. These will be used
to re-connect a TCH/F_PDCH TS in a different mode: either as TCH/F or as PDCH.

All implementations so far return -ENOTSUP, and thus will cause a IPAC PDCH ACT
or DEACT *NACK* to be sent to the BSC as soon as these messages are handled.

Also add stubs in tests.

Change-Id: I21e60c028a1333431c3ed000f788b654d1170b0d
2016-06-17 15:50:47 +00:00
Max ecd5bc2aef TRX: Add vty command to power on/off transceiver
Add vty command (under "phy X instance Y" hierarchy) to manually send
POWERON or POWEROFF command. It's useful for debugging issues related to
BTS/TRX initialization.

Change-Id: I6dfebaf118cdf5ad144516b2b839b17350a73ce4
Related: OS#1648
2016-06-16 13:39:42 +00:00
Max 7cc3c3156e Fix OML activation
Previously software activation could have been reported multiple times
which broke proper BTS init. Introduce guard variable to ensure
reporting happens only once.

Note: this is just minimal workaround - ideally proper OML state machine
should be implemented.

Change-Id: Ifffbdb756bc5d2864f985c01a3299b839c4de7af
Related: OS#1648
2016-06-16 12:43:44 +02:00
Max cb20c83323 Fix ocmo-bts-octphy interaction with OsmoPCU
Previously osmo-bts-octphy have not provided in-band presence
information which cause off-by-one errors and misinterpretation of
ph_data_ind by PCU. This fixed now by adding support for explicitly
passing PH-DATA presence info. Corresponding check and in-band passing
of presence information are removed.

Note: this requires libosmocore version with osmo_ph_pres_info_type
support integrated.

[hfreyther/max: Remove + 1 from the decoded length]
2016-02-22 13:57:54 +01:00
Harald Welte 634c3e4648 Use consistent naming of binaries accross BTS models
Let's use one systematic naming schemes for all BTS models.

osmobts-trx -> osmo-bts-trx
sysmobts -> osmo-bts-sysmo
lc15bts -> osmo-bts-lc15
2016-02-15 14:27:57 +01:00
Harald Welte d784e50747 Introduce new phy_link and phy_instance abstraction
This way we can model a flexible mapping between any number of PHYs,
each having multiple instances, and then map BTSs with TRXx on top of
those PHYs.
2016-02-15 14:18:59 +01:00
Harald Welte 1a5b00ebe2 TRX: Move scheduler to src/common
This is the final step to make the L1 scheduler generally available
to other BTS models than OsmoTRX.
2016-02-15 14:17:55 +01:00
Harald Welte 48726242ad TRX: scheduler: Remove dependency to trx_if.[ch] 2016-02-15 14:17:55 +01:00
Harald Welte 67311cc1f2 TRX: scheduler: Move trx_sched_clock() to scheduler_trx.c
This funciton (and associated static functions) are TRX specific,
and scheduler.c should only contain generic code.
2016-02-15 14:17:55 +01:00
Harald Welte b6b42d150d TRX: scheduler: don't access l1h->config from scheduler 2016-02-15 14:17:55 +01:00
Harald Welte 11db925f15 TRX: call trx_loop_sacch_clock from TRX scheduler backend
this removes the dependency of scheduler.c on loops.h
2016-02-15 14:17:55 +01:00
Harald Welte 2b0e209029 TRX: split scheduler in generic part and backend part
the backend is performing the actual encoding and decoding functions,
while the generic part constsits of the TDMA structures and generating
the RTS.ind
2016-02-15 14:17:55 +01:00
Harald Welte 5538f5cff8 TRX: factor out the scheduler from remaining code
The L1 scheduler is a generally useful component that is unfortunately
tied quite a bit into the OsmoTRX support.  Let's try to separate it out
by having separate per-trx/per-ts/per-chan data structures pre-fixed
with l1sched_

Using this patch it should be one step easier to use the scheduler for
other BTS models, such as the intended upcoming virtual BTS.
2016-02-15 14:17:55 +01:00
Harald Welte 611ef23700 merge bts-specific main function into common/main.c:bts_main()
This removes a lot of copy+paste duplication between different BTS
models.
2016-01-22 09:09:09 +01:00
Harald Welte a0192b859b Add new bts_model_ctrl_cmds_install()
This is one step in making the main() functions of different
BTS models more similar, so we can share one code rather than multiple
copies of it.
2016-01-22 09:09:09 +01:00
Harald Welte f9de18ea15 TRX: the L1SAP queue contains mac blocks, not bursts (cosmetic) 2016-01-16 17:49:13 +01:00
Harald Welte 97cb71971a TRX: Don't hard-code 23 bytes, use GSM_MACBLOCK_LEN 2016-01-16 17:49:08 +01:00
Harald Welte dd562d84ba TRX: Don't use magic numbers when we have #defines 2016-01-16 17:49:04 +01:00
Harald Welte 773ab8b2c5 TRX: replace some more 2715648 magic numbers with GSM_HYPERFRAME 2016-01-16 17:48:57 +01:00
Harald Welte 69ace680dd TRX: scheduler: whitespace cleanup 2016-01-16 17:48:53 +01:00
Harald Welte 1bdd08d07d TRX: schedule: remove dead code
the check whether or not to send a dummy burst is done already in
trx_sched_dl_burst(), so no need to have commented-out code doing that
again.
2016-01-16 17:48:45 +01:00
Harald Welte 519a639cf3 TRX: make trx_chan_desc static, it is not used externally 2016-01-16 17:48:40 +01:00
Harald Welte 6323d2e617 use existing #define for FR/EFR frame length (33/31) 2016-01-16 17:48:26 +01:00
Harald Welte 695d8eb277 TRX: Reduce magic numbers, introduce GSM_HYPERFRAME for 2715648 2016-01-16 17:48:15 +01:00
Harald Welte 5b500f5d8f TRX: use const for dummy and fcch burst definitions 2016-01-16 17:48:04 +01:00
Harald Welte 2bf00d7729 TRX: mark scheduler data structures as 'const'
Those are read-only tables which should end up in the text segment
and not in writable data.
2016-01-16 17:47:59 +01:00
Harald Welte 12992d86dc TRX: some comments dscribing the scheduler.[ch] API 2016-01-16 17:47:54 +01:00
Harald Welte 8250800d3b TRX: Add stub bts_model_change_power() function
This just fixes linking. It still needs to be properly implemented
2016-01-16 17:47:34 +01:00
Harald Welte 6d101a79a8 TRX: remove obsolete get_mac() function 2016-01-16 17:47:13 +01:00
Harald Welte bbcf703be8 TRX: catch up with trhe amr_mode naming changes
OpenBSC introduced a naming change in
615ed46a6ab25f71a7ab0d8201d33b4dbf8fc5b0 but osmo-bts fixes were only
about osmo-bts-sysmo, not osmo-bts-trx.  This updates osmo-bts-trx
accordingly.
2015-11-05 23:02:55 +01:00
Harald Welte 94da045be5 Don't blindly link against '-lortp' but use pkg-config for that
This also ensures that a missing ortp library dependency is discovered
at configure time already
2015-11-05 22:52:50 +01:00
Harald Welte caa648d92e TRX: Add missing call to abis_init()
This somehow got lost during the latest rebase.
2015-09-22 16:41:32 +02:00
Harald Welte 88a31e2a99 make osmo-bts-trx provide bts_model_adjst_ms_pwr() 2015-09-22 16:41:32 +02:00
Alexander Chemeris b812839dfa trx: fix potential use of uninitialized toa variable.
Not really a bug, as we're smart about it down the stream, but it's better to
be strict here as well.
2015-09-22 16:41:31 +02:00
Alexander Chemeris ae525a8761 trx: Send POWERON/OFF commands to osmo-bts only for the first channel.
osmo-trx never supported separate power control for trx's, but now it started
to be more strict about it.
2015-09-22 16:41:31 +02:00
Alexander Chemeris 29ea40f538 trx: Assume 100% BER if total decoded bits is 0 in l1if_process_meas_res() 2015-09-22 16:41:31 +02:00
Alexander Chemeris e9abc5a4f3 trx: Cleanup unused parts of loops.c 2015-09-22 16:41:31 +02:00
Alexander Chemeris 17be7fa73b trx: Remove unused variables. 2015-09-22 16:41:31 +02:00
Alexander Chemeris 68e8b2b1d5 trx: Fix typo in a log message. 2015-09-22 16:41:31 +02:00
Alexander Chemeris 391ff14977 trx: More logging for voice frame decoding functions. 2015-09-22 16:41:31 +02:00
Alexander Chemeris 6fceaca584 trx: Implement BER calculations.
A known issue with this code is that BER is not updated for lost TCH frames,
because osmo-trx doesn't send any indication for them and we don't have
a callback to handle this.

Otherwise the code seem to work fine.
2015-09-22 16:41:31 +02:00
Thomas Tsou ddc0bf14d5 TRX: Remove extra TCH/HS puncturing value
3GPP TS 05.03 "Channel coding" specifies the puncturing matrix (1,0,1)
for class 1 information bits and tail bits valued u(0) to u(103) for a
maximum puncturing index of 311. The puncturing index 313 exceeds the
maximum index and causes osmo_conv_get_output_length() to output the
improper length of 210 instead of 211.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2015-09-22 16:41:31 +02:00
Andreas Eversberg deb01a2652 TRX: Check if Transceiver indicates an out of range clock
If frame number is out of range (>= 2715648), the scheduler's process
would end up in an infinite loop. This is because the loop would schedule
bursts until the indicated frame number is reached, which would not be
possible.

The openbts, calypso-bts and osmo-trx might send out out of range clock
indications every 3.5 hour.
2015-09-22 16:41:30 +02:00
Andreas Eversberg 3cfc9d5fa3 TRX: Show which TRX does not respond or rejects a command 2015-09-22 16:41:30 +02:00
Andreas Eversberg a7d0c5ef5a trx: Set lchan inactive, only if the dedicated channel is deactivated 2015-09-22 16:41:30 +02:00
Andreas Eversberg f39c739bd6 TRX: Activate LCHAN of CCCH when CCCH is configured on time slot 2015-09-22 16:41:30 +02:00
Andreas Eversberg f66f5b3ddc TRX: Free bust buffer memory to when changing lchan type 2015-09-22 16:41:30 +02:00
Andreas Eversberg c241afa87c TRX: Add VTY option to allow setting RTS advance in frames
RTS (ready-to-send) must be issued in advance, so BTS core and especially
osmo-pcu can provide downlink data frames early enough. In some cases PCU
might provide frames too late, so they must be dropped. If PCU provides
frames too late, due to high system load, this "RTS advance" setting must
be increased.
2015-09-22 16:41:30 +02:00
Martin Hauke 178d618d5a TRX: fix some typos in comments 2015-09-22 16:41:30 +02:00
Martin Hauke c9ddb2ba22 build: Use AM_CPPFLAGS in Makefile.am
Since automake 1.13 INCLUDES is depricated and causes a warning
Inspired from similar patches by Alexander Huemer for other osmocom
projects.
2015-09-22 16:41:30 +02:00
Andreas Eversberg b2482a8574 Allow TRX 0..254 at VTY, even if less TRX are available
Instead of limiting the number of TRX at VTY to the actual number of
supported TRX, VTY allows to configure any possible number of TRX. If a
TRX is configured, which is not supported by BTS model, an error message is
returned, which states that the given TRX is not supported.
2015-09-22 16:41:30 +02:00
Andreas Eversberg 812fdd92c7 TRX: Changed logging of unserved primitives from LOGL_NOTICE to LOGL_INFO 2015-09-22 16:41:30 +02:00
Andreas Eversberg ec6225e3e0 TRX: Fixed chan_nr for SACCH/8(7) at scheduler 2015-09-22 16:41:29 +02:00
Andreas Eversberg ef6eb5442c trx: Add option to set transmit power reduction via OML (BSC) 2015-09-22 16:41:29 +02:00
Andreas Eversberg f0072a8de8 TRX: Do not send burst on IDLE channels at TRX != C0
This is required, so the transceiver transmits no power.
2015-09-22 16:41:29 +02:00
Andreas Eversberg 3cf28aa924 TRX: Close TRX (shutdown all active channels) on ABIS link failure 2015-09-22 16:41:29 +02:00
Andreas Eversberg 578340c7a7 TRX: Add bts_model_trx_close to TRX implementation 2015-09-22 16:41:29 +02:00
Andreas Eversberg 3caf3b7c45 TRX: Fixup ciphering state names after rebasing 2015-09-22 16:41:29 +02:00
Andreas Eversberg ee47913389 TRX: No need to set mode and cipher for PDCH 2015-09-22 16:41:29 +02:00
Andreas Eversberg f5aaf523c5 TRX: If no cipher algorithm is given, or if it is a5/0, reset cipher state 2015-09-22 16:41:29 +02:00
Andreas Eversberg 8c8998e551 TRX: Set ciphering to an initial state when activating channel
Handover and assignment may activate channels with ciphering already set,
so we need to tell scheduler to enable/disable ciphering and set the
correct cipher state.
2015-09-22 16:41:29 +02:00
Andreas Eversberg 798c1bba9d TRX: Process real time scheduling option is now similar to sysmobts 2015-09-22 16:41:29 +02:00
Andreas Eversberg db0b93ac39 TRX: Disable handover burst detection when closing channel during detection 2015-09-22 16:41:29 +02:00
Andreas Eversberg 86c936cbb1 TRX: Use correct slot type for GSM_PHCAN_BCCH 2015-09-22 16:41:28 +02:00
Andreas Eversberg b9a917a138 TRX: Handover access burst support 2015-09-22 16:41:28 +02:00
Andreas Eversberg 6527dffc94 TRX: Clear lchan state when resetting TRX 2015-09-22 16:41:28 +02:00
Andreas Eversberg fb04746bce TRX: Report measurements 2015-09-22 16:41:28 +02:00
Andreas Eversberg 05597a7ddb TRX: Fixed typos tranceiver -> transceiver 2015-09-22 16:41:28 +02:00
Andreas Eversberg 82676c13ee TRX: Fix: Cleanly free TRX instances during initialization in case of an error 2015-09-22 16:41:28 +02:00
Andreas Eversberg c2ee307fd4 Allow one or more TRX to configure via VTY 2015-09-22 16:41:28 +02:00
Andreas Eversberg 2e4a26a0e9 TRX: Add VTY options to enable and disable SETTSC and SETBSIC 2015-09-22 16:41:28 +02:00
Andreas Eversberg 6508f21130 TRX: Reset ciphering state when closing channel 2015-09-22 16:41:28 +02:00
Andreas Eversberg c5241c3aa4 TRX: Support for AMR half speech 2015-09-22 16:41:28 +02:00
Andreas Eversberg c910a332b2 TRX: Support for TCH/H and GSM half rate transcoding 2015-09-22 16:41:27 +02:00
Andreas Eversberg f62a64e440 TRX: Add AMR Payload handling 2015-09-22 16:41:27 +02:00
Andreas Eversberg a7f5e07712 TRX: Support for AMR full speech 2015-09-22 16:41:27 +02:00
Andreas Eversberg 5e2341411f Get RSSI from received uplink data and send to PCU 2015-09-22 16:41:27 +02:00
Andreas Eversberg 917cf7018b TRX: Add support for EFR transcoding 2015-09-22 16:41:27 +02:00
Andreas Eversberg 84b9a44535 TRX: Code cleanup, prepare for other codecs than GSM full rate 2015-09-22 16:41:27 +02:00
Andreas Eversberg 7ff22823ca TRX: Use link timeout value from BSC via OML attribute. 2015-09-22 16:41:27 +02:00
Andreas Eversberg 9855e8bd48 TRX: Out of range primitives found in downlink queue are not an error 2015-09-22 16:41:27 +02:00
Andreas Eversberg 219ece83a3 TRX: Implementation of MS power and timing advance loops 2015-09-22 16:41:27 +02:00
Andreas Eversberg 889890da43 TRX: Improved handling of clock indications.
If no clock is received, a POWEROFF is sent until clock is detected.
2015-09-22 16:41:27 +02:00
Andreas Eversberg 23a5183767 TRX: Fixes to TRX interface
Ignore false response to uncritical commands.
2015-09-22 16:41:27 +02:00
Andreas Eversberg ce0f20b597 TRX: Fix of SCH burst data 2015-09-22 16:41:26 +02:00
Andreas Eversberg 7bd6e8b89b TRX: Ciphering 2015-09-22 16:41:26 +02:00
Andreas Eversberg d692b6e054 TRX: Replaced GSM 06.10 ordering table by table in libosmocodec 2015-09-22 16:41:26 +02:00
Andreas Eversberg 89e36c0e64 TRX: Cleanup of channel transcoding 2015-09-22 16:41:26 +02:00
Andreas Eversberg 801c182c02 TRX: By default, send 20 frames in advance to tranceiver 2015-09-22 16:41:26 +02:00
Andreas Eversberg 7451ce29a7 TRX: Detect missing received bursts and fill them with zero-sbits 2015-09-22 16:41:26 +02:00
Andreas Eversberg 78b2080027 TRX: PDTCH (GPRS) works now
Detection and transcoding of all four coding schemes are supported.
2015-09-22 16:41:26 +02:00
Andreas Eversberg 9de67ca962 TRX: Lost TCH frame detection of omitted bursts from tranceiver 2015-09-22 16:41:26 +02:00
Andreas Eversberg b9880bc812 TRX: Allow transcoding of TCH FR with MSB first (RTP) or LSB first (E1) 2015-09-22 16:41:26 +02:00
Andreas Eversberg d10eaee4cc TRX: Completed TCH/F full rate support
Full rate is now tested and working.
2015-09-22 16:41:25 +02:00
Andreas Eversberg b104aed5ec TRX: Fixed swapped stealing bits
Thanx to Sylvain for pointing to this bug.
2015-09-22 16:41:25 +02:00
Andreas Eversberg cd463dd72a TRX: Minor fixes, especially handle TOA of RACH correctly 2015-09-22 16:41:25 +02:00
Andreas Eversberg 7d684d6866 TRX: Fix, never send confirm for DEACT SACCH request (TS 05.08 4.6)
Sending it would cause BSC to change to a state, where it does not release
rf channel.
2015-09-22 16:41:25 +02:00
Andreas Eversberg e0959e7929 TRX: Use received TRX clocks to determine availablility of tranceiver
Only if transceiver becomes available, control commands are sent. If
tranceiver is gone, reset scheduler.

The current availability state is sent to BSC via OML state change
commands.
2015-09-22 16:41:25 +02:00
Andreas Eversberg 2ea68e2b7b TRX: Fixes and improvements of scheduler 2015-09-22 16:41:25 +02:00
Andreas Eversberg d0603d96e9 TRX: Completed transcoding of TCH with reordering Table 2 of TS 05.03 2015-09-22 16:41:25 +02:00
Andreas Eversberg 414faaca19 TRX: Power down tranceiver and reset scheduler, if abis link is lost
If BTS is gone, TRX is powered down, due to loss of abis link. If link is
esablished again, tranceiver and scheduler are provisioned again by BTS.
2015-09-22 16:41:25 +02:00
Andreas Eversberg 7a0d11dd68 ABIS: Introduce bts_model_abis_close to indicate ABIS link failure.
sysmocom-bts model shuts down on link loss, but other models may not want
this, so shutdown is moved tor bts_model_abis_close of osmo-bts-sysmo.
2015-09-22 16:41:25 +02:00
Andreas Eversberg cd0581d815 TRX: On negative response of critical commands, shutdown BTS 2015-09-22 16:41:24 +02:00
Andreas Eversberg acc71ffb4b TRX: Introduce osmobts-trx, a layer 1 implementation for OpenBTS tranceivers
The code is quite complete, TCH and PDCH channels are not yet tested.
2015-09-22 16:41:24 +02:00