aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/trx_provision_fsm.c
AgeCommit message (Collapse)AuthorFilesLines
2021-10-23osmo-bts-trx: fix potential NULL pointer dereferenceVadim Yanitskiy1-4/+6
Change-Id: Ic9c1f3a3fb9c151bba4f6c3e605746fc8d43f44f Fixes: CID#240207
2021-10-04trx_provision_fsm: Fix shutdown while POWERON in transitPau Espin Pedrol1-1/+11
EV_CLOSE in state OPEN_WAIT_POWERON_CNF was not permitted, hence TRX0 was finally moved and kept to state OPEN_POWERON while other TRX were moved OPEN_POWERON->OPEN_WAIT_POWER_CNF: """ 20211004090637640 DL1C <0006> trx_provision_fsm.c:86 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_POWEROFF}: Received Event TRX_PROV_EV_NOMTXPOWER_CNF 20211004090637640 DL1C <0006> trx_provision_fsm.c:498 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_POWEROFF}: state_chg to OPEN_WAIT_POWERON_CNF 20211004090637640 DTRX <000b> trx_if.c:256 phy0.0: Enqueuing TRX control command 'CMD POWERON' ... 20211004090637641 DABIS <000d> abis.c:397 E1L(0) Signalling link down ... 20211004090637642 DOML <0001> bts_shutdown_fsm.c:74 BTS_SHUTDOWN(bts0)[0x55fddfb0b4e0]{NONE}: state_chg to WAIT_TRX_CLOSED ... 20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-3)[0x55fddfb238b0]{OPEN_POWERON}: Received Event TRX_PROV_EV_CLOSE 20211004090637642 DL1C <0006> trx_provision_fsm.c:606 TRX_PROV(phy0-3)[0x55fddfb238b0]{OPEN_POWERON}: state_chg to OPEN_WAIT_POWEROFF_CNF 20211004090637642 DOML <0001> l1_if.c:194 NM_RCARRIER_OP(bts0-trx3)[0x55fddfb2ab20]{DISABLED_OFFLINE}: Received Event DISABLE 20211004090637642 DOML <0001> l1_if.c:195 NM_BBTRANSC_OP(bts0-trx3)[0x55fddfb2ae00]{DISABLED_OFFLINE}: Received Event DISABLE 20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-2)[0x55fddfb22500]{OPEN_POWERON}: Received Event TRX_PROV_EV_CLOSE 20211004090637642 DL1C <0006> trx_provision_fsm.c:606 TRX_PROV(phy0-2)[0x55fddfb22500]{OPEN_POWERON}: state_chg to OPEN_WAIT_POWEROFF_CNF 20211004090637642 DOML <0001> l1_if.c:194 NM_RCARRIER_OP(bts0-trx2)[0x55fddfb27410]{DISABLED_OFFLINE}: Received Event DISABLE 20211004090637642 DOML <0001> l1_if.c:195 NM_BBTRANSC_OP(bts0-trx2)[0x55fddfb27660]{DISABLED_OFFLINE}: Received Event DISABLE 20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-1)[0x55fddfb21150]{OPEN_POWERON}: Received Event TRX_PROV_EV_CLOSE 20211004090637642 DL1C <0006> trx_provision_fsm.c:606 TRX_PROV(phy0-1)[0x55fddfb21150]{OPEN_POWERON}: state_chg to OPEN_WAIT_POWEROFF_CNF 20211004090637642 DOML <0001> l1_if.c:194 NM_RCARRIER_OP(bts0-trx1)[0x55fddfb23b50]{DISABLED_OFFLINE}: Received Event DISABLE 20211004090637642 DOML <0001> l1_if.c:195 NM_BBTRANSC_OP(bts0-trx1)[0x55fddfb23e60]{DISABLED_OFFLINE}: Received Event DISABLE 20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_WAIT_POWERON_CNF}: Received Event TRX_PROV_EV_CLOSE 20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_WAIT_POWERON_CNF}: Event TRX_PROV_EV_CLOSE not permitted 20211004090637642 DOML <0001> l1_if.c:194 NM_RCARRIER_OP(bts0-trx0)[0x55fddfb0bb70]{DISABLED_OFFLINE}: Received Event DISABLE 20211004090637642 DOML <0001> l1_if.c:195 NM_BBTRANSC_OP(bts0-trx0)[0x55fddfb0be50]{DISABLED_OFFLINE}: Received Event DISABLE 20211004090637642 DTRX <000b> trx_if.c:672 phy0.0: Response message: 'RSP POWERON 0' 20211004090637642 DL1C <0006> trx_provision_fsm.c:56 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_WAIT_POWERON_CNF}: Received Event TRX_PROV_EV_POWERON_CNF """ This left the BTS in an unexpected broken state and TTCN3 tests after this race condition failed. Change-Id: Ic4831201a5be1bc9aff757a9a061c637d98582de
2021-10-04trx_provision_fsm: poweronoff_sent flag: track POWERON and POWEROFF separatelyPau Espin Pedrol1-7/+9
It helps better understanding the code, and will allow handling situations where for instance a POWERON in in transit while the BTS is instructed to shutdown, hence a POWEROFF needs to be sent. Change-Id: Iaf62217ceab7420afa4140cba61e1c2f983c61b4
2021-10-04trx_provision_fsm: Drop impossible pathsPau Espin Pedrol1-7/+2
config.enabled is always true in that state. Hence, those paths can be securely dropped since only add confusion. Change-Id: Icf00c52e61ddedd8e32eb37223cea5686005e6a3
2021-10-04trx_provision_fsm: Drop unneeded reset of fieldsPau Espin Pedrol1-6/+0
Since recently, reset of all fields is already properly done in trx_provision_reset(). Change-Id: I3e6bc8205704e425644507dd1f1b299dea4cd851
2021-09-30bts-trx: Delay power ramp up until RCARRIER is ENABLEDPau Espin Pedrol1-7/+26
Prior to this patch, the power ramping started when the PHY is available, but that doesn't necessarily mean the RCARRIER is enabled. Due to this, it was spotted a situation where BTS bootstrap failed after PHY turning up, when RSL connection establishment failed. Hence bts_shutdown_fsm triggered a shutdown while an active power ramping up was ongoing... Change-Id: I17208b74ea2649b1bbb717aee0aa355e42b7e860
2021-09-30trx_provision_fsm: Support OPEN_POWEROFF->CLOSED transitionPau Espin Pedrol1-10/+28
This may happen if bts_shutdown starts a poweroff procedure while POWERON was still not sent to the TRX. In this case, we want to go back to initial closed state to fullfill expected state when BTS is shutdown. Change-Id: Id660fa1018ef175ab237733b37629c56313c061d
2021-09-30trx_provision_fsm: Fix TRX!=0 never going back to CLOSED statePau Espin Pedrol1-7/+4
Change-Id: I39bef8b5776cbf1098753865c597b1c99d355bec
2021-09-27bts-trx: Fix rxgain & maxdly VTY values being resetPau Espin Pedrol1-4/+0
Recent commit added code to reset trx_provision_fsm state fields in orer to support re-using the FSM once BTS is reconnected to a BSC. However, some values being reset there are not set up when reconnecting to the BSC, but rather configured through VTY at startup. Hence those values should be kept. Fixes: 32b51eca7d2a5215814db7843b1a0f8c74ea7527 Change-Id: I5c31241327b98386c313cd9377cf76c009456105
2021-09-23phy_link: Introduce bts_model_phy_link_close() and use it in bts-trxPau Espin Pedrol1-4/+3
This step is required while turning off the BTS without killing the process. Right now only osmo-bts-trx supports this feature, so this function is only available and used by osmo-bts-trx. Later on, when the feature is support more generally, we can move call to this function to common place like bts_shutdown_fsm or alike. Change-Id: I3253112700a31b85db82dc7ccadec8542bac745e
2021-09-23bts-trx: Submit TRX SW_ACT when PHY becomes connectedPau Espin Pedrol1-0/+4
Once the TRXC link is available, we can signal SW_ACT which will transit rcarrier and bbtransc NM FSMs to Disabled Offline and announce availability to be configured to the BSC through transmission of Software Activated Report. Change-Id: I6e62ec2fdd4cae58b52d83fa851552f7ed51c821
2021-09-23trx_provision_fsm: Properly reset FSM state upon starting listening for eventsPau Espin Pedrol1-1/+52
Change-Id: If0d078bc0170091efbca351c44ee412dad1e944a
2021-09-20trx_provision_fsm: Add missing state transition OPEN_WAIT_POWEROFF_CNF => ↵Pau Espin Pedrol1-0/+1
OPEN_POWEROFF Change-Id: I361c1acddfe7ebffb44d886d0545240ef1bbd347
2021-06-04[VAMOS] osmo-bts-trx: properly handle per-timeslot TSC valuesVadim Yanitskiy1-40/+33
Each timeslot can have its own Training Sequence Code value, which may optionally be included in the NM_MT_SET_CHAN_ATTR message sent over the A-bis/OML. If it's not present, then the TSC value for a timeslot is derived from the BCC part of BSIC, which is always included in the NM_MT_SET_BTS_ATTR message. On the TRXC interface, the BTS global TSC value is indicated to the transceiver using either of the 'SETTSC' or 'SETBSIC' commands. The transceiver then applies this value for all timeslots by default, however it can be redefined for each timeslot individually using additional arguments of the 'SETSLOT' command (see section 25.2.4.1 in the user manual [1] for more details). Currently, trx_set_ts_as_pchan() sends TRX_PROV_EV_CFG_TSC to the transceiver provisioning FSM, together with the per-timeslot TSC value. This event causes the FSM to modify the global TSC value, that is going to be or has already been sent to the transceiver. This is wrong, the global TSC value shall not be overwritten. Remove the TRX_PROV_EV_CFG_TSC, and include per-timeslot Training Sequence Code and Set in the data structure that gets passed together with the TRX_PROV_EV_CFG_TS instead. Implement handling of the optional per-timeslot TSC in trx_if_cmd_setslot(). [1] https://downloads.osmocom.org/docs/latest/osmobts-usermanual.pdf Change-Id: Idc5796151e3e83f42d60c2d4cb7c35890d76a7f5 Related: SYS#4895, OS#4941
2021-05-19osmo-bts-{trx,virtual}: fix: pinst->trx may be NULLVadim Yanitskiy1-1/+4
We assume that it's legal to have dangling PHY instances that are not associated with any TRX instances in the configuration file. Obviously, such PHY instances have pinst->trx set to NULL. The DSP based models seem to handle dangling PHY instances without any problems, so let's ensure that we always check pinst->trx against NULL in the osmo-bts-{trx,virtual} specific code. Change-Id: Ib7d9cb7ae47fead723fa46454cd64bf6e88756bb Fixes: CID#236092 "Dereference before null check"
2021-04-21osmo-bts-trx: cosmetic: TRXD 'header version' -> 'PDU version'Vadim Yanitskiy1-12/+12
TRXDv2 brings significant changes to the whole PDU structure, not just the header. Let's highlight this in the code / strings. Change-Id: Id0274bd1ae5c419548596ed1852e6a28ec62b713 Related: SYS#4895, OS#4941, OS#4006
2020-09-10osmo-bts-trx: also print 'txtune-ack' in st_open_poweroff()Vadim Yanitskiy1-1/+2
Change-Id: Ifa453e101c32ee211844becf4604f3e08198da73
2020-09-07bts-trx: Ensure RFMUTE state is set properly at startupPau Espin Pedrol1-0/+3
In general, it is always set to 1 (Locked) in st_open_poweroff_on_enter() right after initial POWEROFF, and once the BSC unlocks it (based on VTY cfg "rf_locked (0|1)") by sending an OML message, the bts_model_chg_adm_state() call will update it sending RFMUTE. This basically fixes the case where osmo-bsc.cfg is configured with "rf_locked 1" to start with a TRX locked until manually unlocked. Related: SYS#4920 Change-Id: I96b64cdc901d6f216df628d7be57a67af4a21e25
2020-09-05osmo-bts-trx/trx_provision_fsm: add missing default labelsVadim Yanitskiy1-0/+8
Change-Id: I494ea9eb64634a03575a52750273cee7c68a8b3a
2020-09-05osmo-bts-trx/trx_provision_fsm: cosmetic: switch is not a functionVadim Yanitskiy1-5/+5
Change-Id: I56d2777bcc43c96b9fa1672d3ad29bf9817208bb
2020-09-05osmo-bts-trx/trx_provision_fsm: fix misleading comment in headerVadim Yanitskiy1-1/+1
Change-Id: Iff9f073ce65bc443109107bb895124ec38dbbb10
2020-07-24bts-trx: prov_fsm: Fix mess with 1 event having 2 namesPau Espin Pedrol1-2/+1
They were both half implemented but named differently, due to myself adding them during the initial FSM implementation. This prevents osmo-bts-trx sending a POWEROFF when OML link is dropped. Related: SYS#4864 Change-Id: Ic2dab864b6d4075dfb9a1e4acfd9af013c9c46fe
2020-07-22bts-trx: Delay TRXC POWERON cmd until all TRXs are provisionedPau Espin Pedrol1-8/+57
Waiting until all other TRX are provisioned before really sending POWERON helps avoiding race conditions where TRX!=0 are not yet fully configured at the TRX side before POWERON is called. This solves for instance the situation where after POWERON RSP the BTS started ramping up on all TRX while on some NOMTXPOWER RSP was yet not received... Related: SYS#4920 Change-Id: I906be4714807c7a2793971cb6062120e24337d7b
2020-07-22bts-trx: Integrate TRX provisioning logic more tightly into the FSMPau Espin Pedrol1-49/+180
The state of each config required is now tracked through the "acked" variables, this way the FSM can know when all configs are confirmed by the TRX and can proceed to submit POWERON command. With this version each TRX is still totally independent (there's an FSM per TRX), which means POWERON can be sent on TRX0 before TRX!=0 are fully configured. As a result, powe ramping may start before we know the NOMTXPOWER of a TRX. This kind of issue will be fixed in next commit. Related: SYS#4920 Change-Id: I1b736a4be5ce52a854f5767d8609153e1f4c08d9
2020-07-22bts-trx: Use bool type for on/off state variablesPau Espin Pedrol1-21/+21
Change-Id: Icb1b7bd8852417ab7b9a7dbc205aa6f6db97d64d
2020-07-14bts-trx: introduce TRX provisioning FSMPau Espin Pedrol1-0/+459
With prior code state managing the TRXC side of osmo-bts-trx, there are plenty o cases (race conditions) where things can go wrong/unexpected, because there's really no infrastructure to wait and synchronize between different TRXs (eg wait until all are configured to POWERON), or to simply keep well known per-trx state regarding lower layers. In order to fix in the future all of those issues and to sanitize current code, a new per-trx FSM is introduced, which takes care of submitting TRXC commands and waiting for response when needed to manage the state of the TRX. Related: OS#4364 Change-Id: I2a00c23df15840e33fbb232c9e1dd6db128f63f6