Commit Graph

1257 Commits

Author SHA1 Message Date
Minh-Quang Nguyen 1f18909335 EDGE: Fix UL link adaptation.
We have seen that UL MCS5- MCS9 link adaptation has not been implemented in current PCU implementation.
If the MS slowly moves far away from the BTS, the UL MCS will always stick at MCS9 no matter UL link quality values leading to poor data service experience.
The UL MCS is expected to adapt from MCS9 -> MCSx due to bad UL quality.

Below PCU traces indicate that UL MCS is quickly increasing to MCS9 (max MCS 9 was used in this test) and it never changes to other UL MCS due zero thresholds.

<0004> gprs_ms.cpp:670 MS (IMSI ): Link quality 23dB (23dB) left window [0, 0], modifying uplink CS level: MCS-6 -> MCS-7
<0004> gprs_ms.cpp:670 MS (IMSI 000): Link quality 23dB (23dB) left window [0, 0], modifying uplink CS level: MCS-7 -> MCS-8
<0004> gprs_ms.cpp:670 MS (IMSI 000): Link quality 23dB (23dB) left window [0, 0], modifying uplink CS level: MCS-8 -> MCS-9

Change-Id: I9272c337ad6399da4a47cc6e2736e25f24e099d8
2017-08-18 18:09:24 +00:00
Harald Welte b1be6112bb GSMTAP: fix category checks in pcu_rx_data_ind and pcu_l1if_tx_ptcch
We needto shift the PCU_GSMTAP_C_* constants before comparing against
the mask of enabled GSMTAP categories.

Change-Id: Ieb9332c65ed7bd57baf1aeab5ab722f92fc23b24
2017-08-17 00:50:24 +02:00
Max f60cf62f4f Simplify polling troubleshooting
* introduce enum describing poll kind and use it in set_polling()
* move state change into set_polling()
* move logging into set_polling() and unify output
* move duplicated code into static function
* adjust tests to match unified logging output

Change-Id: I14074207f8bbc18b3ebd60875bb99a0a3a4b399d
Related: OS#1524
2017-08-14 15:19:08 +00:00
Max a10c39866b Move DL assignment to TBF-DL
This function does not really belongs to BTS and it heavily relies on
direct access to TBF-DL members anyway.

Change-Id: I04584103018675a2f35cfb565473bfd81a208d7c
Closes: OS#1540
2017-08-14 15:50:47 +02:00
Max 341dccd7e2 Move common code into functions
* separate channel request responder into inline function
* move generic TBF poll check into inline function

Change-Id: I9ec3ab8de100f0bc75044f55ac769d1083d52806
Related: OS#1539
2017-08-14 15:49:59 +02:00
Max fd13f6c199 Encapsulate handling of UL ACK timeout
Use helper methods instead checking and manipulating flag directly.

Change-Id: Ia3f009c52118db95b38a077e08eecda844e7f8d1
Related: OS#1539
2017-08-14 15:48:37 +02:00
Pau Espin c4178e55ea Add pcu-socket vty config
osmo-bts already supports configuring a different path for the bts<->pcu
socket by using the 'pcu-socket' config field.

Change-Id: I9b3e1171da467519750b201849ec892a1e318129
2017-08-09 12:17:39 +02:00
Harald Welte 0cd8e4eade README: Clarify that fixed allocations have been revmoved from 3GPP specs
In Release 5, Fixed Allocations were removed as part of a "GPRS
simplification project" inside 3PGPP.  This means that any MS compatible
with Rel-5 or higher may not support it, which makes implementation
in the PCU af historical interest only.  See Tdoc GP-021277 for the
actual removal, it happened at 5.0.0 time.

Change-Id: I8138bc0a47d3468b67cec866447fd4b0fc69d4c5
2017-07-29 22:15:02 +02:00
Harald Welte bc219d5450 GSMTAP: Ad PTCCH as separate gsmtap category
This allows us to send GSMTAP for PTCCH only if requested by user/vty

Change-Id: Id720f4bebdce7f6152fbddddbe05036638c5866e
2017-07-29 13:43:30 +02:00
Harald Welte cd34dd3b2b GSMTAP: Fix logical channel of downlink PTCCH
Change-Id: I29ecc968d56d4d0165cffa206297c42d6fb02cf4
2017-07-29 13:43:30 +02:00
Harald Welte f7740aa44b GSMTAP: Fix channel type for data blocks: PDTCH instead of PACCH
PACCH is used only for RLC/MAC control messages, while PDTCH is used
for data.

