Commit Graph

1825 Commits

Author SHA1 Message Date
Harald Welte a240bdd0a4 OML: Ensure minimum required attributes are set before accepting OPSTART
There are some vital configuration bits such as ARFCN, BSIC, channel
config, .. for which there are no reasonable defaults.  As a result,
the BSC must set those attributes before issuing OPSTART.

Prior to this patch we would blindly accept OPSTART and then transmit
on ARFCN 0, which is definitely not the intended behavior.

Closes: OS#3789
Change-Id: I3a818f8eceb6abef1b20d2b3892a749dbc9e4b05
2019-02-23 15:59:18 +01:00
Harald Welte de3262fd27 OML: Don't advertise baseband transceiver as UNLOCKED at startup
For some strange historical reason, the baseband transceiver MO was
brought up in state "UNLOCKED".

The object should come up in "locked" state until it's explicitly
unlocked by the BSC.

See Section 6.8.2 of TS 12.21: "If there is yet no administrative state
value explicitly set by the BSC (e.g., at an initialization time), the
object shall be presumed to be administratively locked by default"

Change-Id: Id505594b9f224567566caac84dae2e2ae4477fae
Closes: OS#3790
2019-02-23 15:59:18 +01:00
Harald Welte 5eddf98dfc OML: Store merged attributes of IPA OML Managed Objects
For the TS 12.21 standard OML attributes, we store a copy of the
most-recently set value for each attribute in "mo->nm_attr".  This
somehow was missed when adding support for the IPA specific MOs like
those relevant for GPRS.

Change-Id: I75ebda46da9c1fcecc484311bf3833f31c536ee1
2019-02-23 15:59:10 +01:00
Pau Espin b3fb33adea oc2g: vty: Compilation error fixes due to commented code
Change-Id: Id2b16b9acd15d0c80085fac0fdc2a57173ebb0a0
2019-02-20 00:04:51 +01:00
Pau Espin d8afcc143a oc2g: Remove unused static function
Change-Id: I4d0a476f84bc9e92e02f94c3990daddeeaa3c5d5
2019-02-20 00:03:33 +01:00
Pau Espin 6b5bbee25f oc2g: Remove unused variables
Change-Id: I6738adb6b0ae50905351c67c259d7a77cb250624
2019-02-20 00:02:34 +01:00
Pau Espin 546056c9c8 oc2g: fsync requires fd instead of file stream
Similar fix was done for lc15 in a8041edb.

Change-Id: Idcd9dc48ea2e1f80bfdf5cf8b6bf55d8150fe0d2
2019-02-19 23:47:41 +01:00
Pau Espin f3fa1d384d oc2g: led_sleep_cb: pass correct ptr to llist_move_tail
Fix compilation warning. At runtime it's not a big issue because the
"list" field is the first field of the led_list (struct
lc15bts_led_timer_list) variable. Hence, the address passed is the same.

Similar to commit fixing same issue in lc15 in 080302f8.

Change-Id: Ie393a21bc3a725520343c70941cb4f591b313420
2019-02-19 23:43:23 +01:00
Pau Espin 45b9021eb8 oc2g: Cleanup of get_hwversion_desc
Remove unused variables, wrong return type values, etc.

Change-Id: I5565b904c72a9ac1775818416f05c64722d366b2
2019-02-19 23:42:44 +01:00
Pau Espin b3e7a888c9 oc2g: Add get_hwversion_desc to header file
it's used in oc2g/main.c and it needs to be in a header file.

Similar as previously done for lc15 in 19795c5a.

