<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/22631">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">nacc: Avoid RIM procedures targeting cells under same PCU<br><br>Now that we have the required System Information in osmo-pcu to craft<br>the Packet Neigbour Cell Change packet for cells it controls, let's<br>avoid starting a RIM procedure to gather the SI info, since the SGSN<br>would end up routing the RIM request back at us and we'd answer back to<br>ourselves.<br><br>This same optimization cannot be done on the first step (CTRL Neighbor<br>Resolution against BSC), because the PCU cannot know if the target<br>ARFCN+BSIC requested by the MS is actually managed by a cell under the<br>PCU or it's another cell managed by another external PCU, because<br>ARFCN+BSIC keys can be resued among non-neighbor cells. Hence, it shall<br>always ask the BSC since only it holds the information about neighboring<br>cells.<br><br>Related: OS#4909<br>Change-Id: I928875b6b66dff55fc12f51b6b1ad919fef7d03b<br>---<br>M doc/manuals/chapters/configuration.adoc<br>M src/nacc_fsm.c<br>2 files changed, 55 insertions(+), 9 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/31/22631/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/manuals/chapters/configuration.adoc b/doc/manuals/chapters/configuration.adoc</span><br><span>index 7371e72..01e4d65 100644</span><br><span>--- a/doc/manuals/chapters/configuration.adoc</span><br><span>+++ b/doc/manuals/chapters/configuration.adoc</span><br><span>@@ -236,9 +236,8 @@</span><br><span> their control, obtained through PCUIF when the BTS registers against OsmoPCU, so</span><br><span> no specific user configuration is required here.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-However, for remote neighbors (cells managed by another OsmoPCU instance),</span><br><span style="color: hsl(0, 100%, 40%);">-OsmoPCU requires to gather the information from somewhere else before being able</span><br><span style="color: hsl(0, 100%, 40%);">-to provide it to the MS requesting the NACC.</span><br><span style="color: hsl(120, 100%, 40%);">+In general, OsmoPCU requires to gather the information from somewhere else</span><br><span style="color: hsl(120, 100%, 40%);">+before being able to provide it to the MS requesting the NACC.</span><br><span> </span><br><span> If OsmoPCU fails to gather the System Information, it will simply answer the MS</span><br><span> allowing the proposed changed but without previously providing the System</span><br><span>@@ -280,13 +279,19 @@</span><br><span> ==== System Information Resolution</span><br><span> </span><br><span> Once OsmoPCU gains knowledge of the target cell's address in the Core Network,</span><br><span style="color: hsl(0, 100%, 40%);">-it can query its System Information. The query is done using RIM procedures</span><br><span style="color: hsl(0, 100%, 40%);">-(NACC RAN-INFO application) over the Gb interface against the SGSN that OsmoPCU</span><br><span style="color: hsl(0, 100%, 40%);">-is connected to. In its turn, the SGSN will potentially forward this query to</span><br><span style="color: hsl(0, 100%, 40%);">-the PCU serving the target cell, which will provide back the System Information</span><br><span style="color: hsl(0, 100%, 40%);">-of that cell.</span><br><span style="color: hsl(120, 100%, 40%);">+it can query its System Information.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-The System Information received from remote neighbors are by default</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoPCU will gather the requested System Information of target cells under its</span><br><span style="color: hsl(120, 100%, 40%);">+control without need for any external query, since the System Information of all</span><br><span style="color: hsl(120, 100%, 40%);">+BTSs it manages are received over PCUIF and stored internally in OsmoPCU.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+For those targets cells not managed by the OsmoPCU instance, the query is</span><br><span style="color: hsl(120, 100%, 40%);">+accomplished by using RIM procedures (NACC RAN-INFO application) over the Gb</span><br><span style="color: hsl(120, 100%, 40%);">+interface against the SGSN that OsmoPCU is connected to. In its turn, the SGSN</span><br><span style="color: hsl(120, 100%, 40%);">+will potentially forward this query to the PCU serving the target cell, which</span><br><span style="color: hsl(120, 100%, 40%);">+will provide back the System Information of that cell.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The System Information received from external PCUs over RIM are by default</span><br><span> cached for a while in order to avoid querying the SGSN frequently and, as a</span><br><span> result, optimizing the resolution time too.</span><br><span> </span><br><span>diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c</span><br><span>index b479f9c..6a92f83 100644</span><br><span>--- a/src/nacc_fsm.c</span><br><span>+++ b/src/nacc_fsm.c</span><br><span>@@ -268,6 +268,27 @@</span><br><span>     return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define SI_HDR_LEN 2</span><br><span style="color: hsl(120, 100%, 40%);">+static void bts_fill_si_cache_value(const struct gprs_rlcmac_bts *bts, struct si_cache_value *val)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       val->type_psi = false;</span><br><span style="color: hsl(120, 100%, 40%);">+     val->si_len = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+   if (bts->si1_is_set) {</span><br><span style="color: hsl(120, 100%, 40%);">+             osmo_static_assert(sizeof(bts->si1) - SI_HDR_LEN == BSSGP_RIM_SI_LEN, _si1_header_size);</span><br><span style="color: hsl(120, 100%, 40%);">+           memcpy(&val->si_buf[val->si_len], bts->si1 + SI_HDR_LEN, BSSGP_RIM_SI_LEN);</span><br><span style="color: hsl(120, 100%, 40%);">+              val->si_len += BSSGP_RIM_SI_LEN;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+     if (bts->si3_is_set) {</span><br><span style="color: hsl(120, 100%, 40%);">+             osmo_static_assert(sizeof(bts->si3) - SI_HDR_LEN == BSSGP_RIM_SI_LEN, _si3_header_size);</span><br><span style="color: hsl(120, 100%, 40%);">+           memcpy(&val->si_buf[val->si_len], bts->si3 + SI_HDR_LEN, BSSGP_RIM_SI_LEN);</span><br><span style="color: hsl(120, 100%, 40%);">+              val->si_len += BSSGP_RIM_SI_LEN;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+     if (bts->si13_is_set) {</span><br><span style="color: hsl(120, 100%, 40%);">+            osmo_static_assert(sizeof(bts->si13) - SI_HDR_LEN == BSSGP_RIM_SI_LEN, _si13_header_size);</span><br><span style="color: hsl(120, 100%, 40%);">+         memcpy(&val->si_buf[val->si_len], bts->si13 + SI_HDR_LEN, BSSGP_RIM_SI_LEN);</span><br><span style="color: hsl(120, 100%, 40%);">+             val->si_len += BSSGP_RIM_SI_LEN;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span> </span><br><span> ////////////////</span><br><span> // FSM states //</span><br><span>@@ -382,8 +403,28 @@</span><br><span>      struct gprs_pcu *pcu = bts->pcu;</span><br><span>  struct bssgp_ran_information_pdu pdu;</span><br><span>        const struct si_cache_value *si;</span><br><span style="color: hsl(120, 100%, 40%);">+      struct gprs_rlcmac_bts *bts_i;</span><br><span>       int rc;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   /* First check if the CGI-PS addresses a cell managed by this PCU. If</span><br><span style="color: hsl(120, 100%, 40%);">+  * that's the case, we already have the info and there's no need to go</span><br><span style="color: hsl(120, 100%, 40%);">+         * the RIM way since we'd end up to this same PCU on the other end anyway.</span><br><span style="color: hsl(120, 100%, 40%);">+         */</span><br><span style="color: hsl(120, 100%, 40%);">+   llist_for_each_entry(bts_i, &the_pcu->bts_list, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+                if (bts_i == bts) /* Makes no sense targeting the same cell */</span><br><span style="color: hsl(120, 100%, 40%);">+                        continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             if (osmo_cgi_ps_cmp(&ctx->cgi_ps, &bts_i->cgi_ps) != 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                 continue;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           LOGPFSML(fi, LOGL_DEBUG, "neighbor CGI-PS %s addresses local BTS %d\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                      osmo_cgi_ps_name(&ctx->cgi_ps), bts_i->nr);</span><br><span style="color: hsl(120, 100%, 40%);">+                bts_fill_si_cache_value(bts, &ctx->si_info);</span><br><span style="color: hsl(120, 100%, 40%);">+           /* Tell the PCU scheduler we are ready to go, from here one we</span><br><span style="color: hsl(120, 100%, 40%);">+                 * are polled/driven by the scheduler */</span><br><span style="color: hsl(120, 100%, 40%);">+              nacc_fsm_state_chg(fi, NACC_ST_TX_NEIGHBOUR_DATA);</span><br><span style="color: hsl(120, 100%, 40%);">+            return;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* First check if we have SI info for the target cell in cache */</span><br><span>    si = si_cache_lookup_value(pcu->si_cache, &ctx->cgi_ps);</span><br><span>   if (si) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/22631">change 22631</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/+/22631"/><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: I928875b6b66dff55fc12f51b6b1ad919fef7d03b </div>
<div style="display:none"> Gerrit-Change-Number: 22631 </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>