path: root/src
AgeCommit message (Collapse)AuthorFilesLines
5 hoursbts-trx: Implement MS Power control loop calculations using dBm instead of ↵HEADpespin/ms-pwrmasterPau Espin Pedrol2-31/+58
ctl levels Some bands, such as DCS1800, contain power levels such as 29, 30 and 31 not following same unified sequence other power levels follow regarding conversion to dBm values. This makes extremly complex and prone to error comparing different power levels. Let's instead use dBm values to calculate and crop desired new value, and then convert it back to TS 05.05 ms power control level value. With this commit the control loop should be able to manage correctly the MS power levels explained above. Related: OS#4244 Change-Id: I0160637c5ffa606ee3081ad30be8e6f2a42b725b
5 hoursrsl: Assign recv pwr to lchan's max ms powerPau Espin Pedrol1-2/+22
Otherwise older ms_power value will be kept and used as a maximum. From TS 08.58 sec 4.8 "MS power control": """ If power control is supported by BTS and it is to be used, this is indicated by optional parameters in the MS POWER CONTROL message (or the CHANNEL ACTIVATION message). Based on the measurements performed on the uplink, TRX then attempts to keep the power control parameters within the limits set by the MS POWER CONTROL message (or by the CHANNEL ACTIVATION message). """ Change-Id: I0583eef477c33279ee5bfcda80141f365413a276
12 daysscheduler_trx: initalize n_errors, n_bursts_bits, n_bits_totalPhilipp Maier1-5/+11
Make sure the variables n_errors, n_bursts_bits, n_bits_total are always initalized. For example in rx_tchh_fn() the value for n_errors is defined in a switch statement, where the default lets n_errors uninitalized, which is in that particular case a theoretical problem, however, lets make sure that the variables n_errors, n_bursts_bits and n_bits_total are always initalized with 0 Related: CID#205452 Related: CID#205451 Change-Id: If28ea11cc111c7d73ca47b25e65ce399e5baa4c1
2019-10-29scheduler_trx: use gsm0502_fn_remap() to calculate frame numberPhilipp Maier1-26/+35
When sched_compose_tch_ind, sched_compose_ph_data_ind or l1if_process_meas_res is called from rx_tchf_fn or rx_tchh_fn the frame number of the beginning of the block is required. At the moment this frame number is calculated wrongly using strange formulas. Lets use gsm0502_fn_remap() to calculate the beginning of the block properly Change-Id: I37601ddd85e4287dd9e41ad4a8cb7d314de1a83d Depends: libosmocore I3d71c66f8c401f5afbad9b1c86c24580dab9e0ce Related: OS#3803
2019-10-28cosmetic: l1sap.c: Fix typoPau Espin Pedrol1-1/+1
Change-Id: I9fee7be915546cfd11810c74d511beb8ec10d044
2019-10-28power_control.c: Take into account RSL CHAN ACT ms power level limitsPau Espin Pedrol1-0/+7
This is similar commit to Ifda92155bd9c277ac150a327a7ab63c854087788, which previously fixed same issue for osmo-bts-trx specific power control loop code. TS 48.058 sec 4.8 MS power control: """ TRX then attempts to keep the power control parameters within the limits set by the MS POWER CONTROL message (or by the CHANNEL ACTIVATION message) by changing the MS Power Level field of the L1 header sent to MS in each SACCH block. """ Should fix TTCN3 BTS_Tests.TC_rsl_ms_pwr_dyn_max for non-bts-trx BTS models. Related: OS#1622 Change-Id: I376b52d7bee44132993a69cf532bd418171d0ca2
2019-10-28loops.h: Fix missing include for struct l1sched_trxPau Espin Pedrol1-0/+2
Change-Id: I67b63367e46bd43807f61e8f7e63924b8c2427e4
2019-10-28bts-trx: loops.c: Take into account RSL CHAN ACT ms power level limitsPau Espin Pedrol1-0/+4
TS 48.058 sec 4.8 MS power control: """ TRX then attempts to keep the power control parameters within the limits set by the MS POWER CONTROL message (or by the CHANNEL ACTIVATION message) by changing the MS Power Level field of the L1 header sent to MS in each SACCH block. """ Fixes TTCN3 BTS_Tests.TC_rsl_ms_pwr_dyn_max Change-Id: Ifda92155bd9c277ac150a327a7ab63c854087788
2019-10-28cosmetic: bts-trx: document variable power levelPau Espin Pedrol1-1/+1
Change-Id: Ia4bc291c8213dd6cfe3b13a99b3108532b6907b1
2019-10-21osmo-bts-trx/scheduler: fix: print the last frame number in rx_data_fn()Vadim Yanitskiy1-2/+2
All other Uplink burst handlers print frame number of the last (currently received) burst. Let's make rx_data_fn() consistent. Change-Id: Ie5762a132326be3ef4e4e38cc126f05d51098a20
2019-10-21vty.c: avoid coverity BAD_SHIFT issuesOliver Smith1-0/+2
Make it obvious for compilers and for coverity, that the sapi value used to shift a bit for the sapi_mask is always <= 31. The sapi value is an index of the value string l1sap_common_sapi_names, which has 24 entries. Fixes: CID#205067, CID#205068 Change-Id: Id8be0ab67479b1f76a4f624bd3a5242e4fe59f4b
2019-10-21vty.c: don't ignore get_string_value() errorsOliver Smith1-4/+4
Change uint8_t sapi to int, so we can properly assert on errors from get_string_value(). Fixes: CID#205066, CID#205069 Change-Id: I4d30afacfab93051868ae8f462cee9ad3dbc7fd0
2019-10-17Rename variable: CALIB_SUCESS -> CALIB_SUCCESSMartin Hauke1-3/+3
Correct the name of this variable. Change-Id: I75cb6404d772b79933d1d9d694abf8eff1fad020
2019-10-17Fix common misspellings and typosMartin Hauke33-84/+84
Change-Id: I403b9029f57fec3fdec2c1e2cbeac0f6eab53f24
2019-10-17vty: add "logging filter l1-sapi"Oliver Smith2-0/+70
Add VTY commands to filter by L1 SAPI. Allow to filter by multiple SAPIs by running the filter command multiple times: OsmoBTS> logging filter l1-sapi agch OsmoBTS> logging filter l1-sapi pch Related: OS#2356 Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889
2019-10-16bts-trx: Time out if no clock ind recvd after RSP POWERONPau Espin Pedrol2-2/+51
Before this patch, if due to whatever reason the TRX started fine (RSP POWERON 0) and sockets were created but no CLOCK IND was ever received by the BTS, it wouldn't notice since the timerfd timeouts (bts_shutdown("no clock")) are only checked after the first CLOCK IND is sent by the TRX. As a result, the BTS would be kept on forever saying everything is fine but it would be sending no DL burst at all to the TRX (tested with a modfied osmo-trx dropping clock indication). With this patch, new APIs are added to indicate the scheduler_trx code the timeframes where clock ind are expected (between RSP POWERON 0 and RSP POWEROFF 0); if TRX sends clock indications out of that timeframe, BTs lower layers will drop them (controlled by "powered" bool). Hence, the scheduler_trx can now place a timeout (reusing same timerfd because its new use is exclusive in time with its other previous use) when it is told that CLOCK IND should start appearing, and if none arrives in considerable time, then the BTS can be shut down to notify the rest of the network. Related: OS#4215 Change-Id: Iba5dbe867aff10e70ec73dbf1f7aeeecb15c0a4d
2019-10-11log: set L1 SAPI log contextOliver Smith5-0/+262
Add a new common L1 SAPI enum, to unify all the BTS specific SAPIs. Translate to this enum, and set the context for uplink messages in each BTS specific implementation. Set the context for downlink messages in the common l1sap code, by converting the osmo_phsap_prim back to the SAPI value (mostly looking at chan_nr). The new functions for doing this conversion, get_common_sapi_by_trx_prim() and get_common_sapi_ph_data(), are based on the existing to_gsmtap() and gsmtap_ph_data() functions. Note that we can't set the uplink SAPI context in the common code, because then we can't set it as early as possible. In this patch, the SAPI context is set for the PHYs where the SAPI is readily available. With additional conversion from the RSL channel, the SAPI context could be set for osmo-bts-trx in a follow up patch. Related: OS#2356 Depends: (libosmocore) I814cb3328d99faca9220adb5a80ffb934f219d7d Change-Id: I6b7bb2e1d61502b61214f854a4ec5cbb7267545b
2019-10-09L1SAP: there can be no DATA.ind primitives on PTCCH/U, reject themVadim Yanitskiy1-16/+18
Change-Id: Ib846a9b8e619c7da56b5f0a54d16f629913af80d
2019-10-09L1SAP: use GSMTAP_CHANNEL_PDTCH for PDTCH blocks by defaultVadim Yanitskiy1-2/+4
We don't know whether a data block on PDCH belongs to PDTCH or PACCH without parsing it, because the latter one is being allocated on demand. Let's use GSMTAP_CHANNEL_PDTCH by default, rather than GSMTAP_CHANNEL_PACCH. Change-Id: I7639215ef936a8ac05ca417a91f4e12755f318d4
2019-10-09L1SAP: fix gsmtap_pdch(): there can be no DATA.ind on PTCCH/UVadim Yanitskiy1-7/+0
Change-Id: Id69010ffa8c697e8c01bbb21509253c330f95343
2019-10-09L1SAP: use the actual ARFCN for outgoing PCUIF messagesVadim Yanitskiy1-4/+4
Change-Id: I07b3aac97603d85fb6cf077d3a342b12b0643171
2019-10-09bts-trx: Log TRXC and TRXD socket recv()/send() failuresPau Espin Pedrol1-5/+23
Related: OS#4215 Change-Id: Ic3e41d82b43459495d45873d612a3bd349ac174a
2019-10-09L1SAP: properly handle 11-bit encoded RACH.ind in gsmtap_ph_rach()Vadim Yanitskiy1-1/+1
Change-Id: Id263c2b716fd282d37d705a1c5f430ce7c0edaf0
2019-10-09L1SAP: refactor handling of Access Bursts on PDCHVadim Yanitskiy1-15/+43
First of all, we also need to apply the same filtering to Access Bursts on PDCH as for the normal ones on RACH, i.e. filter them by ToA (Timing of Arrival) and BER (Bit Error Rate). Secondly, we shall not interpret Access Bursts on PDTCH/U as handover related ones. Instead, let's print a warning and ignore them since they are not (yet) supported by OsmoBTS. Finally, in gsmtap_pdch() we need to set a proper channel type for Access Bursts received on PDCH (PDTCH/U or PTCCH/U). Change-Id: I461fde9f4543c45c42b591cd3fd0ff3d98673cec
2019-10-09L1SAP: do not pass unused parameter to l1sap_handover_rach()Vadim Yanitskiy1-3/+2
Change-Id: I7f2d909f1bde09cbec106240df290381b3418e46
2019-10-09L1SAP: clarify debug messages in rach_pass_filter()Vadim Yanitskiy1-3/+3
RACH stands for Random Access CHannel, while in rach_pass_filter() we're dealing with Access Bursts, that may be received on other logical channels too (e.g. PTCCH, PDTCH or any other). Change-Id: I1e5ca9930ab491a6916c972865154d54530cbf51
2019-10-05bts-trx: Drop unused func check_transceiver_availability()Pau Espin Pedrol2-13/+0
After getting rid of transceiver_available, this function is not used anymore by any code, since its per-trx counterpart l1if_provision_transceiver_trx() is the one used by other code. Change-Id: If5a988eb14658a78dd46234dccc052dc12fb872a
2019-10-05bts-trx: Get rid of messy transceiver_available state handlerPau Espin Pedrol5-40/+21
This variable meaning has been changing its exact meaning over time until finally not being really clear which kind of state it holds. Initially it seemed to be used to identfy whether CLOCK IND were being received. However, over time both osmo-bts and osmo-trx have evolved and were fixed so that clock indications are only sent by osmo-trx after POWERON command is sent. As a result, this state can be checked simply by looking at the "powered" phy_link variable, which is only set to true once the TRX has confirmed the POWERON command, and hence it is sending CLOCK IND. On the other hand, at some point in time "available" started to be set to 1 in bts_model_phy_link_open(), which means available is nowadays almost always 1 from startup until the end (only dropped during bts_shutdown(), when we are already exiting the process anyway). As a result, !available condition in scheduler_trx.c:trx_fn_timer_cb can almost never happen, because available is set to true already. Only possibility would be if an old process of osmo-trx (not set up by this BTS process) is still sending CLOCK INDs, but in that case we for sure don't want to configure the BTS based on that, but ignore them until this BTS process has again configured the TRX. So that whole check can be dropped. We are better checking for "powered" state, which is far more accurate, and we better do that in trx_if.c before calling trx_fn_timer_cb(). Other uses of "transceiver_available" being used can be changed to use plink->state!= PHY_LINK_SHUTDOWN, since available was already being set to 1 at the same time the plink->state was being set to PHY_LINK_CONNECTING. As a result of this state handling re-arrangement, OS#4215 is fixed since trx_if_powered() is used instead of previous state condition to check whether data frames should be sent. Related: OS#4215 Change-Id: I35f4697bd33dbe8a4c76c9500b82c16589c701d4
2019-10-05bts-trx: Don't reset transceiver_available in scheduler_trx.cPau Espin Pedrol1-3/+0
It can be dropped since bts_shutdown() ends up calling immediatelly bts_model_trx_close() which in turn calls bts_model_trx_close() which sets enabled = false and calls l1if_provision_transceiver_trx() to power off the TRX. Related: OS#4215 Change-Id: If8b3d2379d7ae102e1c338f4558ac1352de761cc
2019-10-05bts-trx: Rework code handling poweron statePau Espin Pedrol5-51/+76
Use of variables in each code is confusing and mixing configuration with POWERON/POWEROFF state (which is at least per phy inst and not per TRX, since those commands are only expected on the 1st phy inst). * field "poweron" becomes "enabled", and is used as an indicator for actions to take during TRX provisioning (hether to power it on and configure it or to power it off). * poweron/poweroff state becomes "powered", and it is shared by all trx in same phy_link, and is updated only after confirmation by TRX. * poweron_set becomes poweronoff_set (because it's used by both POWERON and POWEROFF), and becomes shared by all trx in same phy_link, since those CMDs are usually sent by first phy instance of the link (the first trx). Related: OS#4215 Change-Id: Icd0b482f1454236432e1952220bbec9d178b8607
2019-10-05bts-trx: trx_set_bts(): Avoid double loop by checking current trxPau Espin Pedrol1-2/+1
check_transceiver_availability() is a loop over every trx, same to what trx_set_bts() does, so let's call the per-trx version directly. Change-Id: I8843c1438c6af700631aba7b7e72aae0bdb7ec3a
2019-10-05bts-trx: vty: Print phy link state in cmd 'show transceiver'Pau Espin Pedrol2-1/+14
Change-Id: I8e49f8edad9f9c68d110dbb7faeea5143aa91022
2019-10-05bts-trx: Allocate struct osmo_trx_clock_state as part of bts-trx private dataPau Espin Pedrol3-44/+52
Related: OS#4215 Change-Id: I9b7ffb51423ada74b8be347c57eade08f307f88f
2019-10-05struct gsm_bts: Add model_priv pointer handing bts_model specific dataPau Espin Pedrol5-11/+32
Currently there's bts-virtual specific fields in gsm_bts which is not used by other models and are always allocated. An alternative would be having a union with different structs inside, one per model, but since we already have the bts_model abstraction, in this case it makes more sense to use that abstraction instead of filling code with preprocessor ifdefs to guard against non-defined types, etc. Existing model specific data is moved there. This new infra will be user further in forthcoming commits. Related: OS#4215 Change-Id: Ib17a752cdbaa7d5eb8c5dfa0b197f80a4f38b38e
2019-10-04common/l1sap: increase ToA precision for packet Access BurstsVadim Yanitskiy1-1/+2
QTA is a Timing Advance value in units of 1/4 of a symbol. Let's use ToA256 (1/256 of a symbol) field of L1SAP RACH.ind as a base for QTA calculation in order to achieve better precision. Change-Id: I6e6fa7985c430a9bdbd12af2a8b2a5a66f11a41c
2019-10-04osmo-bts-trx/scheduler: also detect TSC for Access Bursts on PDCHVadim Yanitskiy1-3/+4
If a logical channel, on which an Access Burst has been received, is not either of RACH, PDTCH or PTCCH, then this is a handover Access Burst, which is always encoded as 8-bit and shall contain the generic training sequence (TS0). Access Bursts on a PDCH time-slot are not related to handover. Change-Id: If7d6135d6c4d7f9bd71d9fab6f8adc3f8cfd10ea
2019-10-04scheduler: fix handling of PTCCH/U and PTCCH/D logical channelsVadim Yanitskiy3-7/+25
According to 3GPP TS 45.010, section 5.6.2, for packet-switched channels the BTS shall monitor the delay of the Access Bursts sent by the MS on PTCCH and respond with timing advance values for all MS performing the procedure on that PDCH. According to 3GPP TS 45.002, section, PTCCH (Packet Timing advance control channel) is a packet dedicated channel, that is used for continuous Timing Advance control (mentioned above). There are two sub-types of that logical channel: - PTCCH/U (Uplink): used to transmit random Access Bursts to allow estimation of the Timing Advance for one MS in packet transfer mode. - PTCCH/D (Downlink): used by the network to transmit Timing Advance updates for several MS. As per 3GPP TS 45.003, section 5.2, the coding scheme used for PTCCH/U is the same as for PRACH as specified in subclause 5.3, while the coding scheme used for PTCCH/D is the same as for CS-1 as specified in subclause 5.1.1. The way we used to handle both PTCCH/U and PTCCH/D is absolutely wrong - they have nothing to do with xCCH coding. Instead, we need to use tx_pdtch_fn() for Downlink and rx_rach_fn() for Uplink. In l1sap_ph_rach_ind() we need to check if an Access Burst was received on PTCCH/U and forward it to OsmoPCU with proper SAPI value (PCU_IF_SAPI_PTCCH). To be able to specify a SAPI, a new parameter is introduced to pcu_tx_rach_ind(). Change-Id: I232e5f514fbad2c51daaa59ff516004aba97c8a3 Related: OS#4102
2019-10-02l1sap: Log conn dropped due to radio link counter timeoutPau Espin Pedrol1-1/+5
Change-Id: I78c5ff00be8d2c870ed0277294a8e499ba8a8d95
2019-10-02scheduler: Use OSMO_ASSERT instead of abortPau Espin Pedrol1-4/+3
Change-Id: I594842b08cdb97a473273ba7097a05502f5751b8
2019-10-02scheduler.c: Move some message log level to DEBUGPau Espin Pedrol1-4/+4
Otherwise using "logging level set-all info" makes it impossible to see anything in VTY due to tons of those two lines appearing. Change-Id: I9c7500c1e56db0c4dcb474f93c882a9c7c004d55
2019-09-27bts-trx: vty: Use API to get poweron statePau Espin Pedrol1-1/+1
Change-Id: I8b78e1ad34f19d8fe348b9c975742fc0f7112da2
2019-09-19bts-trx: Change super verbose IDLE ind not-supported line to DEBUGPau Espin Pedrol1-1/+1
It's impossible to see other logging otherwise. Change-Id: I64ee83b734ecff593ff2a1cf97b192db93228e22
2019-09-12osmo-bts-trx/scheduler: fix: check rc of osmo_ecu_frame_out()Vadim Yanitskiy1-2/+4
Change-Id: I32d244f5ddef46c8b8719f5ec27b7456514d407a Fixes: CID#204005 (CID#204007), CID#204006 (CID#204004)
2019-09-10bts-trx: Log case where no SETFORMAT is sentPau Espin Pedrol1-5/+12
If VTY cmd "osmotrx trxd-max-version 0" is used, max version 0 is used (default starting one) and hence no need to send SETFORMAT (this is useful in order to avoid sending SETFORMAT to old TRX implementations not supporting the command). In this case, let's inform the user that indeed osmo-bts won't send SETFORMAT because version 0 is assumed. Change-Id: I7136ea6745c2275278bc400676b58fb4b10da966
2019-09-10osmo-bts-trx: migrate to new generic ECU abstractionHarald Welte3-30/+78
libosmocodec has recently introduced a generic ECU abstraction layer which supports (pluggable) Error Concealment Units for not only the FR codec, but potentially any other codec, too. Change-Id: I001005aae6de76d4e045b8dc572239f057bb150d Depends: libosmocore I4d33c9c7c2d4c7462ff38a49c178b65accae1915
2019-09-07osmo-bts-trx/scheduler: add FIXME note about FACCH/H and BFIVadim Yanitskiy1-0/+2
Change-Id: Ie006cd46cb574d272fbe3b38595a3087617c79d1
2019-09-07osmo-bts-trx/scheduler: fix tx_tch_common(): do not send AMR BFI twiceVadim Yanitskiy1-1/+0
We call _sched_compose_tch_ind() after the switch statement, so there is no need to send it from case 'GSM48_CMODE_SPEECH_AMR'. Change-Id: I0488082494120157ac438d7763b52e3998f0eac7
2019-09-07osmo-bts-trx/scheduler: prevent uninitialized memory accessHarald Welte1-6/+18
When sending an AMR BFI, we need to call osmo_amr_rtp_enc() with AMR_BAD as the last parameter. This function returns the length of encoded payload, which needs to be at least 2 octets long. If osmo_amr_rtp_enc() returns a length value lower than 2 octets (what should not happen in general), we should neither call memset() on it, nor call _sched_compose_tch_ind(). Change-Id: I70ce98c5697b9ce6fac7ab57a5d70f3201db29d9 Fixes: CID#178648, CID#178637, CID#178651
2019-09-07common/rsl.c: fix possible NULL-pointer dereferenceVadim Yanitskiy1-1/+5
Change-Id: I11a35a8f500fafa7b3c93d2f2244cc4d42f09f1b Fixes: CID#203810
2019-09-06pcu_interface: Forward ETWS Primary Notification to PCUHarald Welte2-0/+26
All MS/UE must be notified of ETWS Primary Notifiations. Depending on their state, the notification goes different paths: * CS dedicated mode: BSC sends it as L3 message over LAPDm / DCCH * CS/PS idle mode: BTS sends paging messages on PCH * PS TBF active: PCU send Packet Application Info This enables the last of the three methods by passing any ETWS Primary Notifications received over RSL via the PCU socket into the PCU. Change-Id: Ic0b3f38b400a0ca7e4089061ceb6548b0695faa6 Related: OS#4047, OS#4048