Change-Id: Ic6826d8c8ff5c648158493454a80704bb956b51d
2019-02-19 23:30:11 +01:00
Pau Espin 3713b59368 oc2g: Fix compilation error (comment mark inside comment)
Change-Id: Ib27b31825744ea397b5b4eb258da78f5f834895c
2019-02-19 23:21:07 +01:00
Max f788aefe6f Enable statsd support
Change-Id: I9112d9fd527cdc29d89868df40c6845a751c4865
2019-02-18 13:40:03 +01:00
Philipp Maier 12d362fe09 scheduler_trx: use stored fn for pdtch data indications
When the ph-data indications for the PDTCH are passed up to l1sap,
then a forumla is used to calculate the frame number of the beginning of
the block that is just passed up. This is not necessary since the start
frame number of the block is stored in *first_fn when the block arrives.
We should use this frame number instead. (For the measurement indication
it is already done this way).

Change-Id: I6c01987be78203acfa689c6decb2c806f8fff3d6
Related: OS#2977
2019-02-15 17:52:07 +01:00
Max fa8b9e2aa3 Log lchan kind on PCU-related error
Change-Id: Iadb464e7040dd11e4a8cabfc96d6d90f32594109
2019-02-14 21:46:34 +00:00
Max de9e2092c9 osmo-bts-trx: add extended (11-bit) RACH support
Attempt to decode incoming RACH burst as 11-bit first
and fallback to 8-bit if unsuccessful.

Change-Id: Ia28741603636406744e5e22ffff1fb7a9689955a
Related: OS#1854
2019-02-14 15:48:08 +00:00
Harald Welte 3933e930c3 OML: Work around OsmoBSC sending "GET ATTRIBUTES" with short length
OsmoBSC used to have a bug in encoding the "GET ATTRIBUTES" OML message,
resulting in the actual message length being three bytes longer than the
encoded length value.

As in Ib98f0d7c2cff9172714ed18667c02564540d65d7 we have introduced
proper consistency checks on length values, all "GET ATTRIBUTES" from
OsmoBSC version suntil today will fail.  This patch introduces a
work-around to remain compatible with old OsmoBSC while still keeping
the consistency checks for all other messages.

Change-Id: Ifa24e9e2c71feb2c597557807d675438c2825b2d
Related: OS#3799
2019-02-12 20:29:50 +01:00
Harald Welte 906357c5e2 OML: Properly reject short messages and truncate over-long messages
For OML, what matters is the length indicated in the OML message header.

If we don't have sufficient bytes, reject the message and send a failure
event report.

If we have more bytes, truncate the message at the number of bytes
indicated in the OML length header.

Change-Id: Ib98f0d7c2cff9172714ed18667c02564540d65d7
2019-02-12 20:28:49 +01:00
Harald Welte e160ac6ea5 OML: Reject segmented OML messages
TS 12.21 describes segmenting of OML messages using placement
fist/middle/last and the "sequence' number of the OML header. We don't
implement this and hence must ignore or reject any related messages.

Before this patch however, we simply treated such segments as if they
were a complete OML message.  Let's fix that.

Change-Id: Idd42cf4edc1bf9ab366853bd9b0f7afd9c060910
Closes: OS#3795
2019-02-12 20:08:56 +01:00
Harald Welte 96bded3ebd OML: Use 'const struct abis_oml_mo *' whenever users only read
Try to constrain the code a bit further by making all read-only
accesses use 'const *'.

Change-Id: I5a61e6d1b4e5e083bb24017166186dc87d035cd0
2019-02-12 20:08:18 +01:00
Harald Welte ccc7ba17c0 OML: Report short messages even for invalid TRX numbers in down_fom()
Change-Id: I65b57d3fc714814db3ae3fd34398f307413fece8
2019-02-12 20:08:18 +01:00
Harald Welte 055c29bc6b OML: Reduce code duplication in down_mom/down_fom
Simply use a "mo" variable on the stack rather than having duplicate
but otherwise identical calls to oml_tx_failure_event_rep()

Change-Id: Ibe6c79e95405b13d041047549d2ffa39aa355eb2
2019-02-12 20:08:18 +01:00
Harald Welte e57a62deee OML: send proper OML alerts in case of errors
Change-Id: I5b19b82a4874617c7c584cf3eac55eb9c756710a
2019-02-12 20:08:08 +01:00
Harald Welte 268ba55a6e OML: remove double-logging on oml_tx_failure_event_rep()
When we send an OML failure event report using
oml_tx_failure_event_rep(), the function itself will not only send
the report to the BSC but also log it.  So there's no need to both
have an explicit LOGP() and a call to oml_tx_failure_event_rep().