Change-Id: I6c912e17d8c8d4178096679a541e61eeeb4b6643
2017-07-29 13:43:30 +02:00
Harald Welte 05d7b5dd59 BSSGP: Improve logging of received messages
We now differentiate clearly between messages that

a) we don't expect based on our reading of the spec
b) we have not implemented yet (but should)
c) we do not even know of

Also, unify the log string formats and provide BVCI whenever possible.

Change-Id: Ie32f5771d49960547ec5d7611f96a74facc1b035
2017-07-29 10:21:24 +02:00
Harald Welte 18a17aa487 Remove #warnings that have been adressed since 2015
In commit 9399046729 the lookup by
TLLI, TLLI-OLD and IMSI has been implemented, but the corresponding
compile-time warning was never removed.

Change-Id: I7a1767bc7cab01048e851fd4e63112bc676d6c78
2017-07-29 10:21:24 +02:00
Max 2813f931dd BSSGP: Use libosmocore for BVC-RESET
Implement proper BVC RESET procedure by using libosmocore code to handle
BVCI reset and initiate PTP BVC reset if necessary.

Requires I9bf8f4dd784ccddbb9926492a85fff3293a0e913 in libosmocore.
Related: OS#1638
Change-Id: I718c949759688cb34ce6bcbb3da2092fcdfa6989
2017-07-28 17:42:45 +00:00
Harald Welte 717cdf5405 Introduce GSMTAP categories
When looking at GSMTAP output so far, one is easily overwhelmed by way
too much information being presented.  A lot of is consists of DUMMY
frames, which are probably of lowest interest, ever.

A concept similar to the "gsmtap-sapi" of OsmoBTS is introduced, by
which the user can configure which particular categories (uplink or
downlink control or data, gprs or egprs, ...) he actually wants to
see in his logs.

Change-Id: I297183690e98a7234dfc1608c18847d8981306e4
2017-07-21 22:15:28 +02:00
Harald Welte 9530a404ce check for missing result of rate_ctr_group_alloc()
In case the counter group allocation fails, we must handle this
gracefully and fail the allocation of the parent object, too.

Change-Id: Id6d780c67b4af15aaa5c6f2b8b00f2a0b70a7385
Related: OS#2361
2017-07-12 00:47:10 +02:00
Harald Welte 8c8027c307 jenkins.sh: Proper error message if local environment isn't set up
Change-Id: Ibd24ba6024714f3d7aac14ef661acf52de2a3825
2017-07-10 14:01:07 +00:00
Max aae1bfbbe0 Remove TBF knowledge from rcv_control*dl_ack_nack
Do not access TBF internals directly from rcv_control*dl_ack_nack() -
wrap corresponding code into TBF-DL method.

Change-Id: I3d1b5782001e45617b4a960612fcfc249904b37c
Related: OS#1539
2017-07-10 09:39:53 +00:00
Max 5579595464 Ignore test binaries using mask
Change-Id: Ic7930c6e715447e91572f7ed6b0d2bb2238cf367
2017-07-10 10:49:02 +02:00
Max 241f5bcb00 Copy sysmopcu.service to osmo-pcu
This way the name of systemd service file will match the name of the
binary similar to OsmoBTS. Add aliases so the user can use both old and
new names regardless of which file is installed. Once the corresponding
changes to OE recipes are applied old file can be removed.

Based on work by Pau Espin Pedrol <pespin@sysmocom.de>

Change-Id: I2ca6f6c486bd6fcf4d5b3d0a05d25dc04f020c26
2017-07-03 18:50:49 +02:00
Max 3741f14689 Remove comment warning
It's unclear why the warning was placed next to commented log statement
to begin with, so let's just follow that warning's advice and drop it.

Change-Id: I3ef7a45d015a28fdadf75f97294bc5d4f825b8ae
2017-06-26 12:10:12 +02:00
Max 865436dee0 lc15: use environment for firmware version
This allows to specify firmware version to use by jenkins builder via
environment variable. If environment variable does not exist than
default master branch is used.

Change-Id: If8b249aa00270e60a0449f089a16823976e54d54
Related: SYS#3683
2017-06-22 17:00:46 +00:00
Max a468cfaf2e tests: remove unused definition
Fix compilation warning.

Change-Id: I1c95c6ec8bee68773643f9646b0319a83fbc6cfa
2017-06-22 13:28:39 +02:00
Max 062dfa1d0c lc15: use generic L1 headers helper
* use generic L1 headers helper for both sysmocom-dsp and lc15bts-phy
  options
* use sh instead of bash

