aboutsummaryrefslogtreecommitdiffstats
path: root/src/bts.h
AgeCommit message (Collapse)AuthorFilesLines
2021-02-22Use ALPHA value received in SI13 from PCUIFPau Espin Pedrol1-0/+3
The old VTY command is marked as deprecated and still overrides the use in case it's used. Related: SYS#5358 Depends: libosmocore.git Change-Id I74fb0a3afc1ac4aadbfc609b882d929401f790eb Depends: osmo-bsc.git Change-Id I8b97ea11bad5fe05f2f634945b5703ee9abde81d Change-Id: I46f2a955b157a409055fca7fb917dc4f75482426
2021-02-02gprs_bssgp_rim: add serving BSS NACC applicationPhilipp Maier1-0/+4
Answer an incoming RAN INFORMATION REQUEST RIM PDU with RAN INFORMATION PDU that contains system information type 1, 3 and 13 Depends: osmo-bts I5138ab183793e7eee4dc494318d984e9f1f56932 Change-Id: Id72118120c14984d2fb1b918b41fac4868150d41 Related: SYS#5103
2021-01-29Introduce NACC supportPau Espin Pedrol1-0/+5
A new nacc_fsm is introduced per MS object, with its partner priv structure struct nacc_fsm_ctx, which exists and is available in the MS object only during the duration of the NACC procedure. The NACC context is created on an MS whenever a Pkt Cell Change Notification is received on Uplink RLCMAC, which asks for neighbor information of a given ARFCN+BSIC. First, the target ARFCN+BSIC needs to be translated into a CGI-PS (RAC+CI) address. That's done by asking the BSC through the Neighbour Resolution Service available in osmo-bsc using the CTRL interface. Once the CGI-PS of the target cell is known, PCU starts a RIM RAN-INFO request against the SGSN (which will route the request as needed), and wait for a response containing the SI bits from the target cell. After the SI are received, the scheduler is instructed to eventually poll a TBF for the MS originating the CCN, so that we can send the SI encapsulated into multiple Packet Neighbor Cell Data messages on the downlink. One all the SI bits are sent, the scheduler is instructed to send a Packet Cell Change Continue message. Once the message above has been sent, the FSM autodestroys itself. Caches are also introduced in this patch which allows for re-using recently known translations ARFCN+BSIC -> CGI-PS and CGI-PS -> SI_INFO respectively. Change-Id: Id35f40d05f3e081f32fddbf1fa34cb338db452ca
2021-01-20bts: Store RAC+CI from info_indPau Espin Pedrol1-0/+1
Having those values at hand will be needed later for RIM / NACC related purposes. Change-Id: Ia3596e9e81cd71443be2cc6f2450bb7f91d2667d
2021-01-20Allow multiple bts objects in PCUPau Espin Pedrol1-2/+5
This patch doesn't really tests whether osmo-pcu can work on a multi-bts environment, but it prepares the data structures to be able to do so at any later point in time. Change-Id: I6b10913f46c19d438c4e250a436a7446694b725a
2021-01-19Move tbf::free_all static methods to proper object filesPau Espin Pedrol1-0/+1
Move each method to the object on which they operate, be it a trx or a pdch ts. Change-Id: Ida715cbf384431d37b2b192fbd7882957c93a4d1
2021-01-19Get rid of bts singletonsPau Espin Pedrol1-3/+0
There's no BTS single global object anymore, get rid of those APIs. Move users to use "pcu->bts", which will evolve to a linked list in the future. Change-Id: I9cf762b0d3cb9e2cc3582727e07fa82c8e183ec5
2021-01-19Unify BTS into a C usable structurePau Espin Pedrol1-201/+123
Previous work on BTS class started to get stuff out of the C++ struct into a C struct (BTS -> struct gprs_glcmac_bts) so that some parts of it were accessible from C code. Doing so, however, ended up being messy too, since all code needs to be switching from one object to another, which actually refer to the same logical component. Let's instead rejoin the structures and make sure the struct is accessible and usable from both C and C++ code by rewriting all methods to be C compatible and converting 3 allocated suboject as pointers. This way BTS can internally still use those C++ objects while providing a clean APi to both C and C++ code. Change-Id: I7d12c896c5ded659ca9d3bff4cf3a3fc857db9dd
2021-01-18Fix configuration mess of initial_cs/mcs between PCUIF and VTYPau Espin Pedrol1-0/+6
Both values (optionally) set (forced) by VTY and the values received from PCUIF were stored in the same variable, meaning that for instance the PCUIF values wouldn't really be used if someone applied eg "no cs" during runtime. This commit does something similar to what was already done for the max_(m)cs fields. We store PCUIF values in one place and VTY ones in another place, and then trigger a bts object internal process to find out exactly which initial CS should it be using. Change-Id: I80a6ba401f9c0c85bdf6e0cc99a9d2008d31e1b0
2021-01-18Move llc_* fields from BTS to PCUPau Espin Pedrol1-4/+0
Change-Id: Iffb916e53fdf99164ad07cd19e4b35a64136307e
2021-01-18Move ws_* fields from BTS to PCUPau Espin Pedrol1-2/+0
Change-Id: I997bc52f0d924c8f2a0b1d6cf23af98828ad4258
2021-01-18Move fc_* fields from BTS to PCUPau Espin Pedrol1-6/+0
Change-Id: I816d49e732d0fc7a3c9aa1f0e9a83b83d25e6a32
2021-01-18Move ns_dialect field from BTS to PCUPau Espin Pedrol1-3/+0
Change-Id: Iffb22b776b91f93d6d2a7ccfa47deeecc22c33f0
2021-01-18Move (m)cs_lqual_ranges fields from BTS to PCUPau Espin Pedrol1-3/+0
Change-Id: I39e2fc7e229851610d797c594d84902af6079411
2021-01-18Move cs_downgrade_threshold field from BTS to PCUPau Espin Pedrol1-4/+0
Change-Id: I3e1c65eb3cccff565d5d84588bdce93a47909a0f
2021-01-18Move cs_adj* fields from BTS to PCUPau Espin Pedrol1-3/+0
Change-Id: I2b00a83279dccd4feeeeb95e34878c4405e7972c
2021-01-18Move dl_arq_type field from BTS to PCUPau Espin Pedrol1-2/+0
Change-Id: I0b82ab59edd58d60e5581c707dc49f58de0ba203
2021-01-18Move dl_tbf_preemptive_retransmission field from BTS to PCUPau Espin Pedrol1-1/+0
Change-Id: I3ab32fcafe83f3ecb116a5b8a05f58f3fddc5451
2021-01-18Move alpha,gamma fields from BTS to PCUPau Espin Pedrol1-1/+0
Change-Id: I2fdd9c8a7393157183fff64084bb10e2a3b1dc63
2021-01-18Move force_two_phase field from BTS to PCUPau Espin Pedrol1-1/+0
Change-Id: I68a6e032f725cde87992b99f039c5280e912faf7
2021-01-18Move T_defs_pcu from BTS to PCU objectPau Espin Pedrol1-1/+0
Change-Id: I0cac5c12dff2e90b52d00383a00b4b94a9603a0a
2021-01-18Split PCU global PCU object from BTS objectPau Espin Pedrol1-43/+10
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold both PCU global fields and BTS specific fields, all mangled together. The BTS is even accessed in lots of places by means of a singleton. This patch introduces a new struct gprs_pcu object aimed at holding all global state, and several fields are already moved from BTS to it. The new object can be accessed as global variable "the_pcu", reusing and including an already exisitng "the_pcu" global variable only used for bssgp related purposes so far. This is only a first step towards having a complete split global pcu and BTS, some fields are still kept in BTS and will be moved over follow-up smaller patches in the future (since this patch is already quite big). So far, the code still only supports one BTS, which can be accessed using the_pcu->bts. In the future that field will be replaced with a list, and the BTS singletons will be removed. The cur_fn output changes in TbfTest are actually a side effect fix, since the singleton main_bts() now points internally to the_pcu->bts, hence the same we allocate and assign in the test. Beforehand, "the_bts" was allocated in the stack while main_bts() still returned an unrelated singleton BTS object instance. Related: OS#4935 Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-05Convert GprsMS and helpers classes to CPau Espin Pedrol1-5/+11
As we integrate osmo-pcu more and more with libosmocore features, it becomes really hard to use them since libosmocore relies heavily on C specific compilation features, which are not available in old C++ compilers (such as designated initializers for complex types in FSMs). GprsMs is right now a quite simple object since initial design of osmo-pcu made it optional and most of the logic was placed and stored duplicated in TBF objects. However, that's changing as we introduce more features, with the GprsMS class getting more weight. Hence, let's move it now to be a C struct in order to be able to easily use libosmocore features there, such as FSMs. Some helper classes which GprsMs uses are also mostly move to C since they are mostly structs with methods, so there's no point in having duplicated APIs for C++ and C for such simple cases. For some more complex classes, like (ul_,dl_)tbf, C API bindings are added where needed so that GprsMs can use functionalitites from that class. Most of those APIs can be kept afterwards and drop the C++ ones since they provide no benefit in general. Change-Id: I0b50e3367aaad9dcada76da97b438e452c8b230c
2020-12-16ns2: follow ns2 dialect changesAlexander Couzens1-1/+7
NS2 introduce a ns dialect to differentiate between the 4 possible dialects. Related: OS#4472, OS#4890 Depends: libosmocore.git Ia118bb6f994845d84db09de7a94856f5ca573404 Change-Id: I16dc82c38eb75c2b9d1197640a955fec7df84efc
2020-12-01Implement downgrade to DL MCS1-4 when USF for GPRS_only MSPau Espin Pedrol1-0/+1
In previous status, if USF for GPRS-only MS was selected, then EGPRS TBFs were skipped and either a GPRS TBF was selected or a Dummy Block was sent. That means the behavior was unfair towards EGPRS TBFs, because sometimes they were skipped in favor of GPRS ones. This patch imporves the situation in the above mentioned USF scenario, by first, under specific conditions, allowing selection of an EGPRS TBF and then forcing it to transmit in EGPRS-GMSK (MCS1-4) so that the USF-targeted MS can still decode the USF, while at the same time providing more fairness by allowing the EGPRS TBF to transmit data. The specific conditions mentioned above are, mainly, related to the fact that once a DL data block has been sent, and hence a BSN was assigned to it, it cannot be retransmitted later using another MCS, since lower MCS1-4 wouldn't be able to contain higher MCS RLC payload. The set of conditions could be expanded in the future by also selecting the EGPRS TBF if retransmition is required and the block to be retransmitted was originally transmitted as MCS1-4. Related: OS#4544 Change-Id: I9af23e175435fe9ae7b0e4119ad52fcd4707b9ca
2020-11-10TLLI 0x00000000 is a valid TLLI, use 0xffffffff insteadVadim Yanitskiy1-1/+2
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-04Fix configuration of initial_(m)csPau Espin Pedrol1-1/+2
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-04Get rid of bts->egprs_enabledPau Espin Pedrol1-1/+0
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-04tbf_ul: Allow non-egprs phones if EGPRS is enabledPau Espin Pedrol1-1/+0
We'll be able to still serve GPRS-only phones if EGPRS is enabled. Related: OS#4544 Change-Id: I2e01b9d0de7506e0c0960342d73dba29187fe61f
2020-11-04Take into account BTS supported (M)CS values when retrieving the maximumPau Espin Pedrol1-2/+17
Change-Id: I2d3a8bbae2f9887400ce56d2f8303ea30abaecfa
2020-11-04pcuif: Improve BTS-supported CS/MCS handlingPau Espin Pedrol1-4/+2
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-10-29bts: define egprs_enabled as boolPau Espin Pedrol1-1/+2
Change-Id: I66a8254ee392ad75226c58b7df5746f409463f0f
2020-10-10struct gprs_rlcmac_bts: remove unused 'nsei' fieldVadim Yanitskiy1-1/+0
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-06Use the new NS2 libAlexander Couzens1-0/+5
Depends: Id7edb8feb96436ba170383fc62d43ceb16955d53 (libosmocore) Depends: I2a9dcd14f4ad16211c0f6d98812ad4a13e910c2a (libosmocore) Change-Id: Ib389925cf5c9f18951af6242c31ea70476218e9a
2020-08-24paging: pass struct osmo_mobile_identity, not encoded IE bytesNeels Hofmeyr1-1/+1
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-06-11bts: add send_gsmtap_rach(), also send PTCCH/U over GSMTAPVadim Yanitskiy1-0/+3
Change-Id: I5cc4c3d2522215a31924121f83fcc2ac9ac6fe9c
2020-06-03bts: refactor handling and parsing of RACH.indVadim Yanitskiy1-3/+20
This patch is a set of tightly related changes: - group all RACH.ind parameters into struct 'rach_ind_params'; - group Channel Request parameters into struct 'chan_req_params'; - get rid of egprs_mslot_class_from_ra(), priority_from_ra(), and is_single_block(), introduce unified parse_rach_ind(); - improve logging, get rid of redundant information. This is needed for proper EGPRS Packet Channel Request handling. Change-Id: I5fe7e0f51bf5c9eac073935cc4f4edd667c67c6e Related: OS#1548
2020-05-20gsmtap: Set signal level and SNR fieldsPau Espin Pedrol1-0/+3
lqual (containing C/I value) is passed instead of SNR, but let's have that better than nothing. Change-Id: Ibe9502d42c8bd1b984069e7fd805dde87ecbab0c
2020-05-20Get rid of class GprsCodingSchemePau Espin Pedrol1-1/+1
We have same kind of object splitted into two layers, in coding_scheme and gprs_coding_scheme. Let's merge them together and get rid of the class, which is not really useful because it's only a set of functions operating on one enum value. This change also fixes gcc 10.1.0 error about memseting a complex type in rlc.h init(). Change-Id: Ie9ce2144ba9e8dbba9704d4e0000a2929e3e41df
2020-05-14bts: Drop specific functions to add values to statsPau Espin Pedrol1-23/+9
Change-Id: I877a9c9a35b6c94c3dd6b1ab3019bc57f6c8568a
2020-05-14bts: Drop specific functions to add values to countersPau Espin Pedrol1-16/+4
It's super annoying seeing lots of functions being called everywhere only to find out they are only incrementing a counter. Let's drop all those functions and increment the counter so people looking at code doesn't see dozens of code paths evyerwhere. Most of the commit was generated by following sh snippet: """ #!/bin/bash define_pattern="^CREATE_COUNT_ADD_INLINE" generic_func="do_rate_ctr_add" grep -r -l "${define_pattern}" . | xargs cat | grep "${define_pattern}("| tr -d ",;" | tr "()" " " | awk '{ print $2 " " $3 }' >/tmp/hello while read -r func_name ctr_name do #echo "$func_name -> $ctr_name"; files="$(grep -r -l "${func_name}(" .)" for f in $files; do echo "$f: $func_name -> $ctr_name"; sed -i "s#${func_name}(#${generic_func}(${ctr_name}, #g" $f done; done < /tmp/hello grep -r -l "void ${generic_func}" | xargs sed -i "/void ${generic_func}(CTR/d" grep -r -l "$define_pattern" | xargs sed -i "/$define_pattern/d" """ Change-Id: I966221d6f9fb9bb4f6068bf45ca2978008a0efed
2020-05-14bts: Drop specific functions to increase countersPau Espin Pedrol1-253/+93
It's super annoying seeing lots of functions being called everywhere only to find out they are only incrementing a counter. Let's drop all those functions and increment the counter so people looking at code doesn't see dozens of code paths evyerwhere. Most of the commit was generated by following sh snippet: """ #!/bin/bash grep -r -l ^CREATE_COUNT_INLINE . | xargs cat | grep "^CREATE_COUNT_INLINE("| tr -d ",;" | tr "()" " " | awk '{ print $2 " " $3 }' >/tmp/hello while read -r func_name ctr_name do #echo "$func_name -> $ctr_name" files="$(grep -r -l "${func_name}()" .)" for f in $files; do echo "$f: $func_name -> $ctr_name"; sed -i "s#${func_name}()#do_rate_ctr_inc(${ctr_name})#g" $f done; done < /tmp/hello grep -r -l "void do_rate_ctr_inc" | xargs sed -i "/void do_rate_ctr_inc(CTR/d" grep -r -l "CREATE_COUNT_INLINE" | xargs sed -i "/^CREATE_COUNT_INLINE/d" """ Change-Id: I360e322a30edf639aefb3c0f0e4354d98c9035a3
2020-03-30Move gsm_rlcmac.cpp -> .cPau Espin Pedrol1-2/+2
Original file from wireshark.git (packet-gsm_csn1.c) is being built and maintained as a C file. There's no real need for us to maintain it as a C++, and doing so will make both files derive over time (as already happened). Let's keep it as a C compiler (which btw seems to be more strict) to make it easier to port patches back and forth wireshark.git. Take the chance to move some declarations we added to csn1.h to be able to build it out of wireshark. Let's keep those in a separate header file to ease looking for differences. Change-Id: I818a8ae947f002d35142f9f5473454cfd80e1830
2020-01-06Pass paging group instead of imsi where later is not neededPau Espin Pedrol1-1/+1
Change-Id: Id0663a81f439f2d0b893b0d34f85a6db1927ef8e
2020-01-01Split identity_lv param into mi+mi_lenPau Espin Pedrol1-1/+1
It's not really needed to have those together in some function calls, and makes it more difficult to follow the code. Furthermore, new callers not having content already aligned (len+value) will be using these functions in forthcoming commits. Change-Id: Ifb9d3997bfb74b35366c3d1bc51ce458f19abf16
2019-11-28Clarify (M)CS related VTY attributesPau Espin Pedrol1-4/+7
Some are used to control (M)CS values for downlink while some do it for uplink. Let's make clear which one is used for what. Take the chance to document the fields a bit better than they were. Some more information about the origin of cs_downgrade_threshold can be found in the commit introducing it: 70b96aa232bd9784a94247bf7b193cb2147ada9d. Related: OS#4286 Change-Id: I4e890e924b094a1937fbd3794de96704cf0421a8
2019-11-23PTCCH: properly handle RACH.ind for PCU_IF_SAPI_PTCCHVadim Yanitskiy1-0/+1
Change-Id: I482d60a46b9d253dfe0b16140eac9fea6420b30c Related: OS#1545
2019-10-01Log AGCH and PCH blocks using GSMTAPPau Espin Pedrol1-0/+2
Change-Id: I4d62f98801af1b0a290d3dd35bd213ccf3151035
2019-09-30Log RACH Requests using GSMTAPPau Espin Pedrol1-0/+1
Change-Id: Ib686a49e8c630808c30bede5810cd65fc045954a
2019-09-17Use osmo_tdef to implement dl-tbf-idle-timePau Espin Pedrol1-1/+0
Change-Id: I5e4f0d2f90e643600b7752525d6c2830856c9d3b