Commit Graph

1358 Commits

Author SHA1 Message Date
Alexander Couzens 6d73205280 egprs_rlc_compression: fix white spaces
Change-Id: I43a5acc2dda4ba567ada9846880e31c85bc98394
2019-06-17 02:04:09 +02:00
Alexander Couzens b7439f28a1 encoding: use `/* */` for comments instead of `#if 0 #endif`
Change-Id: Ifff9526b15bfda7a0f85c92bcb0d3fabab61ca32
2019-06-17 02:03:18 +02:00
Alexander Couzens 3f640773f3 encoding: correct encoding of CRBB in ACK/NACK when not byte aligned
The last bits of the CRBB (compressed receive block bitmap) was incorrect
encoded when the CRBB is not byte aligned.

Related: OS#3728
Change-Id: I7261aa71b37d7ead52992f8db462f72a3804988e
2019-06-13 21:26:12 +00:00
Alexander Couzens 5c3783b7e8 gprs_bssgp_pcu: explicit allocate & initialize bssgp_nsi instance
The instance bssgp_nsi is a global instance to be used by all
NS related functions. Previous the PCU allocated and initialized
the bssgp_nsi instance when (re-)connecting and freeing on disconnect.
The problem of the implicit initialisation is gprs_ns_vty_init(bssgp_nsi).
All vty init functions must be called before the configuration is read,
otherwise a previous vty written configuration is invalid.
Furthermore the vty modifications to the `ns` object were lost when the PCU has to
reconnect to the SGSN.

Fixes: OS#4024
Change-Id: I2aa53ea54e9352577f6280ad7b9d1d9da9f57eaf
2019-06-07 01:17:53 +02:00
Oliver Smith a558ad4269 debian: create -doc subpackage with pdf manuals
I have verified, that the resulting debian packages build in my own OBS
namespace (see the -doc packages):
https://download.opensuse.org/repositories/home:/osmith42/Debian_9.0/all/
https://build.opensuse.org/project/show/home:osmith42

Depends: Ib7251cca9116151e473798879375cd5eb48ff3ad (osmo-ci)
Related: OS#3899
Change-Id: I9f2e7cfd93ee0b13d064c606a20378c1ea01400e
2019-05-29 12:14:18 +02:00
Alexander Couzens eb64d43922 gprs_bssgp_pcu: make gprs_bssgp_ns_cb public
rename the function sgsn_ns_cb -> gprs_bssgp_ns_cb.
To allow writing and reading the same configuration, the pcu needs to register
all vty commands before reading the configuration. This callback
is required to register NS based vty commands

Related: OS#4024
Change-Id: I440c0df2e32fe22bf43288c00bb4aa3a0c6a3a51
2019-05-25 05:56:32 +02:00
Max 41d6b35670 Add test for MS mode and (M)CS settings
Right now set_mode() on GprsMs behaves in pretty counter-intuitive way:
* it's possible to set current DL MCS higher than max value
* EGPRS and EGPRS_GMSK have the same max DL MCS
* setting EGPRS* mode drops current/max MCS values to unknown

Let's capture this in a unit-test before attempting any further
modifications.

Change-Id: Ibf917f4b49d927a21cbd467775806fa6ea06a6a6
2019-04-11 07:29:53 +00:00
Rafael Diniz 0e6e45a65f Fix help message formatting of osmo-pcu.
Change-Id: If4ecf9be5a0739bb54aedb077eda51ad091b4c3f
2019-04-08 19:28:02 +00:00
Max 34513feff9 cosmetic: use const pointer for bts_data
It's used several time for logging so let's call it once to make code
easier to follow.

Change-Id: Icfd9e5603a5d8701f487f17e9c0335d458e9e80b
2019-04-08 07:36:11 +00:00
Max 902e3e58db Update MCS selection for retransmission
In 3GPP TS 44.060 the selection of MCS for retransmissions is defined as
separate tables (8.1.1.1 and 8.1.1.2) depending on the value of
resegmentation bit (which is opposite to the way EGPRS_ARQ are defined
in the source code). Let's follow the same idea and explicitly check for
resegmentation bit value and use separate tables. This also makes it
easier to add proper support for special cases (MCS-6-9 and MCS-5-7) and
padding in future independently for different ARQ types. The code is
also moved to c to avoid unnecessary conversions to and from cpp class.

