Change in osmo-bsc[master]: BSSMAP RESET: move RESET-ACK into reset fsm

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Mon Oct 12 23:13:21 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/20627 )


Change subject: BSSMAP RESET: move RESET-ACK into reset fsm
......................................................................

BSSMAP RESET: move RESET-ACK into reset fsm

The Lb interface will need the same RESET-ACK logic.

Change-Id: Idf4682319a0af5665e867dbc0515d1fe343d9daf
---
M include/osmocom/bsc/reset.h
M src/osmo-bsc/a_reset.c
M src/osmo-bsc/osmo_bsc_bssap.c
M src/osmo-bsc/reset.c
M tests/handover/handover_test.c
5 files changed, 51 insertions(+), 10 deletions(-)



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

diff --git a/include/osmocom/bsc/reset.h b/include/osmocom/bsc/reset.h
index 1eb5435..6c246c7 100644
--- a/include/osmocom/bsc/reset.h
+++ b/include/osmocom/bsc/reset.h
@@ -2,6 +2,7 @@
 #pragma once
 
 enum reset_fsm_event {
+	RESET_EV_RX_RESET,
 	RESET_EV_RX_RESET_ACK,
 	RESET_EV_CONN_CFM_SUCCESS,
 	RESET_EV_CONN_CFM_FAILURE,
@@ -11,6 +12,7 @@
 	int conn_cfm_failure_threshold;
 	struct {
 		void (*tx_reset)(void *data);
+		void (*tx_reset_ack)(void *data);
 		void (*link_up)(void *data);
 		void (*link_lost)(void *data);
 	} ops;
diff --git a/src/osmo-bsc/a_reset.c b/src/osmo-bsc/a_reset.c
index b385dad..bbede51 100644
--- a/src/osmo-bsc/a_reset.c
+++ b/src/osmo-bsc/a_reset.c
@@ -32,6 +32,12 @@
 	osmo_bsc_sigtran_tx_reset(msc);
 }
 
+static void a_reset_tx_reset_ack(void *data)
+{
+	struct bsc_msc_data *msc = data;
+	osmo_bsc_sigtran_tx_reset_ack(msc);
+}
+
 static void a_reset_link_up(void *data)
 {
 	struct bsc_msc_data *msc = data;
@@ -56,6 +62,7 @@
 		.conn_cfm_failure_threshold = 3,
 		.ops = {
 			.tx_reset = a_reset_tx_reset,
+			.tx_reset_ack = a_reset_tx_reset_ack,
 			.link_up = a_reset_link_up,
 			.link_lost = a_reset_link_lost,
 		},
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index d37b3e0..74770c6 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -45,6 +45,7 @@
 #include <osmocom/core/socket.h>
 #include <osmocom/core/sockaddr_str.h>
 #include <osmocom/bsc/lcs_loc_req.h>
+#include <osmocom/bsc/reset.h>
 
 #define IP_V4_ADDR_LEN 4
 
@@ -96,17 +97,17 @@
 	     osmo_sccp_addr_name(osmo_ss7_instance_find(msc->a.cs7_instance),
 				 &msc->a.msc_addr));
 
-	/* Instruct the bsc to close all open sigtran connections and to
-	 * close all active channels on the BTS side as well */
-	osmo_bsc_sigtran_reset(msc);
-
 	update_msc_osmux_support(msc, msg, length);
 
-	/* Inform the MSC that we have received the reset request and
-	 * that we acted accordingly */
-	osmo_bsc_sigtran_tx_reset_ack(msc);
+	if (!msc->a.reset) {
+		LOGP(DMSC, LOGL_ERROR, "(msc%d) missing RESET FSM\n", msc->nr);
+		/* Make sure to shut down all open connections, if any */
+		osmo_bsc_sigtran_reset(msc);
+		return -1;
+	}
 
