Change in osmo-ttcn3-hacks[master]: pcu: transmit PCUIF DATA.ind with len=0 when no UL data to transmit

pespin gerrit-no-reply at lists.osmocom.org
Fri Mar 12 11:44:42 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23256 )

Change subject: pcu: transmit PCUIF DATA.ind with len=0 when no UL data to transmit
......................................................................

pcu: transmit PCUIF DATA.ind with len=0 when no UL data to transmit

PCUIF will be updated to always send DATA.ind for each expected block FN
on any activated PDCH slot, irrespective of whether valid data was
received or not, similarly to what's done already for TRXDv1 NOPE.ind in
TRXD and TCH channels in OsmoBTS. The aim at this change is to be able to
track TDMA clock in an accurate way without hops, and hence be able to
detect on time whether expected UL blocks (SF, RRBP poll) didn't arrive.

Older osmo-pcu versions can cope well with this change, they will simply
print an error upon ach data_len=0 messages received and submit a GSMTAP
block, then discard it, so tests still pass.
Nevertheless, a new module parameter is added to disable this new
behavior in order to avoid logs and pcap files ending up clogged with
uneeded information until a new osmo-pcu release appears.

Related: OS#5020
Change-Id: Ib4f97a9bcfa68230945effeb6412218faa64ec78
---
M library/PCUIF_Types.ttcn
M pcu/PCUIF_Components.ttcn
2 files changed, 62 insertions(+), 23 deletions(-)

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



diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index ef27b11..96b2bac 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -161,7 +161,7 @@
 	uint32_t		hLayer1,
 	PCUIF_InfoTrxTsList	ts
 } with { variant (pdch_mask) "BITORDER(msb)" };
-private type record length(8) of PCUIF_InfoV10Trx PCUIF_InfoV10TrxList;
+type record length(8) of PCUIF_InfoV10Trx PCUIF_InfoV10TrxList;
 
 /* Version <= 9 specific coding */
 private type record PCUIF_InfoV09Trx {
diff --git a/pcu/PCUIF_Components.ttcn b/pcu/PCUIF_Components.ttcn
index 50de700..6b0a412 100644
--- a/pcu/PCUIF_Components.ttcn
+++ b/pcu/PCUIF_Components.ttcn
@@ -50,6 +50,10 @@
  *               +---------------------------+
  */
 
+modulepar {
+	boolean mp_send_all_data_ind := true;
+}
+
 /* Events are used by the components to indicate that something
  * has happened, e.g. we have got a connection from the PCU. */
 type enumerated RAW_PCU_EventType {
@@ -308,6 +312,8 @@
 
 	/* Whether to forward PTCCH/U burst events to the TC */
 	var boolean cfg_ptcch_burst_fwd := false;
+
+	var PCUIF_info_ind g_info_ind;
 }
 
 /* Queue received messages from Test Case, they will eventually be scheduled and
@@ -337,6 +343,57 @@
 		}
 }
 
+/* Get first message from queue. true if non-empty, false otherwise */
+private function f_tx_data_ind_fn(integer bts_nr, integer fn)
+runs on RAW_PCU_BTS_CT
+{
+	var PCUIF_Message pcu_msg;
+	var boolean has_msg, use_msg;
+	var PCUIF_InfoV10TrxList trx_list := g_info_ind.trx.v10;
+
+	for (var uint8_t ts_nr := 0; ts_nr < 8; ts_nr := ts_nr + 1) {
+		for (var integer trx_nr := 0; trx_nr < lengthof(trx_list); trx_nr := trx_nr + 1) {
+			//var charstring prefix := "BTS=" & int2str(bts_nr) & ",TRX=" & int2str(trx_nr) & ",TS=" & int2str(ts_nr) & ",FN=" & int2str(fn) & ": ";
+			if (trx_list[trx_nr].pdch_mask[ts_nr] == '0'B) {
+				//log(prefix, "disabled");
+				continue; /* TRX+TS not activated */
+			}
+
+			/* Check if we reached time to serve the first DATA.ind message in the queue: */
+			has_msg := f_PCUIF_MsgQueue_first(pdtch_data_queue, pcu_msg) and
+				   pcu_msg.u.data_ind.trx_nr == trx_nr and
+				   pcu_msg.u.data_ind.ts_nr == ts_nr;
+			use_msg := has_msg and (pcu_msg.u.data_ind.fn == 0 or pcu_msg.u.data_ind.fn == fn);
+			if (use_msg) {
+				/* Dequeue a DATA.ind message */
+				f_PCUIF_MsgQueue_dequeue(pdtch_data_queue, pcu_msg);
+				/* Patch TDMA frame / block number */
+				pcu_msg.u.data_ind.fn := fn;
+				pcu_msg.u.data_ind.block_nr := 0; /* FIXME! */
+				//log(prefix, "DATA.ind");
+			} else if (has_msg and pcu_msg.u.data_ind.fn < fn) {
+					setverdict(fail, "We are late scheduling the block! ", pcu_msg.u.data_ind.fn, " < ", fn);
+					mtc.stop;
+			} else {
+				/* NOPE.ind: */
+				pcu_msg := valueof(ts_PCUIF_DATA_IND(bts_nr, trx_nr, ts_nr, 0 /* FIXME */,
+								     PCU_IF_SAPI_PDTCH, ''O, fn,
+								     trx_list[trx_nr].arfcn,
+								     rssi := -80, ber10k := 0,
+								     ta_offs_qbits := 0, lqual_cb := 10));
+				//log(prefix, "DATA.ind (len=0)");
+			}
+
+			if (use_msg or mp_send_all_data_ind) {
+				PCUIF.send(pcu_msg); /* Send to the PCU and notify the TC */
+				if (use_msg) {
+					TC.send(ts_RAW_PCU_CLCK_EV(TDMA_EV_PDTCH_BLOCK_SENT, fn));
+				}
+			}
+		}
+	}
+}
+
 /* Handle schedule events and manage actions: Send msgs over PCUIF to PCU,
  * advertise Test Case about sent messages, etc. */
 private altstep as_BTS_CT_TDMASched(integer bts_nr)
@@ -344,7 +401,6 @@
 	var PCUIF_Message pcu_msg;
 	var RAW_PCU_Event event;
 	var integer ev_begin_fn;
-	var integer next_fn;
 
 	[] CLCK.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_BEG)) -> value event {
 		/* If the RTS queue for PDTCH is not empty, send a message */
@@ -362,29 +418,10 @@
 		PCUIF.send(ts_PCUIF_TIME_IND(bts_nr, event.data.tdma_fn));
 		repeat;
 		}