Change-Id: Ia73baeefee7a58834f0fc50e3b8bf8d5e3eb7815
2019-04-08 07:35:19 +00:00
Max 12a0987b36 vty: add commands to show TBF of a certain kind
Add vty commands to show only TBFs allocated via PACCH or CCCH.

Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312
Related: OS#1759
2019-04-08 07:35:00 +00:00
Max 0e6ac799f7 TS alloc: expand tests log
* restructure code for easier reading
* use consistent formatting for output
* log essential allocation parameters on failure

Change-Id: I4b78951a79ddbc0745b39d091080a4e0e247d3c5
Related: OS#2282
2019-03-28 08:58:41 +00:00
Daniel Willmann 8ab35b14e9 jenkins.sh: Add oc2g build support
Related: OS#3749, SYS#4524
Change-Id: I014e5e59bc5e904a616ddf50ebfb8247f0d428cf
2019-03-27 14:26:22 +01:00
Daniel Willmann 32518cce5a oc2g: Change log type (Litecell15->Oc2g)
Change-Id: I95ced5da1c89dae5a16963b10b005747277f320b
2019-03-27 14:23:17 +01:00
Daniel Willmann f57dccbbfb oc2g: Remove custom alarms
Don't try to send custom alarms that weren't included in upstream.

Change-Id: I51de826aa732a3875d75396b46b7d2821ef7417c
2019-03-27 14:21:15 +01:00
Minh-Quang Nguyen ba66ea4406 OC-2G: Always use positive TA information provided in PH-RA-IND
From-Commit: 960aa3d1b0b1
From-Remote: https://gitlab.com/nrw_noa/osmo-pcu
Change-Id: Ia526f712b95eb7bba99252f2a348d9fb5d2f3838
2019-03-27 14:20:21 +01:00
Minh-Quang Nguyen 2ba608415b OC-2G: Fix TA adjustment
Problem:
 TA provided from L1 PH-DATA-IND is a relative amount of TA adjustment to actual TA
 being used for given TBF. The current TA update algorithm in PCU simply applies the relative
 amount of TA to given TBF but does not take into account of current TA.
 As a result, the PCU will request wrong TA jump for given TBF if the MS is moving away from
 BTS more than 2 km.

 Related issue: http://osmocom.org/issues/2611

Fixes:
- The PCU needs increase or decrease current TA of given TBF on receiving of relative
  amount of TA adjustment provided by PH-DATA-IND from L1.
- The PCU needs to set absolute TA of given TBF on receiving absolute TA provided by
  PH-RA-IND from L1.

From-Commit: 139ad3f42193
From-Remote: https://gitlab.com/nrw_noa/osmo-pcu
Change-Id: I7665586dd5722bbe04632ee5673d3033bc082324
2019-03-27 14:19:40 +01:00
Minh-Quang Nguyen 4a1796fe76 OC-2G: Fix missing header
From-Commit: a9eefb54c62a
From-Remote: https://gitlab.com/nrw_noa/osmo-pcu
Change-Id: Ida0592c9da74588a57d9d2d5be40fcf79edcb596
2019-03-27 14:18:30 +01:00
Jean-Francois Dionne c1e44908fe Initial commit for OC-2G support.
From-Commit: b77fd00608dd
From-Remote: https://gitlab.com/nrw_noa/osmo-pcu
Change-Id: I7cd89a549c9463e81893ca7dd925299f728e4453
2019-03-27 14:16:41 +01:00
Max 3fa235fe01 Update IA Rest Octets encoding
Write initial bits of 3GPP TS 44.018 §10.5.2.16 IA Rest Octets the same
way as  write_ia_rest_*() routines do.

This should also fix the issue addressed in
I75dd5bebc74eea85edf9582607c774d0bba0d2a6 initially by properly encoding
L/H bits.

