diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-10-16 13:52:28 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-10-16 14:06:03 +0200 |
commit | 9a053c07c9c69409e61a7d72def27c3ce4f57c55 (patch) | |
tree | 9be642d33b0cc3ace3a655698c51b9a05d736dbf | |
parent | 023b61b2cbdbb9f97bd50555058576e8a466e90a (diff) |
bts: Fix race condition during init_rsl receiving from multiple TRX
When several TRX are set up, it can be that in between a RSLEM_EV_TRX_UP
event and the related tr_RSL_RF_RES_IND for that TRX, we receive a
RSLEM_EV_TRX_UP from another TRX which got just connected in parallel.
Change-Id: I1296c76c1d97e6704340484994ff3921975146b9
-rw-r--r-- | bts/BTS_Tests.ttcn | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn index 0ce611a9..ae2d2e0a 100644 --- a/bts/BTS_Tests.ttcn +++ b/bts/BTS_Tests.ttcn @@ -194,8 +194,11 @@ type component ConnHdlr extends RSL_DchanHdlr, lapdm_test_CT { private function f_init_rsl(charstring id) runs on test_CT { var bitstring trx_mask := '00000000'B; + var bitstring rfind_mask := '00000000'B; var integer trx_count := 0; + var integer rfind_count := 0; var RSLEm_Event ev; + var ASP_RSL_Unitdata rx_ud; timer T; vc_IPA := IPA_Emulation_CT.create(id & "-RSL-IPA"); @@ -220,14 +223,28 @@ private function f_init_rsl(charstring id) runs on test_CT { log2str("Duplicate RSL stream ID (", ev.sid, ")")); } - /* This message (RF RESource INDication) is sent by the IUT itself */ - RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RF_RES_IND, ev.sid)); trx_mask[enum2int(ev.sid)] := '1'B; trx_count := trx_count + 1; log(trx_count, "/", mp_transceiver_num, " transceiver(s) connected"); - if (trx_count < mp_transceiver_num) { repeat; } + repeat; + } + /* This message (RF RESource INDication) is sent by the IUT itself */ + [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RF_RES_IND, ?)) -> value rx_ud { + if (trx_mask[enum2int(rx_ud.streamId)] == '0'B) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Got RF Resource Indication before RSLEM_EV_TRX_UP (", rx_ud.streamId, ")")); } + if (rfind_mask[enum2int(rx_ud.streamId)] == '1'B) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Duplicate RF Resource Indication ID (", rx_ud.streamId, ")")); + } + + rfind_mask[enum2int(rx_ud.streamId)] := '1'B; + rfind_count := rfind_count + 1; + log(rfind_count, "/", mp_transceiver_num, " RF Resource Indication(s) received"); + if (rfind_count < mp_transceiver_num) { repeat; } + } /* osmo-bts may send us CCCH LOAD INDication or whatever else */ [] RSL_CCHAN.receive(ASP_RSL_Unitdata:?) { repeat; } [] T.timeout { |