Commit Graph

1562 Commits

Author SHA1 Message Date
Pau Espin 2ccb6aef89 pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding
Wireshark expects to receive the plen in order to decode it.

Fixes: 58543709e4
Change-Id: I91d1354689300b949760cdbaee03294eab958e12
2019-10-07 18:26:10 +02:00
Pau Espin 58543709e4 Log AGCH and PCH blocks using GSMTAP
Change-Id: I4d62f98801af1b0a290d3dd35bd213ccf3151035
2019-10-01 10:38:55 +02:00
Pau Espin 1ec211f57f Log RACH Requests using GSMTAP
Change-Id: Ib686a49e8c630808c30bede5810cd65fc045954a
2019-09-30 20:15:54 +02:00
Pau Espin 1879442443 vty: Fix osmo_tdef timers not listed in write config
Change-Id: I5c7ae18919e4b016505aa01eea6694d8a3f5df5f
2019-09-26 18:25:35 +02:00
Pau Espin f4c77e686a tbf_dl.cpp: Remove dup call to tbf_update_ms_class() in state GPRS_RLCMAC_WAIT_RELEASE
tbf_update_ms_class() is already called two lines above in the common
path.

Fixes: 409efa1ec8
Change-Id: Icbe3805c72a5c77366215be55128b586e5a00fb7
2019-09-26 14:43:22 +02:00
Pau Espin ad586a9fe4 tbf_dl: Setup m_llc_timer in constructor using osmocom API
Change-Id: I3e761b319326e33ab1d56c4fb30cafe3b0f96c29
2019-09-26 14:43:22 +02:00
Pau Espin bddf1ad7f6 Move tbf_{dl,ul} child constructors to respective .cpp files
Fixes: 9d1cdb1f69
Change-Id: Id258589d46de42ad4e27889bc396f930b7f94b79
2019-09-26 14:43:22 +02:00
Pau Espin 9d1cdb1f69 Move out tbf subclasses from tbf.h to their own headers
It's a good start towards clearing current mess between parent and the 2
children classes.

Change-Id: Ibc22ea2e02609af7ee058b8bc15df2115d4c6f60
2019-09-25 17:50:06 +02:00
Pau Espin 488aa29083 cosmetic: fix whitespace
Change-Id: I45bbe4d3c69d573aaff010d16f338c7ec3eaf08a
2019-09-25 17:50:06 +02:00
Pau Espin e13cdc503e pdch.cpp: Use pcu_l1_meas previously filled by lower layers
Otherwise, a new meas object is allocated in the stack in upper layers
which doesn't contain the link_qual information (have_link_qual=0),
outputting following error:

osmo-pcu/src/gprs_ms.cpp:644 Unable to update UL (M)CS CS-2 because we don't have link quality measurements.

Change-Id: I1980ca325c8d65f3f6310fa697dd810eec7ab077
2019-09-25 13:52:31 +02:00
Pau Espin 812d466bbd pdch.cpp: Refactor bitvec param passing in rcv_control_block
Move code in rcv_block_gprs() only needed for rcv_control_block() into
the later. This way rcv_block_gprs() is simplified and shows similar
code paths with regards to rcv_data_block().
It can now be seen that the main difference between both is the meas
param no being passed in the control case.

Change-Id: I2a0133463edced93c72ccc743a0cf00d1d6922cf
2019-09-25 13:35:13 +02:00
Oliver Smith 04797b1e35 configure.ac: set C and C++ dialects
Make sure that the compiler always assumes the same C dialect, to
prevent unexpected compiler errors when building with older compilers
(on other Linux distrubtions like in OBS, or in docker).

Use gnu89 and gnu++03, because that is what the code currently compiles
with.

Related: https://lists.osmocom.org/pipermail/openbsc/2019-September/013030.html
Related: OS#3598
Change-Id: Ia57ba101627e3cc0babeca82631e207a3e2e0960
2019-09-18 14:28:43 +02:00
Oliver Smith 2beb1b85e0 tests/app_info: fix compiling with older g++
Do not use C++11 extended initializers to prevent the following error.

AppInfoTest.cpp:109:54: error: extended initializer lists only available with -std=c++11 or -std=gnu++11
  pcu_prim.u.app_info_req = {0, 15, {0xff, 0x00, 0xff}};

I ran into this when modifying the gerrit build verification job to
build with docker (which still uses GCC-4.9).

