Change in osmo-bts[master]: fix SAPIs for handover to match 48.058 4.1.{3, 4}

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Mon Nov 9 01:08:38 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/21078 )


Change subject: fix SAPIs for handover to match 48.058 4.1.{3,4}
......................................................................

fix SAPIs for handover to match 48.058 4.1.{3,4}

Change-Id: Ibea973ccadf5d424213f141f97a61395856b76de
---
M include/osmo-bts/gsm_data.h
M src/common/handover.c
M src/common/l1sap.c
M src/common/rsl.c
M src/common/scheduler.c
M src/osmo-bts-sysmo/oml.c
M src/osmo-bts-trx/l1_if.c
7 files changed, 77 insertions(+), 22 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/78/21078/1

diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 1c1c5d4..f16cb21 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -194,6 +194,28 @@
 
 	char *name;
 
+	/* For handover, activation is described in 3GPP TS 48.058 4.1.3 and 4.1.4:
+	 *
+	 *          |          | Access ||  transmit         |  activate
+	 *          | MS Power | Delay  ||  on main channel  |  dl SACCH
+	 * ----------------------------------------------------------------------
+	 * async ho   no         *     -->  yes                 no
+	 * async ho   yes        *     -->  yes                 may be started
+	 * sync ho    no         no    -->  yes                 no
+	 * sync ho    yes        no    -->  yes                 may be started
+	 * sync ho    yes        yes   -->  yes                 shall be started
+	 *
+	 * Always start the main channel immediately.
+	 * dl_sacch.want_active indicates whether dl SACCH should be activated on CHAN ACT.
+	 */
+	struct {
+		bool want_active;
+		/* Indicates whether BTS model specific code has activated the dl SACCH SAPI yet.
+		 * Note: after deactivating SACCH on channel release or likewise, this remains true, so it is not an
+		 * indicator whether SACCH is still active at any point in time, only for initial activation. */
+		bool activated;
+	} dl_sacch;
+
 	/* Number of different GsmL1_Sapi_t used in osmo_bts_sysmo is 23.
 	 * Currently we don't share these headers so this is a magic number. */
 	struct llist_head sapi_cmds;
diff --git a/src/common/handover.c b/src/common/handover.c
index b615932..b8298c3 100644
--- a/src/common/handover.c
+++ b/src/common/handover.c
@@ -112,6 +112,7 @@
 
 	/* Set timing advance */
 	lchan->rqd_ta = acc_delay;
+	lchan->dl_sacch.want_active = true;
 
 	/* Stop handover detection, wait for valid frame */
 	lchan->ho.active = HANDOVER_WAIT_FRAME;
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index c9ec9bf..1181e2e 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1525,6 +1525,7 @@
 {
 	struct gsm_bts *bts = trx->bts;
 	struct lapdm_channel *lc;
+	struct gsm_lchan *lchan;
 
 	DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind\n");
 
@@ -1557,10 +1558,10 @@
 	bts->load.rach.access++;
 
 	lc = &trx->ts[0].lchan[CCCH_LCHAN].lapdm_ch;
+	lchan = get_lchan_by_chan_nr(trx, rach_ind->chan_nr);
 
 	/* According to 3GPP TS 48.058 § 9.3.17 Access Delay is expressed same way as TA (number of symbols) */
-	set_ms_to_data(get_lchan_by_chan_nr(trx, rach_ind->chan_nr),
-		rach_ind->acc_delay, false);
+	set_ms_to_data(lchan, rach_ind->acc_delay, false);
 
 	/* check for packet access */
 	if ((trx == bts->c0 && L1SAP_IS_PACKET_RACH(rach_ind->ra)) ||
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 660fd0c..35e5d9a 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1095,6 +1095,7 @@
 	struct tlv_parsed tp;
 	uint8_t type;
 	int rc;
+	bool ms_power_present = false;
 
 	if (lchan->state != LCHAN_S_NONE) {
 		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "error: lchan is not available, but in state: %s.\n",
@@ -1188,6 +1189,7 @@
 	if (TLVP_PRES_LEN(&tp, RSL_IE_MS_POWER, 1)) {
 		lchan->ms_power_ctrl.max = *TLVP_VAL(&tp, RSL_IE_MS_POWER) & 0x1F;
 		lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max;
+		ms_power_present = true;
 	}
 	/* 9.3.24 Timing Advance */
 	if (TLVP_PRES_LEN(&tp, RSL_IE_TIMING_ADVANCE, 1))
@@ -1312,6 +1314,18 @@
 		return 0;
 	}
 
+	/* Indicate which SAPIs should be enabled before the first RACH is received, for handover. See 3GPP TS 48.058
+	 * 4.1.3 and 4.1.4. */
+	switch (type) {
+	case RSL_ACT_INTER_ASYNC:
+	case RSL_ACT_INTER_SYNC:
+		lchan->dl_sacch.want_active = ms_power_present;
+		break;
+	default:
+		lchan->dl_sacch.want_active = true;
+		break;
+	}
+
 	/* Remember to send an RSL ACK once the lchan is active */
 	lchan->rel_act_kind = LCHAN_REL_ACT_RSL;
 
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index b61330d..d959eb0 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -858,6 +858,12 @@
 		return -ENODEV;
 	}
 
+	/* For handover detection, there are cases where the SACCH should remain inactive until the first RACH
+	 * indicating the TA is received. */
+	if (L1SAP_IS_LINK_SACCH(link_id)
+	    && !l1t->ts[tn].chan_state[chan].lchan->dl_sacch.activated)
+		return;
+
 	LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn,
 		"PH-RTS.ind: chan_nr=0x%02x link_id=0x%02x\n", chan_nr, link_id);
 
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index e8bfb2d..c70f4ba 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1176,10 +1176,10 @@
 			"%s Trying to activate lchan, but commands in queue\n",
 			gsm_lchan_name(lchan));
 
