aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-25 10:05:34 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-25 12:10:48 +0100
commit2493c660e9cbede4ac43f2584c0a8e6d8625e1dd (patch)
treec7b4e2860297e15aacd4217b0f1169533607661d
parenta3e4509ff9b6ce2de574eaec7d085fc914cfeaab (diff)
tbf/test: Fix fn/block_nr in test_tbf_final_ack
Currently fn and block_nr are not incremented correctly. In addition, the comments around the sending of blocks are not accurate either. This commit introduces the send_rlc_block helper function which takes care of the increments, updates the comments to reflect what is really happening, and adds assertion to verify at least some aspects of what is now stated in the comments. Sponsored-by: On-Waves ehf
-rw-r--r--tests/tbf/TbfTest.cpp23
-rw-r--r--tests/tbf/TbfTest.err10
2 files changed, 25 insertions, 8 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 80d6909..a5effd3 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -132,6 +132,17 @@ static gprs_rlcmac_dl_tbf *create_dl_tbf(BTS *the_bts, uint8_t ms_class,
return dl_tbf;
}
+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)
+{
+ gprs_rlcmac_rcv_rts_block(bts, trx_no, ts_no, 0, *fn, *block_nr);
+ *fn += 4;
+ if ((*fn % 13) == 12)
+ *fn += 1;
+ *block_nr += 1;
+}
+
enum test_tbf_final_ack_mode {
TEST_MODE_STANDARD,
TEST_MODE_REVERSE_FREE
@@ -145,6 +156,7 @@ static void test_tbf_final_ack(enum test_tbf_final_ack_mode test_mode)
unsigned i;
uint8_t ms_class = 45;
uint32_t fn;
+ uint8_t block_nr;
uint8_t trx_no;
uint8_t rbb[64/8];
@@ -160,17 +172,20 @@ static void test_tbf_final_ack(enum test_tbf_final_ack_mode test_mode)
for (i = 0; i < sizeof(llc_data); i++)
llc_data[i] = i%256;
- /* Schedule two blocks */
+ /* Schedule two LLC frames */
dl_tbf->append_data(ms_class, 1000, llc_data, sizeof(llc_data));
dl_tbf->append_data(ms_class, 1000, llc_data, sizeof(llc_data));
- /* FIXME: Need correct frame number here? */
+ /* Send only a few RLC/MAC blocks */
fn = 0;
- for (; fn < 3; fn++) {
+ block_nr = 0;
+ while (block_nr < 3) {
/* Request to send one block */
- gprs_rlcmac_rcv_rts_block(bts, trx_no, ts_no, 0, fn, 0);
+ send_rlc_block(bts, trx_no, ts_no, 0, &fn, &block_nr);
}
+ OSMO_ASSERT(dl_tbf->have_data());
+ OSMO_ASSERT(dl_tbf->state_is(GPRS_RLCMAC_FLOW));
/* Queue a final ACK */
memset(rbb, 0, sizeof(rbb));
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 485d0ee..174237a 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -42,13 +42,14 @@ Complete DL frame for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW)len=0
- Dequeue next LLC for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) (len=200)
-- Chunk with length 200 larger than space (19) left in block: copy only remaining space, and we are done
data block: 07 00 00 03 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=1 block=0 data=07 00 00 03 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=4 block=1 data=07 00 00 03 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12
+Received RTS for PDCH: TRX=0 TS=4 FN=8 block_nr=2 scheduling free USF for polling at FN=13 of TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW)
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4)
TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==1)
- Sending new block at BSN 1
-- Chunk with length 181 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 03 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=2 block=0 data=07 00 03 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=8 block=2 data=07 00 03 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26
TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) downlink acknowledge
- Final ACK received.
TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) changes state from FLOW to WAIT RELEASE
@@ -108,13 +109,14 @@ Complete DL frame for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW)len=0
- Dequeue next LLC for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) (len=200)
-- Chunk with length 200 larger than space (19) left in block: copy only remaining space, and we are done
data block: 07 00 00 03 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=1 block=0 data=07 00 00 03 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=4 block=1 data=07 00 00 03 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12
+Received RTS for PDCH: TRX=0 TS=4 FN=8 block_nr=2 scheduling free USF for polling at FN=13 of TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW)
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4)
TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==1)
- Sending new block at BSN 1
-- Chunk with length 181 larger than space (20) left in block: copy only remaining space, and we are done
data block: 07 00 03 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26
-Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=2 block=0 data=07 00 03 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26
+Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=8 block=2 data=07 00 03 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26
TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) downlink acknowledge
- Final ACK received.
TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) changes state from FLOW to WAIT RELEASE