Related: SYS#3683
Change-Id: I3dc621731f47650cbc15a5f17b9e899e9ed2770f
2017-06-19 12:53:26 +02:00
Harald Welte 49b78229ca use tlvp_val16be() rather than manual pointer-cast + ntohs()
Change-Id: Ib77cb703bb1710da396db3a939700515b5c20235
2017-06-11 11:40:19 +02:00
Harald Welte c136be04f7 lc15: further fixes regarding --with-litecell15
The fix in 0fb294a8dd was only partially
valid, as it unconditionally used $includedir, without any prefix.  This
polluted the include path with host include files in cross-compiling
builds.

Let's take a different approach and simply define LITECELL15_CFLAGS
(similar to what pkgconfig does), which makes the "-I" go away if no
--with-litecell15 has been specified.

Change-Id: I63393decfe42a24dab56c7654f716c1580416ab2
2017-06-11 11:40:18 +02:00
Harald Welte 0fb294a8dd lc15: fix configure.ac variable substitution causing compile error
When "--enable-lc15bts-phy" is passed to './configure' without specifying
an explicit header file path using "--with-litecell15=", we ended up
generating an empty string as LITECELL15_INCDIR and rendered something
like "-DENABLE_DIRECT_PHY  -I -I../../git/src/osmo-bts-litecell15" as
part of the compiler invocation, where the -I with no argument will hide
the second -I, as the second one is supposed to be the optarg for the
first include.

This in turn made the "#include <lc15_l1_if.h>" fail, when using
separate source and build directories.

This patch fixes the configur script to use $includedir, rather than the
non-existant $incdir as default for LITECELL15_INCDIR

Change-Id: I483e62f8331e7867a92f8055c4d450fdd5288cb6
2017-06-11 10:35:56 +02:00
Max 9dabfa2c2b Cleanup FN scheduling
* replace magic number with defined constant
* move copy-pasted code to inline functions
* remove unused code

Change-Id: I6fee0714453d0c3c3f3f875f88daea2d9c477331
Related: OS#1524
2017-05-26 07:55:52 +00:00
Harald Welte 356ac618f1 Fix format string error (string needs %s)
In a49475b5a8 we introduce the use of
bssgp_pdu_str() and change from printing the numeric code to the
stringified version of the message code.  However, the format string
was not updated accordingly :/

Change-Id: I7173b692fb1f222aab44cd4f44a482038d0f51dc
Fixes: Coverity CID 169684
2017-05-25 19:05:32 +02:00
Max e8284a7f92 Fix typo in logging
DL-TBD was errorneously printed as UL-TBF.

Change-Id: I94a224c0339a062e4c8d5aa6c4c858f3f0298a0d
2017-05-24 22:19:43 +00:00
Max a49475b5a8 Print human-readable BSSGP PDU type
Change-Id: Ief4b5ce4e4020edaf771eaa24f4382ec368dd18c
2017-05-23 17:53:38 +02:00
Alexander Couzens ccde5c9557 remove pcu own bitvector implementation
The osmocore bitvec is exact the same, but use a pointer instead of
a reference.

Change-Id: Id8f797631d89aa12b6e48efb2dc153a3e2f059f7
2017-05-15 12:46:33 +00:00
Neels Hofmeyr 3de6d0602f fix PACCH paging: don't return early in case of NULL TBF
Commit b78a4a6dfe tried to fix a NULL dereference
error, but apparently was overly eager to return, because it looked like all
code paths would dereference the tbf.

In fact the code path further above, for msg != NULL, has "always" dereferenced
the tbf, but the lower code path, the one effecting the paging, has only
started to dereference tbf since shortly before the overly eager fix: in
da7250ad2c, to "update the dl ctrl msg counter
for ms". It seems that this tbf dereference in the paging path is bogus and the
cause for the segfault that made me write the early exit fix.

Fix that fix:

Do not exit early if tbf == NULL, stay in there to be able to reach the paging
path below.

In case of a message to be sent, assume that tbf is present, and verify: print
an error message and abort if there is a msg but no tbf, so that we will see
the error if I'm wrong there. If a tbf is missing, free the msg.

In case of no message, go on to send pending pagings, but do not attempt to
count ctrl messages for a tbf -- IIUC there will never be a tbf if we're
paging.

This should avoid segfaults while keeping PACCH paging intact.

Tweak a comment for and add a blank line above the paging section.

Related: OS#2176 CID#158969
Change-Id: Ib79f4a945e211a13ac7d1e511cc37b0940ac6202
2017-05-15 10:40:34 +00:00
Alexander Couzens 333d7e6345 tbf.cpp: use new tlli instead of old tlli
The old tlli might be 0x00000000.