Change-Id: Ib3fd06b3266d896aebeed4ebe42ac71ff173bb5c
2019-02-09 09:08:27 +01:00
Harald Welte 742dad5b69 OML: Don't overwrite MO instance before oml_tx_failure_event_rep()
In Change-Id Ic163bcfb6361a8ebd39e0bc0f238ef51e2cb214e we introduced
several additional calls to oml_tx_failure_event_rep() during OML
messaeg processing.  However, for some reason, we *overwrite* the
bts_nt/trx_nr/ts_nr of the TRX MO.  This is clearly wrong.  The
"address" of a managed object doesn't change at runtime!

Change-Id: Idfb80ccd6dd485d52dc006867fae3dde3fb005f3
2019-02-09 09:08:27 +01:00
Harald Welte 02231177a9 OML: Ensure MOs are initialized with valid "Administrative State'
When osmo-bts connects to the BSC, it sends a ton of "State Change Event
Report" messages indicating the Operational State (NULL), Availability
status (power off) and [as an osmocom extension] also the Administrative
State. However, the value of the administrative state is "0", which is
not defined in TS 12.21 Section 9.4.4

Change-Id: I03f8a4b08b266cd40036076c76f9dc7e8bf08da2
Closes: OS#3785
2019-02-09 09:08:27 +01:00
Harald Welte 893e499e0c OML: Return attributes in ACK/NACK messages
As per 3GPP TS 12.21 Section 8.2 "ACK messages shall return all the
attributes in the original message". OsmoBTS fails to do so but simply
sends no attributes at all in the ACK.

TS 12.21 is a bit vague whether or not the attributes shall also be
achoed in the NACK.  Let's do it and append the CAUSE in this case.

Closes: OS#3788
Change-Id: Ifb305fe75f8305bb04872f26492b8b1bb8c27f49
2019-02-09 09:08:22 +01:00
Harald Welte 3c89e2c36a OML: some more comments on what functions do
Change-Id: I5f30f6c556968fab60283ff1948966af28dc6e83
2019-02-08 22:09:29 +01:00
Harald Welte 9c9232c993 scheduler_trx: Fix erroneous multiply-by-four
Commit acefd0586e introduced the "toa256"
resolution change.

Before the change, _sched_compose_ph_data_ind() used quarter-bits as
units, so multiplying the old "toa" value by four made sense.

However, after said change, the value is in 1/256th of bits, and hence
we need to report the toa256 value without any multiply-by-four.

Change-Id: I9f980236ea1cd635cb229290e187747cc8c86d8d
Related: OS#2977
2019-02-05 17:46:25 +01:00
Daniel Willmann 5c205639f1 doc/examples: Install OC2G config files with autotools
Change-Id: I2fd587e91b5e0e4cd1b8ffa781f65dbfd4484f19
2019-01-30 10:35:13 +01:00
Daniel Willmann 3bf27cefbb systemd: Install OC2G service files with autotools
Change-Id: Ifd37b6a01ad9007a9e887fe3dd208dc74047b4d8
2019-01-30 09:40:52 +01:00
Vadim Yanitskiy e8ebbe300c common/vty.c: fix 'cfg_phy_no_inst_cmd' command description
A comma is needed to separate a command definition from its
description, not the parts of description. Let's fix this.

Before this patch:

  OsmoBTS# configure terminal
  OsmoBTS(config)# phy 0
  OsmoBTS(phy)# no?

    no  PHY Instance number

  OsmoBTS(phy)# no ?

    instance
    osmotrx   OsmoTRX Transceiver configuration

