pcu: Ignore dummy rlcmac packets in f_ms_rx_pkt_ass_pacch
Allow ignoring for received dumy packets while waiting for a Pkt Ass on
PACCH. This fixes some tests failing sometimes due to race condition
where rlcmac packet is requested too quicky, after the PCU has received
the BSSGP packet we sent to it.
The function is splitted into an internal altestep + a wrap function
which is compatible with tests already using it.
Related: OS#4779
Change-Id: I0a10d3a7383d8534e9263864b4130a96392e6198
diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index 16036ad..a76deaa 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -498,38 +498,63 @@
function f_ms_rx_pkt_ass_pacch(inout GprsMS ms, out uint32_t poll_fn,
template RlcmacDlBlock t_pkt_ass := ?,
- template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum)
+ template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum,
+ boolean ignore_dummy := true)
runs on MS_BTS_IFACE_CT return RlcmacDlBlock {
var RlcmacDlBlock dl_block;
- var uint32_t dl_fn;
+ BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr,
+ sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+ arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)),
+ block_nr := nr.blk_nr));
+ as_ms_rx_pkt_ass_pacch(ms, poll_fn, t_pkt_ass, nr, ignore_dummy, dl_block);
+ return dl_block;
+}
- f_rx_rlcmac_dl_block(dl_block, dl_fn, nr := nr);
- if (not match(dl_block, t_pkt_ass)) {
- setverdict(fail, "Failed to match Packet Assignment:", t_pkt_ass);
- f_shutdown(__BFILE__, __LINE__);
- }
+altstep as_ms_rx_pkt_ass_pacch(inout GprsMS ms, out uint32_t poll_fn,
+ template RlcmacDlBlock t_pkt_ass := ?,
+ template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum,
+ boolean ignore_dummy := true,
+ out RlcmacDlBlock dl_block)
+runs on MS_BTS_IFACE_CT {
+ var PCUIF_Message pcu_msg;
+ [] BTS.receive(tr_PCUIF_DATA_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr,
+ sapi := PCU_IF_SAPI_PDTCH)) -> value pcu_msg {
+ var uint32_t dl_fn;
+ dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
+ if (ignore_dummy and match(dl_block, tr_RLCMAC_DUMMY_CTRL())) {
+ /* TODO: sleep? */
+ BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr,
+ sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+ arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), block_nr := nr.blk_nr));
+ repeat;
+ }
- poll_fn := f_rrbp_ack_fn(dl_fn, dl_block.ctrl.mac_hdr.rrbp);
-
- if (match(dl_block, tr_RLCMAC_UL_PACKET_ASS)) {
- ms.ul_tbf := f_ultbf_new_from_ass_pacch(dl_block);
- if (ms.ul_tbf.ass.pacch.identity.tlli.tlli != ms.tlli) {
- setverdict(fail, "Wrong TLLI ", ms.ul_tbf.ass.pacch.identity.tlli, " received vs exp ", ms.tlli);
- f_shutdown(__BFILE__, __LINE__);
- }
- } else if (match(dl_block, tr_RLCMAC_DL_PACKET_ASS)) {
- ms.dl_tbf := f_dltbf_new_from_ass_pacch(dl_block);
- if (ischosen(ms.dl_tbf.ass.pacch.tfi_or_tlli.tlli) and
- ms.dl_tbf.ass.pacch.tfi_or_tlli.tlli.tlli != ms.tlli) {
- setverdict(fail, "Wrong TLLI ", ms.dl_tbf.ass.pacch.tfi_or_tlli.tlli.tlli, " received vs exp ", ms.tlli);
+ if (not match(dl_block, t_pkt_ass)) {
+ setverdict(fail, "Failed to match Packet Assignment:", t_pkt_ass);
f_shutdown(__BFILE__, __LINE__);
}
- } else {
- setverdict(fail, "Should not happen:", dl_block);
- f_shutdown(__BFILE__, __LINE__);
- }
- return dl_block;
+ dl_fn := pcu_msg.u.data_req.fn;
+ poll_fn := f_rrbp_ack_fn(dl_fn, dl_block.ctrl.mac_hdr.rrbp);
+
+ if (match(dl_block, tr_RLCMAC_UL_PACKET_ASS)) {
+ ms.ul_tbf := f_ultbf_new_from_ass_pacch(dl_block);
+ if (ms.ul_tbf.ass.pacch.identity.tlli.tlli != ms.tlli) {
+ setverdict(fail, "Wrong TLLI ", ms.ul_tbf.ass.pacch.identity.tlli, " received vs exp ", ms.tlli);
+ f_shutdown(__BFILE__, __LINE__);
+ }
+ } else if (match(dl_block, tr_RLCMAC_DL_PACKET_ASS)) {
+ ms.dl_tbf := f_dltbf_new_from_ass_pacch(dl_block);
+ if (ischosen(ms.dl_tbf.ass.pacch.tfi_or_tlli.tlli) and
+ ms.dl_tbf.ass.pacch.tfi_or_tlli.tlli.tlli != ms.tlli) {
+ setverdict(fail, "Wrong TLLI ", ms.dl_tbf.ass.pacch.tfi_or_tlli.tlli.tlli, " received vs exp ", ms.tlli);
+ f_shutdown(__BFILE__, __LINE__);
+ }
+ } else {
+ setverdict(fail, "Should not happen:", dl_block);
+ f_shutdown(__BFILE__, __LINE__);
+ }
+ }
}
function f_ms_establish_ul_tbf(inout GprsMS ms, template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum)
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index 13b33b2..7d569b1 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -3109,8 +3109,8 @@
f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit)));
/* Expect an RLC/MAC block with Packet Uplink Assignment on PACCH (see 11.2.29) */
- var RlcmacDlBlock blk := f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_UL_PACKET_ASS);
- var PacketUlAssignment ua := blk.ctrl.payload.u.ul_assignment;
+ f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_UL_PACKET_ASS);
+ var PacketUlAssignment ua := ms.ul_tbf.ass.pacch;
/* 3GPP TS 44.060, section 12.8 "Frequency Parameters" */
var template (omit) FrequencyParameters fp;
@@ -3165,8 +3165,8 @@
BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data));
/* Expect an RLC/MAC block with Packet Downlink Assignment on PACCH (see 11.2.29) */
- dl_block := f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS);
- var PacketDlAssignment da := dl_block.ctrl.payload.u.dl_assignment;
+ f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS);
+ var PacketDlAssignment da := ms.dl_tbf.ass.pacch;
/* This is an optional IE, so it's worth to check its presence */
if (not ispresent(da.freq_par)) {