diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2011-12-01 11:07:10 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2016-09-25 08:11:46 +0200 |
commit | 54fa680f182623f0e39ddc9be594c7b8afe62dd5 (patch) | |
tree | 9fa08410b56b7a0caa288de01ab84670561694a3 | |
parent | cffc0dcb958c50c34d9809099e64485a955c8df9 (diff) |
layer23/mobile: Adding summary of up to 6 strongest neighbour cells
-rw-r--r-- | src/host/layer23/include/osmocom/bb/mobile/gsm322.h | 8 | ||||
-rw-r--r-- | src/host/layer23/src/mobile/gsm322.c | 12 |
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 */ |