Change in osmo-bts[master]: enable Early Immediate Assignment

neels gerrit-no-reply at lists.osmocom.org
Mon Aug 23 20:37:53 UTC 2021


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

Change subject: enable Early Immediate Assignment
......................................................................

enable Early Immediate Assignment

When an Immediate Assignment comes in targeting an lchan that is not yet
active, then hold back the RR Immediate Assignment until the channel
becomes active.

This allows the BSC to send the Immediate Assignment before first
waiting for the Channel Activation ACK, saving one Abis roundtrip, and
helping avoid double allocation on high latency Abis links.

Related: SYS#5559
Related: I56c25cde152040fb66bdba44399bd37671ae3df2 (osmo-bsc)
Related: Ifb2c62431a91dafa6116b5d6b9410930f00a6e18 (osmo-ttcn3-hacks)
Change-Id: Ie52765b238b01f22fb327fe12327fbf10abcad4c
---
M include/osmo-bts/gsm_data.h
M src/common/lchan.c
M src/common/rsl.c
3 files changed, 59 insertions(+), 0 deletions(-)

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



diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 2e3eaa4..55c3bdf 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -412,6 +412,11 @@
 
 	/* Message buffer to store DL-SACCH repeation candidate */
 	struct msgb *rep_sacch;
+
+	/* Cached early Immediate Assignment message: if the Immediate Assignment arrives before the channel is
+	 * confirmed active, then cache it here and send it once the channel is confirmed to be active. This is related
+	 * to the Early IA feature, see OsmoBSC config option 'immediate-assignment pre-chan-ack'. */
+	struct msgb *early_rr_ia;
 };
 
 extern const struct value_string lchan_ciph_state_names[];
diff --git a/src/common/lchan.c b/src/common/lchan.c
index 5a3f539..987f78a 100644
--- a/src/common/lchan.c
+++ b/src/common/lchan.c
@@ -22,6 +22,8 @@
 #include <osmocom/core/logging.h>
 #include <osmo-bts/logging.h>
 #include <osmo-bts/gsm_data.h>
+#include <osmo-bts/bts.h>
+#include <osmo-bts/rsl.h>
 
 void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state)
 {
@@ -30,6 +32,34 @@
 	       gsm_lchans_name(lchan->state),
 	       gsm_lchans_name(state));
 	lchan->state = state;
+
+	/* Early Immediate Assignment: if we have a cached early IA pending, send it upon becoming active, or discard it
+	 * when releasing. */
+	if (lchan->early_rr_ia) {
+		struct gsm_bts *bts = lchan->ts->trx->bts;
+		switch (lchan->state) {
+		case LCHAN_S_ACT_REQ:
+			/* Activation is requested, keep the early IA until active. This allows the BSC to send the IA
+			 * even before a dynamic timeslot is done switching to a different pchan kind (experimental). */
+			break;
+		case LCHAN_S_ACTIVE:
+			/* Activation is done, send the RR IA now. Put RR IA msg into the AGCH queue of the BTS. */
+			if (bts_agch_enqueue(bts, lchan->early_rr_ia) < 0) {
+				/* if there is no space in the queue: send DELETE IND */
+				rsl_tx_delete_ind(bts, lchan->early_rr_ia->data, lchan->early_rr_ia->len);
+				rate_ctr_inc2(bts->ctrs, BTS_CTR_AGCH_DELETED);
+				msgb_free(lchan->early_rr_ia);
+			}
+			lchan->early_rr_ia = NULL;
+			break;
+		default:
+			/* Transition to any other state means whatever IA the BSC has sent shall now not be relevant
+			 * anymore. */
+			msgb_free(lchan->early_rr_ia);
+			lchan->early_rr_ia = NULL;
+			break;
+		}
+	}
 }
 
 bool ts_is_pdch(const struct gsm_bts_trx_ts *ts)
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 18c0349..f5a963c 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1085,6 +1085,30 @@
 	msg->l2h = NULL;
 	msg->len = TLVP_LEN(&tp, RSL_IE_FULL_IMM_ASS_INFO);
 
+	/* Early Immediate Assignment: when there is a lot of latency on Abis, the Abis roundtrip of Chan Activ -> Chan
+	 * Activ ACK -> Immediate Assignment may take so long that each MS sends a second RACH for Chan Rqd, reserving
+	 * two SDCCH for each request but using only one. To help with that, the Early IA feature in osmo-bsc sends the
+	 * Immediate Assignment without waiting for the Channel Activation ACK. This may then be too early, and the MS
+	 * may not be able to establish a channel. So to help with Early IA, look up whether the target lchan is already
+	 * active. If not, then hold back the RR Immediate Assignment message, and send it once L1 has confirmed that
+	 * the channel is active. Hence we still wait for the activation, but don't need the Abis roundtrip of Activ ACK
+	 * -> Immediate Assignment via the BSC.
+	 * If anything is wrong with the sizes or the lchan lookup, behave normally, i.e. do not do the RR IA caching,
+	 * but just send the RR message to the MS as-is. */
+	if (msg->len >= sizeof(struct gsm48_imm_ass)) {
+		struct gsm48_imm_ass *rr_ia = (void*)msg->data;
+		struct gsm_lchan *ia_target_lchan = lchan_lookup(trx, rr_ia->chan_desc.chan_nr, "Early IA check: ");
+		if (ia_target_lchan && ia_target_lchan->state != LCHAN_S_ACTIVE) {
+			/* Target lchan is not yet active. Cache the IA.
+			 * If a previous IA is still lingering, free it. */
+			msgb_free(ia_target_lchan->early_rr_ia);
+			ia_target_lchan->early_rr_ia = msg;
+
+			/* return 1 means: don't msgb_free() the msg */
+			return 1;
+		}
+	}
+
 	/* put into the AGCH queue of the BTS */
 	if (bts_agch_enqueue(trx->bts, msg) < 0) {
 		/* if there is no space in the queue: send DELETE IND */

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ie52765b238b01f22fb327fe12327fbf10abcad4c
Gerrit-Change-Number: 25195
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr 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/20210823/a4622525/attachment.htm>


More information about the gerrit-log mailing list