Change in osmo-bsc[master]: RES IND: pick lchan with least interference

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
Thu Jul 8 04:49:20 UTC 2021


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


Change subject: RES IND: pick lchan with least interference
......................................................................

RES IND: pick lchan with least interference

In lchan_select, do not return on the first available lchan, but iterate
through all available lchans. Among those that would match, pick the one
with the lowest interference level as indicated by earlier RES IND.

Lchans that have no interference ratings are picked last.

Change-Id: I844494092193811dfd9fa4d52983cbaed0fc9248
---
M src/osmo-bsc/lchan_select.c
M tests/handover/test_resource_indication.ho_vty
2 files changed, 49 insertions(+), 28 deletions(-)



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

diff --git a/src/osmo-bsc/lchan_select.c b/src/osmo-bsc/lchan_select.c
index efa2ff2..1209a24 100644
--- a/src/osmo-bsc/lchan_select.c
+++ b/src/osmo-bsc/lchan_select.c
@@ -30,22 +30,36 @@
 #include <osmocom/bsc/lchan_select.h>
 #include <osmocom/bsc/bts.h>
 
+static struct gsm_lchan *pick_better_lchan(struct gsm_lchan *a, struct gsm_lchan *b)
+{
+	if (!a)
+		return b;
+	if (!b)
+		return a;
+	/* comparing negative dBm values: smaller value means less interference. */
+	if (b->interf_dbm < a->interf_dbm)
+		return b;
+	return a;
+}
+
 static struct gsm_lchan *
 _lc_find_trx(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan,
 	     enum gsm_phys_chan_config as_pchan, bool allow_pchan_switch, bool log)
 {
 	struct gsm_lchan *lchan;
+	struct gsm_lchan *found_lchan = NULL;
 	struct gsm_bts_trx_ts *ts;
 	int j, start, stop, dir;
 
-#define LOGPLCHANALLOC(fmt, args...) \
+#define LOGPLCHANALLOC(fmt, args...) do { \
 	if (log) \
 		LOGP(DRLL, LOGL_DEBUG, "looking for lchan %s%s%s%s: " fmt, \
 		     gsm_pchan_name(pchan), \
 		     pchan == as_pchan ? "" : " as ", \
 		     pchan == as_pchan ? "" : gsm_pchan_name(as_pchan), \
 		     ((pchan != as_pchan) && !allow_pchan_switch) ? " without pchan switch" : "", \
-		     ## args)
+		     ## args); \
+	} while (0)
 
 	if (!trx_is_usable(trx)) {
 		LOGPLCHANALLOC("%s trx not usable\n", gsm_trx_name(trx));
@@ -88,19 +102,35 @@
 		lchans_as_pchan = pchan_subslots(as_pchan);
 		ts_for_n_lchans(lchan, ts, lchans_as_pchan) {
 			if (lchan->fi->state == LCHAN_ST_UNUSED) {
-				LOGPLCHANALLOC("%s ss=%d is available%s\n",
+				struct gsm_lchan *was = found_lchan;
+				found_lchan = pick_better_lchan(found_lchan, lchan);
+				if (found_lchan != was)
+					LOGPLCHANALLOC("%s ss=%d interf=%u=%ddBm is %s%s\n",
+						       gsm_ts_and_pchan_name(ts), lchan->nr,
+						       lchan->interf_band, lchan->interf_dbm,
+						       was == NULL ? "available" : "better",
+						       ts->pchan_is != as_pchan ? ", after dyn PCHAN change" : "");
+				else
+					LOGPLCHANALLOC("%s ss=%d interf=%u=%ddBm is also available but not better\n",
+						       gsm_ts_and_pchan_name(ts), lchan->nr,
+						       lchan->interf_band, lchan->interf_dbm);
+			} else {
+				LOGPLCHANALLOC("%s ss=%d in type=%s,state=%s not suitable\n",
 					       gsm_ts_and_pchan_name(ts), lchan->nr,
-					       ts->pchan_is != as_pchan ? " after dyn PCHAN change" : "");
-				return lchan;
+					       gsm_lchant_name(lchan->type),
+					       osmo_fsm_inst_state_name(lchan->fi));
 			}
-			LOGPLCHANALLOC("%s ss=%d in type=%s,state=%s not suitable\n",
-				       gsm_ts_and_pchan_name(ts), lchan->nr,
-				       gsm_lchant_name(lchan->type),
-				       osmo_fsm_inst_state_name(lchan->fi));
 		}
 	}
 
-	return NULL;
+	if (found_lchan)
+		LOGPLCHANALLOC("%s ss=%d interf=%ddBm%s is the best pick\n",
+			       gsm_ts_and_pchan_name(found_lchan->ts), found_lchan->nr,
+			       found_lchan->interf_dbm,
+			       found_lchan->ts->pchan_is != as_pchan ? ", after dyn PCHAN change," : "");
+	else
+		LOGPLCHANALLOC("Nothing found");
+	return found_lchan;
 #undef LOGPLCHANALLOC
 }
 