Change-Id: I2fd6fec022506e203d05e91c36ccd9e020ff816c
2017-05-01 16:57:48 +00:00
Neels Hofmeyr e6d26ec09c bitcomp test: use expected rc instead of 'verify' flag
The 'verify' flag is useless, we always want to verify everything.  Replace
'verify' with 'expect_rc', expecting a specific decoding result per test set.

When an error code was returned, cut short the loop and skip printing expected
vs. decoded bits.

This uncovers the fact that the first test marked as "invalid inputs" does not
seem to be invalid after all, or at least does not produce an error to be
returned. For now, only uncover this fact, the fix shall be submitted later.

Change-Id: Icf815a8f1acb0e275463408450171df046879847
2017-03-27 00:24:28 +02:00
Neels Hofmeyr 5382e0fc1f bitcomp test: fix: also verify bits after decoded data
Before this, the expected data had seemingly random bits set after the end of
the expected decoding result. Make the test expect these extra bits as zero,
matching with the buffer initialization to zero.

In result_matches(), compare the full length of bytes instead of masking the
bits after the end of the decoded data (which caused us to not catch the wrong
expectation until now).

This fixes the underlying issues found in
http://lists.osmocom.org/pipermail/osmocom-net-gprs/2017-March/000876.html
  [osmo-pcu 0.2.896-0a8f] testsuite: 4 failed
  from: Arnaud ZANETTI
  on: Fri Mar 24 09:53:53 UTC 2017

Change-Id: I2501208e2f8b4f709efbcadbd1057c086472c9e6
2017-03-27 00:24:28 +02:00
Neels Hofmeyr dd1700a397 bitcomp test: fix: only one hexdump per log; use printf
The test wants to write multiline results, so it should use printf instead of
the logging system.

Split logs to only one hexdump per printf(). One cannot use osmo_hexdump twice
in one printf(); before this, one of the two hexdumps won, both dumps would
show as the same. Very bad for a regression test!

This uncovers a discrepancy between expected and produced results, proving that
the expected stderr output was not capable of uncovering test failures. The
test's check_result() function *has* always verified the decoded data, but only
up to the last decoded bit. Our expected data contains seemingly random bits
after the end of the decoded bits, but check_result() never compares those,
hence we don't catch that error. The extra bits should definitely be zero,
because the destination buffer is pre-initialized to zero -- fixed in a
subsequent patch.

This should cosmetically fix the build failure found in:
http://lists.osmocom.org/pipermail/osmocom-net-gprs/2017-March/000876.html
  [osmo-pcu 0.2.896-0a8f] testsuite: 4 failed
  from: Arnaud ZANETTI
  on: Fri Mar 24 09:53:53 UTC 2017
The real fix will follow.

Change-Id: I24fc32eb55baaf22f9c6fdda917bfb8395d02b1c
2017-03-27 00:24:28 +02:00
Neels Hofmeyr 7783964bb9 cosmetic: BitcompTest: make readable
In order to understand what the bitcomp test is logging, cosmetically rearrange
the code:

- memset bits_data before assigning to destination bitvec.
- use macro CEIL_DIV_8 to clarify what (x+7)/8 does.
- rename check_result() to result_matches() and return a bool,
  also constify result_matches() args and pass a bitvec reference instead of
  copying the bitvec struct.
- rearrange logging lines to make readable what is going on there.
- drop unused 'init_flag'

There are obviously errors like double hexdumps per log line, multiple newlines
in a LOGP statement and so forth: these shall be fixed by subsequent patches.

Change-Id: Id0da9d9b67f4713d3a67e3532ed44b8cb1bd1d08
2017-03-27 00:24:03 +02:00
Max 0a8fae8d14 Support sending OML Alerts via BTS
* extend BTS <-> PCU protocol with TXT messages
* use it to implement OML alerts support
* use it to implement version message
* add function to transmit both of them them
* send alerts for internal encoding problems as an example
* send version when BTS socket is connected

Note: requires corresponding change
If57459c0610f2c7b36d599b13087c8deef8bdd9e in libosmocore.

Related: OS#1614, 1615
Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7
2017-03-17 17:01:28 +00:00
Harald Welte db84235a0b Update README file with general project info and use Markdown
Also, it seems the readme was so far not included in any tarballs (make
dist).  Let's change that.

