[PATCH] osmo-pcu[master]: BTS: accept also relative frame numbers with rach requst

dexter gerrit-no-reply at lists.osmocom.org
Wed Jan 25 17:46:12 UTC 2017


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1205

to look at the new patch set (#5).

BTS: accept also relative frame numbers with rach requst

The rach request contains a relative frame number (Fn % 42432),
while BTS::rcv_rach() accepts the full frame number only.

Since the BTS is always aware of the full frame number this is
not a problem. But for BSC co-located PCU schemes it is a problem
since the rach request only contains the relative frame number
as mentioned above.

The pcu continusly receives frame number updates with the GSM time
indication message. It is simple to re-calculate the full frame
number from that information.

This patch makes BTS::rcv_rach() compatible with relative frame
numbers, while not breaking the compatibility for full frame
numbers

Change-Id: Iaa182d8d29c6a0f5fa06064c2eb48b21b1ba2775
---
M src/bts.cpp
M tests/tbf/TbfTest.cpp
2 files changed, 21 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/05/1205/5

diff --git a/src/bts.cpp b/src/bts.cpp
index 25cbc60..5e4266a 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -536,9 +536,23 @@
 	if (is_11bit)
 		rach_frame_11bit();
 
-	LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF on RACH, "
-		"so we provide one \n"
-		"ra=0x%02x Fn=%u qta=%d is_11bit=%d:\n", ra, Fn, qta, is_11bit);
+	/* Note: If a BTS is sending in a rach request it will be fully aware
+	 * of the frame number. If the PCU is used in a BSC-co-located setup.
+	 * The BSC will forward the incoming RACH request. The RACH request
+	 * only contains the relative frame number (Fn % 42432) in its request
+	 * reference. This PCU implementation has to fit both secenarious, so
+	 * we need to assume that Fn is a relative frame number. */
+
+	/* Ensure that all following calculations are performed with the
+	 * relative frame number */
+	Fn = Fn % 42432;
+
+	/* Restore the full frame number
+	 * (See also 3GPP TS 44.018, section 10.5.2.38) */
+	Fn = Fn + m_cur_fn - m_cur_fn % 42432;
+
+	LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF on RACH, so we provide "
+		"one:\n");
 
 	sb = is_single_block(ra, burst_type, is_11bit, &ms_class, &priority);
 
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index aec6ef8..e367ce6 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -42,6 +42,8 @@
 
 #include <errno.h>
 
+#define DUMMY_FN 2654167
+
 void *tall_pcu_ctx;
 int16_t spoof_mnc = 0, spoof_mcc = 0;
 
@@ -166,6 +168,7 @@
 	trx = &bts->trx[0];
 
 	trx->pdch[ts_no].enable();
+	the_bts->set_current_frame_number(DUMMY_FN);
 }
 
 static gprs_rlcmac_dl_tbf *create_dl_tbf(BTS *the_bts, uint8_t ms_class,
@@ -1692,7 +1695,7 @@
 {
 	BTS the_bts;
 	int ts_no = 7;
-	uint32_t fn = 2654167; /* 17,25,9 */
+	uint32_t fn = DUMMY_FN; /* 17,25,9 */
 	uint32_t tlli = 0xf1223344;
 	const char *imsi = "0011223344";
 	uint16_t qta = 31;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iaa182d8d29c6a0f5fa06064c2eb48b21b1ba2775
Gerrit-PatchSet: 5
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list