[PATCH] osmo-pcu[master]: EGPRS: add test case to show EPDAN BSN out of window bug

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

arvind.sirsikar gerrit-no-reply at lists.osmocom.org
Tue Oct 25 07:19:25 UTC 2016


Hello Neels Hofmeyr, Jenkins Builder,

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

    https://gerrit.osmocom.org/861

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

EGPRS: add test case to show EPDAN BSN out of window bug

This patch adds a test case test_tbf_epdan_out_of_rx_window,
which expects a current bug with EPDAN for interpretation of the
bitmap explained in section 9.1.8.2.4 in 44.060 version 7.27.0
Release 7. The specification explains that a bit within the
uncompressed bitmap whose corresponding BSN is not within the
transmit window shall be ignored. But current PCU implementation
drops the EPDAN and does not update status of the BSN which are
inside the window. The test's expectation is corrected along with
the bug fix in a subsequent commit.

Related: OS#1789

Change-Id: If32b67f5c05707155281128b776a90a1e3d587b2
---
M tests/tbf/TbfTest.cpp
M tests/tbf/TbfTest.err
M tests/tbf/TbfTest.ok
3 files changed, 140 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/61/861/9

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 @@
 	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 @@
 	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 @@
 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 @@
 === 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 ===

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If32b67f5c05707155281128b776a90a1e3d587b2
Gerrit-PatchSet: 9
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: arvind.sirsikar <arvind.sirsikar at radisys.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: arvind.sirsikar <arvind.sirsikar at radisys.com>



More information about the gerrit-log mailing list