Commit Graph

1459 Commits

Author SHA1 Message Date
Pau Espin 9c4f9ffec1 pdch: Log hexdump of decde failure for dl rlcmac block
Change-Id: I591212a43bf92984348d1992df8c9b4fdddeba3b
2020-11-23 16:36:42 +01:00
Pau Espin 7d3ee9ed8d pdch: packet_paging_request: Put back non-fitting paging entry where where it was
dequeue_paging() dequeues the first paging (at the start of the list).
If a paging request is dequeued but later it cannot be added to the
message being sent, it has to be re-added to the list for later
processing on next message. However, existing code was enqueueing it at
the end, which meant that paging request was delayed for no reason.

Change-Id: Iad8e7045267d56e32f42db0fbb8448b1b1185f05
2020-11-23 16:04:11 +01:00
Pau Espin 228628860f Support multiplexing of GPRS and EGPRS TBFs in one PDCH
There are some restrictions to have both GPRS-only and EGPRS MS attached
to the same MS:
* Any MS needs to be able to successfully decode a DL block at least
  every 18 DL blocks (360 ms). That means a Dl block with CS1-4 must be
  sent at least once during that time.
* Any MS needs to be able to decode USF targeting it. GPRS-only MS can
  successfully decode USF from DL blocks using GMSK: CS1-4 and MCS1-4.

In this patch, if USF of a GPRS-only MS is selected, then all DL EGPRS
TBFs are discarded from data block selection. However, this logic can be
further improved later by still allowing selection of DL EGPRS TBFs and
then forcing construction of a DL EGPRS data block using MCS1-4.

Sources:
* 3GPP TS 03.64 version 8.12.0 "6.6.4.1.1.2 Multiplexing of GPRS and EGPRS MSs"
* 3GPP TS 05.08 version 8.23.0 "10.2.2 BTS output power"

Related: OS#4544
Change-Id: Ib4991c864eda6864533363443f76ae5d999532ae
2020-11-17 16:42:15 +01:00
Pau Espin daa6c1c645 sched: Use correct GMSTAP category for EGPRS DL data blocks
Change-Id: I3bd8b6a2328e13543b7d4c4a945e86f14ff35bda
2020-11-17 15:05:10 +01:00
Pau Espin 4c5a7d315c sched: Fix sending GSMTAP DL data blocks with unset USF
Change-Id: Ib5ceb83a85b517ee9bf2c59cf27fe818373abe60
2020-11-17 15:05:10 +01:00
Pau Espin 49efd9b606 encoding: Fix duplicate word in log str
Change-Id: Ifb0b359c43e79bab5599625fae20750ae5a6ae54
2020-11-17 09:52:29 +00:00
Pau Espin e309d80dd4 Fix ctr reports: Remove ctr description from already removed counter
Recent commit removed the counter enum but forgot to remove the
description, so the descriptions were all shifted by 1 counter.

Fixes: 133fe4a852
Change-Id: I82ee9f36d60a1fd129ae3a864508fcd886e4bfef
2020-11-13 16:19:25 +01:00
Harald Welte 2bbdf2e3d7 Use osmo_fd_*_{disable,enable}
Change-Id: I16563a1033ad12a32104bfee974045ac4302bc74
Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d
2020-11-11 20:15:37 +00:00
Vadim Yanitskiy cb98894eb1 TLLI 0x00000000 is a valid TLLI, use 0xffffffff instead
The assumption that TLLI 0x00000000 is invalid and can be used
as the initializer is wrong.  Similar to TMSI, 0x00000000 is a
perfectly valid value, while 0xffffffff is reserved - use it.

According to 3GPP TS 23.003, section 2.4, a TMSI/P-TMSI with
all 32 bits equal to 1 is special and shall not be allocated by
the network.  The reason is that it must be stored on the SIM,
where 'ff'O represents the erased state.  According to section
2.6 of the same document, a local/foreign TLLI is derived from
P-TMSI, so the same rule applies to TLLI.

I manually checked and corrected all occurances of 'tlli' in the
code.  The test expectations have been adjusted with this command:

  $ find tests/ -name "*.err" | xargs sed -i "s/0x00000000/0xffffffff/g"

so there should be no behavior change.  The only exception is
the 'TypesTest', where TLLI 0xffffffff is being encoded and
expected in the hexdump, so I regenerated the test output.

Change-Id: Ie89fab75ecc1d8b5e238d3ff214ea7ac830b68b5
Related: OS#4844
2020-11-10 17:06:39 +00:00
Pau Espin 305763dc6f tbf_ul: Log mismatching TLLI on log message
Change-Id: Ia2ac7062c1f3308a1485da6d769cb8a869fa8100
2020-11-06 20:03:24 +01:00
Pau Espin 9897b26e3e gprs_ms: Avoid enabling EGPRS if no MCS are supported
This patch avoids enabling EGPRS on MS objects if BTS/VTY assigned no
MCS supported/available for use.
As a result, if NO MCS is enabled/supported EGPRS won't be used despite
the MS announcing through EGPRS MS class that it supports EGPRS.

