Commit Graph

1256 Commits

Author SHA1 Message Date
Pau Espin 3e9c071aa6 configure.ac: Set CXXFLAGS during --enable-sanitize
For some unknown reason ld was failing to find some asan symbols until I
enabled asan too in CXXFLAGS.

Change-Id: I695314b284277674dc336b40765313a37d238d6e
2018-09-10 14:52:21 +02:00
Pau Espin e63c72acfb Cleanup of systemd service files
Let's use a symlink in debian/ as we do in other projects,
and merge the two service files since anyway they call the same binary.

Change-Id: Ibd82ec12cbeb73a27ca5860266587efb58be14ab
2018-09-06 15:06:22 +02:00
Harald Welte 54af2dba78 debian/rules: Don't overwrite .tarball-version
The .tarball-version file should contain the *source version* uniquely
identifying the git commit, and not the Debian package name.

With https://gerrit.osmocom.org/#/c/osmo-ci/+/10343/ there is a correct
.tarball-version file in the .tar.xz of the nightly source packages.

Change-Id: I093c9c1943e5f09d8f91f94af438f697a93e7127
Related: OS#3449
2018-08-06 11:18:24 +02:00
Pau Espin 448750e4e2 Bump version: 0.5.0.11-218e-dirty → 0.5.1
Change-Id: I0c5a3f3cee8332d5088982117037d5a0b077061b
2018-07-27 21:56:39 +02:00
Pau Espin 218ee98de0 tbf: Replace '.' in counter names with ':'
The '.' is illegal character in counter names, as they are exported
via CTRL interface, where '.' has a special meaning that cannot be
used by strings comprising the variable name.

Change-Id: Ieb7496e1a30ab4f2bfe36c7b664dcdc034010a15
2018-07-11 22:20:31 +02:00
Pau Espin 09269017d3 tbf: Use incrementing id for rate_ctr_group_alloc
Wrap-around of var handling next id will luckly happen
long after initially assigned TBFs are already released.

Change-Id: I90ef64133986c556c1a529f5b966e847e6cabbad
2018-07-11 22:20:31 +02:00
Stefan Sperling 3df1532e97 check bssgp_tlv_parse() return code in gprs_bssgp_pcu_rcvmsg()
The return code from bssgp_tlv_parse() was not checked for a parsing
error. In case of a parsing error the stored return code could have
been overwritten later in this function.

Explicitly check for a parsing error, log corresponding packets,
and return an "invalid mandatory information" error status to
the sender. To avoid loops, do not respond with an error status
to STATUS PDUs.

Change-Id: I56e10a97cda7fd2d40bc7b4b2e6202f97772e1b3
Related: OS#3178
2018-06-25 13:02:06 +02:00
Pau Espin e176a4d047 jenkins.sh: use flag --enable-werror for sysmo and none
The lc15 flavour still contains compilation warnings and thus the flag
cannot be enabled while building it.

Change-Id: I66a43822f8a40764d7d6e09503892cea6030e697
2018-06-20 23:30:40 +02:00
Stefan Sperling 082443d2c7 change log level of "DL packet loss" log messages
The TBF tests are failing on some machines due to unexpected
log output: "DL packet loss of IMSI= / TLLI=0xffeeddcc: 0%"
These messages are printed if >= 1 second has passed between
loss reports. This timing is machine-dependent so the test
is unstable as a result. Only print these messages at log
level debug to (hopefully) make TBF tests pass consistently.
Update expected test output accordingly.

Change-Id: Ie43f0e3a8740f0fc132809a09a153886c51fadf9
2018-06-05 11:42:12 +02:00
Stefan Sperling 78ab624c2a fix time-delta calculations for measurement reports
The previous implementation unconditionally subtracted nanosecond
values from different time measurements, causing overflow if the
current measurement was taken in less of a fraction of a second
than the past measurement. Use timespecsub() instead, which
accounts for nanoseconds correctly.

Also, fix calculations of KBit/s throughtput. It was not being
calculated correctly, since it was actually accounting for one
KB per 128th-part-of-a-second.

Change-Id: I7d22e7b5902c230efeae66eb20c17026a4037887
Related: OS#3225
2018-05-31 14:12:58 +02:00
Stefan Sperling f0f7df1b87 read monotonic clock with clock_gettime() instead of gettimeofday()
There have been test failures on the osmo-pcu Jenkins builders due
to apparent clock drift. Switch relevant code from gettimeofday()
to clock_gettime() with CLOCK_MONOTONIC to prevent time from going
backwards and causing negative time deltas in calculations.

