Commit Graph

2281 Commits

Author SHA1 Message Date
Pau Espin 7a58aa9bc4 scheduler: Add rate_ctr informing about Dl block not found
Together with previous counter L1SCHED_TS_CTR_DL_LATE, it allows
understanding which dl blocks are really lost (never queued) and which
were simply queued too late.

Change-Id: I456d0cfbef1e03b147ce7d968a3ec42dd728fe74
2020-06-18 11:48:49 +00:00
Pau Espin 1240ea8b83 scheduler: Add rate_ctr informing about too low rts-advance
Change-Id: I76c3dd4020c6d74192b03b1d42413ae536da5f05
2020-06-18 11:48:49 +00:00
Pau Espin 871f624f40 Merge gsm_data_shared.h into gsm_data.h
Old _shared one comes from time where we shared header with other
componenets. It's no longer the case sine a logn time ago.
The gsm_data_shared.h is only being included by gsm_data.h nowadays, so
let's simply merge it to simplify header dependency and struct
definitions.

Similarly, gsm_data_shared.c is renamed to gsm_data.c

Change-Id: Id60e7582e3a32dbc5e3531b87b2b49f07aee734d
2020-06-17 17:50:07 +02:00
Pau Espin 600ab79e7d cosmetic: include/osmo-bts/Makefile.am: split each header file in one line
Change-Id: I58d86a8c2e8846f683d4414fcd2a3bf7f89049ce
2020-06-17 17:27:24 +02:00
Pau Espin 44d91846f0 cosmetic: common/Makefile.am: split each source file in one line
Change-Id: I9c4d78fb80446fa4142950d947dad20856573275
2020-06-17 17:24:46 +02:00
Pau Espin b56161f4e6 scheduler: _sched_dequeue_prim(): Refactor found_msg goto path
Change-Id: Icf7414d9fb17bbc3eb384329f587b3042ba0fcd5
2020-06-16 16:39:40 +02:00
Pau Espin 1e63317e29 scheduler: _sched_dequeue_prim(): Refactor goto paths
Change-Id: Ia0b1674ac3dfbe89c9eb0e6d6426848ec64320d9
2020-06-16 16:39:11 +02:00
Pau Espin 2772cabbd0 scheduler: Early return in _sched_dequeue_prim() and clarify FN cases
We should always expect the msgb queue to be ordered by FN, so there's
no use in continue traversing the queue after we found a later primitive
than the one at current time, since next onews will be even more in the
future.

Change-Id: If57fc3d89a74e6cbc79fce80dae7bf4f77e9364d
2020-06-16 14:34:27 +02:00
Pau Espin 5f71aab35f scheduler: Improve logging about prim being out of range
Change-Id: Ie7ea210fee1f59ece3abe171b64cdc04670c344b
2020-06-16 13:54:35 +02:00
Pau Espin 6f71a959b9 doc: Fix typos in bts-models.adoc
Change-Id: I05c9eb9b0edda528363a16d27dbf683994d9ab62
2020-06-16 12:42:30 +02:00
Vadim Yanitskiy c3fdee43dd A-bis/OML: fix logging: do not print A-bis MO name twice
LOGPFOH() itself prepends A-bis MO name to the logging message.

Change-Id: I513efeb441a69e9eee1ad7bbd8cb0b552b7195eb
2020-06-15 22:51:24 +07:00
Vadim Yanitskiy df26770d41 A-bis/RSL: refactor handling of BS Power IE (power reduction)
According to 3GPP TS 08.58, section 9.3.4, BS Power IE indicates
the transmission power attenuation on a particular channel:

  +--------------+---------+-----------------+
  | Reserved (3) | FPC (1) | Power level (4) |
  +--------------+---------+-----------------+

so let's change handling of this IE as follows:

  - s/bs_power/bs_power_red/g, so it reflects 'reduction';
  - store power attenuation value in dB, not in 2 db steps;
  - get rid of ms_power_ctrl.bts_tx_pwr, it's always 0 anyway;
    - fix rsl_tx_meas_res(): use lchan->bs_power_red;
  - always check if FPC (Fast Power Control) flag is set;
    - we don't support it, so reject messages containing it;
    - fix rsl_rx_chan_activ(): properly apply the bitmask.

Change-Id: I16cc50dfca102030380a06e16c234d5f6698f38f
2020-06-15 22:51:20 +07:00
Vadim Yanitskiy 906a9b5e71 osmo-bts-trx: include BS Power reduction in Downlink bursts
For those osmo-bts-trx specific logical channels with a generic
logical channel state associated, let's finally apply the BS Power
reduction (attenuation) value that was received from the BSC.

