aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/l1_if.c
AgeCommit message (Collapse)AuthorFilesLines
2018-02-27L1SAP: Increase resolution of reported burst timingHarald Welte1-1/+1
Before this patch we had: * osmo-bts-trx internally using 1/256th bit/symbol period * osmo-bts-sysmo internally using 1/4 bit/smbol period * PCU interface using 1/4 * L1SAP interface using 1/4 * measurement processing code on top of L1SAP using 1/256 So for sysmo/lc15/octphy we are not loosing resolution, but for osmo-bts-trx we're arbitrarily reducing the resolution via L1SAP only then to compute with higher resolution again. Let's change L1SAP to use 1/256 bits and hence not loose any resolution. This requires a corresponding change in libosmocore for l1sap.h, which is found in Change-Id Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
2018-02-27trx/scheduler: Use integer math for TOA (Timing of Arrival)Harald Welte1-6/+6
There's no need to express TOA as a float: * We receive it as signed 16bit integer in units 1/256 symbol periods * We pass it to L1SAP as signed integer in 1/4 symbol periods So turn it into an int16_t with 1/256 symbol period accuracy throughout the code to avoid both float arithmetic as well as loosing any precision. Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
2018-02-23osmo-bts-trx: Add missing frame number to l1if_process_meas_res()Harald Welte1-1/+1
Change-Id: I7f1322b025ce733f78ae2b958c7a2bb38b6aa6f5
2018-02-19trx: make l1if_fill_meas_res() staticHarald Welte1-1/+1
it's not used anywhere outside of l1_if.c, so make it a static function Change-Id: If988a7679f3a9253fab1a4d177a276d8ecaf794f
2018-02-05Remove unused variablesPau Espin Pedrol1-4/+0
Change-Id: I3fec7e4b337f3ea4d8cd79f4e7261babc34911cb
2017-09-02trx: avoid deactivating lchan on LCHAN_REL_ACT_REACTMax1-0/+6
* do not deactivate lchan when called with LCHAN_REL_ACT_REACT * add fixme comment It's unclear yet if any special steps are required for osmo-bts-trx so let's just make it compatible with setups [1] using BS_AG_BLKS_RES != 1 for now. Background: CCCH is auto activated by some OsmoBTS - before we receive SI3, see 4a8582846281322e8d7dfc577b18767cf35c24d1. To accommodate for that we deactivate CCCH in common/rsl.c, which triggers BTS-model specific callback sapi_deactivate_cb() which updates parameters and activates it again. In case of osmo-bts-trx there is no auto-activation and (seems to be) no need in special interaction with hw to activate channel (no lchan_activate()) hence we can just skip entire deactivate/setup/activate again routine. [1] "channel-descrption bs-ag-blks-res N" in OpenBSC config file. Related: OS#1575 Change-Id: I20b89ba1e43d1414180b083cd1e085eeffe5d513
2017-08-19osmo-bts-trx: Fix MS power control loop.Alexander Chemeris1-1/+1
The following two commits from 2014-12-06 introduced a new variable to control MS power - ms_power_ctrl, but kept the old ms_power variable in place. They have also changed the meaning of the ms_power variable - it now keeps original RSL configured value. So when much later osmo-trx-bts code was merged to master the code was compiling fine and this change in the meaning was overlooked. In osmo-bts: 579651bf300de002731dfd3bd39985c9fd15616c power/sysmobts: Add a manual ms power level control In OpenBSC: f6f86b0eec18da165db136b14bf2db87fde4b4ac osmo-bts: Introduce new struct for a power loop in the BTS code Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1
2017-07-30TRX / VIRT-PHY: Make check for BCCH/CCCH more specificHarald Welte1-2/+2
In bts_model_l1sap_down() we want to identify BCCH/CCCH channel numbers, but our check is a bit non-specific. Let's make the check more specific to only cover the BCCH, Uplink CCCH and Downlink CCCH C-bits as defined n 3GPP TS 08.58 Section 9.3.1 Change-Id: Ia20ab09b96c87c0dfbfaf98e5b2a8d36423fac67
2017-07-01TRX: merge/simplify l1_if and trx_if codeHarald Welte1-42/+0
Related code / function structure still dates back to the pre-phy_link days. Let's clean this up to make things less convoluted and reduce the number of non-static symbols needed between code split over two files. Change-Id: I1f30ae1f547a5c01c516d4a05032193294c25f2d
2017-06-29osmo-bts-trx: fix missing frame number in MEAS INDPhilipp Maier1-2/+3
The layer 1 interface (l1_if.c) for osmo-bts-trx does not include the frame number into the measurement indications it forwards to higher layers. The frame number is required to properly detect the end of a measurement period. Change-Id: Ife3c791ff50e8a866a97b9783ac7ef3ef2402a70
2017-05-29osmo-bts-trx: Remove duplicate parsing of NM_ATT_CONN_FAIL_CRITHarald Welte1-5/+0
For some reason, osmo-bts-trx did another take at parsing NM_ATT_CONN_FAIL_CRIT and storing the second octet in btsb->radio_link_timeout, just like the generic code already does in oml_rx_set_bts_attr(), but without proper checking and any error message. Let's remove it. Change-Id: Idb0179e1443c0b5a97e59919dba684a001e90192
2017-05-29Consistently check for minimum attribute/TLV length in RSL and OMLHarald Welte1-1/+1
Make more use of TLVP_PRES_LEN() instead of plain TLVP_PRESENT() and implicitly assuming a certain length of the information element. What this obviously doesn't introduce is some kind of error generation/reporting in case the minimum length is not fulfilled. An IE that's too small is silently ignored by TLVP_PRES_LEN() and treated as if the IE wouldn't exist in the first place. Change-Id: If5c4eee65711c49bc8ba4675221b1d5fd16198e9
2017-05-09osmo-bts-trx/l1_if.c: cosmetic: drop double checkVadim Yanitskiy1-3/+3
Change-Id: I25a8f85ee65e1c0dd54049ffacc039702ca36c8f
2017-03-23osmo-bts-trx/l1_if.c: use channel combination III for TCH/HVadim Yanitskiy1-1/+1
Currently the channel combination II is used for TCH/H, which allows only one lchan to be allocated. The reason is that it saves a bit of CPU by disabling UL burst detection on lchan 1. There is also the channel combination III, which allows to increase channel capacity, providing two lchans on a single TCH/H timeslot. Ideally we should implement some dynamic II <-> III switching depending on the network load level. But for now this change replaces the channel combination of TCH/H by III, until dynamic switching is implemented. Fixes issue: https://osmocom.org/issues/1795 Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810
2017-02-14osmo-trx-bts: Fix incorrect bts shutdown procedure in case of abis ↵Ivan Klyuchnikov1-4/+1
connection closure This issue occurs in case of osmo-nitb restart which leads to abis connection closure. Function bts_shutdown from common/bts.c should be used in this case for proper bts shutdown. Change-Id: Id025e703dd5c91896d450d200e88e46552f178f0
2017-02-10osmo-trx-bts: Fix osmo-bts-trx crash on startup during reading phy instance ↵Ivan Klyuchnikov1-2/+1
parameters from config file pinst->u.osmotrx.hdl should be allocated before reading phy_instance parameters from config file and applying them. So allocation of pinst->u.osmotrx.hdl should be moved from l1if_open function to bts_model_phy_instance_set_defaults function, which is proper place for this allocation according to start-up procedure of osmo-bts. Change-Id: I6e23f92644400acb268818c9373a8fb10c003da1
2017-02-10osmo-trx-bts: Fix incorrect setting of RXGAIN and POWER parameters on second ↵Ivan Klyuchnikov1-23/+16
channel (TRX1) of osmo-trx Move rxgain and tx-attenuation (power) parameters from phy_link layer to phy_inst layer. Rxgain and tx-attenuation parameters should be set for each phy_inst and send for each osmo-trx channel accordingly via control commands. Change-Id: I4861a59d10d1ef91954e0c6ea265e66dec08844f
2016-12-12osmo-bts-trx: fix lchan deactivationMax1-2/+4
Use chan_nr for deactivating lchan instead of lchan->nr: chan_nr is the RSL Channel Number IE value, a bitfield aggregation of lchan type bits (cbits) and lchan number (lowest three bits). The error was introduced in 36153239bfd0b633c4d259a9de0a759f41197a2b. Change-Id: I6dd7060422ab9d18743c1ff2ab419e3e7299d74d
2016-12-05TRX: prevent segfault upon phy initMax1-7/+10
Previously if multiply phy instances were configured but not used osmo-bts-trx would segfault. Terminate with clear error message instead so user can correct configuration. Example configuration which caused problem: ... phy 0 instance 0 instance 1 ... trx 0 phy 0 instance 0 Note the 2nd instance of phy 0 which is not used in trx later on. Change-Id: Id979506731ea92401458f1060e87aeb690901539
2016-12-01Remove duplicated codeMax1-5/+19
Remove lchan deactivation related code duplication to facilitate future use for dynamic CCCH re-activation. Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9
2016-12-01trx: Add "maxdlynb" VTY command to control max TA for Normal Bursts.Alexander Chemeris1-0/+5
Originally `maxdly` command in osmo-trx was contrlling max TA for Normal Bursts. This was not a proper behaviour, because it was used to "control maximum distance a handset can attach from" which is controlled by Access Bursts max TA. Osmo-trx was corrected to apply `maxdly` to Access Bursts and a new command was introduced to contrl max TA for Normal Bursts - `maxdlynb`. This patch adds support for this configuration command into osmo-bts-trx. If you wonder why would you need that - some test equipment (namely R&S CMD57) has really bad timing sync and can generate signal a few symbols off. That prevents osmo-trx from properly receiving otherwise perfectly good bursts generated by CMD57. This configuration is a solution for this. Change-Id: Ib5d255299668ac1ef9f0ce95e016f55ba3c82277
2016-11-11Replace link_id constant with defineMax1-4/+4
Instead of using constant for link_id directly, use shared define value. Change-Id: Ibf3d439d8893bd994ba089796175b6c635db2cf8
2016-10-18Replace magic number with defineMax1-4/+4
SDCCH occupy lchan 0..3 in combined configuration so for CCCH we've always used lchan[4] - replace it with CCCH_LCHAN define and add comment. Change-Id: Ic5d742c292d638f119c6b4672120c1950adeb7f0
2016-08-10dyn TS: complete for TRXNeels Hofmeyr1-8/+19
Apply similar fixes as for TCH/F_PDCH also for TCH/F_TCH/H_PDCH: Detect dyn TS in PDCH mode in ts_is_pdch(). In trx_set_ts(), enhance the "if (TCH_F_PDCH)" to a switch statement including both dynamic channel types. Adjust the comment to include both kinds. Change-Id: I6669739cd08780cd9ffb9451cdae9f6b9704c4fe
2016-07-28dyn PDCH: trx l1_if.c: drop fixme, add commentNeels Hofmeyr1-1/+1
Change-Id: Ib240f21f4d460524767f4273fc9077617d1ffb43
2016-07-28dyn PDCH: complete for trx: implement bts_model_ts_[dis]connect()Neels Hofmeyr1-2/+17
bts_model_ts_disconnect() has nothing to do. bts_model_ts_connect() merely sets the new pchan on the ts. Change-Id: Ieb66935d6efc26854e95d238e810c4f8b16cfa88
2016-07-28dyn PDCH: trx l1_if.c: factor out trx_set_ts_as_pchan() from trx_set_ts()Neels Hofmeyr1-3/+20
To be able to set a specific pchan type for dynamic channels, have the trx_set_ts_as_pchan() function with an explicit pchan argument instead of using ts->pchan. Keep trx_set_ts() as a thin wrapper to use ts->pchan directly. Change-Id: I9eeef05d2a6763f86a5b89ee7c3b4211f6736e4d
2016-07-14osmo-bts-trx: init OML only once by sending AVSTATE_OK with OPSTATE_ENABLEDNeels Hofmeyr1-11/+1
When receiving an OPSTART for the BTS object, also set the availability state to OK. Before, the availability would remain at NM_AVSTATE_DEPENDENCY, which caused an unfortunate chain reaction resulting in osmo-bts-trx going through the initialization sequence twice: BTS BSC |<-----| SITE_MANAGER OPSTART n |----->| BTS state change: OPSTATE_DISABLED, AVSTATE_DEPENDENCY o | | This signals to nm_statechg_event() in bts_ipaccess_nanobts.c r | | to (a) Set BTS Attributes and (b) send BTS OPSTART m |<-----| Set BTS Attributes (a) a | | When osmo-bts-trx receives a Set BTS Attributes, it sends l |----->| CHANNEL state change: OPSTATE_DISABLED x8 | | This signals the BSC to Set CHANNEL Attributes and OPSTART i |<-----| Set CHANNEL Attributes x8 n |<-----| CHANNEL OPSTART x8 i |----->| CHANNEL state change: OPSTATE_ENABLED, AVSTATE_OK x8 t | | |<-----| BTS OPSTART (b) | | osmo-bts-trx immediately replies with: |----->| BTS state change: OPSTATE_ENABLED, AVSTATE_DEPENDENCY | | Unfortunately, availability is left at DEPENDENCY, | | and the NM_OC_BTS case in nm_statechg_event() only | | checks for availability, not for the opstate. | | Hence nm_statechg_event() again feels inclined to | | to (a) Set BTS Attributes and (b) send BTS OPSTART, | | --+------+----- This is where the second round starts | | s |<-----| Set BTS Attributes (a) e | | When osmo-bts-trx receives a Set BTS Attributes, it sends c |----->| CHANNEL state change: OPSTATE_DISABLED x8 o | | All channels are disabled again, and then re-launched: n |<-----| Set CHANNEL Attributes x8 d |<-----| CHANNEL OPSTART x8 |----->| CHANNEL state change: OPSTATE_ENABLED, AVSTATE_OK x8 | | i |<-----| BTS OPSTART (b) n | | osmo-bts-trx again sets the OPSTATE_ENABLED, but since i | | this time it was already enabled, no further state change t | | is sent back to the BSC. This nightmare pivots on two hinges: 1. osmo-bts-trx fails to set BTS availability to AVSTATE_OK. 2. nm_statechg_event() fails to heed the OPSTATE_ENABLED of the BTS state change. Note, the configured channels from the first round were not actually taken down, only the OML OPSTATE_DISABLED were sent. In this commit, fix the osmo-bts-trx side: send AVSTATE_OK for the BTS object upon sending OPSTATE_ENABLED, so that only the part marked "normal init" above is run. This change applies the same fix to other OML objects, which should make sense in the same manner, within the current hackish OML implementation: * NM_OC_BTS * NM_OC_SITE_MANAGER * NM_OC_BASEB_TRANSC * NM_OC_GPRS_NSE * NM_OC_GPRS_CELL * NM_OC_GPRS_NSVC This means that the NM_OC_CHANNEL case just above is identical, and thus collapse NM_OC_CHANNEL onto the other cases. Drop the comments from NM_OC_CHANNEL since they merely rephrase the commands themselves. See OS#1770 for BTS and NITB logs. Fixes: OS#1770 Change-Id: I08aa861f6100568c79750f4fbc9a32e1557b9304
2016-07-09cosmetic: osmo-bts-trx: add comment, fix comment typoNeels Hofmeyr1-0/+1
Change-Id: Iea62bd98954d0219ba597613cea6db63f7a6b396
2016-06-23Make get_lchan_by_chan_nr globally availableMax1-7/+2
* Remove static qualifier * Remove duplicated code - use generic function instead Change-Id: I37a312648771f58d3087471083cfcebbd97ccf1d
2016-06-17dyn PDCH: add bts_model_ts_connect() and _disconnect() stubsNeels Hofmeyr1-0/+11
Enhance bts_model_ API in preparation of dyn PDCH switching. These will be used to re-connect a TCH/F_PDCH TS in a different mode: either as TCH/F or as PDCH. All implementations so far return -ENOTSUP, and thus will cause a IPAC PDCH ACT or DEACT *NACK* to be sent to the BSC as soon as these messages are handled. Also add stubs in tests. Change-Id: I21e60c028a1333431c3ed000f788b654d1170b0d
2016-06-16Fix OML activationMax1-3/+9
Previously software activation could have been reported multiple times which broke proper BTS init. Introduce guard variable to ensure reporting happens only once. Note: this is just minimal workaround - ideally proper OML state machine should be implemented. Change-Id: Ifffbdb756bc5d2864f985c01a3299b839c4de7af Related: OS#1648
2016-02-15Introduce new phy_link and phy_instance abstractionHarald Welte1-34/+50
This way we can model a flexible mapping between any number of PHYs, each having multiple instances, and then map BTSs with TRXx on top of those PHYs.
2016-02-15TRX: Move scheduler to src/commonHarald Welte1-1/+1
This is the final step to make the L1 scheduler generally available to other BTS models than OsmoTRX.
2016-02-15TRX: factor out the scheduler from remaining codeHarald Welte1-15/+20
The L1 scheduler is a generally useful component that is unfortunately tied quite a bit into the OsmoTRX support. Let's try to separate it out by having separate per-trx/per-ts/per-chan data structures pre-fixed with l1sched_ Using this patch it should be one step easier to use the scheduler for other BTS models, such as the intended upcoming virtual BTS.
2016-01-16TRX: Don't use magic numbers when we have #definesHarald Welte1-5/+5
2016-01-16TRX: Add stub bts_model_change_power() functionHarald Welte1-0/+6
This just fixes linking. It still needs to be properly implemented
2015-11-05TRX: catch up with trhe amr_mode naming changesHarald Welte1-8/+8
OpenBSC introduced a naming change in 615ed46a6ab25f71a7ab0d8201d33b4dbf8fc5b0 but osmo-bts fixes were only about osmo-bts-sysmo, not osmo-bts-trx. This updates osmo-bts-trx accordingly.
2015-09-22make osmo-bts-trx provide bts_model_adjst_ms_pwr()Harald Welte1-0/+7
2015-09-22trx: Assume 100% BER if total decoded bits is 0 in l1if_process_meas_res()Alexander Chemeris1-1/+2
2015-09-22trx: Implement BER calculations.Alexander Chemeris1-9/+24
A known issue with this code is that BER is not updated for lost TCH frames, because osmo-trx doesn't send any indication for them and we don't have a callback to handle this. Otherwise the code seem to work fine.
2015-09-22trx: Set lchan inactive, only if the dedicated channel is deactivatedAndreas Eversberg1-4/+3
2015-09-22TRX: Activate LCHAN of CCCH when CCCH is configured on time slotAndreas Eversberg1-0/+12
2015-09-22TRX: fix some typos in commentsMartin Hauke1-3/+3
2015-09-22trx: Add option to set transmit power reduction via OML (BSC)Andreas Eversberg1-0/+7
2015-09-22TRX: Close TRX (shutdown all active channels) on ABIS link failureAndreas Eversberg1-0/+10
2015-09-22TRX: Add bts_model_trx_close to TRX implementationAndreas Eversberg1-2/+2
2015-09-22TRX: Fixup ciphering state names after rebasingAndreas Eversberg1-3/+3
2015-09-22TRX: Set ciphering to an initial state when activating channelAndreas Eversberg1-0/+8
Handover and assignment may activate channels with ciphering already set, so we need to tell scheduler to enable/disable ciphering and set the correct cipher state.
2015-09-22TRX: Use correct slot type for GSM_PHCAN_BCCHAndreas Eversberg1-1/+1