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
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);