Change-Id: I1967fbbdeadb967c0c0dce2c112ac692c539da1d
2017-03-17 17:24:55 +01:00
Neels Hofmeyr 20827374e9 jenkins: add value_string termination check
Change-Id: I27217c9162efd800eebcb403eab770f4528d21ac
Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8
2017-03-16 19:01:04 +00:00
Max b86a30dc22 tests: include headers from include/
In addition to .h files from src/ add include/ as well: some headers are
now public and reside in separate directory.

Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95
2017-03-13 13:43:22 +00:00
Max 5dd8d1bbd8 bts.cpp: Fix overloading ambiguity
Fix error introduced in 1275a3f91a by
using signed 32 bit integer which is enough for Frame Number in
GSM. Also, mark parameter constraints more explicitly:
- add assert for expected FN values
- don't perform computation for non-relative FN

The error was:
bts.cpp: In member function ‘uint32_t BTS::rfn_to_fn(uint32_t)’:
bts.cpp:554:25: error: call of overloaded ‘abs(uint32_t)’ is ambiguous
  if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) {
                         ^
In file included from /usr/include/c++/6/cstdlib:75:0,
                 from /usr/include/c++/6/stdlib.h:36,
                 from /usr/include/osmocom/core/linuxrbtree.h:97,
                 from /usr/include/osmocom/core/timer.h:35,
                 from ./bts.h:29,
                 from bts.cpp:21:
/usr/include/stdlib.h:735:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
In file included from /usr/include/c++/6/stdlib.h:36:0,
                 from /usr/include/osmocom/core/linuxrbtree.h:97,
                 from /usr/include/osmocom/core/timer.h:35,
                 from ./bts.h:29,
                 from bts.cpp:21:
/usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128)
   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
   ^~~
/usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }

Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8
2017-03-13 11:25:14 +00:00
Max 727295f206 Add pkg-config file
We're installing header file pcuif_proto.h so it's better to use
pkg-config for proper version tracking similar to the way it's done for
OpenBSC.

Change-Id: I0520045e5655794df152b98b9755d7cbbd334049
2017-03-09 12:17:35 +01:00
Philipp Maier 1275a3f91a BTS: Convert relative frame numbers to absolute frame numbers
The implementation of the method rcv_rach() in class BTS, restores
the absolute frame number of the incoming RACH-Request by using
the relative frame number (RFn = Fn mod 42432) from the rach
request and the already known internal absolute frame number
m_cur_fn, which is continusly updated by the CCU interface.

In some rare cases, a RACH request might be received by the BTS,
a very short time before the frame number wraps in its 42432.
Depending on the PCU location, RACH request might be received
by the BSC, which forwards it to the PCU. It is then likely
that, while the RACH request is being forwarded to the PCU, the
PCU internal absolute frame number wraps before the RACH
can be processed. The relative frame number from the rach
request would then be interpreted as if it were received after
the wrapping of the internal frame number modulos.

This commit adds logic to detect and resolve this race condition.
Also a unit test is added to check some cornercases.

Change-Id: I74f00c11e5739d49f370ce6c357149e81d9aa759
2017-03-05 12:23:56 +00:00
Neels Hofmeyr a01e2ee177 logging fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*
In libosmocore, my patch was merged to master a bit too soon. To accomodate the
request for naming that matches the general "LOG" prefix instead of "LOGGING",
a fixup was committed to libosmocore. Adjust for that.

Original patch: change-id I5c343630020f4b108099696fd96c2111614c8067
The fixup: change-id I424fe3f12ea620338902b2bb8230544bde3f1a93

Change-Id: I4db4a668f2be07f3d55f848d38d1b490d8a7a685
2017-02-23 18:11:44 +01:00
Neels Hofmeyr d0a887b28b gprs_debug.h: remove unused cruft / cosmetic tweaks
Change-Id: Ied1ffc320332a605b140d23910eb0a13ef9a7a75
2017-02-20 15:30:18 +00:00
Neels Hofmeyr 4ae5406959 logging: use central filter and ctx consts from libosmocore
Change-Id: I7b41a5a26527864177c63403ad171d2987f0ff6a
Depends: libosmocore change-id I5c343630020f4b108099696fd96c2111614c8067
2017-02-17 17:23:36 +01:00
Neels Hofmeyr b609190369 dl tbf: initialize punct values and verify
Solves a sanitizer issue where punct2 is unset when passed to
gprs_rlc_mcs_cps() and thus takes a value not defined in the enum.

Change-Id: I004cbbab15e6ffa2749f4b7f1df651517c2ae693
2017-02-14 12:20:57 +01:00
Neels Hofmeyr 49b83ec3a3 dl tbf: calculate CPS only for EGPRS
Patch-by: Aravind Sirsikar <Arvind.Sirsikar@radisys.com>
Change-Id: I81b8e1d10bfe9efba3a9f04bced66f87d93285dd
2017-02-14 12:19:18 +01:00