pcu: Wait for USF before start using UL TBF

Change-Id: Ibe8f8c24b239715c0a43d52e59475011e78cb4eb
This commit is contained in:
Pau Espin 2023-06-26 16:50:22 +02:00
parent 59517227de
commit 7e50fa280c
2 changed files with 104 additions and 1 deletions

View File

@ -992,6 +992,36 @@ runs on MS_BTS_IFACE_CT {
return;
}
/* Keep receiving & discarding DL blocks until the PCU requests USF for this MS */
function f_ms_wait_usf(inout GprsMS ms, template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum)
runs on MS_BTS_IFACE_CT return uint32_t {
var BTS_PDTCH_Block data_msg;
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));
alt {
[] as_pcuif_rx_ignore_empty(nr);
[] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr,
tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH),
?)) -> value data_msg {
var uint3_t rx_usf := f_rlcmac_dl_block_get_usf(data_msg.dl_block);
var uint3_t exp_usf := ms.ul_tbf.usf[valueof(nr.ts_nr)];
log("Rx DL block USF ", rx_usf, " vs exp USF ", exp_usf);
if (rx_usf != exp_usf) {
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;
}
}
};
return data_msg.raw.fn;
}
////////////////////////
// Low level APIs
////////////////////////

View File

@ -326,6 +326,9 @@ runs on RAW_PCU_Test_CT {
var RlcmacDlBlock dl_block;
var uint32_t poll_fn;
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(g_ms[i]);
f_ms_tx_ul_data_block(g_ms[i], dummy, with_tlli := true, fn := g_ms[i].ul_tbf.start_time_fn, nr := nr);
f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := nr);
}
@ -429,6 +432,9 @@ testcase TC_pcuif_suspend_active_tbf() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine */
f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn);
@ -531,6 +537,9 @@ testcase TC_ta_ul_ack_nack_first_block() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* In a busy network, there can be a significant delay between resource
* allocation (Packet Uplink Assignment above) and the actual time when
* the MS is allowed to transmit the first Uplink data block. */
@ -825,6 +834,8 @@ testcase TC_cs_lqual_ul_tbf() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* The actual / old link quality values. We need to keep track of the old
* (basically previous) link quality value, because OsmoPCU actually
@ -917,6 +928,9 @@ testcase TC_cs_initial_ul() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine. */
/* 16 bytes fills the llc block (because TLLI takes 4 bytes) */
@ -989,6 +1003,9 @@ testcase TC_cs_max_ul() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine. */
/* 16 bytes fills the llc block (because TLLI takes 4 bytes) */
@ -1602,6 +1619,9 @@ testcase TC_n3103_max_t3169() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
f_ms_tx_ul_data_block_multi(ms, 5, with_tlli := true);
exp_ul_ack_sub := tr_UlAckNackGprs(*, tr_AckNackDescription('1'B), *);
exp_ul_ack := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, exp_ul_ack_sub);
@ -2172,6 +2192,9 @@ testcase TC_countdown_procedure() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine. */
total_payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true));
@ -2223,6 +2246,9 @@ testcase TC_ul_all_sizes() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine. */
payload := f_rnd_octstring(16); /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */
@ -2358,6 +2384,9 @@ testcase TC_ul_data_toolong_fills_padding() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
f_TC_ul_data_toolong_fills_padding_cs(ms, CS_2, 2);
f_TC_ul_data_toolong_fills_padding_cs(ms, CS_3, 1);
f_TC_ul_data_toolong_fills_padding_cs(ms, CS_4, 0);
@ -2391,6 +2420,9 @@ private function f_TC_mo_ping_pong_1phase_access(template (present) CodingScheme
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine */
f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn);
@ -2668,6 +2700,9 @@ testcase TC_ul_intermediate_retrans() runs on RAW_PCU_Test_CT {
f_ms_establish_ul_tbf(ms);
tfi := ms.ul_tbf.tfi;
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine. */
payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */
@ -2884,6 +2919,9 @@ testcase TC_ul_flow_multiple_llc_blocks() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Summary of what's transmitted:
* 1- UL RlcDataBlock(dataA) [BSN=0, CV=3]
* 2- UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2]
@ -3185,6 +3223,9 @@ testcase TC_dl_multislot_tbf_ms_class_from_sgsn() runs on RAW_PCU_Test_CT {
through PDCH (no multiblock assignment possible through PCH) */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine */
f_ms_tx_ul_data_block(ms, data, with_tlli := true, fn := ms.ul_tbf.start_time_fn,
@ -3330,6 +3371,9 @@ testcase TC_ul_tbf_reestablish_with_pkt_resource_req() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine */
f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn);
@ -3416,6 +3460,9 @@ testcase TC_ul_tbf_reestablish_with_pkt_resource_req_t3168() runs on RAW_PCU_Tes
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine */
f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn);
@ -3580,6 +3627,9 @@ testcase TC_paging_cs_from_bts() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* build mobile Identity */
mi := valueof(ts_MI_IMSI_LV(imsi));
mi_enc_lv := enc_MobileIdentityLV(mi);
@ -3624,6 +3674,9 @@ runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send paging request with or without TMSI */
if (use_ptmsi) {
tmsi := oct2int(f_rnd_octstring(4)); /* Random P-TMSI */
@ -3786,6 +3839,9 @@ testcase TC_bssgp_dl_unitdata_with_valid_imsi() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Fake GMM GPRS Attach or similar, PCU doesn't care about upper layers here */
f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn);
f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn);
@ -3845,6 +3901,9 @@ testcase TC_bssgp_dl_unitdata_with_invalid_imsi() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Fake GMM GPRS Attach or similar, PCU doesn't care about upper layers here */
f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn);
f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn);
@ -3960,6 +4019,9 @@ testcase TC_ul_tbf_finished_pkt_dl_ass_pch() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine. */
payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true));
@ -4024,6 +4086,9 @@ testcase TC_ul_tbf_1phase_while_dl_ass_pch() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine. */
payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true));
@ -4048,10 +4113,12 @@ testcase TC_ul_tbf_1phase_while_dl_ass_pch() runs on RAW_PCU_Test_CT {
* The MS decides it want to send new Ul TBF so it send RACH req to ask for it: */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
dl_fn := f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
* contention resolution) and make sure it is ACKED fine. */
payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true));
dl_fn := f_rx_rlcmac_dl_block_exp_dummy(dl_block);
f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn));
/* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */
@ -4099,6 +4166,9 @@ testcase TC_ul_tbf_2phase_while_dl_ass_pch() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send one UL block (with TLLI since we are in One-Phase Access
contention resolution) and make sure it is ACKED fine. */
payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true));
@ -4692,6 +4762,9 @@ testcase TC_pcuif_fh_pkt_ass_dl() runs on RAW_PCU_Test_CT {
/* Establish an Uplink TBF */
f_ms_establish_ul_tbf(ms);
/* Wait until PCU starts requesting for UL block on this TBF: */
f_ms_wait_usf(ms);
/* Send an Uplink block, so this TBF becomes "active" */
f_ms_tx_ul_data_block(ms, data, with_tlli := true, fn := ms.ul_tbf.start_time_fn);