summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/gsm322.h8
-rw-r--r--src/host/layer23/src/mobile/gsm322.c12
2 files changed, 19 insertions, 1 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm322.h b/src/host/layer23/include/osmocom/bb/mobile/gsm322.h
index 66bc8522..e136999c 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/gsm322.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/gsm322.h
@@ -147,6 +147,13 @@ struct gsm322_neighbour {
uint8_t prio_low;
};
+/* a summary of the 6 strongest neighbour cells */
+struct gsm322_nb_summary {
+ uint8_t valid;
+ int8_t rxlev_dbm;
+ uint16_t arfcn;
+};
+
#define GSM322_NB_NEW 0 /* new NB instance */
#define GSM322_NB_NOT_SUP 1 /* ARFCN not supported */
#define GSM322_NB_RLA_C 2 /* valid measurement available */
@@ -190,6 +197,7 @@ struct gsm322_cellsel {
uint16_t last_serving_arfcn; /* the ARFCN of last cell */
uint8_t last_serving_valid; /* there is a last cell */
struct gsm322_neighbour *neighbour; /* when selecting neighbour cell */
+ struct gsm322_nb_summary nb_summary[6];
time_t resel_when; /* timestamp of last re-selection */
int8_t nb_meas_set;
int16_t rxlev_sum_dbm; /* sum of received levels */
diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c
index f537f077..4ed519de 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -2286,6 +2286,7 @@ static int gsm322_cs_store(struct osmocom_ms *ms)
struct msgb *nmsg;
struct gsm322_msg *ngm;
int found, any = 0;
+ int i;
if (cs->state != GSM322_C2_STORED_CELL_SEL
&& cs->state != GSM322_C1_NORMAL_CELL_SEL
@@ -2444,6 +2445,10 @@ indicate_plmn_avail:
gsm_get_mnc(cs->sel_mcc, cs->sel_mnc));
}
+ /* flush summary list of neighbour cells */
+ for (i = 0; i < 6; i++)
+ cs->nb_summary[i].valid = 0;
+
/* tell CS process about available cell */
LOGP(DCS, LOGL_INFO, "Cell available.\n");
nmsg = gsm322_msgb_alloc(GSM322_EVENT_CELL_FOUND);
@@ -4739,7 +4744,7 @@ static int gsm322_nb_new_rxlev(struct gsm322_cellsel *cs)
INIT_LLIST_HEAD(&sorted);
/* detach up to 6 of the strongest neighbour cells from list and put
- * them in the "sorted" list */
+ * them in the "sorted" list, also put them in the nb_summary list */
while (!llist_empty(&cs->nb_list)) {
strongest = -128;
strongest_nb = NULL;
@@ -4755,11 +4760,16 @@ static int gsm322_nb_new_rxlev(struct gsm322_cellsel *cs)
break;
LOGP(DNB, LOGL_INFO, "#%d ARFCN=%d RLA_C=%d\n",
i+1, strongest_nb->arfcn, strongest_nb->rla_c_dbm);
+ cs->nb_summary[i].valid = 1;;
+ cs->nb_summary[i].arfcn = strongest_nb->arfcn;;
+ cs->nb_summary[i].rxlev_dbm = strongest_nb->rla_c_dbm;;
llist_del(&strongest_nb->entry);
llist_add(&strongest_nb->entry, &sorted);
if (++i == GSM58_NB_NUMBER)
break;
}
+ for (; i < 6; i++)
+ cs->nb_summary[i].valid = 0;
/* take the sorted list and attat it to the head of the neighbour cell
* list */