summaryrefslogtreecommitdiffstats
path: root/src/target/trx_toolkit/fake_trx.py
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-07-11 03:59:39 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-07-14 17:21:14 +0700
commit6e1c82d29836496b20e0d826976d9e71b32493d8 (patch)
treeccf08d6a1353a5fd177e67d609eddcc95d180846 /src/target/trx_toolkit/fake_trx.py
parentf262caca7980b27f575d008cb67711de8559db6c (diff)
trx_toolkit/transceiver.py: implement the transmit burst queue
In order to reflect the UL/DL delay caused by the premature burst scheduling (a.k.a. 'fn-advance') in a virtual environment, the Transceiver implementation now queues all to be transmitted bursts, so they remain in the queue until the appropriate time of transmission. The API user is supposed to call recv_data_msg() in order to obtain a L12TRX message on the TRXD (data) inteface, so it gets queued by this function. Then, to ensure the timeous transmission, the user of this implementation needs to call clck_tick() on each TDMA frame. Both functions are thread-safe (queue mutex). In a multi-trx configuration, the use of queue additionally ensures proper burst aggregation on multiple TRXD connections, so all L12TRX messages are guaranteed to be sent in the right order, i.e. with monolithically-increasing TDMA frame numbers. Of course, this change increases the overall CPU usage, given that each transceiver gets its own queue, and we need to serve them all on every TDMA frame. According to my measurements, when running test cases from ttcn3-bts-test, the average load is ~50% higher than what it used to be. Still not significantly high, though. Change-Id: Ie66ef9667dc8d156ad578ce324941a816c07c105 Related: OS#4658, OS#4546
Diffstat (limited to 'src/target/trx_toolkit/fake_trx.py')
-rwxr-xr-xsrc/target/trx_toolkit/fake_trx.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/target/trx_toolkit/fake_trx.py b/src/target/trx_toolkit/fake_trx.py
index 27c2b888..b487a938 100755
--- a/src/target/trx_toolkit/fake_trx.py
+++ b/src/target/trx_toolkit/fake_trx.py
@@ -388,6 +388,8 @@ class Application(ApplicationBase):
# Init shared clock generator
self.clck_gen = CLCKGen([])
+ # This method will be called on each TDMA frame
+ self.clck_gen.clck_handler = self.clck_handler
# Power measurement emulation
# Noise: -120 .. -105
@@ -456,14 +458,18 @@ class Application(ApplicationBase):
for trx in self.trx_list.trx_list:
# DATA interface
if trx.data_if.sock in r_event:
- msg = trx.recv_data_msg()
- if msg is not None:
- self.burst_fwd.forward_msg(trx, msg)
+ trx.recv_data_msg()
# CTRL interface
if trx.ctrl_if.sock in r_event:
trx.ctrl_if.handle_rx()
+ # This method will be called by the clock thread
+ def clck_handler(self, fn):
+ # We assume that this list is immutable at run-time
+ for trx in self.trx_list.trx_list:
+ trx.clck_tick(self.burst_fwd, fn)
+
def shutdown(self):
log.info("Shutting down...")