Change in osmo-bsc[master]: hodec2: [1/2] implement automatic choice between FULL and SUBSET meas...

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 Jul 5 15:44:21 UTC 2021


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


Change subject: hodec2: [1/2] implement automatic choice between FULL and SUBSET measurements
......................................................................

hodec2: [1/2] implement automatic choice between FULL and SUBSET measurements

Cosmetic preparation for enabling automatic choice between FULL and
SUBSET measurements depending on DTX in handover decision 2.

Change the internal API to pass separate enums for the choices {RXLEV,
RXQUAL}, {UL, DL} and {FULL, SUB}.

Change-Id: I283e03126a6bc1f5f1b35f9801e841053edd2947
---
M include/osmocom/bsc/meas_rep.h
M src/osmo-bsc/handover_decision.c
M src/osmo-bsc/handover_decision_2.c
M src/osmo-bsc/meas_rep.c
4 files changed, 77 insertions(+), 26 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/50/24850/1

diff --git a/include/osmocom/bsc/meas_rep.h b/include/osmocom/bsc/meas_rep.h
index 54e0519..77af365 100644
--- a/include/osmocom/bsc/meas_rep.h
+++ b/include/osmocom/bsc/meas_rep.h
@@ -51,14 +51,31 @@
 	struct gsm_meas_rep_cell cell[6];
 };
 