After this patch:

  OsmoBTS# configure terminal
  OsmoBTS(config)# phy 0
  OsmoBTS(phy)# no?

    no  Negate a command or set its defaults

  OsmoBTS(phy)# no ?

    instance  Select a PHY instance to remove
    osmotrx   OsmoTRX Transceiver configuration

Change-Id: If10d85abc6506118ba08c37e8101f423d6f838ea
2019-01-27 15:31:01 +03:00
Harald Welte e1dade0471 Bump version: 0.8.1.199-5c93-dirty → 1.0.0
Change-Id: Ie33252aef4144f9bb825d7c234970fd4e6083bb2
2019-01-20 20:38:25 +00:00
Daniel Willmann 5a266511bf dump_docs: Use new config file naming scheme
Change-Id: I05723ef50deb918ed1131c1d30f8e613351b3be5
2019-01-17 17:07:44 +01:00
Daniel Willmann a4649308eb Rename oc2g config file to match new naming scheme
examples/oc2g/osmo-bts.cfg->examples/oc2g/osmo-bts-oc2g.cfg

Change-Id: Ie49d5695ea78da2995252c56c75ce42e6cec0e9c
Related: SYS#4444
2019-01-17 17:07:43 +01:00
Harald Welte 5c93677be5 osmo-bts-trx/loops.c: Make code control flow more readable
Use the 'else' construct where applicable to avoid too many return paths
from functions

Change-Id: I819f0c80e90855e8b3252795c837f8e3053b6e87
Related: OS#1622, OS#1851
2018-12-23 10:38:23 +00:00
Harald Welte 5d9cb9f555 osmo-bts-trx/loops.c: Use lchan name based logging
The loops.c code dates back to ancient times when we printed the TRX
number and the raw channel number to identify a logical channel.  We
meanwhile have gsm_lchan_name() and should use it to log messages
related to this lchan in a common format.

This commit introduces the LOGPLCHAN() helper macro [similar to
osmo-bsc], and uses it from loops.c.

As a result, some functions don't need a chan_nr argument anymore,
while some need to add a new lchan argument.

Change-Id: I6976dd7444c26b1f52741bc367b0311ebbef1718
Related: OS#1622, OS#1851
2018-12-23 10:38:23 +00:00
Harald Welte a4f5622408 osmo-bts-trx/loops.[ch]: Make functions "void" if they always return 0
The concept of a return value only makes sense if there's actually ever
something non-constant to return, and if the caller actually processes
that return value.  If we always "return 0" and ignore it on the caller
side, functions should be of "void" type.

Change-Id: I3575a2cef75f3fd4c3f95eddb40719d28a055b54
Related: OS#1622, OS#1851
2018-12-23 10:38:23 +00:00
Harald Welte 3379250b51 osmo-bts-trx/loops.c: Add comments documenting TA + MS power control loop
The loops.c code is not very easily understood, so let's add some
comments to it.

As can be seen, there are functions of integer type which always return
0, and whose callers don't check for the return value.  This will be
adressed in subsequent patches.

Change-Id: Iafea07eb751ed85d29b214576bb0d31ea919cd72
Related: OS#1622, OS#1851
2018-12-23 10:38:23 +00:00
Pau Espin 719c6a9135 rsl: Send PDCH ACT NACK if TCH chan is still active
Fix recent commit which broke TTCN3 BTS_tests
TC_dyn_ipa_pdch_tchf_act_pdch_act_nack.

Prior to the breaking commit, logic was still not good, because
1- It didn't return after sending the NACK
2- It sent a NACK in all cases, while for PDCH DEACT we want to force
its deactivation. Going through tests it can be seen that indeed it
can deactivate it in that case:
rsl.c:2206 (bts=0,trx=0,ts=3,pchan=TCH/F_PDCH as PDCH) Request to PDCH DEACT, but lchan is still in state ACTIVE
...
rsl.c:2103 (bts=0,trx=0,ts=3,ss=0) Tx PDCH DEACT ACK