Related: OS#4204
Change-Id: I307cd87af88e86804a90d6466e9cc3909bfe701f
2019-09-18 13:58:42 +02:00
Pau Espin 2b5c629055 Use osmo_tdef to implement dl-tbf-idle-time
Change-Id: I5e4f0d2f90e643600b7752525d6c2830856c9d3b
2019-09-17 11:11:04 +02:00
Pau Espin 63700ead34 Use osmo_tdef to implement ms-idle-time
This commit would also remove the option from config_write_pcu() since
it's automatically filled in by osmo_tdef, but there was actually a bug
because that param was never printed when saving the config...

Change-Id: Id8e70b0f44ef2f7e20ecdb3fd8ca93ae2a05b9a3
2019-09-17 11:05:45 +02:00
Pau Espin 474dc77894 tests: TbfTest: Unify stderr and stdout to ease debugging
osmo-pcu code is really verbose, and since log lines printing start and
end of tests are sent to a different file, it's really difficult to
understand which test outputs what.

Change-Id: I3e887158e2c9585c360d44f12f995f55861170f2
2019-09-16 14:21:21 +00:00
Pau Espin 38cfa734f4 Use osmo_tdef to implement T3190
Change-Id: I0c767c526398d98ca47ef98fdaccfc23af11fb0d
2019-09-16 14:21:21 +00:00
Pau Espin 5211d9deca Use osmo_tdef for BSSGP T1 and T2
Change-Id: I477e5b702c8b956136d93fc1cee01991233e381f
2019-09-16 14:21:21 +00:00
Oliver Smith cfb6321b88 Forward ETWS Primary Notification to MS
Receive an Application Information Request from the BTS via PCU
interface. Construct a Packet Application Information message from it
(3GPP TS 44.060 11.2.47) and send it to all MS with active TBF.

The TTCN-3 test infrastructure to test this feature is not quite ready
yet, so I've added C unit tests instead.

Related: OS#4048
Change-Id: Ie35959f833f46bde5f2126314b6f96763f863b36
2019-09-14 15:28:43 +00:00
Pau Espin 5360ef5447 bts.cpp: Fix osmo_tdef initialization on older g++ compilers
Fixing errrors spotted:
bts.cpp:78:1: error: uninitialized const member 'osmo_tdef::T'
 };
 ^
bts.cpp:78:1: error: uninitialized const member 'osmo_tdef::default_val'
bts.cpp:78:1: error: uninitialized const member 'osmo_tdef::unit'
bts.cpp:84:1: error: uninitialized const member 'osmo_tdef::T'
 };
 ^
bts.cpp:84:1: error: uninitialized const member 'osmo_tdef::default_val'
bts.cpp:84:1: error: uninitialized const member 'osmo_tdef::unit'

Change-Id: I2dfecf22516f52cc19e0a0442e70dbc4dbc61336
2019-09-13 12:42:38 +02:00
Alexander Couzens e46d8dcaab tbf_dl: add comments to the scheduler
Change-Id: Ib037f9fda30472313c7a82effb1e925c6abebbe5
2019-09-12 16:49:21 +00:00
Pau Espin 28f160e76c Introduce osmo_tdef infra and timer VTY commands
This will allow for configuration of some of the timers by the user,
and allow him to inspect current values being used.
It will be also useful for TTCN3 tests which may want to test some of
the timers without having to wait for lots of time.

Timers are splitted into 2 groups: BTS controlled ones and PCU controlled
ones. The BTS controlled ones are read-only by the user (hence no
"timer" VTY command is provided to change them).

TbfTest.err output changes due to timers being set up correctly as a
consequence of changes. Other application such as pcu_emu.cpp and
pcu_main.cpp had to previosuly set the initial values by hand (and did
so), but apparently TbfTest.c was missing that part, which is now fixed
for free.

Depends: libosmocore.git Id56a1226d724a374f04231df85fe5b49ffd2c43c
Change-Id: I5cfb9ef01706124be262d4536617b9edb4601dd5
2019-09-12 14:17:07 +02:00
Oliver Smith 45fdc44d68 tbf_dl: make preemptive retransmission optional
Since [1], OsmoPCU already starts to retransmit downlink blocks before
the MS has had a chance to receive them and/or send the related
acknowledgement in uplink. Make this optional with the new VTY option
"no dl-tbf-preemptive-retransmission".