Change-Id: Ib692ff1a75a80fceccb481839c8514d4b2a547b9
2020-06-15 21:06:52 +07:00
Vadim Yanitskiy b828b32f31 osmo-bts-trx: store pointer to gsm_lchan in l1sched_chan_state
This change simplifies access to generic logical channel state
(struct gsm_lchan) from osmo-bts-trx specific state (struct
l1sched_chan_state), so there is no need to look it up using
get_lchan_by_chan_nr() on receipt of each Uplink burst.

Change-Id: Ic4378020f980845b962f71b9e4b7faea738bc174
2020-06-15 20:55:23 +07:00
Vadim Yanitskiy ae781bc5cd osmo-bts-trx: introduce and use struct trx_dl_burst_req
This change is similar to what we did for Uplink bursts:

  - group all Downlink burst parameters into a single structure,
  - allocate it once and pass a pointer to lchan handlers,
  - pass a pointer to trx_if_send_burst().

Given that the structure is allocated and (zero-)initialized in
trx_sched_fn(), we can get rid of some memset() calls in lchan
handlers and thus improve the overall performance a bit.

Change-Id: If3014e69746559963569b77561dbf7b163c68ffa
2020-06-15 10:42:03 +00:00
Vadim Yanitskiy 36c5ec4881 osmo-bts-trx: move logical channel handlers to separate files
It's easier to maintain the logical channel handlers in separate
files, rather than in a huge one (scheduler_trx.c, ~2k lines).