Change-Id: I775d85d0d3ac740330879e588bdab6fce7f0b46c
Related: OS#3225
2018-05-25 17:33:06 +00:00
Stefan Sperling 143b2da4f8 fix a one-byte stack buffer overrun in osmo-pcu
Address sanitizer uncovered a one-byte stack overrun due to an
off-by-one in the size of the 'data' buffer in pcu_l1if_tx_pch().
Fix the problem and add an assertion which triggers before the
overrun can occur.

Change-Id: I08a879d72fcb916f78f175612fd90467d7bdd57c
Related: OS#3289
2018-05-25 15:19:50 +02:00
Pau Espin 7a9c1660cc rlc: Fix memset(0) on object with no trivial copy-assignment
As warned by gcc 8.1.0, the cs field is a class (GprsCodingScheme) and
should not be memset.

Change-Id: Id742f82aa856e696b5fb414991dfd0883d0ac7fe
2018-05-16 15:22:27 +02:00
Pau Espin 0b0748a4be tbf: Fix memset(0) on object with no trivial copy-assignment
As warned by gcc 8.1.0:
osmo-pcu/src/tbf.cpp: In constructor ‘gprs_rlcmac_tbf::gprs_rlcmac_tbf(BTS*, gprs_rlcmac_tbf_direction)’:
osmo-pcu/src/tbf.cpp:222:33: error: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct gprs_rlc’ with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess]
  memset(&m_rlc, 0, sizeof(m_rlc));
                                 ^
In file included from osmo-pcu/src/tbf.h:24,
                 from osmo-pcu/src/bts.h:37,
                 from osmo-pcu/src/tbf.cpp:22:
