Change in osmo-ttcn3-hacks[master]: bts: Fix race condition during init_rsl receiving from multiple TRX

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Fri Oct 16 12:07:09 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20678 )


Change subject: bts: Fix race condition during init_rsl receiving from multiple TRX
......................................................................

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
---
M bts/BTS_Tests.ttcn
1 file changed, 20 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/78/20678/1

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 0ce611a..ae2d2e0 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -194,8 +194,11 @@
 
 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 @@
 				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 {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20678
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I1296c76c1d97e6704340484994ff3921975146b9
Gerrit-Change-Number: 20678
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201016/d6544d10/attachment.htm>


More information about the gerrit-log mailing list