+enum tdma_meas_field {
+	TDMA_MEAS_FIELD_RXLEV,
+	TDMA_MEAS_FIELD_RXQUAL,
+};
+
+enum tdma_meas_dir {
+	TDMA_MEAS_DIR_UL,
+	TDMA_MEAS_DIR_DL,
+};
+
+enum tdma_meas_set {
+	TDMA_MEAS_SET_FULL,
+	TDMA_MEAS_SET_SUB,
+	TDMA_MEAS_SET_AUTO,
+};
+
 /* obtain an average over the last 'num' fields in the meas reps */
 int get_meas_rep_avg(const struct gsm_lchan *lchan,
-		     enum meas_rep_field field, unsigned int num);
+		     enum tdma_meas_field field, enum tdma_meas_dir dir, enum tdma_meas_set set,
+		     unsigned int num);
 
 /* Check if N out of M last values for FIELD are >= bd */
 int meas_rep_n_out_of_m_be(const struct gsm_lchan *lchan,
-			enum meas_rep_field field,
-			unsigned int n, unsigned int m, int be);
+			   enum tdma_meas_field field, enum tdma_meas_dir dir, enum tdma_meas_set set,
+			   unsigned int n, unsigned int m, int be);
 
 unsigned int calc_initial_idx(unsigned int array_size,
 			      unsigned int meas_rep_idx,
diff --git a/src/osmo-bsc/handover_decision.c b/src/osmo-bsc/handover_decision.c
index 1eeb277..220fa1c 100644
--- a/src/osmo-bsc/handover_decision.c
+++ b/src/osmo-bsc/handover_decision.c
@@ -214,7 +214,7 @@
 static void on_measurement_report(struct gsm_meas_rep *mr)
 {
 	struct gsm_bts *bts = mr->lchan->ts->trx->bts;
-	enum meas_rep_field dlev, dqual;
+	enum tdma_meas_set meas_set;
 	int av_rxlev;
 	unsigned int pwr_interval;
 
@@ -231,24 +231,18 @@
 		return;
 	}
 
-	if (mr->flags & MEAS_REP_F_DL_DTX) {
-		dlev = MEAS_REP_DL_RXLEV_SUB;
-		dqual = MEAS_REP_DL_RXQUAL_SUB;
-	} else {
-		dlev = MEAS_REP_DL_RXLEV_FULL;
-		dqual = MEAS_REP_DL_RXQUAL_FULL;
-	}
+	meas_set = (mr->flags & MEAS_REP_F_DL_DTX) ? TDMA_MEAS_SET_SUB : TDMA_MEAS_SET_FULL;
 
 	/* parse actual neighbor cell info */
 	if (mr->num_cell > 0 && mr->num_cell < 7)
 		process_meas_neigh(mr);
 
-	av_rxlev = get_meas_rep_avg(mr->lchan, dlev,
+	av_rxlev = get_meas_rep_avg(mr->lchan, TDMA_MEAS_FIELD_RXLEV, TDMA_MEAS_DIR_DL, meas_set,
 				    ho_get_hodec1_rxlev_avg_win(bts->ho));
 
 	/* Interference HO */
 	if (rxlev2dbm(av_rxlev) > -85 &&
-	    meas_rep_n_out_of_m_be(mr->lchan, dqual, 3, 4, 5)) {
+	    meas_rep_n_out_of_m_be(mr->lchan, TDMA_MEAS_FIELD_RXQUAL, TDMA_MEAS_DIR_DL, meas_set, 3, 4, 5)) {
 		LOGPC(DHO, LOGL_INFO, "HO cause: Interference HO av_rxlev=%d dBm\n",
 		      rxlev2dbm(av_rxlev));
 		attempt_handover(mr);
@@ -256,7 +250,7 @@
 	}
 
 	/* Bad Quality */
-	if (meas_rep_n_out_of_m_be(mr->lchan, dqual, 3, 4, 5)) {
+	if (meas_rep_n_out_of_m_be(mr->lchan, TDMA_MEAS_FIELD_RXQUAL, TDMA_MEAS_DIR_DL, meas_set, 3, 4, 5)) {
 		LOGPC(DHO, LOGL_INFO, "HO cause: Bad Quality av_rxlev=%d dBm\n", rxlev2dbm(av_rxlev));
 		attempt_handover(mr);
 		return;
diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c
index 0966583..c3674ff 100644
--- a/src/osmo-bsc/handover_decision_2.c
+++ b/src/osmo-bsc/handover_decision_2.c
@@ -244,18 +244,16 @@
 static int current_rxlev(struct gsm_lchan *lchan)
 {
 	struct gsm_bts *bts = lchan->ts->trx->bts;
-	return get_meas_rep_avg(lchan,
-				ho_get_hodec2_full_tdma(bts->ho) ?
-					MEAS_REP_DL_RXLEV_FULL : MEAS_REP_DL_RXLEV_SUB,
+	return get_meas_rep_avg(lchan, TDMA_MEAS_FIELD_RXLEV, TDMA_MEAS_DIR_DL,
+				ho_get_hodec2_full_tdma(bts->ho) ? TDMA_MEAS_SET_FULL : TDMA_MEAS_SET_SUB,
 				ho_get_hodec2_rxlev_avg_win(bts->ho));
 }
 
 static int current_rxqual(struct gsm_lchan *lchan)
 {
 	struct gsm_bts *bts = lchan->ts->trx->bts;
-	return get_meas_rep_avg(lchan,
-				ho_get_hodec2_full_tdma(bts->ho) ?
-					MEAS_REP_DL_RXQUAL_FULL : MEAS_REP_DL_RXQUAL_SUB,
+	return get_meas_rep_avg(lchan, TDMA_MEAS_FIELD_RXQUAL, TDMA_MEAS_DIR_DL,
+				ho_get_hodec2_full_tdma(bts->ho) ? TDMA_MEAS_SET_FULL : TDMA_MEAS_SET_SUB,
 				ho_get_hodec2_rxqual_avg_win(bts->ho));
 }
 
diff --git a/src/osmo-bsc/meas_rep.c b/src/osmo-bsc/meas_rep.c
index 32c689d..0ddf349 100644
--- a/src/osmo-bsc/meas_rep.c
+++ b/src/osmo-bsc/meas_rep.c
@@ -80,9 +80,43 @@
 	return idx;
 }
 
-/* obtain an average over the last 'num' fields in the meas reps */
+static inline enum meas_rep_field choose_meas_rep_field(enum tdma_meas_field field, enum tdma_meas_dir dir,
+							enum tdma_meas_set set)
+{
+	const enum meas_rep_field map[2][2][2] = {
+		[TDMA_MEAS_FIELD_RXLEV] = {
+			[TDMA_MEAS_DIR_UL] = {
+				[TDMA_MEAS_SET_FULL] = MEAS_REP_UL_RXLEV_FULL,
+				[TDMA_MEAS_SET_SUB] = MEAS_REP_UL_RXLEV_SUB,
+			},
+			[TDMA_MEAS_DIR_DL] = {
+				[TDMA_MEAS_SET_FULL] = MEAS_REP_DL_RXLEV_FULL,
+				[TDMA_MEAS_SET_SUB] = MEAS_REP_DL_RXLEV_SUB,
+			},
+		},
+		[TDMA_MEAS_FIELD_RXQUAL] = {
+			[TDMA_MEAS_DIR_UL] = {
+				[TDMA_MEAS_SET_FULL] = MEAS_REP_UL_RXQUAL_FULL,
+				[TDMA_MEAS_SET_SUB] = MEAS_REP_UL_RXQUAL_SUB,
+			},
+			[TDMA_MEAS_DIR_DL] = {
+				[TDMA_MEAS_SET_FULL] = MEAS_REP_DL_RXQUAL_FULL,
+				[TDMA_MEAS_SET_SUB] = MEAS_REP_DL_RXQUAL_SUB,
+			},
+		},
+	};
+
+	OSMO_ASSERT(field == TDMA_MEAS_FIELD_RXQUAL || field == TDMA_MEAS_FIELD_RXLEV);
+	OSMO_ASSERT(dir == TDMA_MEAS_DIR_UL || dir == TDMA_MEAS_DIR_DL);
+	OSMO_ASSERT(set == TDMA_MEAS_SET_FULL || set == TDMA_MEAS_SET_SUB);
+	return map[field][dir][set];
+}
+
+/* obtain an average over the last 'num' fields in the meas reps. For 'field', pass either DL_RXLEV or DL_RXQUAL, and
+ * by tdma_meas_set, choose between full, subset or automatic choice of set. */
 int get_meas_rep_avg(const struct gsm_lchan *lchan,
-		     enum meas_rep_field field, unsigned int num)
+		     enum tdma_meas_field field, enum tdma_meas_dir dir, enum tdma_meas_set set,
+		     unsigned int num)
 {
 	unsigned int i, idx;
 	int avg = 0, valid_num = 0;
@@ -98,7 +132,11 @@
 
 	for (i = 0; i < num; i++) {
 		int j = (idx+i) % ARRAY_SIZE(lchan->meas_rep);
-		int val = get_field(&lchan->meas_rep[j], field);
+		enum meas_rep_field use_field;
+		int val;
+
+		use_field = choose_meas_rep_field(field, dir, set);
+		val = get_field(&lchan->meas_rep[j], use_field);
 
 		if (val >= 0) {
 			avg += val;
@@ -114,8 +152,8 @@
 
 /* Check if N out of M last values for FIELD are >= bd */
 int meas_rep_n_out_of_m_be(const struct gsm_lchan *lchan,
-			enum meas_rep_field field,
-			unsigned int n, unsigned int m, int be)
+			   enum tdma_meas_field field, enum tdma_meas_dir dir, enum tdma_meas_set set,
+			   unsigned int n, unsigned int m, int be)
 {
 	unsigned int i, idx;
 	int count = 0;
@@ -125,7 +163,11 @@
 
 	for (i = 0; i < m; i++) {
 		int j = (idx + i) % ARRAY_SIZE(lchan->meas_rep);
-		int val = get_field(&lchan->meas_rep[j], field);
+		enum meas_rep_field use_field;
+		int val;
+
+		use_field = choose_meas_rep_field(field, dir, set);
+		val = get_field(&lchan->meas_rep[j], use_field);
 
 		if (val >= be) /* implies that val < 0 will not count */
 			count++;

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I283e03126a6bc1f5f1b35f9801e841053edd2947
Gerrit-Change-Number: 24850
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/20210705/f3963c28/attachment.htm>


More information about the gerrit-log mailing list