<p>pespin <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/25459">View Change</a></p><div style="white-space:pre-wrap">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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">abis.c: Loop over list of BSCs until connection succeeds<br><br>Do not exit if all BSCs in the list fail to connect, keep trying<br>forever. This commit still doesn't change the logic after BTS has<br>successfully connected to a BSC. In that situation, if the link goes<br>down, BTS will exit in order to reset all state and let the user/system<br>restart it.<br><br>Related: SYS#4971<br>Change-Id: I67bba3b7e2d9d62b98a59a74987ae55206a3ec51<br>---<br>M src/common/abis.c<br>1 file changed, 25 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/common/abis.c b/src/common/abis.c</span><br><span>index c230a4b..31a3505 100644</span><br><span>--- a/src/common/abis.c</span><br><span>+++ b/src/common/abis.c</span><br><span>@@ -61,9 +61,11 @@</span><br><span> static struct ipaccess_unit bts_dev_info;</span><br><span> </span><br><span> #define S(x) (1 << (x))</span><br><span style="color: hsl(120, 100%, 40%);">+#define        OML_RETRY_TIMER 5</span><br><span> </span><br><span> enum abis_link_fsm_state {</span><br><span style="color: hsl(0, 100%, 40%);">-     ABIS_LINK_ST_CONNECTING, /* OML link has not yet been established */</span><br><span style="color: hsl(120, 100%, 40%);">+  ABIS_LINK_ST_WAIT_RECONNECT, /* OML link has not yet been established */</span><br><span style="color: hsl(120, 100%, 40%);">+      ABIS_LINK_ST_CONNECTING, /* OML link in process of been established */</span><br><span>       ABIS_LINK_ST_CONNECTED, /* OML link is established, RSL links may be established or not */</span><br><span>   ABIS_LINK_ST_FAILED, /* There used to be an active OML connection but it became broken */</span><br><span> };</span><br><span>@@ -128,12 +130,10 @@</span><br><span> </span><br><span>  last = (struct bsc_oml_host *)llist_last_entry(&bts->bsc_oml_hosts, struct bsc_oml_host, list);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      if (!priv->current_bsc) /* Pick first one: */</span><br><span style="color: hsl(120, 100%, 40%);">+      if (!priv->current_bsc || priv->current_bsc == last) /* Pick first one (wrap around): */</span><br><span>               priv->current_bsc = (struct bsc_oml_host *)llist_first_entry(&bts->bsc_oml_hosts, struct bsc_oml_host, list);</span><br><span>      else if (priv->current_bsc != last)</span><br><span>               priv->current_bsc = (struct bsc_oml_host *)llist_entry(priv->current_bsc->list.next, struct bsc_oml_host, list);</span><br><span style="color: hsl(0, 100%, 40%);">-       else</span><br><span style="color: hsl(0, 100%, 40%);">-            return -1; /* We are so far not starting over the list when we reach the list, but only exit */</span><br><span> </span><br><span>  return 0;</span><br><span> }</span><br><span>@@ -199,7 +199,7 @@</span><br><span>                 break;</span><br><span>       case ABIS_LINK_EV_SIGN_LINK_DOWN:</span><br><span>            reset_oml_link(bts);</span><br><span style="color: hsl(0, 100%, 40%);">-            osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTING, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+           osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);</span><br><span>                break;</span><br><span>       default:</span><br><span>             OSMO_ASSERT(0);</span><br><span>@@ -262,14 +262,32 @@</span><br><span>      }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+int abis_link_fsm_timer_cb(struct osmo_fsm_inst *fi)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   switch (fi->state) {</span><br><span style="color: hsl(120, 100%, 40%);">+       case ABIS_LINK_ST_WAIT_RECONNECT:</span><br><span style="color: hsl(120, 100%, 40%);">+             osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTING, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+           break;</span><br><span style="color: hsl(120, 100%, 40%);">+        default:</span><br><span style="color: hsl(120, 100%, 40%);">+              OSMO_ASSERT(0);</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+     return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static struct osmo_fsm_state abis_link_fsm_states[] = {</span><br><span style="color: hsl(120, 100%, 40%);">+   [ABIS_LINK_ST_WAIT_RECONNECT] = {</span><br><span style="color: hsl(120, 100%, 40%);">+             .name = "WAIT_RECONNECT",</span><br><span style="color: hsl(120, 100%, 40%);">+           .out_state_mask =</span><br><span style="color: hsl(120, 100%, 40%);">+                     S(ABIS_LINK_ST_CONNECTING),</span><br><span style="color: hsl(120, 100%, 40%);">+   },</span><br><span>   [ABIS_LINK_ST_CONNECTING] = {</span><br><span>                .name = "CONNECTING",</span><br><span>              .in_event_mask =</span><br><span>                     S(ABIS_LINK_EV_SIGN_LINK_OML_UP) |</span><br><span>                   S(ABIS_LINK_EV_SIGN_LINK_DOWN),</span><br><span>              .out_state_mask =</span><br><span style="color: hsl(0, 100%, 40%);">-                       S(ABIS_LINK_ST_CONNECTING) |</span><br><span style="color: hsl(120, 100%, 40%);">+                  S(ABIS_LINK_ST_WAIT_RECONNECT) |</span><br><span>                     S(ABIS_LINK_ST_CONNECTED) |</span><br><span>                  S(ABIS_LINK_ST_FAILED),</span><br><span>              .onenter = abis_link_connecting_onenter,</span><br><span>@@ -298,6 +316,7 @@</span><br><span>       .event_names = abis_link_fsm_event_names,</span><br><span>    .allstate_action = abis_link_allstate,</span><br><span>       .allstate_event_mask = S(ABIS_LINK_EV_VTY_RM_ADDR),</span><br><span style="color: hsl(120, 100%, 40%);">+   .timer_cb = abis_link_fsm_timer_cb,</span><br><span> };</span><br><span> </span><br><span> int abis_oml_sendmsg(struct msgb *msg)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/25459">change 25459</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bts/+/25459"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I67bba3b7e2d9d62b98a59a74987ae55206a3ec51 </div>
<div style="display:none"> Gerrit-Change-Number: 25459 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>