Change-Id: Ib19e9e006d851c2147de15f4aec36ab65250bdd3
2020-11-05 15:48:11 +01:00
Pau Espin f1159c559b Fix mcs_is_valid(): UNKNOWN value is not a valid (M)CS
Also add a few more asserts to make sure a valid CS/MCS is passed in
some placed where we expect (M)CS to be set.

Change-Id: I0a973e10cd9477f72d8bd47a06048414b33ae96a
2020-11-05 15:48:04 +01:00
Pau Espin b47b137c66 Fix configuration of initial_(m)cs
Properly clip initial_(m)cs values to be lower-equal than maximum
configured.

Regarding initial_mcs, use values provided by BTS, which were not used
before.

Change-Id: Ifc6bc7c2734d1ae404adc2497afec5366e4f9e50
2020-11-04 21:39:43 +01:00
Pau Espin 87eec1fd74 Get rid of bts->egprs_enabled
BTS simply notifies the PCU about the supported MCS, and PCU is
responsible for providing correct data formatting supported for the BTS
and the target MS.

Related: OS#4544
Change-Id: Ifcf23771bd23afc64ca6fea38948f98f2d134ecb
2020-11-04 21:39:43 +01:00
Pau Espin 133fe4a852 tbf_ul: Allow non-egprs phones if EGPRS is enabled
We'll be able to still serve GPRS-only phones if EGPRS is enabled.

Related: OS#4544
Change-Id: I2e01b9d0de7506e0c0960342d73dba29187fe61f
2020-11-04 21:39:43 +01:00
Pau Espin 569f0d27c7 tbf_dl: Don't fake EGPRS MS class when no related info is available
For instance if PCU received DL data to be sent to an MS from an SGSN,
and the MS is not currently cached in the PCU (because there's no TBF
active for it), it will page it and transmit the DL data to it.
The SGSN is capable of sending (EGPRS) MS Class information in that same
DL data message, so it's the one responsible for providing that
information if not available at the PCU.
In the PCU if we don't have information about that MS and SGSN didn't
provide us information about it, we cannot assume the MS is going to be
EGPRS capable and even less expecting a specific EGPRS MS class.
So let's drop this code.

Related: OS#4544
Change-Id: Icce66cadb51af25ae0c3b3719940eccb548fe33b
2020-11-04 21:39:42 +01:00
Pau Espin 4808d1ceb8 pdch: Process received CS1-4 data blocks regardless of egprs_enabled
EGPRS "enabled" or "not enabled" is a bit of confusing idea, since there
are different levels of EGPRS support. For instance we may have been
instructed by config to not transmit using MCS5-9 (8PSK), or not use
MCS1-9 at all (GMSK+8PSK). However, we cannot control what is sent to us
or what we receive on lower layers, so if the BTS PHY/receiver was able
to decode+receive, let's try to process it anyway...

Related: OS#4544
Change-Id: Ie70ec8e4a2d688762d7d320d6ad58d5a0cc52ea1
2020-11-04 21:39:42 +01:00
Pau Espin 270c9ea5d9 Enable egprs support through PCUIF from BTS/BSC
This VTY command was added due to EGPRS being introduced later as an
experimental feature. It's no longer needed and causes more problems
than goodness (since people sometimes forgets to enable it).

Let's rather simply enable EGPRS support based on what BTS/BSC requests
over PCUIF.

Related: OS#4544
Change-Id: Ic80970a136361584da9c912252a07e7c3c9d85d0
2020-11-04 21:39:42 +01:00
Pau Espin 343ec9b9fd Take into account BTS supported (M)CS values when retrieving the maximum
Change-Id: I2d3a8bbae2f9887400ce56d2f8303ea30abaecfa
2020-11-04 21:39:42 +01:00
Pau Espin 8072e354cc Move EGPRS MS mode set to gprs_ms.cpp
Some tests were wrong (TypesTest) and required modification, since they
were setting a EGPRS MS but then expecting a GPRS assignment.

Change-Id: I9d3ee21c765054a36bd22352e48bde5ffca9225a
2020-11-04 21:39:42 +01:00
Pau Espin d87722d03c pcuif: Improve BTS-supported CS/MCS handling
Take into account the MCS values supported by the BTS. In osmo-bts,
in general all MCS are enabled if "mode egprs" is selected in BSC,
and none otherwise.

Change-Id: Ie8f0215ba17da1e545e98bec9325c02f1e8efaea
2020-11-04 21:39:42 +01:00
Pau Espin 46fd7a0316 Move BTS initial values inside bts.cpp
This way everytime any program or test initiates a BTS object, the
bts_data structure has the same values.

Change-Id: Iffd6eecb1f08bda0091f45e2ef7c9c63b42e10b3
2020-11-04 19:32:12 +00:00
Alexander Couzens a2848546d2 NS2: follow the change of ownership
When receiving a primitive from the NS2 layer
the PCU must free the msg buffer if given.