-	[lengthof(pdtch_data_queue) > 0] CLCK.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_END)) -> value event {
+	[] CLCK.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_END)) -> value event {
 		/* FN matching the beginning of current block: */
 		ev_begin_fn := event.data.tdma_fn - 3;
-
-		/* Check if we reached time to serve the first DATA.ind message in the queue: */
-		f_PCUIF_MsgQueue_first(pdtch_data_queue, pcu_msg);
-		next_fn := pcu_msg.u.data_ind.fn;
-		if (next_fn != 0 and next_fn != ev_begin_fn) {
-			if (next_fn < ev_begin_fn) {
-				setverdict(fail, "We are late scheduling the block! ", next_fn, " < ", ev_begin_fn);
-				mtc.stop;
-			}
-			repeat;
-		}
-		/* Dequeue a DATA.ind message */
-		f_PCUIF_MsgQueue_dequeue(pdtch_data_queue, pcu_msg);
-
-		/* Patch TDMA frame / block number */
-		pcu_msg.u.data_ind.fn := ev_begin_fn;
-		pcu_msg.u.data_ind.block_nr := 0; /* FIXME! */
-
-		PCUIF.send(pcu_msg); /* Send to the PCU and notify the TC */
-		TC.send(ts_RAW_PCU_CLCK_EV(TDMA_EV_PDTCH_BLOCK_SENT, ev_begin_fn));
+		f_tx_data_ind_fn(bts_nr, ev_begin_fn);
 		repeat;
 		}
 	[lengthof(ptcch_rts_queue) > 0] CLCK.receive(tr_RAW_PCU_EV(TDMA_EV_PTCCH_DL_BLOCK)) -> value event {
@@ -417,6 +454,8 @@
 	var BTS_PTCCH_Block pcu_msg_ptcch;
 	var BTS_CCCH_Block pcu_msg_rr;
 
+	g_info_ind := info_ind;
+
 	/* Init TDMA clock generator (so we can stop and start it) */
 	vc_CLCK_GEN := RAW_PCU_ClckGen_CT.create("ClckGen-" & int2str(bts_nr)) alive;
 	connect(vc_CLCK_GEN:CLCK, self:CLCK);

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib4f97a9bcfa68230945effeb6412218faa64ec78
Gerrit-Change-Number: 23256
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20210312/7e3bf15f/attachment.htm>


More information about the gerrit-log mailing list