Fixes: 133a3d96dc ("rsl: Avoid sending ipa PDCH DEACT NACK followed by ACK")
Change-Id: I6d6d12aec10c801fe55012ca6e58d0bc8755b15d
2018-12-23 10:22:25 +00:00
Pau Espin 8564ececa5 sysmobts_mgr: Add support for gpsd < 2.96
This allows running sysmobts-mgr on systems with old gpsd releases
(which may have other software depending on such old release).

GPSD_API_MAJOR_VERSION define was first added in gpsd 2.39, before that
it didn't exist (but this code is known to work against 2.38).

GPSD_API_MAJOR_VERSION == 5 was set in version 2.96.

Related gpsd commits:
3771dba081bd1175adab6096d7b6270d3822aaa1
e69bcb6b01af6b25c6a525fb1961b92ac04f5213

Related: SYS#4290
Change-Id: If3c35021a020a61d5fa3cde5eebcd09908db822b
2018-12-18 21:40:00 +01:00
Pau Espin 17ffb08de0 sysmobts_mgr: Prepare code for gpsd < 2.96 support
API prior to that version allocates the pointer internally. Let's change
current code to always use a pointer and in current supported code (gpsd
>= 2.96) point it to a user-allocated struct.

Follow-up patch will introduce necessary ifdefs to support older gpsd.

Change-Id: Iaeb5ac527cc3e58168027021d0f60afa93d1fb6f
2018-12-18 21:40:00 +01:00
Oliver Smith fc88d8e7dc contrib: fix makedistcheck with disabled systemd
EXTRA_DIST files need to be distributed, no matter if the systemd option
is configured or not.

Change-Id: I5d3712b54a8b777c33a9804a4f612e4f37f829df
2018-12-06 13:43:26 +01:00
Oliver Smith 9c4a6facdb contrib/jenkins_*.sh: build and publish manuals
Add new environment variables WITH_MANUALS and PUBLISH to control if
the manuals should be built and uploaded. Describe all environment vars
on top of jenkins_bts_model.sh. Change the top description line to look
like all the other contrib/jenkins.sh files (from other repositories),
so it is clear that this is the entry point of Jenkins (and not the
other contrib/jenkins_*.sh scripts).

When WITH_MANUALS is set, install osmo-gsm-manuals like any other
dependency and add --enable-manuals to the configure flags (for "make"
and "make distcheck"). Add the bin subdir of the installed files to
PATH, so osmo-gsm-manuals-check-depends can be used by ./configure.

Related: OS#3385
Change-Id: If51194cc595bd8cf1081b35ab0e1a5ddcd448860
2018-12-05 13:10:55 +01:00
Pau Espin c606103d9f bts-trx: (n)ack PDCH DEACT only after TRX answered SETSLOT
Before this patch, PDCH DEACT was (n)acked to the BSC without taking
into account if TRX succeeded or failed to set the TS:

