<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/22826">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">nacc_fsm: Move code filling struct to helper function<br><br>Same filler will be needed in different places since that message can<br>arrive at different points of time (different states).<br>It also helps supporting newer key types in the future.<br><br>Change-Id: Idfd4db8408f767b1847b04c88047a1c4996e543e<br>---<br>M src/nacc_fsm.c<br>1 file changed, 19 insertions(+), 10 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/26/22826/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c</span><br><span>index 6a92f83..f9dea98 100644</span><br><span>--- a/src/nacc_fsm.c</span><br><span>+++ b/src/nacc_fsm.c</span><br><span>@@ -268,6 +268,22 @@</span><br><span>      return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static int fill_neigh_key_from_bts_pkt_cell_chg_not(struct neigh_cache_entry_key *neigh_key,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                  const struct gprs_rlcmac_bts *bts,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                    const Packet_Cell_Change_Notification_t *notif)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        switch (notif->Target_Cell.UnionType) {</span><br><span style="color: hsl(120, 100%, 40%);">+    case 0: /* GSM */</span><br><span style="color: hsl(120, 100%, 40%);">+             neigh_key->local_lac = bts->cgi_ps.rai.lac.lac;</span><br><span style="color: hsl(120, 100%, 40%);">+         neigh_key->local_ci = bts->cgi_ps.cell_identity;</span><br><span style="color: hsl(120, 100%, 40%);">+                neigh_key->tgt_arfcn = notif->Target_Cell.u.Target_Cell_GSM_Notif.ARFCN;</span><br><span style="color: hsl(120, 100%, 40%);">+                neigh_key->tgt_bsic = notif->Target_Cell.u.Target_Cell_GSM_Notif.BSIC;</span><br><span style="color: hsl(120, 100%, 40%);">+          return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     default:</span><br><span style="color: hsl(120, 100%, 40%);">+              return -ENOTSUP;</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> #define SI_HDR_LEN 2</span><br><span> static void bts_fill_si_cache_value(const struct gprs_rlcmac_bts *bts, struct si_cache_value *val)</span><br><span> {</span><br><span>@@ -303,19 +319,12 @@</span><br><span>    switch (event) {</span><br><span>     case NACC_EV_RX_CELL_CHG_NOTIFICATION:</span><br><span>               notif = (Packet_Cell_Change_Notification_t *)data;</span><br><span style="color: hsl(0, 100%, 40%);">-              switch (notif->Target_Cell.UnionType) {</span><br><span style="color: hsl(0, 100%, 40%);">-              case 0: /* GSM */</span><br><span style="color: hsl(0, 100%, 40%);">-                       ctx->neigh_key.local_lac = bts->cgi_ps.rai.lac.lac;</span><br><span style="color: hsl(0, 100%, 40%);">-                       ctx->neigh_key.local_ci = bts->cgi_ps.cell_identity;</span><br><span style="color: hsl(0, 100%, 40%);">-                      ctx->neigh_key.tgt_arfcn = notif->Target_Cell.u.Target_Cell_GSM_Notif.ARFCN;</span><br><span style="color: hsl(0, 100%, 40%);">-                      ctx->neigh_key.tgt_bsic = notif->Target_Cell.u.Target_Cell_GSM_Notif.BSIC;</span><br><span style="color: hsl(0, 100%, 40%);">-                        nacc_fsm_state_chg(fi, NACC_ST_WAIT_RESOLVE_RAC_CI);</span><br><span style="color: hsl(0, 100%, 40%);">-                    break;</span><br><span style="color: hsl(0, 100%, 40%);">-          default:</span><br><span style="color: hsl(120, 100%, 40%);">+              if (fill_neigh_key_from_bts_pkt_cell_chg_not(&ctx->neigh_key, bts, notif) < 0) {</span><br><span>                   LOGPFSML(fi, LOGL_NOTICE, "TargetCell type=0x%x not supported\n",</span><br><span>                           notif->Target_Cell.UnionType);</span><br><span>                   osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">-                      return;</span><br><span style="color: hsl(120, 100%, 40%);">+               } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      nacc_fsm_state_chg(fi, NACC_ST_WAIT_RESOLVE_RAC_CI);</span><br><span>                 }</span><br><span>            break;</span><br><span>       default:</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/22826">change 22826</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-pcu/+/22826"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Idfd4db8408f767b1847b04c88047a1c4996e543e </div>
<div style="display:none"> Gerrit-Change-Number: 22826 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>