[MERGED] osmo-bts[master]: Fix AGCH/PCH proportional allocation

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Dec 1 15:25:26 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: Fix AGCH/PCH proportional allocation
......................................................................


Fix AGCH/PCH proportional allocation

Do not assume that 1 == BS_AG_BLKS_RES but take that information from
SI3. Note: due to current implementation quirks we activate channels
before SI3 obtained, than we deactivate channels upon receiving SI3 and
activate them again. This might not be necessary once we migrate to
proper OML state machines.

This affects lc15 and sysmo hw.

Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e
Related: OS#1575
---
M include/osmo-bts/bts.h
M include/osmo-bts/rsl.h
M src/common/l1sap.c
M src/common/paging.c
M src/common/rsl.c
M src/common/sysinfo.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-litecell15/oml.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-sysmo/oml.c
10 files changed, 44 insertions(+), 50 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index ec58edd..567772e 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -36,7 +36,7 @@
 int lchan_init_lapdm(struct gsm_lchan *lchan);
 
 void load_timer_start(struct gsm_bts *bts);
-
+uint8_t num_agch(struct gsm_bts_trx *trx, const char * arg);
 void bts_update_status(enum bts_global_status which, int on);
 
 int trx_ms_pwr_ctrl_is_osmo(struct gsm_bts_trx *trx);
diff --git a/include/osmo-bts/rsl.h b/include/osmo-bts/rsl.h
index d542ff6..a2a6e3d 100644
--- a/include/osmo-bts/rsl.h
+++ b/include/osmo-bts/rsl.h
@@ -9,6 +9,7 @@
 	LCHAN_REL_ACT_RSL,
 	LCHAN_REL_ACT_PCU,
 	LCHAN_REL_ACT_OML,
+	LCHAN_REL_ACT_REACT,
 };
 
 #define LCHAN_FN_DUMMY 0xFFFFFFFF
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 553011f..82aa1ac 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -205,7 +205,8 @@
 
 /* send primitive as gsmtap */
 static int gsmtap_ph_data(struct osmo_phsap_prim *l1sap, uint8_t *chan_type,
-			  uint8_t *ss, uint32_t fn, uint8_t **data, int *len)
+			  uint8_t *ss, uint32_t fn, uint8_t **data, int *len,
+			  uint8_t num_agch)
 {
 	struct msgb *msg = l1sap->oph.msg;
 	uint8_t chan_nr, link_id;
@@ -229,10 +230,9 @@
 	} else if (L1SAP_IS_CHAN_BCCH(chan_nr)) {
 		*chan_type = GSMTAP_CHANNEL_BCCH;
 	} else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) {
-#warning Set BS_AG_BLKS_RES
 		/* The sapi depends on DSP configuration, not
 		 * on the actual SYSTEM INFORMATION 3. */
-		if (L1SAP_FN2CCCHBLOCK(fn) >= 1)
+		if (L1SAP_FN2CCCHBLOCK(fn) >= num_agch)
 			*chan_type = GSMTAP_CHANNEL_PCH;
 		else
 			*chan_type = GSMTAP_CHANNEL_AGCH;
@@ -312,7 +312,7 @@
 					 &len);
 		else
 			rc = gsmtap_ph_data(l1sap, &chan_type, &ss, fn, &data,
-					    &len);
+					    &len, num_agch(trx, "GSMTAP"));
 		break;
 	case OSMO_PRIM(PRIM_PH_RACH, PRIM_OP_INDICATION):
 		rc = gsmtap_ph_rach(l1sap, &chan_type, &tn, &ss, &fn, &data,
@@ -615,10 +615,9 @@
 		}
 	} else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) {
 		p = msgb_put(msg, GSM_MACBLOCK_LEN);
-#warning "TODO: Yet another assumption that BS_AG_BLKS_RES=1"
-		/* if CCCH block is 0, it is AGCH */
 		rc = bts_ccch_copy_msg(trx->bts, p, &g_time,
-			(L1SAP_FN2CCCHBLOCK(fn) < 1));
+				       (L1SAP_FN2CCCHBLOCK(fn) <
+					num_agch(trx, "PH-RTS-IND")));
 		if (rc <= 0)
 			memcpy(p, fill_frame, GSM_MACBLOCK_LEN);
 	}
diff --git a/src/common/paging.c b/src/common/paging.c
index f75f12d..957d609 100644
--- a/src/common/paging.c
+++ b/src/common/paging.c
@@ -538,12 +538,6 @@
 		struct paging_state *ps = btsb->paging_state;
 		struct gsm48_system_information_type_3 *si3 = (void *) bts->si_buf[SYSINFO_TYPE_3];
 
-#warning "TODO: Remove this when setting u8NbrOfAgch is implemented properly"
-		if (si3->control_channel_desc.bs_ag_blks_res != 1)
-			LOGP(DPAG, LOGL_ERROR,
-			     "Paging: BS_AG_BLKS_RES = %d != 1 not fully supported\n",
-			     si3->control_channel_desc.bs_ag_blks_res);
-
 		paging_si_update(ps, &si3->control_channel_desc);
 	}
 	return 0;
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 880136c..8d1175d 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -295,6 +295,14 @@
 		LOGP(DRSL, LOGL_INFO, " Rx RSL BCCH INFO (SI%s)\n",
 			get_value_string(osmo_sitype_strs, osmo_si));
 
