RSL_Emulation: Add procedure calls to suspend/resume dchan handling

We introduce a procedure by which any DchanHandler can globally
disable all receiving/processing of DChan related messages.  This is
required in upcoming handover code, as we need to block handling
of messages such as RSL IPAC CRCX on the new Dchan before we have
processed the RR HANDOVER CMD and raised an associated expect here in
the RSL emulation code.

Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
This commit is contained in:
Harald Welte 2018-02-12 20:47:31 +01:00
parent 421e4d4eee
commit 70b52c9d4b
1 changed files with 34 additions and 3 deletions

View File

@ -54,9 +54,10 @@ type port RSL_DCHAN_PT message {
signature RSLEM_register(uint8_t trx_nr, RslChannelNr chan_nr, RSL_DchanHdlr hdlr);
signature RSLEM_unregister(uint8_t trx_nr, RslChannelNr chan_nr, RSL_DchanHdlr hdlr);
signature RSLEM_suspend(boolean suspend);
type port RSLEM_PROC_PT procedure {
inout RSLEM_register, RSLEM_unregister;
inout RSLEM_register, RSLEM_unregister, RSLEM_suspend;
} with { extension "internal" };
/***********************************************************************
@ -276,6 +277,8 @@ function main() runs on RSL_Emulation_CT {
var uint8_t trx_nr;
var integer cid;
var integer i;
/* special synchronization handling during hand-over */
var boolean dchan_suspended := false;
f_conn_table_init();
@ -348,7 +351,7 @@ function main() runs on RSL_Emulation_CT {
IPA_PT.send(ts_ASP_RSL_UD(rx_rsl.streamId, ts_RSL_CHAN_ACT_ACK(chan_nr, 23)));
}
[] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeDR(?))) -> value rx_rsl {
[not dchan_suspended] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeDR(?))) -> value rx_rsl {
/* dispatch to channel based on ChanId */
cid := f_cid_by_chan_nr(f_trx_by_streamId(rx_rsl.streamId),
rx_rsl.rsl.ies[0].body.chan_nr);
@ -359,7 +362,7 @@ function main() runs on RSL_Emulation_CT {
}
}
[] IPA_PT.receive {
[not dchan_suspended] IPA_PT.receive {
setverdict(fail, "Received unknown primitive from IPA");
self.stop;
}
@ -389,6 +392,17 @@ function main() runs on RSL_Emulation_CT {
RSL_PROC.reply(RSLEM_unregister:{trx_nr, chan_nr, vc_conn});
}
[] RSL_PROC.getcall(RSLEM_suspend:{true}) {
log("Suspending DChan");
dchan_suspended := true;
RSL_PROC.reply(RSLEM_suspend:{true});
}
[] RSL_PROC.getcall(RSLEM_suspend:{false}) {
log("Resuming DChan");
dchan_suspended := false;
RSL_PROC.reply(RSLEM_suspend:{false});
}
}
}
@ -420,5 +434,22 @@ runs on RSL_DchanHdlr {
}
}
/* resume handling of RSL DChan messages from IPA until f_rslem_resume() is called */
function f_rslem_suspend(RSLEM_PROC_PT PT)
runs on RSL_DchanHdlr {
PT.call(RSLEM_suspend:{true}) {
[] PT.getreply(RSLEM_suspend:{true}) {};
}
}
/* resume handling of RSL DChan messages after f_rslem_suspend() is called */
function f_rslem_resume(RSLEM_PROC_PT PT)
runs on RSL_DchanHdlr {
PT.call(RSLEM_suspend:{false}) {
[] PT.getreply(RSLEM_suspend:{false}) {};
}
}
}