Change in osmo-bts[master]: abis.c: Loop over list of BSCs until connection succeeds

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/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Sep 20 12:19:02 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/25459 )

Change subject: abis.c: Loop over list of BSCs until connection succeeds
......................................................................

abis.c: Loop over list of BSCs until connection succeeds

Do not exit if all BSCs in the list fail to connect, keep trying
forever. This commit still doesn't change the logic after BTS has
successfully connected to a BSC. In that situation, if the link goes
down, BTS will exit in order to reset all state and let the user/system
restart it.

Related: SYS#4971
Change-Id: I67bba3b7e2d9d62b98a59a74987ae55206a3ec51
---
M src/common/abis.c
1 file changed, 25 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve



diff --git a/src/common/abis.c b/src/common/abis.c
index c230a4b..31a3505 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -61,9 +61,11 @@
 static struct ipaccess_unit bts_dev_info;
 
 #define S(x) (1 << (x))
+#define	OML_RETRY_TIMER	5
 
 enum abis_link_fsm_state {
-	ABIS_LINK_ST_CONNECTING, /* OML link has not yet been established */
+	ABIS_LINK_ST_WAIT_RECONNECT, /* OML link has not yet been established */
+	ABIS_LINK_ST_CONNECTING, /* OML link in process of been established */
 	ABIS_LINK_ST_CONNECTED, /* OML link is established, RSL links may be established or not */
 	ABIS_LINK_ST_FAILED, /* There used to be an active OML connection but it became broken */
 };
@@ -128,12 +130,10 @@
 
 	last = (struct bsc_oml_host *)llist_last_entry(&bts->bsc_oml_hosts, struct bsc_oml_host, list);
 
-	if (!priv->current_bsc) /* Pick first one: */
+	if (!priv->current_bsc || priv->current_bsc == last) /* Pick first one (wrap around): */
 		priv->current_bsc = (struct bsc_oml_host *)llist_first_entry(&bts->bsc_oml_hosts, struct bsc_oml_host, list);
 	else if (priv->current_bsc != last)
 		priv->current_bsc = (struct bsc_oml_host *)llist_entry(priv->current_bsc->list.next, struct bsc_oml_host, list);
-	else
-		return -1; /* We are so far not starting over the list when we reach the list, but only exit */
 
 	return 0;
 }
@@ -199,7 +199,7 @@
 		break;
 	case ABIS_LINK_EV_SIGN_LINK_DOWN:
 		reset_oml_link(bts);
-		osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTING, 0, 0);
+		osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);
 		break;
 	default:
 		OSMO_ASSERT(0);
@@ -262,14 +262,32 @@
 	}
 }
 
+int abis_link_fsm_timer_cb(struct osmo_fsm_inst *fi)
+{
+	switch (fi->state) {
+	case ABIS_LINK_ST_WAIT_RECONNECT:
+		osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTING, 0, 0);
+		break;
+	default:
+		OSMO_ASSERT(0);
+	}
+	return 0;
+}
+
+
 static struct osmo_fsm_state abis_link_fsm_states[] = {
+	[ABIS_LINK_ST_WAIT_RECONNECT] = {
+		.name = "WAIT_RECONNECT",
+		.out_state_mask =
+			S(ABIS_LINK_ST_CONNECTING),
+	},
 	[ABIS_LINK_ST_CONNECTING] = {
 		.name = "CONNECTING",
 		.in_event_mask =
 			S(ABIS_LINK_EV_SIGN_LINK_OML_UP) |
 			S(ABIS_LINK_EV_SIGN_LINK_DOWN),
 		.out_state_mask =
-			S(ABIS_LINK_ST_CONNECTING) |
+			S(ABIS_LINK_ST_WAIT_RECONNECT) |
 			S(ABIS_LINK_ST_CONNECTED) |
 			S(ABIS_LINK_ST_FAILED),
 		.onenter = abis_link_connecting_onenter,
@@ -298,6 +316,7 @@
 	.event_names = abis_link_fsm_event_names,
 	.allstate_action = abis_link_allstate,
 	.allstate_event_mask = S(ABIS_LINK_EV_VTY_RM_ADDR),
+	.timer_cb = abis_link_fsm_timer_cb,
 };
 
 int abis_oml_sendmsg(struct msgb *msg)

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I67bba3b7e2d9d62b98a59a74987ae55206a3ec51
Gerrit-Change-Number: 25459
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210920/232204db/attachment.htm>


More information about the gerrit-log mailing list