-	/* override the regular SAPIs if this is the first hand-over
-	 * related activation of the LCHAN */
+	/* For handover, always start the main channel immediately. lchan->dl_sacch.want_active indicates whether dl
+	 * SACCH should be activated. Also, for HO, start the RACH SAPI. */
 	if (lchan->ho.active == HANDOVER_ENABLED)
-		s4l = &sapis_for_ho;
+		enqueue_sapi_act_cmd(lchan, GsmL1_Sapi_Rach, GsmL1_Dir_RxUplink);
 
 	for (i = 0; i < s4l->num_sapis; i++) {
 		int sapi = s4l->sapis[i].sapi;
@@ -1192,6 +1192,15 @@
 			fl1h->alive_prim_cnt = 0;
 			osmo_timer_schedule(&fl1h->alive_timer, 5, 0);
 		}
+
+		/* For handover, possibly postpone activating the dl SACCH until the HO RACH is received. */
+		if (sapi == GsmL1_Sapi_Sacch && dir == GsmL1_Dir_TxDownlink) {
+			if (!lchan->dl_sacch.want_active)
+				continue;
+			else
+				lchan->dl_sacch.activated = true;
+		}
+
 		enqueue_sapi_act_cmd(lchan, sapi, dir);
 	}
 
@@ -1651,17 +1660,9 @@
 	return enqueue_sapi_deact_cmd(lchan, sapi, dir);
 }
 
-static int release_sapis_for_ho(struct gsm_lchan *lchan)
+static int release_rach_sapi(struct gsm_lchan *lchan)
 {
-	int res = 0;
-	int i;
-
-	const struct lchan_sapis *s4l = &sapis_for_ho;
-
-	for (i = s4l->num_sapis-1; i >= 0; i--)
-		res |= check_sapi_release(lchan,
-				s4l->sapis[i].sapi, s4l->sapis[i].dir);
-	return res;
+	return check_sapi_release(lchan, GsmL1_Sapi_Rach, GsmL1_Dir_RxUplink);
 }
 
 static int lchan_deactivate_sapis(struct gsm_lchan *lchan)
@@ -1678,12 +1679,18 @@
 		if (s4l->sapis[i].sapi == GsmL1_Sapi_Sch)
 			osmo_timer_del(&fl1h->alive_timer);
 
+		/* If no dl SACCH has been activated, skip its release */
+		if (s4l->sapis[i].sapi == GsmL1_Sapi_Sacch
+		    && s4l->sapis[i].dir == GsmL1_Dir_TxDownlink
+		    && !lchan->dl_sacch.activated)
+			continue;
+
 		/* Release if it was allocated */
 		res |= check_sapi_release(lchan, s4l->sapis[i].sapi, s4l->sapis[i].dir);
 	}
 
 	/* always attempt to disable the RACH burst */
-	res |= release_sapis_for_ho(lchan);
+	res |= release_rach_sapi(lchan);
 
 	/* nothing was queued */
 	if (res == 0) {
@@ -1886,13 +1893,13 @@
 		gsm_lchan_name(lchan));
 
 	/* Give up listening to RACH bursts */
-	release_sapis_for_ho(lchan);
+	release_rach_sapi(lchan);
 
-	/* Activate the normal SAPIs */
-	for (i = 0; i < s4l->num_sapis; i++) {
-		int sapi = s4l->sapis[i].sapi;
-		int dir = s4l->sapis[i].dir;
-		enqueue_sapi_act_cmd(lchan, sapi, dir);
+	/* Activate the dl SACCH if not yet active */
+	if (lchan->dl_sacch.want_active
+	    && !lchan->dl_sacch.activated) {
+		enqueue_sapi_act_cmd(lchan, GsmL1_Sapi_Sacch, GsmL1_Dir_TxDownlink);
+		lchan->dl_sacch.activated = true;
 	}
 
 	return 0;
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index fc8ef76..21445da 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -439,6 +439,10 @@
 		case PRIM_INFO_MODIFY:
 			chan_nr = l1sap->u.info.u.act_req.chan_nr;
 			lchan = get_lchan_by_chan_nr(trx, chan_nr);
+			/* For osmo-bts-trx, the dl_sacch.activated directly has the effect of transmitting the SACCH,
+			 * no need to interact with another entity to activate the SAPI. Just set it to whatever the
+			 * caller wants. */
+			lchan->dl_sacch.activated = lchan->dl_sacch.want_active;
 			if (l1sap->u.info.type == PRIM_INFO_ACTIVATE) {
 				if ((chan_nr & 0xE0) == 0x80) {
 					LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Cannot activate"

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ibea973ccadf5d424213f141f97a61395856b76de
Gerrit-Change-Number: 21078
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201109/69ec5b58/attachment.htm>


More information about the gerrit-log mailing list