osmo-pcu/src/rlc.h:234:8: note: ‘struct gprs_rlc’ declared here
 struct gprs_rlc {
        ^~~~~~~~

Change-Id: Ifb0529b9ae6cd4300e5cbbd9151054792edbfe06
2018-05-16 15:20:43 +02:00
Harald Welte 45143d270c Don't register SIGHUP handler without actually handling SIGHUP
In libosmocore, we normally register a SIGHUP handler for log file
rotation.

However, the osmo-pcu code so far installed its own signal handler,
which did exactly nothing in the SIGHUP case.

Let's fix this by removing SIGHUP handling here, letting libosmocore
take care about this.

Change-Id: Ifa20d79770bc4d88d40601b008a3a2a79d083c04
Closes: OS#3265
2018-05-15 16:23:04 +02:00
Pau Espin f1a334be63 Bump version: 0.4.0.115-513c-dirty → 0.5.0
Change-Id: I6ce6fb40690a66b0980eba4fa03b47da2f59ee6e
2018-05-03 16:20:01 +02:00
Stefan Sperling 513c9bca17 improve documentation of Encoding::write_paging_request()
Add pointers to relevant parts of the spec. Tweak comments to be
more specific about the values being written and abbreviations used.

Change-Id: Ia5bf3f7f8846198b7b4e25ff1accf6206764be74
2018-05-02 14:53:16 +02:00
Philipp Maier 33c52b6271 tbf: add frame number to log output
Currently, the TBF timer log messages lack the frame number in
the logoutput

- Add frame number to TBF timer related log-statements

Change-Id: I5a744dc5cd7c1de1baea13fffac026c83d091429
Related: SYS#4139
Patch-by: Octasic inc.
2018-04-12 12:46:44 +02:00
Philipp Maier 7e8e3978fe pcu_l1_if: add frame number to log output
Currently, the log output lacks the frame number.

 - make get_current_fn() public
 - add frame number to the log statements in pcu_l1_if.cpp

Change-Id: Idce994dbf86a2bbf861907d75418a2a3867244db
Related: SYS#4139
Patch-by: Octasic inc.
2018-04-10 13:35:24 +02:00
Philipp Maier 8ccf704608 cosmetic: remove runaway semicolon
Change-Id: I33c335dc8d564a8357ffb5b1163c2c4b1a578b49
Related: SYS#4139
Patch-by: Octasic inc.
2018-04-10 13:35:18 +02:00
Neels Hofmeyr 42f2d61ac9 use osmo_init_logging2() with proper talloc ctx
There is a duality of initialization: early_init() in bts.cpp wants to init
logging even before static instances get initialized. Make sure that
tall_pcu_ctx is initialized during early_init() as well. There is a build
context that does not seem to include bts.cpp (osmo-pcu-remote), so to be sure,
init tall_pcu_ctx as NULL and both in early_init() as well as pcu_main.cpp,
init both tall_pcu_ctx and logging if it is still NULL.

Change-Id: I2199b62d0270bd35dec2283e8f5b364b7c63915b
2018-04-01 16:57:42 +02:00
Neels Hofmeyr e6e4898027 Revert "Rewrite EGPRS Packet Uplink Assignment"
This reverts commit 529ce88545,
I2139fb347b3290621bbc3f6a031f7f213d372e65.

Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 /
896574e92b was found (empirically) to be a
regression, rendering GPRS service fatally unreliable.

This reverted commit seems to be related to the regression and is reverted
along with it.

Related: OS#3013
Change-Id: I3e8cc0e8ba3ba5bd444124fd4cb95ef92a71fdfb
2018-03-30 14:30:13 +00:00
Neels Hofmeyr 9f06cbff6d configure: properly quote CFLAGS in lc15 check
Change-Id: I7bb7a7d7b5b9340cb41c95f848774ee378c59212
2018-03-29 22:10:57 +00:00
Neels Hofmeyr a661bcd086 configure: fix --enable-sysmocom-dsp and --with-sysmobts flags
Fix multiple problems around the sysmobts DSP access and headers:

- Use the proper variable name to detect the choice: $enable_sysmocom_bts was
  not set anywhere and would actually be used from the current user env, if
  present, instead of from configure args.

- Quote the $CPPFLAGS when assigning to oldCPPFLAGS and back.

- When checking SYSMOBTS_INCDIR, do not allow an empty "-I" without a dir.

- Ensure the --with-sysmobts path is used as an absolute path.

- Error out if --with-sysmobts is paired with --disable-sysmocom-dsp.

Also tweak reporting.

The resulting behavior now is:

./configure --disable-sysmocom-dsp
checking whether to enable direct DSP access for PDCH of sysmocom-bts... no

./configure --enable-sysmocom-dsp
checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes
checking for sysmocom/femtobts/superfemto.h... no
configure: error: sysmocom/femtobts/superfemto.h can not be found, see --with-sysmobts

./configure --disable-sysmocom-dsp --with-sysmobts=../../../sysmobts/layer1-api
checking whether to enable direct DSP access for PDCH of sysmocom-bts... error
configure: error: --with-sysmobts does not work with --disable-sysmocom-dsp

./configure --enable-sysmocom-dsp --with-sysmobts=../../../sysmobts/layer1-api
checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes, using -I/n/s/sysmobts/layer1-api
checking for sysmocom/femtobts/superfemto.h... yes

./configure --with-sysmobts=../../../sysmobts/layer1-api
checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes, using -I/n/s/sysmobts/layer1-api
checking for sysmocom/femtobts/superfemto.h... yes

./configure --with-sysmobts=/nonexisting/path
checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes, using -I/nonexisting/path
checking for sysmocom/femtobts/superfemto.h... no
configure: error: sysmocom/femtobts/superfemto.h can not be found in -I/nonexisting/path, see --with-sysmobts

./configure --with-sysmobts=/var/log
checking whether to enable direct DSP access for PDCH of sysmocom-bts... yes, using -I/var/log
checking for sysmocom/femtobts/superfemto.h... no
configure: error: sysmocom/femtobts/superfemto.h can not be found in -I/var/log, see --with-sysmobts

Change-Id: I2f5988730dbbcf3b21d8c647c499623843ed3da9
2018-03-29 17:14:22 +02:00
Neels Hofmeyr 39f845848c Revert "Rewrite Packet Downlink Assignment"
This reverts commit 896574e92b,
I52ec9b07413daabba8cd5f1fba5c7b3af6a33389.

This commit was found (empirically) to be a regression, rendering GPRS service
fatally unreliable.

Related: OS#3013
Change-Id: Idcba0381f70eb7f7c9aefdee9dfeafd5de96a9be
2018-03-28 14:34:55 +00:00
Neels Hofmeyr 782da2cf95 Revert "Rewrite Packet Uplink Assignment"
This reverts commit 93d947f5e8,
I44db2eeea7448ff67e688ae716487bc6dbfc96a3.

Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 /
896574e92b was found (empirically) to be a
regression, rendering GPRS service fatally unreliable.

This reverted commit seems to follow after the regression and is reverted along
with it.

Related: OS#3013
Change-Id: If7038127e9a663c93006475b3add961adc0b1922
2018-03-28 14:34:55 +00:00
Neels Hofmeyr 89b85e078e Revert "Use Timing Advance Index in UL assignments"
This reverts commit 6298fbb7b2,
I8b17be78a46c0bc17516b7c90f35aa4768010ae4.

Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 /
896574e92b was found (empirically) to be a
regression, rendering GPRS service fatally unreliable.

This reverted commit seems to follow after the regression and is reverted along
with it.

Related: OS#3013
Change-Id: I5e0fd8c9c3b89e519e7382e3d0bb24e0aeddeff6
2018-03-28 14:34:55 +00:00
Neels Hofmeyr f75381498c mslot_class: two more: use uint32_t to shift 1 << 31
Avoid runtime error seen on jenkins admin-deb9build slave, when building
osmo-pcu with_dsp=None,with_vty=False, during ts_alloc and tbf regression
tests:

+../../../src/mslot_class.c:271:36: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
+../../../src/mslot_class.c:272:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

This time it seems that these are all.

The master-osmo-pcu breaks on this since moving to a debian9 build slave.

Change-Id: I976a1dca9da19a05afc85a17b7ba60545b7bc1e5
2018-03-28 14:44:47 +02:00
Neels Hofmeyr 8b4bd46b95 mslot_class: find_free_tfi(): use uint32_t to shift 1 << 31
Avoid runtime error seen on jenkins admin-deb9build slave, when building
osmo-pcu with_dsp=None,with_vty=False, during ts_alloc and tbf regression
tests:

+../../../src/mslot_class.c:242:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

The master-osmo-pcu breaks on this since moving to a debian9 build slave.

Change-Id: I0cdf10e5fbc1173a7a09bd4fed8a66d06f80aeb1
2018-03-26 23:24:16 +02:00
Pau Espin 74906224ca gprs_bssgp_pcu.cpp: Comment unused function parse_ra_cap
Commit 741d25cb6f commented the only user
of the function but forgot to comment too the function itself.

Change-Id: I8b291b45aaedfb0421cd28c0d9e24cefa5547b09
2018-03-17 01:43:14 +01:00
Neels Hofmeyr 5a5919435e configure: add --enable-werror
Provide a sane means of adding the -Werror compiler flag.

Currently, some of our jenkins.sh add -Werror by passing 'CFLAGS="-Werror"',
but that actually *overwrites* all the other CFLAGS we might want to have set.

Maintain these exceptions from -Werror:
a) deprecation (allow upstream to mark deprecation without breaking builds);
b) "#warning" pragmas (allow to remind ourselves of errors without breaking
   builds)

