[MERGED] osmo-bsc[master]: HO: Count the actual meas.rep. get_meas_rep_avg fails if not...

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
Fri Jan 19 22:09:27 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: HO: Count the actual meas.rep. get_meas_rep_avg fails if not reached
......................................................................


HO: Count the actual meas.rep. get_meas_rep_avg fails if not reached

get_meas_rep_avg will return -EINVAL, if the required number of
measurements are not reached. There will be no handover possible until the
given number of measurements are available.

Change-Id: Ibc4410b4e162cdb6c070128d2c63946bb79d6d65
---
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/abis_rsl.c
M src/libbsc/chan_alloc.c
M src/libbsc/meas_rep.c
4 files changed, 18 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/bsc/gsm_data_shared.h b/include/osmocom/bsc/gsm_data_shared.h
index fd566d2..fed3494 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -268,6 +268,7 @@
 	/* cache of last measurement reports on this lchan */
 	struct gsm_meas_rep meas_rep[6];
 	int meas_rep_idx;
+	int meas_rep_count;
 
 	/* GSM Random Access data */
 	struct gsm48_req_ref *rqd_ref;
diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index 64e5c92..457cc95 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -1470,8 +1470,11 @@
 
 	if (!TLVP_PRESENT(&tp, RSL_IE_MEAS_RES_NR) ||
 	    !TLVP_PRESENT(&tp, RSL_IE_UPLINK_MEAS) ||
-	    !TLVP_PRESENT(&tp, RSL_IE_BS_POWER))
+	    !TLVP_PRESENT(&tp, RSL_IE_BS_POWER)) {
+		LOGP(DRSL, LOGL_ERROR, "%s Measurement Report lacks mandatory IEs\n",
+		     gsm_lchan_name(mr->lchan));
 		return -EIO;
+	}
 
 	/* Mandatory Parts */
 	mr->nr = *TLVP_VAL(&tp, RSL_IE_MEAS_RES_NR);
@@ -1517,6 +1520,10 @@
 			return rc;
 	}
 
+	mr->lchan->meas_rep_count++;
+	LOGP(DRSL, LOGL_DEBUG, "%s: meas_rep_cnt++=%d\n",
+	     gsm_lchan_name(mr->lchan), mr->lchan->meas_rep_count);
+
 	print_meas_rep(msg->lchan, mr);
 
 	send_lchan_signal(S_LCHAN_MEAS_REP, msg->lchan, mr);
diff --git a/src/libbsc/chan_alloc.c b/src/libbsc/chan_alloc.c
index 07248fb..1caa13d 100644
--- a/src/libbsc/chan_alloc.c
+++ b/src/libbsc/chan_alloc.c
@@ -347,6 +347,10 @@
 		     gsm_ts_and_pchan_name(lchan->ts),
 		     lchan->nr, gsm_lchant_name(lchan->type));
 
+		/* reset measurement report counter and index */
+	        lchan->meas_rep_count = 0;
+	        lchan->meas_rep_idx = 0;
+
 		/* clear sapis */
 		memset(lchan->sapis, 0, ARRAY_SIZE(lchan->sapis));
 
diff --git a/src/libbsc/meas_rep.c b/src/libbsc/meas_rep.c
index cb8379e..fbd1515 100644
--- a/src/libbsc/meas_rep.c
+++ b/src/libbsc/meas_rep.c
@@ -19,6 +19,7 @@
  *
  */
 
+#include <errno.h>
 
 #include <osmocom/bsc/gsm_data.h>
 #include <osmocom/bsc/meas_rep.h>
@@ -75,7 +76,10 @@
 	int avg = 0;
 
 	if (num < 1)
-		return 0;
+		return -EINVAL;
+
+	if (num > lchan->meas_rep_count)
+		return -EINVAL;
 
 	idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
 				lchan->meas_rep_idx, num);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibc4410b4e162cdb6c070128d2c63946bb79d6d65
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list