diff options
author | Philipp <pmaier@sysmocom.de> | 2016-11-07 13:07:36 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-11-17 21:09:55 +0100 |
commit | bd25b76c0172c82f7712fc369b63986bb1567ce5 (patch) | |
tree | 733c0cb551d940f528543b2b514c62801a4f082a | |
parent | e18f0a4e6c046253cf511e8f9c5085072cbe16cb (diff) |
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
-rw-r--r-- | src/bts.cpp | 7 | ||||
-rw-r--r-- | tests/tbf/TbfTest.cpp | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/bts.cpp b/src/bts.cpp index 763fa2a4..b63c162f 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -525,6 +525,13 @@ int BTS::rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, rach_frame(); + /* Santizize 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; + if (is_11bit) rach_frame_11bit(); diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 213bd125..de8df60f 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -42,6 +42,8 @@ extern "C" { #include <errno.h> +#define DUMMY_FN 2654167 + void *tall_pcu_ctx; int16_t spoof_mnc = 0, spoof_mcc = 0; @@ -166,6 +168,7 @@ static void setup_bts(BTS *the_bts, uint8_t ts_no, uint8_t cs = 1) 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, @@ -1350,7 +1353,7 @@ static void test_tbf_single_phase() { 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; |