+		if (SYSINFO_TYPE_3 == osmo_si && trx->nr == 0 &&
+		    num_agch(trx, "RSL") != 1) {
+			lchan_deactivate(&trx->bts->c0->ts[0].lchan[CCCH_LCHAN]);
+			/* will be reactivated by sapi_deactivate_cb() */
+			trx->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =
+				LCHAN_REL_ACT_REACT;
+		}
+
 		if (SYSINFO_TYPE_2quater == osmo_si) {
 			si2q = (struct gsm48_system_information_type_2quater *)
 				bts->si_buf[SYSINFO_TYPE_2quater];
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index ee42da2..d0a476d 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -22,6 +22,7 @@
 #include <osmocom/gsm/gsm_utils.h>
 #include <osmocom/gsm/sysinfo.h>
 
+#include <osmo-bts/logging.h>
 #include <osmo-bts/gsm_data.h>
 
 #define BTS_HAS_SI(bts, sinum)	((bts)->si_valid & (1 << sinum))
@@ -132,6 +133,19 @@
 	return NULL;
 }
 
+uint8_t num_agch(struct gsm_bts_trx *trx, const char * arg)
+{
+	struct gsm_bts *b = trx->bts;
+	struct gsm48_system_information_type_3 *si3;
+	if (BTS_HAS_SI(b, SYSINFO_TYPE_3)) {
+		si3 = GSM_BTS_SI(b, SYSINFO_TYPE_3);
+		return si3->control_channel_desc.bs_ag_blks_res;
+	}
+	LOGP(DL1P, LOGL_ERROR, "%s: Unable to determine actual BS_AG_BLKS_RES "
+	     "value as SI3 is not available yet, fallback to 1\n", arg);
+	return 1;
+}
+
 uint8_t *lchan_sacch_get(struct gsm_lchan *lchan)
 {
 	uint32_t tmp;
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 632e769..d959338 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1188,22 +1188,6 @@
 	return l1if_handle_ind(fl1h, msg);
 }
 
-#if 0
-/* called by RSL if the BCCH SI has been modified */
-int sysinfo_has_changed(struct gsm_bts *bts, int si)
-{
-	/* FIXME: Determine BS_AG_BLKS_RES and 
-	 *  	* set cfgParams.u.agch.u8NbrOfAgch
-	 *	* determine implications on paging
-	 */
-	/* FIXME: Check for Extended BCCH presence */
-	/* FIXME: Check for CCCH_CONF */
-	/* FIXME: Check for BS_PA_MFRMS: update paging */
-
-	return 0;
-}
-#endif
-
 static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp,
 				void *data)
 {
diff --git a/src/osmo-bts-litecell15/oml.c b/src/osmo-bts-litecell15/oml.c
index 8afa2a2..64c868c 100644
--- a/src/osmo-bts-litecell15/oml.c
+++ b/src/osmo-bts-litecell15/oml.c
@@ -1025,8 +1025,7 @@
 		lch_par->rach.u8Bsic = lchan->ts->trx->bts->bsic;
 		break;
 	case GsmL1_Sapi_Agch:
-#warning Set BS_AG_BLKS_RES
-		lch_par->agch.u8NbrOfAgch = 1;
+		lch_par->agch.u8NbrOfAgch = num_agch(lchan->ts->trx, lchan->name);
 		break;
 	case GsmL1_Sapi_TchH:
 	case GsmL1_Sapi_TchF:
@@ -1566,6 +1565,12 @@
 
 	lchan_set_state(lchan, LCHAN_S_NONE);
 	mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0);
+
+	/* Reactivate CCCH due to SI3 update in RSL */
+	if (lchan->rel_act_kind == LCHAN_REL_ACT_REACT) {
+		lchan->rel_act_kind = LCHAN_REL_ACT_RSL;
+		lchan_activate(lchan);
+	}
 	return 0;
 }
 
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index ed643fc..2a3caf9 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -1176,22 +1176,6 @@
 	return l1if_handle_ind(fl1h, msg);
 }
 
-#if 0
-/* called by RSL if the BCCH SI has been modified */
-int sysinfo_has_changed(struct gsm_bts *bts, int si)
-{
-	/* FIXME: Determine BS_AG_BLKS_RES and 
-	 *  	* set cfgParams.u.agch.u8NbrOfAgch
-	 *	* determine implications on paging
-	 */
-	/* FIXME: Check for Extended BCCH presence */
-	/* FIXME: Check for CCCH_CONF */
-	/* FIXME: Check for BS_PA_MFRMS: update paging */
-
-	return 0;
-}
-#endif
-
 static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp,
 				void *data)
 {
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index b23d992..01752d1 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1040,8 +1040,7 @@
 		lch_par->rach.u8Bsic = lchan->ts->trx->bts->bsic;
 		break;
 	case GsmL1_Sapi_Agch:
-#warning Set BS_AG_BLKS_RES
-		lch_par->agch.u8NbrOfAgch = 1;
+		lch_par->agch.u8NbrOfAgch = num_agch(lchan->ts->trx, lchan->name);
 		break;
 	case GsmL1_Sapi_TchH:
 	case GsmL1_Sapi_TchF:
@@ -1586,6 +1585,12 @@
 
 	lchan_set_state(lchan, LCHAN_S_NONE);
 	mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0);
+
+	/* Reactivate CCCH due to SI3 update in RSL */
+	if (lchan->rel_act_kind == LCHAN_REL_ACT_REACT) {
+		lchan->rel_act_kind = LCHAN_REL_ACT_RSL;
+		lchan_activate(lchan);
+	}
 	return 0;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/1099
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e
Gerrit-PatchSet: 5
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list