Change-Id: Ie5663fd90596b4800a4546675a323250bbb24c80
2020-06-15 10:42:03 +00:00
Vadim Yanitskiy 0b92bcc37c osmo-bts-trx: use osmo_store32be() in trx_if_send_burst()
Change-Id: I5000fe61b29d796b9229f921bffcb392b1c6d189
2020-06-15 10:42:03 +00:00
Pau Espin c8086c317e abis.c: Grab reference to e1inp_line_get if already created
Since we are returning the pointer, it should always be grabbing a
reference (find doesn't do it).
In practice it's not much important since it is always created and not
found.

Change-Id: Ib84636663be2df33d497131c780b010b57f17e32
2020-06-12 15:16:41 +02:00
Pau Espin 0bf87ccc3e scheduler: Fix reading out of buffer during tx of dummy burst on PDCH TS with EGPRS enabled
If for whatever reason (eg fn-advance too small) there's no burst
available for a PDCH TS where EGPRS is enabled, a dummy burst of size GSM_BURST_LEN
would be selected in _sched_dl_burst(), but the nbits length would still be set to
EGPRS_BURST_LEN above by func() pointer (tx_pdtch_fn()).
As a result, trx_if_send_burst() would later read EGPRS_BURST_LEN from the
dummy burst of size GSM_BURST_LEN.

The issue was found by ASan. See OS#4606 for more info.

Fixes: OS#4606
Change-Id: Iba6ccceed5c0f1db810259768678f174d39cbf8b
2020-06-12 10:01:46 +00:00
Pau Espin 8c6bc4dbb4 bts-trx: Re-apply tx power if nominal power is received after POWERON
it was perceived that sometimes based on order of events (OML attr setup
and timing of RSL connections, etc.), the NOMTXPOWER for TRX!=0 can come
after the RSP POWERON, and hence the target power level for TRX!=0 is
not done correcty. This can be seen by running any test using the
ttcn3-bts setup of docker-playgrounds.git.

Change-Id: I2ec8dba61393be6edfab9e7e478e096e2d0933ad
2020-06-12 09:59:56 +00:00
Pau Espin 26cecfdea4 bts-trx: Use TRXC cmd NOMTXPOWER to retrieve nominal tx power from osmo-trx
Change-Id: I682211f3d664c21f923ca4a530e0464ca383b6d9
2020-06-12 09:59:56 +00:00
Pau Espin 0a81cfefea bts-trx: Introduce helper func l1if_trx_set_nominal_power
This way we wrap same logic in one place, which will be used more in
next commit.

Change-Id: I929fc50d544a88900d2e22317ec5ced10f15e51c
2020-06-12 09:59:56 +00:00
Pau Espin c854ca14d5 bts-trx: Rename setpower TRXC functions to describe they use power attenuation
Change-Id: Iedbe8e76bce990c2330477157cd886a8fc22063c
2020-06-12 09:59:56 +00:00
Pau Espin adf5d3aed2 bts-trx: Implement power ramping during BTS bring up
The nominal transmit power is still only configurable manually from
osmo-bts-trx VTY interface. Support to retrieve the nominal power
from osmo-trx will come later.

Change-Id: Ia7c353e4c199e0fc3bcab55c45a4abda2c66d2c1
2020-06-12 09:59:56 +00:00
Pau Espin c579e674c7 pcu_sock: Change log about tx PCH confirm INFO->DEBUG
It's not something useful to see unless someone's really debugging that
part, and it shows up quite frequently.

Change-Id: I3c0dee36c7d34e6b1341b517ce3bcd1b275e69c1
2020-06-12 09:59:31 +00:00
Vadim Yanitskiy f896d64e22 osmo-bts-trx/scheduler: properly handle NOPE.ind during handover
Looking at GSMTAP during handover, I've noticed many packets on
RACH looking pretty much like false positives, all with RA=0x00.
I correlated GSMTAP traces with TRXD traces, and figured out
that they all are triggered by NOPE indications from osmo-trx.

Since a NOPE.ind carries no valid burst, all its bits are set to
zero. Funny enough, this sequence is still decoded just fine as
a valid RACH, so that's why we see it on GSMTAP. Later on it
gets rejected by L1SAP due to bad RSSI, ToA, and/or C/I ratio.

The is a side effect of [1]. In order to ensure proper Uplink
measurement reporting during handover, including the time
before the handover RACH is received, let's treat and handle
NOPE indications as Normal Bursts.

[1] Ice45d5986610d9bcef2a7e41f0a395ec779e3928

Change-Id: Ic69f3bc2b776a23374c28a6884080a54bc16ef5f
Related: OS#4592
2020-06-12 06:55:05 +00:00
Vadim Yanitskiy 578156b815 Do not mix public and private BTS features, use libosmocore's API
It was a very bad idea to mix "public" BTS features, that are
reported to the BSC via OML, and those features, that are used
locally (and exclusively) in osmo-bts.

Why? At least because we already have the BTS feature manipulation
API in libosmocore, that is used by osmo-bsc, but for some reason
not by osmo-bts. New features added to libosmocore would clash
with the existing "internal" ones like BTS_FEAT_MS_PWR_CTRL_DSP.

So what this change does can be described as follows:

  - remove duplicate definition of the "public" features,
  - use libosmocore's API for the "public" features,
  - separate both "internal" and "public" features:
    - the "public" features continue to live in bitvec,
    - the "internal" features become flags,
    - s/BTS_FEAT/BTS_INTERNAL_FLAG/g.

Change-Id: Icf792d02323bb73e3b8d46384c7890cb1eb4731e
2020-06-11 00:36:21 +07:00
Vadim Yanitskiy ba0e5c7d50 gsm_data_shared: use bitvec API to allocate the feature vector
Change-Id: I19ecfc619c0dc2bfd14f054d17e222c4e16f6238
2020-06-11 00:35:51 +07:00
Vadim Yanitskiy f1c2d40b2c osmo-bts-trx: indicate BTS_FEAT_EGPRS support to BSC
EGPRS support, in particular MCS channel coding, was introduced
to osmo-bts-trx years ago, but we still report that it's not
supported. Let's stop confusing BSC, and set this feature too.

Change-Id: Iaf92764d266e12efd2350967deffae50fbbb3b9e
2020-06-10 23:22:38 +07:00
Vadim Yanitskiy 46aa972411 oml: fix TL16V length calculation in add_bts_feat()
An additional octet is only needed if total number of features
cannot be devided by 8 without the remainder. Fix this.

Change-Id: Ie501e5a635493830e0597f7b2fa287b6448e660d
2020-06-10 23:21:28 +07:00
Pau Espin 8f8d3a7e07 scheduler.c: Fix trailing whitespace
Change-Id: I9842470fcad074863bd30550ac63640754de1d37
2020-06-09 17:56:34 +02:00
Pau Espin 66564ed696 oml.c: Log ADM STATE change locked/unlocked
Use same forma tuse for other OMl states, like OPER and AVAIL states.

Change-Id: Icb176e2215841509bf15a6dfc163ceddcb602954
2020-06-09 08:46:32 +00:00
Pau Espin 5969988754 oml.c: Fix whitespace in log line
Change-Id: I5e9b07303dda374e9196d7d4503ad652970ab6c5
2020-06-09 07:37:37 +00:00
Harald Welte a003fec7cd Ensure we include lchan name in all LAPDm log lines
This makes use of the newly-introduced lapdm_channel_init3() API,
which provides the user (BTS in this case) to provide a human-readable
string identifier for each LAPDm channel.  This identifier is
subsequently used in all related log lines to provide context.

This means we will now get context information about which specific
SAPI in which sub-channel (ACCH/DCCH) on which lchan/ts/trx/bts a given
message originated from.

Example:
DLLAPD <0011> lapd_core.c:829 ((bts=0,trx=0,ts=0,ss=0)[DCCH][0]) SABM(E) received in state LAPD_STATE_IDLE

Change-Id: I17e3d4797ec71e31d0775330ae36d2e1fd70423f
Depends: libosmocore.git Ie6742843fff809edffcac24c4dce4edf66bc71be
Related: OS#1938
2020-06-07 22:31:19 +02:00
Vadim Yanitskiy fe8f13ace3 osmo-bts-trx/trx_if: cosmetic: s/ocommand/command/
Change-Id: I06db72deb78cbab588de2103657b0722b67887a0
2020-06-07 18:59:06 +00:00
Vadim Yanitskiy 79aec05c23 osmo-bts-trx/trx_if: fix memleak in trx_ctrl_cmd_cb()
If we do not enqueue a TRXC message, we should release memory.

Change-Id: Ie2cdf547befbc0fafdb82b10b45ad85a9b188b88
2020-06-07 18:59:06 +00:00
Vadim Yanitskiy 4977e135c8 common/scheduler: use boolean for channel activation state
Change-Id: I0cb1d915db8787050cdec1802894f66e885a9bf3
2020-06-06 19:41:15 +00:00
Vadim Yanitskiy b8200203d8 common/scheduler: fix unreachable code in trx_sched_set_lchan()
Change-Id: Ie9d8f8ca86195be4408db717cd3194a7d2ddc918
2020-06-06 19:41:15 +00:00
Pau Espin 897aa786c2 bts-trx: phy_link: Improve logging fmt in phy_link_state_set()
Change-Id: I4633dd81d0b4cc104ca9e0803993ba766cb23790
2020-06-05 20:57:08 +00:00
Vadim Yanitskiy aa5e46dc9a doc/examples: remove virtual/openbsc-virtual.cfg
This is not the right place to ship configuration examples for
other projects, and definitely not for abandoned ones.

Change-Id: Ib165b16f948126df8023bb42ad5d6d4b2fc11e6a
2020-06-05 20:56:24 +00:00
Vadim Yanitskiy 031f925ccd osmo-bts-virtual: cosmetic: use LID_{SACCH,DEDIC} macros
Change-Id: Idd37ca9ebf0d483cbea6f0e992211b9c3e2af993
2020-06-06 03:14:24 +07:00
Vadim Yanitskiy 5a877b37c2 osmo-bts-trx: fix: use noinst_HEADERS instead of EXTRA_DIST
Change-Id: I3c2fa21baae64e6537a2c74b97f1108b84099064
2020-06-06 00:31:52 +07:00
Vadim Yanitskiy 9a413231d6 osmo-bts-trx: prettify Makefile.am: make it git friendly
Change-Id: I0991910e0ffa6140f20c49bd2f0ad9b42cf231ba
2020-06-06 00:31:38 +07:00
Vadim Yanitskiy ffe5a8d8b8 rsl: refactor handling of RSL_IE_MR_CONFIG
- get rid of gsm_lchan::mr_bts_lv, it's never used anyway,
  - check IE length in amr_parse_mr_conf() before parsing,
  - check return code of amr_parse_mr_conf().

Change-Id: Ibfd5845ea429945b352dd14421e86562998d65ca
2020-06-05 18:40:42 +07:00
Vadim Yanitskiy 301b218509 vty: fix bts_dump_vty(): properly print OML stream ID (TEI)
Change-Id: I80ceba60e4b48d5bc68de71a2b2a2036b1e78f57
2020-06-05 18:38:38 +07:00
Vadim Yanitskiy 759a12e8aa scheduler: drop non-existing extern declarations
Change-Id: Ifa6fc5947e8fb7ec071a6567c275f5db5ab385f9
2020-06-05 18:38:38 +07:00
Vadim Yanitskiy fccd944bd7 gsm_data_shared: drop force_combined_si & bcch_change_mark
Change-Id: I997ab5e9801af50708ce6dc35004da5e11cb926b
2020-06-05 18:38:38 +07:00
Vadim Yanitskiy b8bdefc33b gsm_data_shared: drop unused rach_b_thresh & rach_ldavg_slots
Change-Id: I75ffc5c0c1f683adf0632bfe71ac51d1adfd97bd
2020-06-05 18:38:38 +07:00
Vadim Yanitskiy 24454fc2f8 gsm_data_shared: drop unused ctrl_ack_type_use_block & net_ctrl_ord
Change-Id: I7c8ddc4a9cfbbd1983e89fa261eaf4f32e15c6bd
2020-06-05 18:38:38 +07:00
Vadim Yanitskiy 0d25f9c94c gsm_data_shared: drop unused dtxu from struct gsm_bts
Change-Id: Ic2ddbf04bac7ced900a4e5e532206652dae64059
2020-06-05 18:38:38 +07:00