Review at  https://gerrit.osmocom.org/6396

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
---
M library/RSL_Emulation.ttcn
1 file changed, 34 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/96/6396/1

diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index f45b425..dab1785 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -54,9 +54,10 @@
 
 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 @@
        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 @@
                        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 @@
                        }
                }
 
-               [] IPA_PT.receive {
+               [not dchan_suspended] IPA_PT.receive {
                        setverdict(fail, "Received unknown primitive from IPA");
                        self.stop;
                }
@@ -389,6 +392,17 @@
                        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 @@
        }
 }
 
+/* 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}) {};
+       }
+}
+
+
 
 }

-- 
To view, visit https://gerrit.osmocom.org/6396
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to