Change-Id: I7ed5270bf95c3f6e9e026ff447eef8539f6f0314
2019-03-27 12:32:04 +00:00
Max d4a39291e0 TBF-DL: cosmetic update for helper routines
* use enum values where appropriate
* reformat to proper code style to improve readability

Change-Id: If1d2bc69b0d43fc520e579457007704b7975117e
2019-03-27 12:32:04 +00:00
Max fb59a93425 TBF: update MCS counters
* use enum CodingScheme directly instead of converting it to class and
  back
* drop useless mode check
* log errorneous update attempt

Change-Id: I763136c2f356d63aa3d28d09c57fd5faf5336258
2019-03-27 12:32:04 +00:00
Max e742cc0997 Use Timing Advance Index in UL assignments
Write TAI (if available) when generating Rest Octets for UL
Assignment. This should not affect actual PCU behavior because TAI is
not yet supported by upper layers but we have to adjust corresponding
tests anyway.

That's updated version of reverted commit.

Change-Id: I69407793bdb863be5fc42adadf75842d22f27335
Related: OS#3014
2019-03-27 12:32:04 +00:00
Max 3eb47363ad Rewrite Packet Uplink IA Rest Octets for SBA
Use bitvec_set_*() directly without external write pointer tracking to
simplify the code. This is part of IA Rest Octets (3GPP TS 44.018
§10.5.2.16) which is the last part of the message so it should not
interfere with the rest of encoding functions.

The difference in the expected test output is due to proper handling of
TAI which should not be transmitted for SBA according to the Note in
Table 10.5.2.16.1 in 3GPP TS 44.018.

The change was manually tested against real mobile phone using options
'gprs mode gprs' in osmo-bsc.cfg and 'two-phase-access' in osmo-pcu.cfg
to make sure appropriate code path is actually triggered.

That's partially based on reverted commit 93d947f5e8.

Change-Id: I97d53c27c1ca9e032d431b3aa7f915027d63ddc0
Related: OS#3014
2019-03-27 12:32:04 +00:00
Max 0367ddd62b Rewrite Packet Uplink IA Rest Octets for MBA
Use bitvec_set_*() directly without external write pointer tracking to
simplify the code. This is part of IA Rest Octets (3GPP TS 44.018
§10.5.2.16) which is the last part of the message so it should not
interfere with the rest of encoding functions.

That's partially based on reverted commit 93d947f5e8.

Change-Id: Ibe294b26ac374b9264a734db9663cacc105a4474
Related: OS#3014
2019-03-27 12:32:04 +00:00
Max 6e96dd4665 Fix Channel Coding Command for MCS
Previously result of ".to_num() - 1" was used without any checks which
means that in case of to_num() returning zero we would effectively try
to encode (uint8_t)(-1).

Let's fix this by using proper mcs_chan_code() function which returns
Channel Coding Command for MCS without the need to further correct it
and adjust expected tests output accordingly.

Change-Id: I868062a81fffe6714a811c032215f25a79259905
2019-03-27 12:32:04 +00:00
Max 898dddb1d1 MCS: add Channel Coding Command encoder
Add function to encode MCS value as proper EDGE or GPRS Channel Coding
value according to 3GPP TS 44.060 and corresponding helpers.

Use it for everything except IA Rest Octet encoding which is done in a
follow-up patches to make sure that we distinguish between
encoding-related changes to test output and unrelated changes.

Change-Id: I127fb29f5aaf77a7f6c4c565dfeb3b711af9845d
2019-03-27 12:32:04 +00:00
Harald Welte 48b1e7a86f gprs_debug: Use named initializers and explicit array indicies
This is a much safe way, it allows for modifications of the debug
subsystem enum member values without breakage.  Also, the syntax
introduced here is what we do in all other Osmocom CNI projects.

Change-Id: I2be88586ca44b0b8361f96cf3c034c8459244c2c
2019-03-27 07:39:02 +00:00
Harald Welte 3447c4a8a4 Forward GPRS SUSPEND REQ from BTS to SGSN using BSSGP
As specified in 3GPP TS 03.60 Section 16.2.1 and 44.018 Section 3.4.15,
a Class B MS is sending a "RR GPRS SUSPEND REQ" via a DCCH to the BTS if
it wants to suspend GPRS services.  As of
Change-Id I3c1af662c8f0d3d22da200638480f6ef05c3ed1f, OsmoBTS forwards
this via the PCU socket, so we need to pick it up and send it via BSSGP
to the SGSN.