[1] e25b5b91f6 ("tbf: Only create dummy frames if necessary")
Related: OS#2408
Change-Id: Id08aed513d4033aa0d4324c6ce07cbb2852f2f92
2019-09-11 06:16:29 +00:00
Oliver Smith 37ae22ab13 doc: update generated VTY reference
Change-Id: I6243a2856df9db0f06e704e51e87113f9b57bb36
2019-09-11 06:16:29 +00:00
Pau Espin a8892a69b3 Use proper API osmo_timer_setup() to set up timer struct
Change-Id: Idd2b0c5247870bee3b3c3e460a6731ee50a47404
2019-09-05 16:21:49 +02:00
Pau Espin ef1fe58e19 cosmetic: tbf: Rename T and N arrays
Those namings my collide with usual osmocom "T" variable name associated
to a timer number, which will be added in following patches.

Change-Id: Ic2b5068a4882e4a043bf81496be30a378fdb9a09
2019-09-05 14:40:26 +02:00
Vadim Yanitskiy df0fd8ba27 osmobts_sock.cpp: do not print the same debug message twice
The following message is printed by the pcu_tx_txt_ind():

  DL1IF INFO pcu_l1_if.cpp:113 Sending XXX TXT as PCU_VERSION to BTS

There is no need to print it twice:

  DL1IF INFO osmobts_sock.cpp:74 Sending version XXX to BTS.
  DL1IF INFO pcu_l1_if.cpp:113 Sending XXX TXT as PCU_VERSION to BTS

Change-Id: Ic2793f20cf9df2fa08c45070a8f81ef1c08b925a
2019-08-27 11:06:11 +02:00
Vadim Yanitskiy 9e5ef54594 osmobts_sock.cpp: pcu_sock_read(): further simplify the code
Change-Id: Ie7c0ca8baf0ae5beadda60bda0bc76a44664d439
2019-08-27 11:06:00 +02:00
Vadim Yanitskiy c7849c2dfe osmobts_sock.cpp: pcu_sock_read(): use stack buffer, not heap
We don't really need to use the message buffer (on heap), because
it's never getting passed to pcu_rx(). Let's use a buffer on stack.

Change-Id: I4cb8ca80513df7b71e1438da2e82799be6be1fa0
2019-08-23 18:03:37 +02:00
Vadim Yanitskiy aef6bf43e5 osmobts_sock.cpp: pcu_sock_cb(): use libosmocore's socket API
Change-Id: I7f5c7f5744ab14f36f46cf7941e91352eca8d2b9
2019-08-23 18:03:37 +02:00
Alexander Couzens 2585451408 tests: test encoding of egprs ul ack/nacks
Test the encoding with uncompressed and compressed acknowledgements.

Change-Id: I35d6b5e312faeb116ddda6b33c550840da1496fe
2019-08-12 08:40:04 +00:00
Pau Espin 19b15a5b93 Bump version: 0.6.0.88-3bcc → 0.7.0
Change-Id: I98719f38c490b70983f2dca24ef743abc00b7d28
2019-08-07 21:09:53 +02:00
Pau Espin 3bcc7ab418 Require newer libosmocore to avoid compile failures
Older commit started using OSMO_IMSI_BUF_SIZE, only available in
libosmocore 1.1.0 onwards, but forgot to increase the values in
configure.ac.

Fixes: 2c076bcb4d
Change-Id: Iaf5f276a092c695a5f077551d9784652c2289424
2019-08-07 21:07:49 +02:00
Pau Espin cd2ac56bd4 Remove undefined param passed to {logging,osmo_stats}_vty_add_cmds
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its
parameter removed (c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7). However,
definition in C file doesn't contain "(void)", which means number of
parameters is undefined and thus compiler doesn't complain. Let's remove
parameters from all callers before enforcing "(void)" on it.
API osmo_stats_vty_add_cmds never had a param list but has seem problem
(no "void"), so some users decided to pass a parameter to it.

Related: OS#4138
Change-Id: Ic1ac815eafab49577ff883a5d700ecca5936d216
2019-08-05 14:30:47 +02:00
Vadim Yanitskiy 2c076bcb4d gprs_bssgp_pcu_rx_dl_ud(): use OSMO_IMSI_BUF_SIZE
Change-Id: Ia1da9f005b7f801872c542d31cc8eabd859d997a
2019-07-24 20:39:57 +00:00
Vadim Yanitskiy 6170ac041f gprs_bssgp_pcu.cpp: check return code of gsm48_mi_to_string()
Change-Id: Id1ad279ce9bef38eb3d11ac62337276207e8d8bd
2019-07-24 20:39:57 +00:00
Vadim Yanitskiy aad87b66e8 gprs_bssgp_pcu_rx_dl_ud(): fix: BSSGP_IE_IMSI is optional
Change-Id: I940d220a399166122f33e67a222dd572085e1401
2019-07-24 20:39:57 +00:00
Eric Wild ab8b01effd ubsan: fix shift
Ubsan complains about shifts into the sign bit due to automatic int
promotion, so cast explicitly.

