[PATCH] 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/.

Max gerrit-no-reply at lists.osmocom.org
Mon Oct 17 14:40:18 UTC 2016


Review at  https://gerrit.osmocom.org/1099

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 octphy, 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-octphy/l1_if.c
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-sysmo/oml.c
12 files changed, 52 insertions(+), 50 deletions(-)


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

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 4311ffd..3ec314a 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 10660ee..1eea42d 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,
@@ -617,10 +617,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 6c8f5cc..af8939a 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 f47634e..af50343 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1107,22 +1107,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 453f53a..78c1e0f 100644
--- a/src/osmo-bts-litecell15/oml.c
+++ b/src/osmo-bts-litecell15/oml.c
@@ -1023,8 +1023,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, "MPH.act");
 		break;
 	case GsmL1_Sapi_TchH:
 	case GsmL1_Sapi_TchF:
@@ -1564,6 +1563,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-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index c4105ac..2f28cd6 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -487,6 +487,8 @@
 		sapi = cOCTVC1_GSM_SAPI_ENUM_BCCH;
 	} else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) {
 #warning Set BS_AG_BLKS_RES
+		/* FIXME: how does octphy differentiate between AGCH and PCH?
+		   How to supply num_of_agch properly? */
 		sapi = cOCTVC1_GSM_SAPI_ENUM_PCH_AGCH;
 	} else {
 		LOGP(DL1C, LOGL_NOTICE, "unknown prim %d op %d "
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index de29345..728fd32 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -600,6 +600,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 bef2d30..8ae2ff5 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -1132,22 +1132,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 fd03e22..16e6cd3 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1038,8 +1038,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:
@@ -1584,6 +1583,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: newchange
Gerrit-Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list