[PATCH] osmocom-bb[master]: fake_trx: implement simple freq. filter

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:33:02 UTC 2018


Review at  https://gerrit.osmocom.org/6727

fake_trx: implement simple freq. filter

Change-Id: Ifbeaebeaf68a88c07a05b672502f503ab7b890f2
---
M src/target/fake_trx/burst_fwd.py
M src/target/fake_trx/ctrl_if_bb.py
M src/target/fake_trx/ctrl_if_bts.py
M src/target/fake_trx/fake_trx.py
4 files changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/27/6727/1

diff --git a/src/target/fake_trx/burst_fwd.py b/src/target/fake_trx/burst_fwd.py
index 1ac74c0..5989ce9 100644
--- a/src/target/fake_trx/burst_fwd.py
+++ b/src/target/fake_trx/burst_fwd.py
@@ -26,6 +26,10 @@
 	# Timeslot filter (drop everything by default)
 	ts_pass = None
 
+	# Freq. filter
+	bts_freq = None
+	bb_freq = None
+
 	def __init__(self, bts_link, bb_link):
 		self.bts_link = bts_link
 		self.bb_link = bb_link
@@ -61,6 +65,14 @@
 		data, addr = self.bts_link.sock.recvfrom(512)
 		payload = self.process_payload(data)
 
+		# BB is not connected / tuned
+		if self.bb_freq is None:
+			return None
+
+		# Freq. filter
+		if self.bb_freq != self.bts_freq:
+			return None
+
 		# Timeslot filter
 		if payload[0] != self.ts_pass:
 			return None
@@ -74,5 +86,13 @@
 		data, addr = self.bb_link.sock.recvfrom(512)
 		payload = self.process_payload(data)
 
+		# BTS is not connected / tuned
+		if self.bts_freq is None:
+			return None
+
+		# Freq. filter
+		if self.bb_freq != self.bts_freq:
+			return None
+
 		# Send burst to BTS
 		self.bts_link.send(payload)
diff --git a/src/target/fake_trx/ctrl_if_bb.py b/src/target/fake_trx/ctrl_if_bb.py
index 3882b6a..440094a 100644
--- a/src/target/fake_trx/ctrl_if_bb.py
+++ b/src/target/fake_trx/ctrl_if_bb.py
@@ -72,6 +72,7 @@
 
 			# TODO: check freq range
 			self.rx_freq = int(request[1]) * 1000
+			self.burst_fwd.bb_freq = self.rx_freq
 			return 0
 
 		elif self.verify_cmd(request, "TXTUNE", 1):
diff --git a/src/target/fake_trx/ctrl_if_bts.py b/src/target/fake_trx/ctrl_if_bts.py
index a6b03cf..96027fe 100644
--- a/src/target/fake_trx/ctrl_if_bts.py
+++ b/src/target/fake_trx/ctrl_if_bts.py
@@ -27,6 +27,7 @@
 class CTRLInterfaceBTS(CTRLInterface):
 	# Internal state variables
 	trx_started = False
+	burst_fwd = None
 	rx_freq = None
 	tx_freq = None
 	pm = None
@@ -88,6 +89,7 @@
 
 			# TODO: check freq range
 			self.tx_freq = int(request[1]) * 1000
+			self.burst_fwd.bts_freq = self.tx_freq
 			return 0
 
 		# Wrong / unknown command
diff --git a/src/target/fake_trx/fake_trx.py b/src/target/fake_trx/fake_trx.py
index 533b264..aaa308d 100755
--- a/src/target/fake_trx/fake_trx.py
+++ b/src/target/fake_trx/fake_trx.py
@@ -80,6 +80,9 @@
 		self.bb_data = UDPLink(self.bb_addr,
 			self.bb_base_port + 102, self.bb_base_port + 2)
 		self.burst_fwd = BurstForwarder(self.bts_data, self.bb_data)
+
+		# Share a BurstForwarder instance between BTS and BB
+		self.bts_ctrl.burst_fwd = self.burst_fwd
 		self.bb_ctrl.burst_fwd = self.burst_fwd
 
 		# Share clock between BTS and BB

-- 
To view, visit https://gerrit.osmocom.org/6727
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbeaebeaf68a88c07a05b672502f503ab7b890f2
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list