diff --git a/tests/handover/test_resource_indication.ho_vty b/tests/handover/test_resource_indication.ho_vty
index 6e319c6..fdef2bd 100644
--- a/tests/handover/test_resource_indication.ho_vty
+++ b/tests/handover/test_resource_indication.ho_vty
@@ -11,8 +11,7 @@
 
 res-ind trx 0 0 levels           -    1     2     3     4     3     2     -
 create-ms bts 0 TCH/F AMR
-# FAIL: interference is ignored
-expect-ts-use trx 0 0 states     *    TCH/F -     -     -     -     -     *
+expect-ts-use trx 0 0 states     *    -     -     -     TCH/F -     -     *
 
 # The ordering may also be configured reversed, still the lowest dBm value should win
 network
@@ -22,26 +21,22 @@
 
 res-ind trx 0 0 levels           -    5     4     2     -     3     4     -
 create-ms bts 0 TCH/F AMR
-# FAIL: interference is ignored
-expect-ts-use trx 0 0 states     *    TCH/F TCH/F -     -     -     -     *
+expect-ts-use trx 0 0 states     *    -     -     TCH/F TCH/F -     -     *
 
 # Favor lchans that have an indicated interference level
 res-ind trx 0 0 levels           -    -     -     -     -     4     3     -
 create-ms bts 0 TCH/F AMR
-# FAIL: interference is ignored
-expect-ts-use trx 0 0 states     *    TCH/F TCH/F TCH/F -     -     -     *
+expect-ts-use trx 0 0 states     *    -     -     TCH/F TCH/F -     TCH/F *
 
 # For equal levels, pick the first
 res-ind trx 0 0 levels           -    2     2     -     -     2     -     -
 create-ms bts 0 TCH/F AMR
-# FAIL: interference is ignored
-expect-ts-use trx 0 0 states     *    TCH/F TCH/F TCH/F TCH/F -     -     *
+expect-ts-use trx 0 0 states     *    TCH/F -     TCH/F TCH/F -     TCH/F *
 
 # Test clamping of indexes > 5
 res-ind trx 0 0 levels           -    -     6     -     -     4     -     -
 create-ms bts 0 TCH/F AMR
-# FAIL: interference is ignored
-expect-ts-use trx 0 0 states     *    TCH/F TCH/F TCH/F TCH/F TCH/F -     *
+expect-ts-use trx 0 0 states     *    TCH/F -     TCH/F TCH/F TCH/F TCH/F *
 
 # Also test for TCH/H
 create-bts trx-count 1 timeslots c+s4 TCH/H  TCH/H  TCH/H  TCH/H  TCH/H  TCH/H  PDCH
@@ -52,23 +47,19 @@
 
 res-ind trx 1 0 levels           -    54     32     21     23     45     54     -
 create-ms bts 1 TCH/H AMR
-# FAIL: interference is ignored
-expect-ts-use trx 1 0 states     *    TCH/H- -      -      -      -      -      *
+expect-ts-use trx 1 0 states     *    -      -      TCH/-H -      -      -      *
 
 # Favor lchans that have an indicated interference level
 res-ind trx 1 0 levels           -    -      -      4-     3-     -      -      -
 create-ms bts 1 TCH/H AMR
-# FAIL: interference is ignored
-expect-ts-use trx 1 0 states     *    TCH/HH -      -      -      -      -      *
+expect-ts-use trx 1 0 states     *    -      -      TCH/-H TCH/H- -      -      *
 
 # For equal levels, pick the first
 res-ind trx 1 0 levels           -    -2     22     2-     -2     22     2-     -
 create-ms bts 1 TCH/H AMR
-# FAIL: interference is ignored
-expect-ts-use trx 1 0 states     *    TCH/HH TCH/H- -      -      -      -      *
+expect-ts-use trx 1 0 states     *    TCH/-H -      TCH/-H TCH/H- -      -      *
 
 # Test clamping of indexes > 5
 res-ind trx 1 0 levels           -    7-     67     6-     -7     54     6-     -
 create-ms bts 1 TCH/H AMR
-# FAIL: interference is ignored
-expect-ts-use trx 1 0 states     *    TCH/HH TCH/HH -      -      -      -      *
+expect-ts-use trx 1 0 states     *    TCH/-H -      TCH/-H TCH/H- TCH/-H -      *

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I844494092193811dfd9fa4d52983cbaed0fc9248
Gerrit-Change-Number: 24885
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/20210708/f6f384a7/attachment.htm>


More information about the gerrit-log mailing list