Change-Id: I7b4beb413a6f974373a404b5a11c44d86ba695d3
Closes: OS#2249
2019-03-27 07:39:02 +00:00
Harald Welte 1473b377c2 pcu_l1_if: Fix erroneous endian-swapping of the CellID
In Change-Id I787fed84a7b613158a5618dd5cffafe4e4927234 in February 2018
we accidentially introduced a change that would erroneously swap
the endianness of the CellID on the way between PCUIF socket and
BSGSP.  This meant that all OsmoPCU based BTSs would report the
wrong CellId to the SGSN.

Closes: OS#3854
Change-Id: I2f6cc930c5dbf8dac386b24b0756df2efe8199e4
2019-03-27 07:39:02 +00:00
Max 8a8e0fb267 MCS: add mcs_is_*() helpers
In preparation for Channel Coding Command encoder in follow-up patches
let's add necessary helpers. Those are similar to previously used
helpers from GprsCodingScheme class but without CamelCase and with less
typo chances between Gprs and Egprs cases.

Change-Id: I6699cbc8d7ae766fa4d2b3d37e5f9ff1cf158b7e
2019-03-26 11:19:30 +01:00
Daniel Willmann fb3fd09353 Include pdch.h in bts.h even if we're not compiling C++
bts.h needs pdch.h whether we're compiling C or C++ code so move it out
of the #ifdef.

make[1]: Entering directory '/home/daniel/scm/osmo/oc2g/osmo-pcu-oc2g/src'
  CC       osmo-bts-oc2g/oc2g_l1_if.o
In file included from osmo-bts-oc2g/oc2g_l1_if.c:39:
./bts.h:74:26: error: array type has incomplete element type ‘struct gprs_rlcmac_pdch’
  struct gprs_rlcmac_pdch pdch[8];
                          ^~~~

Change-Id: Ib39e4424f73c677b34f921917440f211e400e14f
2019-03-26 09:29:17 +00:00
Max a4de02db5d MCS: move Mode enum outside of class definition
Move Mode (EDGE/GPRS) definition and related functions outside of
GprsCodingScheme class. This allows us to use standard libosmocore
value_string functions.

Change-Id: I3baaac7f1ca3f5b88917a23c1679d63847455f47
2019-03-24 18:54:52 +01:00
Max 02fbfc15c7 Fix TA index encoder
The TAI is described as { 0 | 1 < TIMING_ADVANCE_INDEX : bit (4) > } in
3GPP TS 44.018 §10.5.2.16.1 so it should be encoded with if-else.

Change-Id: I54482790e1cf3cb13a635a99a481250576deabaf
2019-03-19 18:27:49 +01:00
Max a0353547b1 TBF-DL: log MCS as string
Log MCS name instead of numeric value.

Change-Id: I3e1925a010a6def5fd14da63b73e0b75feddfafc
2019-03-19 18:27:49 +01:00
Max 136ebccc5e MCS: use value_string for conversion
Change-Id: I212ebb892ab162821633974d5a6c7e315d308370
2019-03-19 18:27:49 +01:00
Max 51754b6f35 MCS: move HeaderType enum outside of class definition
Move functions which compute number of blocks or bits depending on
header type and corresponding enum outside of GprsCodingScheme
class. This will allows us to use standard libosmocore value_sting
functions in upcoming patches for IA Rest Octet encoding/decoding.

Change-Id: Id0873f85e1f16a72e17e7fbc4ad76b194917067f
2019-03-19 18:27:06 +01:00
Max d5ffeb5e63 Explicitly clean up BTS singleton
Add method to explicitly cleanup BTS singleton similar to GprsMsStorage
class and use it from main(). The destructor becomes trivial wrapper
around cleanup() method.

This prevents annoying SIGABRT on exit of OsmoPCU caused by
rate_ctr_group_free() being called after talloc_free() which removes the
context in which counter group is allocated.

