dexter has uploaded this change for review. ( https://gerrit.osmocom.org/10039


Change subject: handover_logic: make sure IPACC is done before MGCP
......................................................................

handover_logic: make sure IPACC is done before MGCP

During handover, the IPACC negotiaton on RSL level must be done
at least to the point where the BSC knows the IP-Address and the
Port of the new BTS. Only when this data is known the handover
logic may emit the GSCON_EV_HO_COMPL to tell the GSCON FSM that
the handover is complete (including IPACC)

- Add a signal handler that listens to SS_ABISIP signals.
- In cases where IPACC has not been done yet, postpone GSCON_EV_HO_COMPL
  and let it send by the signal handler as soon as S_ABISIP_CRCX_ACK
  arrives.

Change-Id: I01f05f5d8abe07a0d063e84a1984ac5797afb4f7
Related: OS#3396
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/handover_logic.c
M tests/handover/handover_test.c
3 files changed, 47 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/39/10039/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 5794617..1106176 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -428,6 +428,12 @@
                        uint8_t rr_cause;
                        bool valid;
                } ass_compl;
+
+               /* info we need to postpone the GSCON_EV_HO_COMPL event
+                * (see also handover_logic.c, function ho_gsm48_ho_compl() */
+               struct {
+                       bool postponed;
+               } ho_compl;
        } abis_ip;

        uint8_t rqd_ta;
diff --git a/src/osmo-bsc/handover_logic.c b/src/osmo-bsc/handover_logic.c
index 960bf69..ebc80b2 100644
--- a/src/osmo-bsc/handover_logic.c
+++ b/src/osmo-bsc/handover_logic.c
@@ -329,8 +329,19 @@
        handover_free(ho);
        new_lchan->conn->ho = NULL;

-       /* Inform the GSCON FSM that the handover is complete */
-       osmo_fsm_inst_dispatch(new_lchan->conn->fi, GSCON_EV_HO_COMPL, NULL);
+       /* It may be that the RSL RTP port/IP negotiation is not done yet. In
+        * this case we may not acknowledge the handover as completed yet. We
+        * must postpone GSCON_EV_HO_COMPL and wait for S_ABISIP_CRCX_ACK in
+        * order to be sure that the RTP port/IP information inside
+        * lchan->abis_ip is populated with valid data.
+        * (see also callback function: abisip_sig_cb()) */
+       if (new_lchan->abis_ip.bound_port != 0) {
+               /* Inform the GSCON FSM that the handover is complete */
+               osmo_fsm_inst_dispatch(new_lchan->conn->fi, GSCON_EV_HO_COMPL, 
NULL);
+               new_lchan->abis_ip.ho_compl.postponed = false;
+       } else
+               new_lchan->abis_ip.ho_compl.postponed = true;
+
        return 0;
 }

@@ -392,6 +403,25 @@
        return 0;
 }

+static int abisip_sig_cb(unsigned int subsys, unsigned int signal,
+                        void *handler_data, void *signal_data)
+{
+       struct gsm_lchan *lchan = signal_data;
+
+       if (subsys != SS_ABISIP)
+               return 0;
+
+       switch (signal) {
+       case S_ABISIP_CRCX_ACK:
+               if (lchan->abis_ip.ho_compl.postponed) {
+                       lchan->abis_ip.ho_compl.postponed = false;
+                       osmo_fsm_inst_dispatch(lchan->conn->fi, 
GSCON_EV_HO_COMPL, NULL);
+               }
+               break;
+       }
+       return 0;
+}
+
 static int ho_logic_sig_cb(unsigned int subsys, unsigned int signal,
                           void *handler_data, void *signal_data)
 {
@@ -437,6 +467,11 @@
 static __attribute__((constructor)) void on_dso_load_ho_logic(void)
 {
        osmo_signal_register_handler(SS_LCHAN, ho_logic_sig_cb, NULL);
+
+       /* Note: We must also listen to ABISIP events to make sure that all
+        * RTP port/IP negotiation with the BTS is done before we acknowledge
+        * the handover as completed. */
+       osmo_signal_register_handler(SS_ABISIP, abisip_sig_cb, NULL);
 }

 /* Count number of currently ongoing handovers
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 769fd06..57e7c11 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -416,6 +416,10 @@
        msg->l2h = (unsigned char *)rh;
        msg->l3h = (unsigned char *)gh;

+       /* Pretend that the the IPACC negotiation has been done already */
+       lchan->abis_ip.bound_port = 1;
+       lchan->abis_ip.ho_compl.postponed = false;
+
        abis_rsl_rcvmsg(msg);
 }


--
To view, visit https://gerrit.osmocom.org/10039
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01f05f5d8abe07a0d063e84a1984ac5797afb4f7
Gerrit-Change-Number: 10039
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>

Reply via email to