As a last configure step before generating the output files, print the complete
CFLAGS and CPPFLAGS by means of AC_MSG_RESULT.

Change-Id: I0f735913fc3bbda695c4e66449dcfc94f417dafb
2018-03-13 00:03:38 +00:00
Neels Hofmeyr bdc55fad62 implement support for 3-digit MNC with leading zeros
Receive the mnc_3_digits flag from the PCU interface.

Bump the PCU interface to 9.
This is one part of the three identical pcuif_proto.h patches:
- I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts)
- I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu)
- I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc)

Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).

Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore),
         Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore)

Change-Id: I787fed84a7b613158a5618dd5cffafe4e4927234
2018-03-11 00:47:14 +01:00
Alexander Couzens 8343b4adbb pcuif_proto: add version 8 features
Add PCU_IF_MSG_DATA_CNF_DT and PCU_IF_SAPI_AGCH_DT to bring the
pccif_proto into sync. Both commands are required to support the
rb11 with an osmo-bsc co-located pcu.

Change-Id: Ieaf151447e5556b911be7e2483b7c154fc5ec42e
2018-02-28 03:03:49 +01:00
Alexander Couzens d2a219e644 pcuif_proto.h: fix whitespaces and indention
Change-Id: I290967346af4e2707cfdfb62dccaccd43d195443
2018-02-28 03:03:01 +01:00
Max 731e2bb328 Simplify TS alloc: move slot check into functions
Move timeslot applicability check outside of nested for loop into
separate functions and document them. Add corresponding tests.

This allows us to clarify types used in TS-related computations.

Change-Id: Ic39e848da47dc11357782362fdf6206d2c1457c2
Related: OS#2282
2018-02-21 12:08:40 +00:00
Max 77988d469d Simplify TS alloc: move slot assignment
Move into separate functions:
* move timeslot reservation
* move UL timeslot assignment
* move DL timeslot assignment

Change-Id: I64cf78c5cfc78664766f9769dd5cde632dab92b0
Related: OS#2282
2018-02-21 12:08:38 +00:00
Max 847ed9f8cd TBF: make network counters internal
* store N310* counters in shared array similar to corresponding timers
* add functions to increment/reset counters

This avoids direct access to TBF counters from PDCH.

Change-Id: I8ffff9c7186f74bde7e6ac5f6e98f0b3e4c35274
Related: OS#1539
2018-02-20 18:16:11 +01:00
Max 4da385998a Simplify TS alloc: constify max dl slot func
Constify parameters of gprs_alloc_max_dl_slots_per_ms().