Change-Id: I180433735bfbb3375c41318d7a7709d5845199ba
2020-11-03 22:37:49 +00:00
Vadim Yanitskiy 2c1fed20ab BSSGP: constify argument 'tp' of gprs_bssgp_pcu_rx_paging_{cs,ps}
Change-Id: I24e48964a0ff86c2ca962ab3928d07b1c9200390
2020-11-02 09:10:00 +00:00
Vadim Yanitskiy e9bddabc01 BSSGP: use tlvp_val8() in gprs_bssgp_pcu_rx_paging_cs()
Change-Id: Ic1e37cb9938323c9b9f0466be5cf7251a6db1008
2020-11-02 09:10:00 +00:00
Pau Espin b6450840dc gprs_ms: Use proper function to get CS
Change-Id: I161e733991ac4fa7bd25a0f12b20e5701c76fc52
2020-10-30 19:44:43 +01:00
Pau Espin 758ace867b tbf_dl: Update (egprs_)ms_class for already known MS
If SGSN provides us with MS class information upon DL data, let's use it
and set it in an already existing MS object if not yet known.

Also remove all unneeded code passing ms_class to append_data() which
would simply try to (again) set the ms_class.

Change-Id: I4979c9344bffd3ba7657bbab94981d233eab801f
2020-10-29 12:38:17 +01:00
Pau Espin 16705a4db1 cosmetic: Fix ws between if keyword and parenthesis
Change-Id: I5932f21c58e76552f7187a175b8e281c5846536c
2020-10-29 11:34:17 +00:00
Pau Espin 4d1663594b bts: define egprs_enabled as bool
Change-Id: I66a8254ee392ad75226c58b7df5746f409463f0f
2020-10-29 11:34:17 +00:00
Pau Espin 983bb7eb31 alloc_algo_b: Select TRX with least assigned TFIs during TBF alloc
Before this patch, it would always allocate all TBFs on the first TRX
until all TFIs were filled, then second, and so on. But it would
actually fail around 8th MS requesting an UL TBF because despite a TFI
was successfuly assigned, because all USFs were already exhausted for
that PDCH.

Related: OS#1775
Change-Id: Iccfc8acfbfdc258ed16cc5af01f12b376fe73b72
2020-10-29 11:34:17 +00:00
Pau Espin 528820dbe1 tbf: Clean up gprs_rlcmac_dl_tbf::handle()
Avoid passing tons of params to internal helper function
tbf_nel_dl_assignment() in order to either fetch again the ms object or
create a new one. Let's instead create the ms function earlier if needed
and fill it with all the discovered information prior to calling the
helper function. This provides cleaner code and also better log output.

This way we also avoid trying to fill the MS twice and unneeded
getter+setter for TA.

tbf::imsi(): There' always an ms, so simply forward call to
ms()->imsi().

We can also get rid of assign_imsi, since the modified code is the only
place where it's used and there's already some code in place there to
update the MS. We instead merge it with set_imsi and keep the
duplication code to catch possible bugs from callers.

Move merge_and_clear_ms from tbf class to GprsMS, where it really
belongs.

Change-Id: Id18098bac3cff26fc4a8d2f419e21641a1f4c83b
2020-10-29 11:34:17 +00:00
Alexander Couzens 87c6dd3c26 pcu_l1_if: fix misaligned assignment of remote address
Found-by: asan
Change-Id: I9c87d3fc1b6f03d79b53f1da3a146630061c3459
2020-10-27 15:29:05 +00:00
Pau Espin 9f6d1a85e1 tbf: Drop unused function disable_egprs()
Change-Id: I8e3e1d9e70d46c7ca65ce67c408830f8bd20ce3b
2020-10-25 23:29:20 +01:00
Pau Espin b385969039 Move dl_tbf allocation code to correct file
Change-Id: I50d41b1c6f244edcfb78646d0fac4e47c2e3e561
2020-10-24 22:14:42 +02:00
Pau Espin 442198cd41 Move ul_tbf allocation code to correct file
Change-Id: Ifd98abbcce49e4605c764267965903fbf9f35867
2020-10-24 22:14:42 +02:00
Pau Espin e9f77d377b tbf: Set MS during constructor time
This is another step forward towards a more clear data model where a TBF
always has a MS object (which may be lacking some information, and at a
later point when more information is found, it may actually be a
duplicated MS object and hence one duplicate removed and the TBF moved
to the object being kept).

This helps for instance in removing duplicated information stored in
the TBF which is really per MS, like ms_class, ta, etc. Since there's
always a MS object there's no need to keep a duplicate in both classes
in case there's no MS object.

It can already be seen looking at unit test logging that this kind of
data model already provides better information.
Some unit test parts were needed to adapt to the new model too.

Change-Id: I3cdf4d53e222777d5a2bf4c5aad3a7414105f14c
2020-10-24 22:14:42 +02:00
Pau Espin 7bde60f260 tbf: Implement enable_egprs() once
There's no real need for having different copies of this method in each
children. Furthermore, having the method implemented in the base class
made me shoot my foot while trying to move this to the tbf constructor
(see next commit), so let's simplify this and avoid other people
following into the same issue.

