<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/25195">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">enable Early Immediate Assignment<br><br>When an Immediate Assignment comes in targeting an lchan that is not yet<br>active, then hold back the RR Immediate Assignment until the channel<br>becomes active.<br><br>This allows the BSC to send the Immediate Assignment before first<br>waiting for the Channel Activation ACK, saving one Abis roundtrip, and<br>helping avoid double allocation on high latency Abis links.<br><br>Related: SYS#5559<br>Related: I56c25cde152040fb66bdba44399bd37671ae3df2 (osmo-bsc)<br>Related: Ifb2c62431a91dafa6116b5d6b9410930f00a6e18 (osmo-ttcn3-hacks)<br>Change-Id: Ie52765b238b01f22fb327fe12327fbf10abcad4c<br>---<br>M include/osmo-bts/gsm_data.h<br>M src/common/lchan.c<br>M src/common/rsl.c<br>3 files changed, 60 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/95/25195/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h</span><br><span>index 2e3eaa4..55c3bdf 100644</span><br><span>--- a/include/osmo-bts/gsm_data.h</span><br><span>+++ b/include/osmo-bts/gsm_data.h</span><br><span>@@ -412,6 +412,11 @@</span><br><span> </span><br><span>        /* Message buffer to store DL-SACCH repeation candidate */</span><br><span>   struct msgb *rep_sacch;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Cached early Immediate Assignment message: if the Immediate Assignment arrives before the channel is</span><br><span style="color: hsl(120, 100%, 40%);">+        * confirmed active, then cache it here and send it once the channel is confirmed to be active. This is related</span><br><span style="color: hsl(120, 100%, 40%);">+        * to the Early IA feature, see OsmoBSC config option 'immediate-assignment pre-chan-ack'. */</span><br><span style="color: hsl(120, 100%, 40%);">+ struct msgb *early_rr_ia;</span><br><span> };</span><br><span> </span><br><span> extern const struct value_string lchan_ciph_state_names[];</span><br><span>diff --git a/src/common/lchan.c b/src/common/lchan.c</span><br><span>index 5a3f539..4d67f5f 100644</span><br><span>--- a/src/common/lchan.c</span><br><span>+++ b/src/common/lchan.c</span><br><span>@@ -22,6 +22,7 @@</span><br><span> #include <osmocom/core/logging.h></span><br><span> #include <osmo-bts/logging.h></span><br><span> #include <osmo-bts/gsm_data.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmo-bts/bts.h></span><br><span> </span><br><span> void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state)</span><br><span> {</span><br><span>@@ -30,6 +31,34 @@</span><br><span>            gsm_lchans_name(lchan->state),</span><br><span>            gsm_lchans_name(state));</span><br><span>      lchan->state = state;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Early Immediate Assignment: if we have a cached early IA pending, send it upon becoming active, or discard it</span><br><span style="color: hsl(120, 100%, 40%);">+       * when releasing. */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (lchan->early_rr_ia) {</span><br><span style="color: hsl(120, 100%, 40%);">+          struct gsm_bts *bts = lchan->ts->trx->bts;</span><br><span style="color: hsl(120, 100%, 40%);">+           switch (lchan->state) {</span><br><span style="color: hsl(120, 100%, 40%);">+            case LCHAN_S_ACT_REQ:</span><br><span style="color: hsl(120, 100%, 40%);">+                 /* Activation is requested, keep the early IA until active. This allows the BSC to send the IA</span><br><span style="color: hsl(120, 100%, 40%);">+                         * even before a dynamic timeslot is done switching to a different pchan kind (experimental). */</span><br><span style="color: hsl(120, 100%, 40%);">+                      break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case LCHAN_S_ACTIVE:</span><br><span style="color: hsl(120, 100%, 40%);">+                  /* Activation is done, send the RR IA now. Put RR IA msg into the AGCH queue of the BTS. */</span><br><span style="color: hsl(120, 100%, 40%);">+                   if (bts_agch_enqueue(bts, lchan->early_rr_ia) < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                            /* if there is no space in the queue: send DELETE IND */</span><br><span style="color: hsl(120, 100%, 40%);">+                              rsl_tx_delete_ind(bts, lchan->early_rr_ia->data, lchan->early_rr_ia->len);</span><br><span style="color: hsl(120, 100%, 40%);">+                                rate_ctr_inc2(bts->ctrs, BTS_CTR_AGCH_DELETED);</span><br><span style="color: hsl(120, 100%, 40%);">+                            msgb_free(lchan->early_rr_ia);</span><br><span style="color: hsl(120, 100%, 40%);">+                     }</span><br><span style="color: hsl(120, 100%, 40%);">+                     lchan->early_rr_ia = NULL;</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%);">+                      /* Transition to any other state means whatever IA the BSC has sent shall now not be relevant</span><br><span style="color: hsl(120, 100%, 40%);">+                  * anymore. */</span><br><span style="color: hsl(120, 100%, 40%);">+                        msgb_free(lchan->early_rr_ia);</span><br><span style="color: hsl(120, 100%, 40%);">+                     lchan->early_rr_ia = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+                 break;</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> bool ts_is_pdch(const struct gsm_bts_trx_ts *ts)</span><br><span>diff --git a/src/common/rsl.c b/src/common/rsl.c</span><br><span>index 18c0349..1c92ba8 100644</span><br><span>--- a/src/common/rsl.c</span><br><span>+++ b/src/common/rsl.c</span><br><span>@@ -1085,6 +1085,32 @@</span><br><span>         msg->l2h = NULL;</span><br><span>  msg->len = TLVP_LEN(&tp, RSL_IE_FULL_IMM_ASS_INFO);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+        /* Early Immediate Assignment: when there is a lot of latency on Abis, the Abis roundtrip of Chan Activ -> Chan</span><br><span style="color: hsl(120, 100%, 40%);">+     * Activ ACK -> Immediate Assignment may take so long that each MS sends a second RACH for Chan Rqd, reserving</span><br><span style="color: hsl(120, 100%, 40%);">+      * two SDCCH for each request but using only one. To help with that, the Early IA feature in osmo-bsc sends the</span><br><span style="color: hsl(120, 100%, 40%);">+        * Immediate Assignment without waiting for the Channel Activation ACK. This may then be too early, and the MS</span><br><span style="color: hsl(120, 100%, 40%);">+         * may not be able to establish a channel. So to help with Early IA, look up whether the target lchan is already</span><br><span style="color: hsl(120, 100%, 40%);">+       * active. If not, then hold back the RR Immediate Assignment message, and send it once L1 has confirmed that</span><br><span style="color: hsl(120, 100%, 40%);">+  * the channel is active. Hence we still wait for the activation, but don't need the Abis roundtrip of Activ ACK</span><br><span style="color: hsl(120, 100%, 40%);">+   * -> Immediate Assignment via the BSC.</span><br><span style="color: hsl(120, 100%, 40%);">+     * If anything is wrong with the sizes or the lchan lookup, behave normally, i.e. do not do the RR IA caching,</span><br><span style="color: hsl(120, 100%, 40%);">+         * but just send the RR message to the MS as-is. */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (msg->len >= sizeof(struct gsm48_imm_ass)) {</span><br><span style="color: hsl(120, 100%, 40%);">+         struct gsm48_imm_ass *rr_ia = msg->data;</span><br><span style="color: hsl(120, 100%, 40%);">+           struct gsm_lchan *ia_target_lchan = lchan_lookup(trx, rr_ia->chan_desc.chan_nr, "Early IA check: ");</span><br><span style="color: hsl(120, 100%, 40%);">+             if (ia_target_lchan && ia_target_lchan->state != LCHAN_S_ACTIVE) {</span><br><span style="color: hsl(120, 100%, 40%);">+                 /* Target lchan is not yet active. Cache the IA. */</span><br><span style="color: hsl(120, 100%, 40%);">+                   if (ia_target_lchan->early_rr_ia) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                /* A previous IA is still lingering. Free it. */</span><br><span style="color: hsl(120, 100%, 40%);">+                              msgb_free(ia_target_lchan->early_rr_ia);</span><br><span style="color: hsl(120, 100%, 40%);">+                   }</span><br><span style="color: hsl(120, 100%, 40%);">+                     ia_target_lchan->early_rr_ia = msg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                      /* return 1 means: don't msgb_free() the msg */</span><br><span style="color: hsl(120, 100%, 40%);">+                   return 1;</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>  /* put into the AGCH queue of the BTS */</span><br><span>     if (bts_agch_enqueue(trx->bts, msg) < 0) {</span><br><span>             /* if there is no space in the queue: send DELETE IND */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/25195">change 25195</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/+/25195"/><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: Ie52765b238b01f22fb327fe12327fbf10abcad4c </div>
<div style="display:none"> Gerrit-Change-Number: 25195 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>