-	return 0;
+	/* Normal case: let the reset FSM orchestrate link down / link up callbacks. */
+	return osmo_fsm_inst_dispatch(msc->a.reset->fi, RESET_EV_RX_RESET, NULL);
 }
 
 /* Page a subscriber based on TMSI and LAC via the specified BTS.
diff --git a/src/osmo-bsc/reset.c b/src/osmo-bsc/reset.c
index b5ddc42..b3f0f69 100644
--- a/src/osmo-bsc/reset.c
+++ b/src/osmo-bsc/reset.c
@@ -32,6 +32,7 @@
 };
 
 static const struct value_string reset_fsm_event_names[] = {
+	OSMO_VALUE_STRING(RESET_EV_RX_RESET),
 	OSMO_VALUE_STRING(RESET_EV_RX_RESET_ACK),
 	OSMO_VALUE_STRING(RESET_EV_CONN_CFM_FAILURE),
 	OSMO_VALUE_STRING(RESET_EV_CONN_CFM_SUCCESS),
@@ -90,6 +91,12 @@
 		reset->cfg.ops.tx_reset(reset->cfg.data);
 }
 
+static void tx_reset_ack(struct reset *reset)
+{
+	if (reset->cfg.ops.tx_reset_ack)
+		reset->cfg.ops.tx_reset_ack(reset->cfg.data);
+}
+
 static void reset_disc_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
 {
 	struct reset *reset = (struct reset*)fi->priv;
@@ -99,7 +106,21 @@
 
 static void reset_disc_action(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
-	reset_fsm_state_chg(fi, RESET_ST_CONN);
+	struct reset *reset = (struct reset*)fi->priv;
+	switch (event) {
+
+	case RESET_EV_RX_RESET:
+		tx_reset_ack(reset);
+		reset_fsm_state_chg(fi, RESET_ST_CONN);
+		break;
+
+	case RESET_EV_RX_RESET_ACK:
+		reset_fsm_state_chg(fi, RESET_ST_CONN);
+		break;
+
+	default:
+		OSMO_ASSERT(false);
+	}
 }
 
 static void reset_conn_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
@@ -115,8 +136,15 @@
 
 	switch (event) {
 
+	case RESET_EV_RX_RESET:
+		/* We were connected, but the remote side has restarted. */
+		link_lost(reset);
+		tx_reset_ack(reset);
+		link_up(reset);
+		break;
+
 	case RESET_EV_RX_RESET_ACK:
-		LOGPFSML(fi, LOGL_INFO, "Ignoring duplicate RESET ACK\n");
+		LOGPFSML(fi, LOGL_INFO, "Link is already up, ignoring RESET ACK\n");
 		break;
 
 	case RESET_EV_CONN_CFM_FAILURE:
@@ -153,6 +181,7 @@
 	[RESET_ST_DISC] = {
 		     .name = "DISC",
 		     .in_event_mask = 0
+			     | S(RESET_EV_RX_RESET)
 			     | S(RESET_EV_RX_RESET_ACK)
 			     ,
 		     .out_state_mask = 0
@@ -165,6 +194,7 @@
 	[RESET_ST_CONN] = {
 		     .name = "CONN",
 		     .in_event_mask = 0
+			     | S(RESET_EV_RX_RESET)
 			     | S(RESET_EV_RX_RESET_ACK)
 			     | S(RESET_EV_CONN_CFM_FAILURE)
 			     | S(RESET_EV_CONN_CFM_SUCCESS)
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 12f0cc2..61a6487 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -1816,6 +1816,7 @@
 					       struct gsm_lchan *lchan) { return HO_RESULT_OK; }
 void bsc_tx_bssmap_ho_failure(struct gsm_subscriber_connection *conn) {}
 void osmo_bsc_sigtran_tx_reset(void) {}
+void osmo_bsc_sigtran_tx_reset_ack(void) {}
 void osmo_bsc_sigtran_reset(void) {}
 void reset_alloc(void) {}
 void reset_is_conn_ready(void) {}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/20627
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Idf4682319a0af5665e867dbc0515d1fe343d9daf
Gerrit-Change-Number: 20627
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201012/42bd545c/attachment.htm>


More information about the gerrit-log mailing list