enable_egprs() in tbf.h is moved to be public since it needed (as it was
for the duplicated children mehtods with same name), but anyway it will
be moved to private in next commit.

Change-Id: Id7de060318201a42e51f277f898463f4b9a84eba
2020-10-24 22:14:42 +02:00
Pau Espin b3f239785c tbf: Make window() available to tbf base class
Return an interface to the window base class so that the tbf base class
can access the common window methods, such as set_ws(). It will be used
in next commit to get rid of duplicated function enable_egprs in both
dl_tbf and ul_tbf subclasses.

The user of the function can then decide to access more specific
functionaltiites of the window class by static casting it to the
specific direction (which is known by the caller since it operates on a
ul_tbf or a dl_tbf).

Change-Id: Ia2e1decf91be1184668e28297c2126affb9c7ae4
2020-10-24 22:14:42 +02:00
Pau Espin 834cbab97d Move constructor gprs_rlcmac_dl_tbf::BandWidth to correct file
Change-Id: I7587fd2ee97424020a099a8513f95544d6635f3d
2020-10-24 19:49:43 +00:00
Pau Espin 9767e44fd4 Move gprs_rlcmac_ul_tbf::window to correct file
It wasn't move when all the UL specific code was moved to a separate
file.

Change-Id: I6f8c2d568ffdea3826ec1e11358d24eea6c9335b
2020-10-24 19:49:43 +00:00
Vadim Yanitskiy 1136fdb563 main: add --vty-ref-mode, use vty_dump_xml_ref_mode()
Change-Id: If82208ecb931a6024f1a83c8648c5855b15dcc96
Depends: Ie2022a7f9e167e5ceacf15350c037dd43768ff40
Related: SYS#4910
2020-10-24 05:15:20 +07:00
Vadim Yanitskiy 35668a2e06 main: remove line breaks in print_help(), increase spacing
Change-Id: I07010afec3bb85d875926813772a6504f3bdb7b5
Related: SYS#4910
2020-10-24 05:14:39 +07:00
Pau Espin a611b4f6a0 Fix several calls to LOGPAL
In those cases since a string pointer was passed, it always printed
"single" instead of whatever really was being used, since the string
pointer was not NULL.

Change-Id: Idab7d18e8f519e10fc3df4007634661c46f9256d
2020-10-23 17:13:04 +02:00
Pau Espin 8353d97904 Improve debug logging for alloc algos
In general we want to see explicitly the kind of requested allocation at
the start. The MS class is not needed since it's printed in the previous
log line in any case.

Change-Id: I9eb0a592c15be96da9d140ff373c1afead76b18c
2020-10-23 17:08:43 +02:00
Harald Welte 8347359cb0 Use osmo_fd_setup() whenever applicable
Change-Id: I8abd4c50b172f6b312bb4ba3c29e74396f6e6b93
2020-10-19 11:36:33 +00:00
Vadim Yanitskiy a6c5db954f fix tbf_select_slot_set(): use LOGP() instead of LOGPC()
Change-Id: I8e9ae854d147735357921f71d9a02862376a50b2
2020-10-16 22:33:54 +07:00
Alexander Couzens 5bece2a0ed Rework NS configuration over the info indication
Add support of the second NSVC in the info indication.
Add support to update a previous NS configuration.
Allow to update of a NS-VC while the NSE is still available over the
second.

Depends-on: I917f25ebd1239eae5855d973ced15b93731e33a0 (libosmocore)
Depends-on: I3a0cd305fd73b3cb9ec70246ec15ac70b83e57f2 (libosmocore)
Depends-on: I5a2bb95d05d06d909347e2fb084a446ead888cb3 (libosmocore)
Depends-on: I54f110acc3acccb362f6e554324d08cc42b7c328 (libosmocore)
Depends-on: Ia00753a64b7622a0864341f51ea49b6963543755 (libosmocore)
Depends-on: Ic8f6f8aca10da23a18fab8870be7806065a34b47 (libosmocore)
Depends-on: I5f67e6a9bf4cb322bd169061fee0a528012ed54d (libosmocore)
Change-Id: I589ebaa2a2b7de55b7e4e975d8fd6412dd5f214b
2020-10-13 08:45:30 +00:00
Vadim Yanitskiy 974cc7b324 gprs_bssgp_pcu: fix: do not crash on receipt of subsequent INFO.ind
It's expected to receive subsequent INFO.ind messages at run-time,
e.g. when a dynamic TCH/F_TCH/H_PDCH timeslot is switched from
PDCH to TCH/F or TCH/H, osmo-bts would send us INFO.ind with the
updated PDCH slot-mask indicating that this timeslot is disabled.

In gprs_nsvc_create_and_connect(), do not bind() on the received
NSVC address unconditionally - we may already be bound to it.
Instead, return early and keep everything unchanged.

I don't know how the PCU is supposed to handle NSVC address change,
at least the new NS2 library does not handle this internally, nor
it provides any API for that.  Let's leave it for later.

