aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/l1_if.c
AgeCommit message (Collapse)AuthorFilesLines
2019-10-16bts-trx: Time out if no clock ind recvd after RSP POWERONPau Espin Pedrol1-2/+5
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-05bts-trx: Drop unused func check_transceiver_availability()Pau Espin Pedrol1-12/+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 Pedrol1-2/+13
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: Rework code handling poweron statePau Espin Pedrol1-14/+28
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-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 Welte1-0/+13
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-07-23bts-trx: Introduce VTY command osmotrx trxd-max-versionPau Espin Pedrol1-4/+6
This command allows setting a maximum TRXD format version to negotiate with TRX. osmo-bts-trx will hence end up using that version if supported by TRX, or a lower one otherwise (or fail if TRX doesn't support any of them). Since now the maximum version can be 0, avoid going through SETFORMAT negotiation in that case, since 0 is the default version. This way we keep backward compatibility with TRX implementations that exit upon receival of unknown commands (such as SC5 current one). The VTY command is located in the "phy" node instead of the "phy instance" node because instances of same phy are expected to use same host with same implementation, so TRXD version to use should be the same for both. Related: OS#4006 Change-Id: I5eb1fdc002f9d7f4acf475356d8fc998dc8f6326
2019-07-16osmo-bts-trx/trx_if.c: add TRXD header version negotiationVadim Yanitskiy1-0/+10
This change introduces a new command for TRXD header format negotiation - SETFORMAT. If the transceiver does not support the format negotiation, it would reject this command with 'RSP ERR 1'. If the requested version is not supported by the transceiver, status code of the response message should indicate a preferred (basically, the latest) version. The format of SETFORMAT command is the following: L1 -> TRX: CMD SETFORMAT VER_REQ L1 <- TRX: RSP SETFORMAT VER_RSP VER_REQ where: - VER_REQ is the requested version (suggested by the L1), - VER_RSP is either the applied version if matches VER_REQ, or a preferred version if VER_REQ is not supported. If the transceiver indicates VER_RSP different than VER_REQ, OsmoBTS is supposed to reinitiate the version negotiation using the suggested VER_RSP. For example: L1 -> TRX: CMD SETFORMAT 2 L1 <- TRX: RSP SETFORMAT 1 2 L1 -> TRX: CMD SETFORMAT 1 L1 <- TRX: RSP SETFORMAT 1 1 If no suitable VER_RSP is found, or the VER_REQ is incorrect, the status code in the response would be -1. As soon as VER_RSP matches VER_REQ in the response, the process of negotiation is complete. Changing the header version is supposed to be done before POWERON. Change-Id: I8afe950bd1ec2afaf3347ff848ee46e69c4f5011 Related: OS#4006
2019-06-04bts-trx: trx_if.c: Introduce logging macro LOGPPHIPau Espin Pedrol1-5/+5
This way we unify format. We take the chance to add related information to some log messages which were not printing that information (and was confusing when using more than one phy instance). Change-Id: I5b17a01638ade9a6c41da73e550d5947fa92f568
2018-12-04bts-trx: (n)ack PDCH DEACT only after TRX answered SETSLOTPau Espin Pedrol1-5/+41
Before this patch, PDCH DEACT was (n)acked to the BSC without taking into account if TRX succeeded or failed to set the TS: 20181123044720655 DRLL rsl.c:2523 (bts=0,trx=0,ts=0,ss=0) Rx RLL DATA_REQ Abis -> LAPDm 20181123044720700 DRSL rsl.c:2805 (bts=0,trx=0,ts=6,pchan=TCH/F_PDCH as PDCH) ss=0 Rx RSL IPAC_PDCH_DEACT 20181123044720700 DRSL rsl.c:2205 (bts=0,trx=0,ts=6,pchan=TCH/F_PDCH as PDCH) Request to PDCH DEACT, but lchan is still active 20181123044720700 DRSL rsl.c:2131 (bts=0,trx=0,ts=6,ss=0) Tx PDCH DEACT NACK (cause = 0x0f) 20181123044720700 DPCU pcu_sock.c:124 Sending info 20181123044720700 DPCU pcu_sock.c:139 BTS is up 20181123044720700 DPCU pcu_sock.c:232 trx=0 ts=7: available (tsc=7 arfcn=868) 20181123044720703 DPCU pcu_sock.c:608 Deactivate request received: TRX=0 TX=6 20181123044720703 DL1C l1sap.c:1519 deactivating channel chan_nr=TCH/F on TS6 trx=0 20181123044720703 DTRX trx_if.c:242 Enqueuing TRX control command 'CMD NOHANDOVER 6 0' 20181123044720703 DL1C l1sap.c:648 deactivate confirm chan_nr=TCH/F on TS6 trx=0 20181123044720703 DRSL rsl.c:714 (bts=0,trx=0,ts=6,ss=0) not sending REL ACK 20181123044720703 DRSL rsl.c:2264 (bts=0,trx=0,ts=6,ss=0) PDCH DEACT operation: channel disconnected, will reconnect as TCH 20181123044720703 DL1C scheduler.c:593 Configuring multiframe with TCH/F+SACCH trx=0 ts=6 20181123044720703 DTRX trx_if.c:242 Enqueuing TRX control command 'CMD SETSLOT 6 1' 20181123044720703 DL1C l1_if.c:780 (bts=0,trx=0,ts=6) bts_model_ts_connect(as_pchan=TCH/F) success, calling cb_ts_connected() 20181123044720703 DRSL rsl.c:2339 (bts=0,trx=0,ts=6,ss=0) PDCH DEACT operation: timeslot connected as TCH/F 20181123044720703 DRSL rsl.c:2440 (bts=0,trx=0,ts=6,ss=0) TCH/F_PDCH switched to TCH/F mode (ts->flags == 0) 20181123044720703 DRSL rsl.c:2103 (bts=0,trx=0,ts=6,ss=0) Tx PDCH DEACT ACK 20181123044720704 DTRX trx_if.c:492 Response message: 'RSP NOHANDOVER 0 6' 20181123044720705 DTRX trx_if.c:492 Response message: 'RSP SETSLOT 0 6 1' Change-Id: I888de761b65c3ea8bfe623fcf009f3b2b57c926c
2018-11-26bts_model: Allow TS connect to be processed asynchronouslyPau Espin Pedrol1-5/+3
This commit doesn't change internal logic of any model, only the API to be able to return result of connect TS asyncrhonously since some models (like osmo-bts-trx) require some time to process the result. This way PDCH ACT/DEACT (N)ACK can be sent once the result of this long process is known. For instance, nowadays in osmo-bts-trx we PDCH (DE)ACT ACK before getting the result from SETSLOT on the TRX iface. With this new API, bts_model_ts_connect doesn't return any value synchronously. Instead, it is expected to always end up calling cb_ts_connected with the return code from the TS activation process. 0 is considered a successs, while any other value is considered an error. Change-Id: Ie073a4397dd2f1a691968d12b15b8b42f1e1b0cf
2018-11-26cosmetic: fix whitespacePau Espin Pedrol1-1/+1
Change-Id: Iaa4552844db33fe69da5ed7028dbfa0100c33900
2018-11-20bts-trx: setup timer once at creation timePau Espin Pedrol1-0/+8
The setup is only needed once, so no need to set it every time we want to schedule it. Furthermore, it will ease new code introduced in follow-up patches, which will schedule this timer under some circumstances without need to send a message at the same time (because re-try of a cmd after a delay is wanted). This commit adds an alloc function and an init function to keep different parts of the code decoupled and avoid exposing more implementation details between them (like exposing the trx_if timer). Change-Id: I3b6461d0130d25284e673c5efce0b3832c48bbb5
2018-09-17CBCH: Fix CBCH implementation for osmo-bts-trxHarald Welte1-2/+6
Unfortunately the code in Icc15603079a1709ec094f400a9bcf0008211890f was incomplete as it missed a few spots where the CBCH-enabled channel types weren't yet covered. Using this patch I can both still perform RACH / Location Update as well as actually receive SMSCB messages on an attached phone (Galaxy S5). Change-Id: I311b141668549ef37054cbe74be66bf17ac1d7e6 Closes: OS#1617 Closes: OS#3559
2018-09-16osmo-bts-trx/l1_if.c: cosmetic: fix typo in debug msgVadim Yanitskiy1-1/+1
There is a big difference between both L1 and L2 frames. In the first case, a TDMA frame is assumed, while a L2 frame is the result of decoding a few bursts (e.g. 4 for xCCH) arrived on a few TDMA frames. Anyway, the purpose of l1if_process_meas_res() is to handle measurements, not frames. Change-Id: Ic4362c2869e658c2f42664b4009a30e777f8048c
2018-08-28fix ip.access dyn TS for osmo-bts-trxNeels Hofmeyr1-0/+14
For enabling PDCH on a dynamic timeslot, PDTCH and PTCCH SAPIs shall be enabled. While osmo-bts-sysmo uses the lchan->type to determine which SAPIs to enable (see lchan_activate() in osmo-bts-sysmo/oml.c: sapis_for_lchan[lchan->type]), the osmo-bts-trx code instead relies on the chan_nr indicating RSL_CHAN_OSMO_PDCH = 0xc0 (see trx_sched_set_lchan() in common/scheduler.c and the PDTCH,PTCCH entries in trx_chan_desc[]). The 0xc0 cbits are a non-standard invention specifically used for only Osmocom style dyn TS, so the chan_nr for IPA style dyn TS will and should never include this cbits pattern. Hence gsm_lchan2chan_nr() correctly always returns the TCH/F equivalent chan_nr for IPA dyn TS. Because trx_chan_desc[] relies on the 0xc0 in the chan_nr to activate the PDTCH and PTCCH SAPIs, internally patch the 0xc0 cbits over the chan_nr in osmo-bts-trx/l1_if.c for channel de-/activation, iff lchan->type == PDTCH. This is technically a convoluted mix-up of the cbits usage. Nevertheless, it is the simplest way to make IPA dyn TS behave the same as Osmocom dyn TS in scheduler.c. Apparently, IPA style dyn TS have never worked for osmo-bts-trx before? Related: OS#3493 Change-Id: I0eed8a135f2ab7e7c0d15ad5c76430b7fe54df3d
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.