20181123044720655 DRLL rsl.c:2523 (bts=0,trx=0,ts=0,ss=0) Rx RLL DATA_REQ Abis -> LAPDm
20181123044720700 DRSL rsl.c:2805 (bts=0,trx=0,ts=6,pchan=TCH/F_PDCH as PDCH) ss=0 Rx RSL IPAC_PDCH_DEACT
20181123044720700 DRSL rsl.c:2205 (bts=0,trx=0,ts=6,pchan=TCH/F_PDCH as PDCH) Request to PDCH DEACT, but lchan is still active
20181123044720700 DRSL rsl.c:2131 (bts=0,trx=0,ts=6,ss=0) Tx PDCH DEACT NACK (cause = 0x0f)
20181123044720700 DPCU pcu_sock.c:124 Sending info
20181123044720700 DPCU pcu_sock.c:139 BTS is up
20181123044720700 DPCU pcu_sock.c:232 trx=0 ts=7: available (tsc=7 arfcn=868)
20181123044720703 DPCU pcu_sock.c:608 Deactivate request received: TRX=0 TX=6
20181123044720703 DL1C l1sap.c:1519 deactivating channel chan_nr=TCH/F on TS6 trx=0
20181123044720703 DTRX trx_if.c:242 Enqueuing TRX control command 'CMD NOHANDOVER 6 0'
20181123044720703 DL1C l1sap.c:648 deactivate confirm chan_nr=TCH/F on TS6 trx=0
20181123044720703 DRSL rsl.c:714 (bts=0,trx=0,ts=6,ss=0) not sending REL ACK
20181123044720703 DRSL rsl.c:2264 (bts=0,trx=0,ts=6,ss=0) PDCH DEACT operation: channel disconnected, will reconnect as TCH
20181123044720703 DL1C scheduler.c:593 Configuring multiframe with TCH/F+SACCH trx=0 ts=6
20181123044720703 DTRX trx_if.c:242 Enqueuing TRX control command 'CMD SETSLOT 6 1'
20181123044720703 DL1C l1_if.c:780 (bts=0,trx=0,ts=6) bts_model_ts_connect(as_pchan=TCH/F) success, calling cb_ts_connected()
20181123044720703 DRSL rsl.c:2339 (bts=0,trx=0,ts=6,ss=0) PDCH DEACT operation: timeslot connected as TCH/F
20181123044720703 DRSL rsl.c:2440 (bts=0,trx=0,ts=6,ss=0) TCH/F_PDCH switched to TCH/F mode (ts->flags == 0)
20181123044720703 DRSL rsl.c:2103 (bts=0,trx=0,ts=6,ss=0) Tx PDCH DEACT ACK
20181123044720704 DTRX trx_if.c:492 Response message: 'RSP NOHANDOVER 0 6'
20181123044720705 DTRX trx_if.c:492 Response message: 'RSP SETSLOT 0 6 1'

Change-Id: I888de761b65c3ea8bfe623fcf009f3b2b57c926c
2018-12-04 16:57:52 +00:00
Oliver Smith 19ff607e99 Fix DISTCHECK_CONFIGURE_FLAGS override
Set AM_DISTCHECK_CONFIGURE_FLAGS in Makefile.am instead of
DISTCHECK_CONFIGURE_FLAGS. This is the recommended way from the
automake manual, as otherwise the flag can't be changed by the user
anymore.

Related: OS#3718
Change-Id: I332c94502cce0f3f11fe3f4d9f6c9918ff0c0263
2018-12-04 16:13:16 +01:00
Pau Espin 11465b5ba1 oc2g: Fix headers missing during make distcheck
Change-Id: I2e4aad190c44fea047b4aefcf55335789fa4c571
2018-12-04 16:06:31 +01:00
Oliver Smith 26701bbe85 build manuals moved here from osmo-gsm-manuals.git
Moved to doc/manuals/, with full commit history, in preceding merge commit.
Now incorporate in the build system.

Build with:

$ autoreconf -fi
$ ./configure --enable-manuals
$ make

Shared files from osmo-gsm-manuals.git are found automatically if
- the repository is checked out in ../osmo-gsm-manuals; or
- if it osmo-gsm-manuals was installed with "make install"; or
- OSMO_GSM_MANUALS_DIR is set.

Related: OS#3385
Change-Id: I728ebb56ade6dda079a0744c4e592284e1bea4f6
2018-11-27 17:56:09 +01:00
Neels Hofmeyr 0133b65da1 Merge history from osmo-gsm-manuals.git
Change-Id: Ib62d046bd84204b902cac3fe8c0765e32da0a0c6
2018-11-27 17:54:38 +01:00
Daniel Willmann b7eaf282dd OsmoBTS: Fix typo
Change-Id: I0a4c9f052f14816e88ed0a4a5fff9b3854da195a
2018-11-27 17:54:20 +01:00
Daniel Willmann 473be4f89f OsmoBTS: Print VTY command in fixed-width font
Surrounding with '@' didn't seem to yield the intended result, the
charactars appeared in the compiled document.

Change-Id: I66e7949fa4a6c2164bf9572a2beaf8ace169fa1c
2018-11-27 17:54:20 +01:00