Change-Id: I159138e41e147cd30212da548b0ccd3f81d61b4e
Related: I4c3bc883d795e5d1ee5ab175ac03684924692a7c
Fixes: Ib389925cf5c9f18951af6242c31ea70476218e9a
Related: SYS#5108
2020-10-10 06:16:11 +07:00
Vadim Yanitskiy d038361e95 struct gprs_rlcmac_bts: remove unused 'nsei' field
The code in gprs_nsvc_create_and_connect() stores NSEI there for
no reason, despite it's already stored in struct gprs_ns2_nse.

Change-Id: Ib30152a12384cf0448104a1ee1cfb949f4a27553
2020-10-10 05:05:33 +07:00
Vadim Yanitskiy 0d0ac1b949 gprs_bssgp_pcu: fix possible memleak in gprs_nsvc_create_and_connect()
Change-Id: I9f44cd22b1353ded6eeb2fe9f8dd4818de758003
2020-10-10 05:05:33 +07:00
Vadim Yanitskiy 194b6f06a0 gprs_bssgp_pcu: make osmo_sockaddr local/sgsn arguments const
Change-Id: I40e51de300533cfcbb3c9f90a0858a489a3c2b6b
Depends: I0df6a00ac1830bd64a10b9336b827e113fa772bb
2020-10-09 21:43:09 +00:00
Philipp Maier 08c5037d60 pcu_main: add commandline option --vty-ref-xml
The commandline option --vty-ref-xml is needed to enable automatic
generation of the VTY reference manual.

Change-Id: Ie1829a06b83f69f4cd8256adbf9437388ca3d7e0
Related: SYS#4937, OS#1601
2020-10-09 20:42:16 +02:00
Vadim Yanitskiy 781f04a8f8 pcu_l1_if: print NSVC address in more common format
Change-Id: I5aac1b0624d127ef92a7b9c791f6b409e9e6055a
2020-10-09 20:54:03 +07:00
Vadim Yanitskiy 24c643e143 pcu_l1_if: use proper format string specifiers: %d -> %u
Change-Id: Ieb81dcb4096acbc7a308d003c9e653800071e149
2020-10-09 20:34:21 +07:00
Vadim Yanitskiy 19622aee5b pcu_l1_if: cosmetic: make {local,remote}_sockaddr scoped variables
Change-Id: Ib5ddf3622226ac9c612a03ca32d373bcc9b208cf
2020-10-09 20:03:16 +07:00
Vadim Yanitskiy c1a726c573 pcu_l1_if: correct logging level in pcu_rx_info_ind()
Change-Id: Ib4bb9b907fc2bf279cf22a3bb9b95ea1a0fb3db6
2020-10-08 23:03:39 +07:00
Vadim Yanitskiy 5d5b50aaf3 pcu_l1_if: cosmetic: use ARRAY_SIZE() in pcu_rx_info_ind()
Change-Id: Iff11c854b1687f75c1125a5bcd616da95ade69ee
2020-10-08 23:03:36 +07:00
Philipp Maier 9459ebde32 vty: add attributes to VTY commands indicating when they apply
Change-Id: I63978ce3ea87593c9a41e503ed3b761c64e1e80f
Related: SYS#4937, OS#1601
2020-10-08 07:16:31 +00:00
Alexander Couzens 290d9030e9 Use the new NS2 lib
Depends: Id7edb8feb96436ba170383fc62d43ceb16955d53 (libosmocore)
Depends: I2a9dcd14f4ad16211c0f6d98812ad4a13e910c2a (libosmocore)
Change-Id: Ib389925cf5c9f18951af6242c31ea70476218e9a
2020-10-06 16:38:38 +02:00
Harald Welte 0a369e560c bts.cpp: Increase constructor priority
It seems that some gcc versions do not consider the priority of
"C" __attribute__((constructor)) definitions in the same order as
they do C++ static initializers, which are called in the order in which
they appear in the compile unit (source file).

The problem has been observed at least in a
environment based on T2 SDE with GCC 6.3.0 and binutils 2.28.

Let's work around this by making sure the __attribute__((constructor))
function always gets the highest priority value permitted by gcc (101).

Closes: SYS#5093
Change-Id: I65de69a32ac929e6ddd4e58980027f9e76813153
2020-10-01 19:39:58 +02:00
Pau Espin 84abd2f65e Fix crash accessing NULL tbf->pdch[first_ts]
Fixes consistent crash under some specific scenarios explained in
OS#4756.

The crash was caused due to a bug in channel allocator algorithm
incorrectly populating tbf->pdch[] array as a result of mismatching
first_ts and resulting pdch selected slot bitmask.

The issue happens because when allocating a UL TBF in allocator B, the
subset is always further forced into allocating one single TS. As a
result, on that branch several variables are updated, but first_ts was
not.

The field used to be updated in older versions, but a bug was introduced
during code refactoring in commit listed below (31 Jan 2018).