Change-Id: I6387c7313832f6c7c920e1016b74562b66d6b68e
Related: OS#4029
2019-07-24 19:28:38 +00:00
Harald Welte 7b7f2048b8 bssgp: Fix dead code: PDUT_STATUS can never reach this part
Change-Id: Iae4332cd3b87f37164655d3df16554de4876159d
Closes: CID#188855
2019-07-21 09:26:56 +02:00
Thorsten Alteholz 8bb7904458 fix spelling errors detected by lintian
Change-Id: I381618eb55cc513cfa9c2e384c27cead0935c8bf
2019-07-17 10:56:19 +00:00
Max f3038e7b2a Use libosmocore for IMSI parsing
Change-Id: Iec5c65776fc54b2f9e5dd55c711ace2471662db1
2019-07-16 04:19:21 +00:00
Vadim Yanitskiy f17dfc062a src/pcu_l1_if.cpp: fix: properly pass measurements from PCUIF
The recent versions of OsmoBTS do provide the following measurements:

  - RSSI (Received Signal Strength Indication),
  - ToA (Timing of Arrival),
  - BER (Bit Error Rate),

as well as C/I (Carrier-to-Interference ratio) since [1] (OS#4006).

[1] https://gerrit.osmocom.org/r/Ia58043bd2381a4d34d604522e02899ae64ee0d26

Change-Id: I0fd6c35e8cf0b1314f4e3c336b233b5f7e42dfc6
Related: OS#1855
2019-07-16 04:11:20 +00:00
Alexander Couzens 210ccf4a1d Encoding: ACK/NACK: always encode with length field present
In most cases the length field was present and this field takes 7
bits of the maximum available 110 rest bits.
The length field was only removed when encoding huge bitmaps usually
only happen on lossy connections with packet lost.
However the cases without length field were encoded incorrect,
because all remaining bits must be used by the uncompressed bitmaps,
but the PCU violates this by encoding always the "release 5" bit.
Rather than fixing the encoding without length field, simply remove it
and always encode with length field. This also reduces the code
complexity.

Change-Id: I7bc2e18d647b72b8f17ba7a5c9c5e421d88275fb
2019-07-11 18:38:45 +02:00
Oliver Smith 5c3a9880ca contrib/jenkins.sh: run "make maintainer-clean"
Related: OS#3047
Change-Id: I733df8f8bfaf448a6507c9c9d75d2f076fedb342
2019-07-11 03:38:37 +00:00
Alexander Couzens e4e70d052e Encoding: use uint16_t when interacting with the window object
The ESN, SSN and uncompress bitmap len are uint16_t. The Window is using uint16_t in
function arguments and return values. Don't do so many integer conversions.

Change-Id: If62fa09d7bfa8e91ce707824f7019edb1b83da9e
2019-07-11 03:23:52 +00:00
Alexander Couzens fba931bab6 bts.cpp: ensure left-shift operation does not exceed uint32_t
Found by Asan
Relates: OS#4029
Change-Id: I21640e40e689016d6fb80a8db4257b22e85b303b
2019-07-11 03:22:15 +00:00
Alexander Couzens 243a204021 Encoding: write_packet_ack_nack_desc_egprs: don't use a reference for rest_bits
The rest_bits are never read after calling this function nor are rest_bits
updated properly.

Change-Id: Ic350b0365b125638a6c752f692bef981ad6b9d89
2019-07-11 00:27:15 +02:00
Alexander Couzens 2d24eba903 decompress_crbb: add length argument for search_runlen
search_runlen() must know the exact size in bits when parsing
the bits otherwise it read over the buffer.
Fixes testcase #7 which was wrongly decoded.

Change-Id: Ie34a0651e7e7efea4e9ecff1e3a467588113cf47
2019-06-24 13:51:06 +00:00
Alexander Couzens 3a499f3cb2 Encoding: drop struct gprs_rlcmac_bts* from all functions
The bts is not used at all.

Change-Id: Ia07755e825913a16352ab13f6cf55f2918de8681
2019-06-24 13:48:43 +00:00
Alexander Couzens 0d482c5c97 rlc: replace int with uint16_t
The i value will only count forward and is limited to 11 bit. The integer is also
converted when returning to uint16_t

Change-Id: Ib8a9081bbcb8b4344498254c58941002d17f9381
2019-06-24 13:48:09 +00:00