Change-Id: I796d56a7de3f3a1f9d59708995c8e3e9b05a2747
2019-03-19 15:42:10 +00:00
Max f4d3973688 MS store: move test helper to unit test
It's confusing to have test-specific helper with the same name as tested
function directly inside the GprsMsStorage class. Let's convert it into
static function and move to the unit test.

Change-Id: Ia2a5b90779051af894fe15d957c1d26f0a142f33
2019-03-19 15:05:51 +00:00
Oliver Smith 0fb91b736c tests: use -no-install libtool flag to avoid ./lt-* scripts
This ensures that the rpath of the generated binaries is set to use only
the just-compiled so-files and not any system-wide installed libraries
while avoiding the ugly shell script wrapper.

Change-Id: I2915f0de87598f9f23efc2b9a8f4a6bdf4966efb
2019-03-19 13:46:08 +01:00
Max a3ff316c5f Use unique NSEI/BVCI/NSVCI in TBF tests
This works around the issue with colliding rate counter group index
highlighted by 86e35e4887 by using
different NSEI/BVCI/NSVCI parameters for different TBF tests.

Change-Id: Id7d2d1a48308a6b1fb17768aee0e79adbdee56ee
Related: OS#3827
2019-03-14 09:30:20 +00:00
Max ed6e4acdf6 Debian: bump copyright year
Change-Id: If61a510fbbcd549dc7bdf6e38643a00d242be875
2019-03-13 17:12:57 +01:00
Max 0620656288 MCS: remove unused function
Change-Id: I32ab5ac36a0db90f2bea670b7684784b83a90b6b
2019-03-13 17:11:01 +01:00
Max e43ef21d35 Make get_retx_mcs() into regular function
Moving from header-defined inline function allows us to hide
egprs_mcs_retx_tbl definition and simplify further changes.

Change-Id: I95258d1558a3b918ae83f1a69e7c3de2b97e5627
2019-03-12 15:35:40 +01:00
Max bea2edbc46 MCS: move Coding Scheme enum outside of class definition
Move generic MCS enum to C header file to simplify further modifications
to GprsCodingScheme class in follow-up patches. This also allows us
to use standard libosmocore value_sting functions in upcoming patches
for IA Rest Octet encoding/decoding.

Related: OS#3014
Change-Id: I993b49d9a82b8c7ad677d52d11003794aeabe117
2019-03-12 15:35:40 +01:00
JF Dionne 1beed38b54 encoding: Fixes TMSI vs MI bit selection in repeated page info
Change-Id: Iddb00b9133f523f4ba09c8f1fc5694e62dc46fbf
2019-03-11 13:36:44 +00:00
Max fa3085b45e Log (M)CS UL update errors
Previously some of the errors in update_cs_ul() call were silently
ignored. Let's log all those as errors with appropriate message.

Note: test output needs updating because we do not (yet) set proper meas
struct in TBF tests. That's likely wrong but it's better to update tests
in a separate commit.

Change-Id: I4084fb281dd9dad04a2a3a68cac2a8f7b462548e
2019-03-07 17:05:19 +00:00
Max 86e35e4887 Enable LGLOBAL logging for TBF tests
This exposes the bug in BSSGP rate counter group allocation in the
current tests version which should be fixed in a separate commit.

Change-Id: I6317eccfb1408c5c9d07110a8b059f5ceb5d2afc
2019-03-07 12:20:42 +01:00
Max 8119ecd2db Tighten lqual table limits check
Previously MAX_GPRS_CS was used for both EDGE and GPRS which means that
we waste extra memory in GPRS case. It also leads to misleading
name. Let's fix this by introducing separate definitions for GPRS and
EDGE cases and use them as appropriate in limit checks.

Change-Id: I3ae1ee64ec8e80247b8fe669cc79505b4dadf58f
2019-03-06 20:52:15 +00:00
Max d3a0d91a38 Use msgb_eq_data_print() in tests
This allows to see exact byte which differs with expected output in case
of test failure.

Change-Id: If1285649b27843d68dfaa6f6dd3b80deee9aa148
2019-03-06 20:51:57 +00:00