Fixes: 0cc7212cfd
Related: OS#4756
Change-Id: I79596803f7dab6f21b58bfe39c2af65d9c5b39d5
2020-09-22 20:57:06 +02:00
Pau Espin 01aef5ed8b cosmetic: Fix typo in comment
Change-Id: I6567065b8ec0082b21c371bbd0c2e85fecc96c90
2020-09-22 20:57:05 +02:00
Pau Espin 5d2d2ec466 cosmetic: Fix indentation of for loops
Change-Id: Id7087bd00d9003235688ff34f2b039d525caa777
2020-09-22 20:57:05 +02:00
Pau Espin a1ac2f017f vty: Add 'show bts pdch' command
This allows to see which channels have been enabled according to PCU.

Change-Id: If72e67ba80aab4e0c68408e6996d74d2ff70c322
2020-09-22 20:56:53 +02:00
Pau Espin 5fc95771bb cosmetic: fix indentation alignment
Change-Id: I105cf184a478cf178d69e16cd35fa36c51133a18
2020-09-22 20:46:20 +02:00
Pau Espin bd9973a64f Free all MS TBFs when receiving GPRS Suspension Request
Otherwise the TBFs are kept, and hence PCU will continue reserving resources and
DL data queued will still be sent over the air, despite the MS not
listening anymore on the PDCH.

Change-Id: I4ae1c3706b2ed6e4d271cd16f7cd7f8937b84836
2020-09-22 20:46:15 +02:00
Pau Espin e3ef51ec06 gprs_ms_storage.h: Set pointer to NULL instead of 0
Change-Id: If8acd012909c9f452b609e4a804c9a059379f07d
2020-09-22 13:56:57 +02:00
Pau Espin cd6c466922 tbf: Don't log rlcmac_diag() output in separate lines
Output of all diag in different lines is really confusing, since the
user reads a timeout ocurred and then later in another line something
like "Downlink ACK was received" while no GSMTAP message shows any ACK.

Change-Id: I6a7d79c16c930f0712bc73b308409ececb1946ba
2020-09-22 13:44:15 +02:00
Alexander Couzens 9b5c960f55 pcuif_proto: version 10: add support for IPv6 NSVCs
Introduce a address_type in the NSVC configuration pass the given
protocol.  The remote_ip is network byte order, the default
encoding for in_addr and in6_addr.

Change-Id: Ia0852f9f4395f1248b39363ef90f6f5673b24e2f
Related: SYS#4915
2020-09-22 00:49:28 +07:00
Vadim Yanitskiy 8e2bd1e79d pcuif_proto: version 10: add frequency hopping parameters
Change-Id: I6863830883d90954006a7126c22d348aa2a83271
Related: SYS#4868, OS#4547
2020-09-22 00:49:11 +07:00
Alexander Couzens 40a9e603b9 Revert "pcuif_proto: version 0xa: add support for IPv6 NSVCs"
This reverts commit 38aaa10ed4.
It was to early because the frequency hopping wasn't ready to be merged.

Change-Id: Ibf055d5adfd9bffaaf51cb8468c79be597467e0f
2020-09-16 03:24:55 +02:00
Alexander Couzens 38aaa10ed4 pcuif_proto: version 0xa: add support for IPv6 NSVCs
Introduce a address_type in the NSVC configuration pass the given
protocol.
The remote_ip is network byte order, the default encoding for in_addr and in6_addr.

Change-Id: If26958d5b584973dca79159cf9e7f3f266519ce9
2020-09-15 22:21:43 +02:00
Vadim Yanitskiy 2597cf1494 encoding: fix gen_freq_params(): do not check pdch twice
This is a left-over from an earlier version of [1] that makes
Coverity think that there can be NULL pointer dereference,
even despite we assert(pdch != NULL).

[1] I8adc0cdb1b05a87b4df5d4bc196f6d381283a06f

Change-Id: I3490c38e0c1186dfd2fae63526a05c694547cebb
Fixes: CID#214230
2020-09-10 18:23:03 +07:00
Vadim Yanitskiy 542e388e4f encoding: implement handing of hopping parameters
The following test cases verify coding of the hopping parameters:

  + (RR) Immediate Assignment
    - TC_pcuif_fh_imm_ass_ul_egprs,
    - TC_pcuif_fh_imm_ass_ul,
    - TC_pcuif_fh_imm_ass_dl,

  + (RLC/MAC) Packet Uplink/Downlink Assignment:
    - TC_pcuif_fh_pkt_ass_ul,
    - TC_pcuif_fh_pkt_ass_dl,

all of them pass with this (and the upcoming) change applied.

Change-Id: I8adc0cdb1b05a87b4df5d4bc196f6d381283a06f
Related: SYS#4868, OS#4547
2020-09-08 02:47:02 +07:00
Vadim Yanitskiy db56a3563e encoding: use CSN.1 codec to generate Packet Uplink Assignment
It's quite odd to see that in write_packet_downlink_assignment()
we initialize an 'RlcMacDownlink_t', so then the caller can use
the power of CSN.1 codec to generate the final sequence of bytes
to be transmitted, while in write_packet_uplink_assignment() we
already compose the final RLC/MAC message straight away using
the low-level bitvec API (like bitvec_write_field()).

