Change in osmo-pcu[master]: tests: ulc: Show current bug with FN wrap around

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/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Mar 16 10:02:58 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/23356 )

Change subject: tests: ulc: Show current bug with FN wrap around
......................................................................

tests: ulc: Show current bug with FN wrap around

Issue will be fixed in next commit. Leaving ASSERTs disabled so that
test passes in jenkins.

Related: OS#5020
Change-Id: I657db6b300363f8f3a9e4cfaf7a7f49e361a0512
---
M tests/ulc/PdchUlcTest.cpp
M tests/ulc/PdchUlcTest.err
M tests/ulc/PdchUlcTest.ok
3 files changed, 330 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/tests/ulc/PdchUlcTest.cpp b/tests/ulc/PdchUlcTest.cpp
index 7e2bbdd..320a7bf 100644
--- a/tests/ulc/PdchUlcTest.cpp
+++ b/tests/ulc/PdchUlcTest.cpp
@@ -20,6 +20,9 @@
 
 #include <string.h>
 #include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <inttypes.h>
 
 extern "C" {
 #include <osmocom/core/application.h>
@@ -28,6 +31,7 @@
 #include <osmocom/core/utils.h>
 }
 
+#include "gprs_ms.h"
 #include "bts.h"
 #include "sba.h"
 #include "pdch_ul_controller.h"
@@ -35,6 +39,16 @@
 /* globals used by the code */
 void *tall_pcu_ctx;
 
+static void print_ulc_nodes(struct pdch_ulc *ulc)
+{
+	struct rb_node *node;
+	for (node = rb_first(&ulc->tree_root); node; node = rb_next(node)) {
+		struct pdch_ulc_node *it = container_of(node, struct pdch_ulc_node, node);
+		printf("FN=%" PRIu32 " type=%s\n",
+		       it->fn, get_value_string(pdch_ul_node_names, it->type));
+	}
+}
+
 static void test_reserve_multiple()
 {
 	printf("=== start: %s ===\n", __FUNCTION__);
@@ -143,6 +157,61 @@
 	printf("=== end: %s ===\n", __FUNCTION__);
 }
 
+int _alloc_algorithm_dummy(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf,
+			   bool single, int8_t use_tbf)
+{
+	return 0;
+}
+
+
+static void test_fn_wrap_around()
+{
+	printf("=== start: %s ===\n", __FUNCTION__);
+	const uint32_t start_fn = GSM_MAX_FN - 40;
+
+	the_pcu->alloc_algorithm = _alloc_algorithm_dummy;
+
+	struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
+	struct GprsMs *ms = ms_alloc(bts, 0x12345678);
+	struct gprs_rlcmac_tbf *tbf1 = tbf_alloc_dl_tbf(bts, ms, 0, true);
+	tbf1->trx = &bts->trx[0];
+	struct gprs_rlcmac_pdch *pdch = &tbf1->trx->pdch[0];
+	int rc;
+	uint32_t fn, last_fn;
+
+	fn = start_fn;
+	while (fn < 40 || fn >= start_fn) {
+		printf("*** RESERVE FN=%" PRIu32 ":\n", fn);
+		rc = pdch_ulc_reserve_tbf_poll(pdch->ulc, fn, tbf1);
+		OSMO_ASSERT(rc == 0);
+		print_ulc_nodes(pdch->ulc);
+		fn = fn_next_block(fn);
+	}
+	last_fn = fn;
+
+	/* Expiring fn_next_block(start_fn) should only expire first 2 entries here: */
+	fn = fn_next_block(start_fn);
+	printf("*** EXPIRE FN=%" PRIu32 ":\n", fn);
+	pdch_ulc_expire_fn(pdch->ulc, fn);
+	print_ulc_nodes(pdch->ulc);
+
+	/* We should still be able to release FN=0 here, since it came later: */
+	printf("*** RELEASE fn=%" PRIu32 ":\n", 0);
+	rc = pdch_ulc_release_fn(pdch->ulc, 0);
+	print_ulc_nodes(pdch->ulc);
+	//OSMO_ASSERT(rc == 0); FIXME: DISABLED DUE TO BUG!
+
+	/* Expiring last FN should expire all entries */
+	printf("*** EXPIRE FN=%" PRIu32 ":\n", last_fn);
+	pdch_ulc_expire_fn(pdch->ulc, last_fn);
+	print_ulc_nodes(pdch->ulc);
+	/* Make sure the store is empty now: */
+	//OSMO_ASSERT(!rb_first(&pdch->ulc->tree_root)); FIXME: DISABLED DUE TO BUG!
+
+	talloc_free(bts);
+	printf("=== end: %s ===\n", __FUNCTION__);
+}
+
 int main(int argc, char **argv)
 {
 	tall_pcu_ctx = talloc_named_const(NULL, 1, "pdch_ulc test context");
@@ -161,6 +230,7 @@
 	the_pcu = gprs_pcu_alloc(tall_pcu_ctx);
 
 	test_reserve_multiple();
+	test_fn_wrap_around();
 
 	talloc_free(the_pcu);
 	return EXIT_SUCCESS;
diff --git a/tests/ulc/PdchUlcTest.err b/tests/ulc/PdchUlcTest.err
index 29b4846..88e4644 100644
--- a/tests/ulc/PdchUlcTest.err
+++ b/tests/ulc/PdchUlcTest.err
@@ -4,3 +4,28 @@
 PDCH(bts=0,trx=0,ts=0) Trying to reserve already reserved FN 78
 PDCH(bts=0,trx=0,ts=0) Trying to release unregistered SBA (FN=78, TA=0)
 PDCH(bts=0,trx=0,ts=0) Timeout for registered SBA (FN=72, TA=0)
+Creating MS object, TLLI = 0x12345678
+MS(TLLI=0x12345678, IMSI=, TA=220, 0/0,) Attaching DL TBF: TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=0 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=0): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=4 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=4): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=8 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=8): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=13 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=13): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=17 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=17): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=21 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=21): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=26 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=26): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=30 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=30): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=NULL)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=34 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=34): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=RELEASING)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=39 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=39): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=RELEASING)
+PDCH(bts=0,trx=0,ts=0) Expiring FN=2715613 but previous FN=2715608 is still reserved!
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=2715608): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=RELEASING)
+PDCH(bts=0,trx=0,ts=0) Timeout for registered POLL (FN=2715613): TBF(TFI=0 TLLI=0x12345678 DIR=DL STATE=RELEASING)
diff --git a/tests/ulc/PdchUlcTest.ok b/tests/ulc/PdchUlcTest.ok
index a07636f..7c17f01 100644
--- a/tests/ulc/PdchUlcTest.ok
+++ b/tests/ulc/PdchUlcTest.ok
@@ -1,2 +1,237 @@
 === start: test_reserve_multiple ===
 === end: test_reserve_multiple ===