Change-Id: Ic90930d98560459eab0054cb9e1625cb99db61c8
Related: OS#2282
2018-02-20 10:20:55 +01:00
Max c5407c775a Simplify TS alloc: don't use PDCH for free TFI
Don't use PDCH from free TFI lookup routine. This allows for simpler
function which can be moved to mslot_class.c alongside with other
similar helpers.

Change-Id: Ie154866900453d232a890f7b9a30911b451525a1
Related: OS#2282
2018-02-20 10:19:25 +01:00
Max 6dc90b8c86 Move PDCH-related functions into separate files
The PDCH class and corresponding functions are rather self-contained and
independent from BTS implementation. Let's move them into separate file
to make bts.cpp more manageable. As additional benefit it allow us to
somewhat untangle all the different cross-dependent includes.

Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683
Related: OS#1539
2018-02-19 17:41:24 +01:00
Max 2afec6dba5 Simplify TS alloc: split USF/UL allocation
* move USF allocation into separate function
* document USF allocation

This allows to clearly see where selected UL TS is forced into single TS
in algorithm B allocator.

Change-Id: I563dc10827ce68295553f88f3bf2e1fc0ba595c1
Related: OS#2282
2018-02-19 09:00:21 +00:00
Max 0cc7212cfd Simplify TS alloc: split allocation
* generalize TS allocation and move it into separate function
* move single-slot allocation into separate function
* use common functions for TS allocation on both UL and DL

Change-Id: Ied45ae380c345bc76fe9d6fd9a6184d1109f83f2
Related: OS#2282
2018-02-19 09:00:20 +00:00
Max adca67bcbb Simplify TS alloc: separate capacity computation
Move TRX capacity computation into separate function and document it.

Change-Id: Ifd88fc7ff818ea2a041eae61c5d457926a0df0f2
Related: OS#2282
2018-02-19 09:00:20 +00:00
Max f633b8d8b2 Simplify TS alloc: split off RX mask computation
Move computation of RX mask into separate function and document it. This
allows to significantly shrink find_multi_slot() function and overall
improve code readability.

Since the test output requires cosmetic adjustment anyway due to change
in the sequence of log messages, use this opportunity to better group
and format log message.

Change-Id: I731726a096bba7ee97499e5cbe3e7401869d7392
Related: OS#2282
2018-02-19 09:00:19 +00:00
Max 1187a7719c Update header includes
Many files include unnecessary headers and don't include headers which
are actually used. Because of that combined with the fact that OsmoPCU
is a mixture of C and C++, it makes it hard to modularize code. Fix
this (using iwyu [1] tool):

* add missing headers
* remove unused headers

[1] https://include-what-you-use.org/

Related: OS#1539
Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
2018-02-19 08:43:46 +00:00
Max 910a387b0e Move include guard to the top
Having explicit include above the douible-include guard defines is
potential source for hard to track bugs. Let's move it inside the guard
statement.

Change-Id: I5114a63ce00b03c8eed23565d52969250bd505cc
Related: OS#1539
2018-02-19 08:43:45 +00:00
Max 4382e4e8fe Move paging generation into PDCH
Previously paging was prepared inside BTS function and than handed over
to PDCH function. Move the actual preparation into PDCH to better
decouple PDCH from BTS.

Related: OS#1539
Change-Id: I389fb16b6e54040770c21f88edbcb8e045636928
2018-02-19 08:43:33 +00:00
Max 735e435e8e Use explicit type for pcu_lsb()
It's only used for byte-long input so we can specify input and output
types explicitly.

Change-Id: Id0bef691e17e4331c7c4b491661e36173d85388a
2018-02-19 08:33:04 +00:00
Stefan Sperling 5b22fb7953 Make osmo-pcu wait for BTS to become available at start-up time.
After the PCU socket becomes available, the BTS might send an
INFO_IND message with the 'ACTIVE' flag cleared. If this happens,
do not exit immediately, but keep retrying until an INFO_IND
message with the 'ACTIVE' flag arrives.

Note that this change only affects behaviour at process start-up time.
If the BTS switches from active to inactive state then osmo-pcu will
still exit. If this behaviour should be changed as well it could be
done in a follow-up patch.

Tested against osom-bsc + osmo-bts-virtual.

Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309
Related: OS#2689
2018-02-14 19:55:05 +01:00
Max c907b88ecd emu: use libosmocore definitions
Change-Id: I4eade528faeb3841549ad7a6c78e8c1357909614
2018-02-13 12:53:55 +01:00