I guess the reason is that at the time of writing this code, the
CSN.1 codec was not stable enough, so it was safer to generate
the message 'by hand'.  This would also explain why we *decode*
the final RLC/MAC message in create_ul_ass() right after encoding.

Rewrite write_packet_uplink_assignment(), so now it initializes
a caller-provided 'RlcMacDownlink_t' structure.  Given that it's
allocated on heap using talloc_zero(), do not initialize presence
indicators of fields that are not present in the message.

This would facilitate handling of frequency hopping parameters
in the upcoming changes, in particular we can now introduce a
function that would compose Frequency Parameters IE for both
write_packet_{downlink,uplink}_assignment().

Tested manually by running a GPRS-enabled network, as well as by
running test cases from ttcn3-pcu-test => no regressions observed.

Change-Id: I2850b91e0043cdca8ae7498a5fc727eeedd029b6
Related: SYS#4868, OS#4547
2020-09-08 02:47:02 +07:00
Vadim Yanitskiy 962d717f41 encoding: clarify docstring for write_packet_downlink_assignment()
Change-Id: I7c4458c2e7767b6cf03462ba79acdd9c9904ee83
2020-09-08 02:47:02 +07:00
Pau Espin 1d68cdff92 Fix recent typo preventing MS from registering
Fixes: 0052051c07
Change-Id: Icbbf7340d78ef709ea00d527036533a14e9c21f9
2020-08-26 13:43:39 +02:00
Vadim Yanitskiy 1156776572 encoding: pass pdch slot directly to encoding functions
In order to be able to encode frequency hopping parameters, let's
pass a const pointer to 'gprs_rlcmac_pdch' (PDCH slot) directly,
instead of passing all related parameters separately.

Change-Id: I6bccad508f0fdccc4a763211008dd847a9111a8d
Related: SYS#4868, OS#4547
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy a76cdaceb2 encoding: use bool for use_egprs in write_packet_uplink_assignment()
Change-Id: Iab4fb44c666a0d4fe8c98f5ff9221e23a6f1f2fa
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy 59d64fb234 encoding: fix RRBP field in write_packet_uplink_assignment()
Do not hard-code 0x00, write what was passed as a parameter.

Change-Id: I9eb362292e9f4c16d4b8f8d4253df0422062eeb4
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy 7a1fdfde8a encoding: do not encode out of range Timing Advance values
According to 3GPP TS 44.060, section 12.12 "Packet Timing Advance",
the 'TIMING_ADVANCE_VALUE' field is optional, and takes 6 bits
if present.  This means that a value that fits in range 0..63
(inclusive) can be encoded (0b111111 == 63).

It's possible that tbf->ta() returns GSM48_TA_INVALID == 220,
so the bitvec API would encode only 6 LSBs of it:

  220 & 0b111111 == 28

Let's ensure that the 'TIMING_ADVANCE_VALUE' is present iff
tbf->ta() returns a correct (0 <= x <= 63), and absent otherwise.

Change-Id: I342288ea4ef1e218e5744e9be6a8e528d4e697fa
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy c0ddaa94e6 encoding: constify 'tbf' in UL/DL assignment functions
Change-Id: I9b80ce22914a355592502c936046b233c3ba216d
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy e4bcd2103c tbf: allocate the bitvec on stack in create_{dl,ul}_ass()
Initialize the bit vector to use already allocated memory,
so we would not need to allocate additional 23 bytes and
copy them from the bit vector to a msgb.

Change-Id: I4190707d7fa5b1c4c3db745635f88d5afb9e21ca
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy c82c1f5efc tbf: cosmetic: use GSM_MACBLOCK_LEN where possible
Change-Id: Ib42770cb009e8d559f733ebedd058e2f0a18820a
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy 48587d5475 gsm_rlcmac: use consistent naming for [Extended] Packet Timing Advance
Change-Id: I6382c81f7569b4c5a68521c04f6b03a34bfc39dd
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy 1d52c1e02e pcu_l1_if: cosmetic: correct error message in pcu_rx_info_ind()
Change-Id: I26ad0e990f6bf049a14f63b1255722d60c7ff868
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy 0f41b710b7 pcu_l1_if: cosmetic: move struct 'gprs_rlcmac_pdch' into the for loop
Change-Id: I5bc270ddb6064e5086a801061c2eff074c293e77
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy 11b0f00c00 pcu_l1_if: cosmetic: rename both 'trx'/'ts' to 'trx_nr'/'ts_nr'
Change-Id: Id481eba9bd462e411b2ba047ee5b849ddba8ac6b
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy ce0dae9fda pcu_l1_if: constify the argument of pcu_rx_info_ind()
Change-Id: I0b146c9f8c1e566c3aff4bd7869ca9699f888d4f
2020-08-24 10:53:08 +00:00
Vadim Yanitskiy fad2128d17 pcu_l1_if: use proper format specifier for PCUIF version
Change-Id: Ibd15a678a7a8fc840422e2280b0d358138a67e0c
2020-08-24 10:53:08 +00:00
Pau Espin b69928cfaf pdch: rcv pkt meas rep: Allocate MS object early in path and use it
Let's create the MS object early if doesn't exist and fill in the
information, so that we can operate on it in an early way (for instance,
logging macros), this way it's easier to trace the lifecycle of
subscribers.