+=== start: test_fn_wrap_around ===
+*** RESERVE FN=2715608:
+FN=2715608 type=POLL
+*** RESERVE FN=2715613:
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+*** RESERVE FN=2715617:
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+*** RESERVE FN=2715622:
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+*** RESERVE FN=2715626:
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+*** RESERVE FN=2715630:
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+*** RESERVE FN=2715635:
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+*** RESERVE FN=2715639:
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+*** RESERVE FN=2715643:
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=0:
+FN=0 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=4:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=8:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=8 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=13:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=8 type=POLL
+FN=13 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=17:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=8 type=POLL
+FN=13 type=POLL
+FN=17 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=21:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=8 type=POLL
+FN=13 type=POLL
+FN=17 type=POLL
+FN=21 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=26:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=8 type=POLL
+FN=13 type=POLL
+FN=17 type=POLL
+FN=21 type=POLL
+FN=26 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=30:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=8 type=POLL
+FN=13 type=POLL
+FN=17 type=POLL
+FN=21 type=POLL
+FN=26 type=POLL
+FN=30 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=34:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=8 type=POLL
+FN=13 type=POLL
+FN=17 type=POLL
+FN=21 type=POLL
+FN=26 type=POLL
+FN=30 type=POLL
+FN=34 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RESERVE FN=39:
+FN=0 type=POLL
+FN=4 type=POLL
+FN=8 type=POLL
+FN=13 type=POLL
+FN=17 type=POLL
+FN=21 type=POLL
+FN=26 type=POLL
+FN=30 type=POLL
+FN=34 type=POLL
+FN=39 type=POLL
+FN=2715608 type=POLL
+FN=2715613 type=POLL
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** EXPIRE FN=2715613:
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** RELEASE fn=0:
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+*** EXPIRE FN=43:
+FN=2715617 type=POLL
+FN=2715622 type=POLL
+FN=2715626 type=POLL
+FN=2715630 type=POLL
+FN=2715635 type=POLL
+FN=2715639 type=POLL
+FN=2715643 type=POLL
+=== end: test_fn_wrap_around ===

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/23356
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I657db6b300363f8f3a9e4cfaf7a7f49e361a0512
Gerrit-Change-Number: 23356
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210316/4443b6fe/attachment.htm>


More information about the gerrit-log mailing list