diff options
-rw-r--r-- | tests/tbf/TbfTest.cpp | 102 | ||||
-rw-r--r-- | tests/tbf/TbfTest.err | 36 | ||||
-rw-r--r-- | tests/tbf/TbfTest.ok | 2 |
3 files changed, 140 insertions, 0 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index c716a55..8fb8bfe 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -26,6 +26,7 @@ #include "pcu_utils.h" #include "gprs_bssgp_pcu.h" #include "pcu_l1_if.h" +#include "decoding.h" extern "C" { #include "pcu_vty.h" @@ -2017,6 +2018,106 @@ static void test_tbf_li_decoding(void) printf("=== end %s ===\n", __func__); } +/* + * Test that a bit within the uncompressed bitmap whose BSN is not within + * the transmit window shall be ignored. See section 9.1.8.2.4 of 44.060 + * version 7.27.0 Release 7. + */ +static void test_tbf_epdan_out_of_rx_window(void) +{ + BTS the_bts; + gprs_rlcmac_bts *bts; + uint8_t ms_class = 11; + uint8_t egprs_ms_class = 11; + uint8_t trx_no; + uint32_t tlli = 0xffeeddcc; + gprs_rlcmac_dl_tbf *dl_tbf; + int ts_no = 4; + bitvec *block; + uint8_t bits_data[RLC_EGPRS_MAX_WS/8]; + bitvec bits; + int bsn_begin, bsn_end; + EGPRS_PD_AckNack_t *ack_nack; + RlcMacUplink_t ul_control_block; + gprs_rlc_v_b *prlcmvb; + gprs_rlc_dl_window *prlcdlwindow; + + printf("=== start %s ===\n", __func__); + + bts = the_bts.bts_data(); + + setup_bts(&the_bts, ts_no); + bts->dl_tbf_idle_msec = 200; + bts->egprs_enabled = 1; + /* ARQ II */ + bts->dl_arq_type = EGPRS_ARQ2; + + /* + * Simulate a message captured during over-the-air testing, + * where the following values were observed: + * v_a = 1176, vs = 1288, max sns = 2048, window size = 480. + */ + uint8_t data_msg[23] = {0x40, 0x20, 0x0b, 0xff, 0xd1, + 0x61, 0x00, 0x3e, 0x0e, 0x51, 0x9f, + 0xff, 0xff, 0xfb, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + dl_tbf = create_dl_tbf(&the_bts, ms_class, egprs_ms_class, &trx_no); + dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); + prlcdlwindow = &dl_tbf->m_window; + prlcmvb = &prlcdlwindow->m_v_b; + prlcdlwindow->m_v_s = 1288; + prlcdlwindow->m_v_a = 1176; + prlcdlwindow->set_sns(2048); + prlcdlwindow->set_ws(480); + prlcmvb->mark_unacked(1176); + prlcmvb->mark_unacked(1177); + prlcmvb->mark_unacked(1286); + prlcmvb->mark_unacked(1287); + + OSMO_ASSERT(dl_tbf->state_is(GPRS_RLCMAC_FLOW)); + + block = bitvec_alloc(23); + + bitvec_unpack(block, data_msg); + + bits.data = bits_data; + bits.data_len = sizeof(bits_data); + bits.cur_bit = 0; + + decode_gsm_rlcmac_uplink(block, &ul_control_block); + + ack_nack = &ul_control_block.u.Egprs_Packet_Downlink_Ack_Nack; + + OSMO_ASSERT(prlcmvb->is_unacked(1176)); + OSMO_ASSERT(prlcmvb->is_unacked(1177)); + OSMO_ASSERT(prlcmvb->is_unacked(1286)); + OSMO_ASSERT(prlcmvb->is_unacked(1287)); + + Decoding::decode_egprs_acknack_bits( + &ack_nack->EGPRS_AckNack.Desc, &bits, + &bsn_begin, &bsn_end, &dl_tbf->m_window); + + dl_tbf->rcvd_dl_ack( + ack_nack->EGPRS_AckNack.Desc.FINAL_ACK_INDICATION, + bsn_begin, &bits); + /* + * TODO:status of BSN:1176,1177 shall be invalid + * status of BSN:1286,1287 shall be acked. + * both condition fails because of existing bug. Which shall be + * fixed in subsequent commit + */ + + OSMO_ASSERT(prlcmvb->is_unacked(1176)); + OSMO_ASSERT(prlcmvb->is_unacked(1177)); + OSMO_ASSERT(prlcmvb->is_unacked(1286)); + OSMO_ASSERT(prlcmvb->is_unacked(1287)); + + bitvec_free(block); + tbf_free(dl_tbf); + printf("=== end %s ===\n", __func__); +} + static void test_tbf_egprs_two_phase_spb(void) { BTS the_bts; @@ -2695,6 +2796,7 @@ int main(int argc, char **argv) test_tbf_puan_urbb_len(); test_tbf_update_ws(); test_tbf_li_decoding(); + test_tbf_epdan_out_of_rx_window(); if (getenv("TALLOC_REPORT_FULL")) talloc_report_full(tall_pcu_ctx, stderr); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 8c6b78c..f8e6503 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -6478,3 +6478,39 @@ Send dowlink assignment on PACCH, because TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL EGPRS) changes state from NULL to ASSIGN TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) starting timer 0. TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) append +Searching for first unallocated TFI: TRX=0 + Found TFI=0. +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=11/11 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 11 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 11 +Enabled EGPRS for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS), mode EGPRS +Slot Allocation (Algorithm A) for class 0 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Assign downlink TS=4 TFI=0 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS): trx = 0, ul_slots = 10, dl_slots = 10 +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS): Setting EGPRS window size to 64 +Modifying MS object, TLLI = 0x00000000, TA 220 -> 0 +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS) changes state from NULL to FLOW +The MS object cannot fully confirm an unexpected TLLI: 0xffeeddcc, partly confirmed +TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) downlink acknowledge +- ack: (BSN=1176)"RRRRRRRRRRIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIRRRIRRRRRRRRRRRRRRRRRRRRRRRRRRI"(BSN=1288) R=ACK I=NACK +- ack range is out of V(A)..V(S) range TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) Free TBF! +DL packet loss of IMSI= / TLLI=0xffeeddcc: 100% +TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) changes state from FLOW to RELEASING +TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) free +TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX! +PDCH(TS 4, TRX 0): Detaching TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS), 0 TBFs, USFs = 00, TFIs = 00000000. +Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) +Destroying MS object, TLLI = 0xffeeddcc +********** TBF ends here ********** diff --git a/tests/tbf/TbfTest.ok b/tests/tbf/TbfTest.ok index eb870ea..2978d6d 100644 --- a/tests/tbf/TbfTest.ok +++ b/tests/tbf/TbfTest.ok @@ -66,3 +66,5 @@ Testing retx for MCS 6 to reseg_mcs 3 === end test_tbf_update_ws === === start test_tbf_li_decoding === === end test_tbf_li_decoding === +=== start test_tbf_epdan_out_of_rx_window === +=== end test_tbf_epdan_out_of_rx_window === |