Change-Id: I3ec7eb970310698dd228ae6ad65ec5ca833bab3f
2020-08-24 07:50:49 +00:00
Neels Hofmeyr 59fc0bda6e paging: pass struct osmo_mobile_identity, not encoded IE bytes
In get_paging_mi(), before this, an encoded buffer of Mobile Identity bytes is
returned. Code paths following this repeatedly decode the Mobile Identity
bytes, e.g. for logging. Also, in get_paging_mi(), since the TMSI is read in
from a different encoding than a typical Mobile Identity IE, the TMSI was
manually encoded into a typical Mobile Identity IE. This is essentially a code
dup of osmo_mobile_identity_encode(). Stop this madness.

Instead, in get_paging_mi(), return a decoded struct osmo_mobile_identity. Code
paths after this use the struct osmo_mobile_identity directly without repeated
decoding.

At the point of finally needing an encoded Mobile Identity IE (in
Encoding::write_paging_request()), do a proper osmo_mobile_identity_encode().

Since this may return errors, add an rc check for the caller of
write_paging_request(), gprs_rlcmac_paging_request().

A side effect is stricter validation of the Mobile Identity passing through the
Paging code path. Before, invalid MI might have passed through unnoticed.

Change-Id: Iad845acb0096b75dc453105c9c16b2252879b4ca
2020-08-24 01:12:16 +00:00
Neels Hofmeyr 0052051c07 use new osmo_mobile_identity api (avoid deprecation)
Note: subsequent patch Iad845acb0096b75dc453105c9c16b2252879b4ca will change to
passing a struct osmo_mobile_identity in the Paging code path, instead of
passing the encoded IE data.

Change-Id: Ibb03b8e601160427944f434761ca59811d1fc12f
2020-08-21 16:40:14 +02:00
Pau Espin b75c27febd Support setting rt-prio and cpu-affinity mask through VTY
Change-Id: I92bfabd57fab28b23bd4494a577373106be1daec
Depends: libosmocore.git Change-Id If76a4bd2cc7b3c7adf5d84790a944d78be70e10a
Depends: osmo-gsm-masnuals.git Change-Id Icd75769ef630c3fa985fc5e2154d5521689cdd3c
Related: SYS#4986
2020-08-20 08:44:54 +00:00
Pau Espin f2dad593ae Introduce log macro helper LOGPMS
Change-Id: Ib304ced06531a5154b7ec8bf87f9717dfd7d1397
2020-08-18 20:26:25 +02:00
Pau Espin 5f10fbb166 pdch: Drop unneeded notice log message in rcv pkt meas report
It's totally fine to receive Packet Measurement Report messages with no
SBA present, since the MS also sends measurements on PACCH while
transmitting data.

Related: OS#4719
Change-Id: I8f642d9cdeb342df7d5f2fa30516ea69554a6270
2020-08-18 19:39:26 +02:00
Pau Espin a2c574ede1 Fix typo in log message
Change-Id: Ifd65542eca9180a2fcaaca290861396569e453ec
2020-08-17 18:15:46 +02:00
Vadim Yanitskiy 811c90c5fd direct-phy: fix handle_ph_ra_ind(): handle PH-RA.ind on PRACH SAPI
In [1] I restricted L1 SAPI of PH-RA.ind to PDTCH and PTCCH, and
this seems to have caused a regression reported in [2]:

  DL1IF ERROR sysmo_l1_if.c:251 Rx PH-RA.ind for unknown L1 SAPI PRACH

I assumed that PH-RA.ind belonging to a Control Acknowledgement
message (in format of 4 Access Bursts) would have PDTCH SAPI,
while apparently it's actually arriving on PRACH.

[1] I482d60a46b9d253dfe0b16140eac9fea6420b30c
[2] https://osmocom.org/issues/1526#note-39

Change-Id: Ib0a6da37de7a1db4cad2b96293b31b9f32e7d9eb
Related: OS#1526
2020-08-12 18:20:33 +00:00
Vadim Yanitskiy 9d5a115ee2 encoding: assert() presence of Downlink TBF
This is not something that should normally happen.  If it happens,
then it's definitely a bug, and we should not tolerate it.

Change-Id: I6e46ba42650f0db2399649b536a1d2b3f0fcbf04
2020-07-18 20:54:24 +07:00
Vadim Yanitskiy 8f628ab77f encoding: drop log_alert_exit(), use OSMO_ASSERT() instead
Change-Id: Id5ef1c3c08dc7f264ad801e519d727d86f5ae5b8
2020-07-18 20:47:47 +07:00