aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-24 11:55:17 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-24 11:55:17 +0200
commitee31090b2e4204348f7b73d11abe2a07a723d6d8 (patch)
treead34a7b0dac0f7aaabf41434dee4568a98d3e351 /tests
parent64921d217badb9f6938453174da6c2172a1e4cc6 (diff)
tbf/test: Simplify RLC block number handling
The block number can always be deduced from the frame number. The current test code handles the block number explicitely, which makes the code more complex and has also led to block number errors cause by not wrapping the numbers (valid block numbers range from 0 to 11). This commit changes send_rlc_block to always compute the block number based on the frame number. It also turns the block_nr into an optionaly output-only parameter. Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests')
-rw-r--r--tests/tbf/TbfTest.cpp28
-rw-r--r--tests/tbf/TbfTest.err24
2 files changed, 26 insertions, 26 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index f185ad7..2237d56 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -203,15 +203,18 @@ static unsigned fn_add_blocks(unsigned fn, unsigned blocks)
static void send_rlc_block(struct gprs_rlcmac_bts *bts,
uint8_t trx_no, uint8_t ts_no, uint16_t arfcn,
- uint32_t *fn, uint8_t *block_nr)
+ uint32_t *fn, uint8_t *block_nr = NULL)
{
- gprs_rlcmac_rcv_rts_block(bts, trx_no, ts_no, arfcn, *fn, *block_nr);
+ uint8_t bn = fn2bn(*fn);
+ gprs_rlcmac_rcv_rts_block(bts, trx_no, ts_no, arfcn, *fn, bn);
*fn = fn_add_blocks(*fn, 1);
- *block_nr += 1;
+ bn += 1;
+ if (block_nr)
+ *block_nr = bn;
}
static void send_rlc_block(struct gprs_rlcmac_tbf *tbf,
- uint32_t *fn, uint8_t *block_nr)
+ uint32_t *fn, uint8_t *block_nr = NULL)
{
send_rlc_block(tbf->bts->bts_data(), tbf->trx->trx_no,
tbf->control_ts, tbf->trx->arfcn, fn, block_nr);
@@ -254,10 +257,10 @@ static void test_tbf_final_ack(enum test_tbf_final_ack_mode test_mode)
/* Send only a few RLC/MAC blocks */
fn = 0;
- block_nr = 0;
- while (block_nr < 3)
+ do {
/* Request to send one block */
send_rlc_block(dl_tbf, &fn, &block_nr);
+ } while (block_nr < 3);
OSMO_ASSERT(dl_tbf->have_data());
OSMO_ASSERT(dl_tbf->state_is(GPRS_RLCMAC_FLOW));
@@ -299,7 +302,6 @@ static void test_tbf_delayed_release()
unsigned i;
uint8_t ms_class = 45;
uint32_t fn = 0;
- uint8_t block_nr = 0;
uint8_t trx_no;
uint32_t tlli = 0xffeeddcc;
@@ -331,7 +333,7 @@ static void test_tbf_delayed_release()
/* Drain the queue */
while (dl_tbf->have_data())
/* Request to send one RLC/MAC block */
- send_rlc_block(dl_tbf, &fn, &block_nr);
+ send_rlc_block(dl_tbf, &fn);
OSMO_ASSERT(dl_tbf->state_is(GPRS_RLCMAC_FLOW));
@@ -342,7 +344,7 @@ static void test_tbf_delayed_release()
OSMO_ASSERT(dl_tbf->m_window.window_empty());
/* Force sending of a single block containing an LLC dummy command */
- send_rlc_block(dl_tbf, &fn, &block_nr);
+ send_rlc_block(dl_tbf, &fn);
/* Receive an ACK */
dl_tbf->rcvd_dl_ack(0, dl_tbf->m_window.v_s(), rbb);
@@ -350,7 +352,7 @@ static void test_tbf_delayed_release()
/* Timeout (make sure fn % 52 remains valid) */
fn += 52 * ((msecs_to_frames(bts->dl_tbf_idle_msec + 100) + 51)/ 52);
- send_rlc_block(dl_tbf, &fn, &block_nr);
+ send_rlc_block(dl_tbf, &fn);
OSMO_ASSERT(dl_tbf->state_is(GPRS_RLCMAC_FINISHED));
@@ -595,7 +597,6 @@ static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase(BTS *the_bts,
GprsMs *ms;
uint32_t rach_fn = *fn - 51;
uint32_t sba_fn = *fn + 52;
- uint8_t rts_bn = fn2bn(*fn);
uint8_t trx_no = 0;
int tfi = 0;
gprs_rlcmac_ul_tbf *ul_tbf;
@@ -608,7 +609,7 @@ static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase(BTS *the_bts,
bts = the_bts->bts_data();
/* needed to set last_rts_fn in the PDCH object */
- send_rlc_block(bts, trx_no, ts_no, 0, fn, &rts_bn);
+ send_rlc_block(bts, trx_no, ts_no, 0, fn);
/* simulate RACH, this sends an Immediate Assignment Uplink on the AGCH */
the_bts->rcv_rach(0x73, rach_fn, qta);
@@ -642,8 +643,7 @@ static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase(BTS *the_bts,
/* send packet uplink assignment */
*fn = sba_fn;
- rts_bn = fn2bn(*fn);
- send_rlc_block(ul_tbf, fn, &rts_bn);
+ send_rlc_block(ul_tbf, fn);
/* TODO: send real acknowledgement */
/* Fake acknowledgement */
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 15d2efe..6ae4128 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -293,55 +293,55 @@ TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==11)
- Sending new block at BSN 11, CS=1
-- Chunk with length 182 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 17 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=52 block=12 data=07 00 17 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=52 block=0 data=07 00 17 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==12)
- Sending new block at BSN 12, CS=1
-- Chunk with length 162 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 19 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=56 block=13 data=07 00 19 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=56 block=1 data=07 00 19 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==13)
- Sending new block at BSN 13, CS=1
-- Chunk with length 142 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 1b 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=60 block=14 data=07 00 1b 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=60 block=2 data=07 00 1b 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==14)
- Sending new block at BSN 14, CS=1
-- Chunk with length 122 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 1d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=65 block=15 data=07 00 1d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=65 block=3 data=07 00 1d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==15)
- Sending new block at BSN 15, CS=1
-- Chunk with length 102 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 1f 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=69 block=16 data=07 00 1f 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=69 block=4 data=07 00 1f 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==16)
- Sending new block at BSN 16, CS=1
-- Chunk with length 82 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 21 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=73 block=17 data=07 00 21 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=73 block=5 data=07 00 21 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==17)
- Sending new block at BSN 17, CS=1
-- Chunk with length 62 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 23 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=78 block=18 data=07 00 23 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=78 block=6 data=07 00 23 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==18)
- Sending new block at BSN 18, CS=1
-- Chunk with length 42 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 25 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=82 block=19 data=07 00 25 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=82 block=7 data=07 00 25 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==19)
- Sending new block at BSN 19, CS=1
-- Chunk with length 22 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 27 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=86 block=20 data=07 00 27 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=86 block=8 data=07 00 27 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==20)
- Sending new block at BSN 20, CS=1
@@ -354,7 +354,7 @@ Complete DL frame for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW)len=16
data block: 07 00 28 0a 41 c6 c7 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
- Scheduling Ack/Nack polling, because is was requested explicitly (e.g. first final block sent).
Polling is already sheduled for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW), so we must wait for requesting downlink ack
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=91 block=21 data=07 00 28 0a 41 c6 c7 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=91 block=9 data=07 00 28 0a 41 c6 c7 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink acknowledge
- ack: (BSN=85)"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"(BSN=20) R=ACK I=NACK
- got ack for BSN=20
@@ -389,7 +389,7 @@ Complete DL frame for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW)len=19
data block: 07 00 2a 4d 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
- Scheduling Ack/Nack polling, because is was requested explicitly (e.g. first final block sent).
Polling is already sheduled for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW), so we must wait for requesting downlink ack
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=95 block=22 data=07 00 2a 4d 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=95 block=10 data=07 00 2a 4d 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink acknowledge
- ack: (BSN=86)"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"(BSN=21) R=ACK I=NACK
- got ack for BSN=21
@@ -405,7 +405,7 @@ TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) changes state from FLOW to FINISHED
data block: 07 01 2c 4d 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
- Scheduling Ack/Nack polling, because is was requested explicitly (e.g. first final block sent).
Polling is already sheduled for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FINISHED), so we must wait for requesting downlink ack
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=203 block=23 data=07 01 2c 4d 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=203 block=11 data=07 01 2c 4d 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FINISHED) downlink acknowledge
- Final ACK received.
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FINISHED) changes state from FINISHED to WAIT RELEASE