2010-04-25 16:28:24 +00:00
|
|
|
/*
|
|
|
|
* (C) 2010 by Andreas Eversberg <jolly@eversberg.eu>
|
|
|
|
*
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2011-03-02 10:00:59 +00:00
|
|
|
#include <limits.h>
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
#include <time.h>
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2011-04-26 00:55:30 +00:00
|
|
|
#include <osmocom/core/msgb.h>
|
|
|
|
#include <osmocom/core/talloc.h>
|
|
|
|
#include <osmocom/core/utils.h>
|
|
|
|
#include <osmocom/gsm/gsm48.h>
|
|
|
|
#include <osmocom/core/signal.h>
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-07-27 18:44:46 +00:00
|
|
|
#include <osmocom/bb/common/logging.h>
|
|
|
|
#include <osmocom/bb/common/l1ctl.h>
|
|
|
|
#include <osmocom/bb/common/osmocom_data.h>
|
|
|
|
#include <osmocom/bb/common/networks.h>
|
|
|
|
#include <osmocom/bb/mobile/vty.h>
|
2010-11-14 11:52:57 +00:00
|
|
|
#include <osmocom/bb/mobile/app_mobile.h>
|
2018-07-21 21:20:49 +00:00
|
|
|
#include <osmocom/bb/common/utils.h>
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2011-06-22 21:08:55 +00:00
|
|
|
#include <l1ctl_proto.h>
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
const char *ba_version = "osmocom BA V1\n";
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
static void gsm322_cs_timeout(void *arg);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static int gsm322_cs_select(struct osmocom_ms *ms, int index, uint16_t mcc,
|
|
|
|
uint16_t mnc, int any);
|
2010-04-25 16:28:24 +00:00
|
|
|
static int gsm322_m_switch_on(struct osmocom_ms *ms, struct msgb *msg);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static void gsm322_any_timeout(void *arg);
|
|
|
|
static int gsm322_nb_scan(struct osmocom_ms *ms);
|
|
|
|
static int gsm322_nb_synced(struct gsm322_cellsel *cs, int yes);
|
|
|
|
static int gsm322_nb_read(struct gsm322_cellsel *cs, int yes);
|
|
|
|
static int gsm322_c_camp_any_cell(struct osmocom_ms *ms, struct msgb *msg);
|
|
|
|
static int gsm322_nb_start(struct osmocom_ms *ms, int synced);
|
|
|
|
static void gsm322_cs_loss(void *arg);
|
|
|
|
static int gsm322_nb_meas_ind(struct osmocom_ms *ms, uint16_t arfcn,
|
|
|
|
uint8_t rx_lev);
|
|
|
|
|
|
|
|
#define SYNC_RETRIES 1
|
|
|
|
#define SYNC_RETRIES_SERVING 2
|
|
|
|
|
|
|
|
/* time for trying to sync and read BCCH of neighbour cell again
|
|
|
|
* NOTE: This value is not defined by TS, i think. */
|
|
|
|
#define GSM58_TRY_AGAIN 30
|
|
|
|
|
|
|
|
/* time for reading BCCH of neighbour cell again */
|
|
|
|
#define GSM58_READ_AGAIN 300
|
|
|
|
|
|
|
|
/* number of neighbour cells to monitor */
|
|
|
|
#define GSM58_NB_NUMBER 6
|
|
|
|
|
|
|
|
/* Timeout for reading BCCH of neighbour cells */
|
|
|
|
#define GSM322_NB_TIMEOUT 2
|
|
|
|
|
|
|
|
/* number of neighbour cells to measure for average */
|
|
|
|
#define RLA_C_NUM 4
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* wait before doing neighbour cell reselecton due to a better cell again */
|
|
|
|
#define GSM58_RESEL_THRESHOLD 15
|
2010-09-29 13:24:12 +00:00
|
|
|
|
2012-11-16 16:16:40 +00:00
|
|
|
#define ARFCN_TEXT_LEN 10
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
//#define TEST_INCLUDE_SERV
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/*
|
|
|
|
* notes
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Cell selection process
|
|
|
|
*
|
|
|
|
* The process depends on states and events (finites state machine).
|
|
|
|
*
|
|
|
|
* During states of cell selection or cell re-selection, the search for a cell
|
|
|
|
* is performed in two steps:
|
|
|
|
*
|
|
|
|
* 1. Measurement of received level of all relevant frequencies (rx-lev)
|
|
|
|
*
|
|
|
|
* 2. Receive system information messages of all relevant frequencies
|
|
|
|
*
|
|
|
|
* During this process, the results are stored in a list of all frequencies.
|
|
|
|
* This list is checked whenever a cell is selected. It depends on the results
|
|
|
|
* if the cell is 'suitable' and 'allowable' to 'camp' on.
|
|
|
|
*
|
|
|
|
* This list is also used to generate a list of available networks.
|
2010-05-04 09:48:51 +00:00
|
|
|
*
|
|
|
|
* The states are:
|
|
|
|
*
|
2011-03-16 08:52:01 +00:00
|
|
|
* - cs->list[0..(1023+299)].xxx for each cell, where
|
2010-07-15 17:11:36 +00:00
|
|
|
* - flags and rxlev are used to store outcome of cell scanning process
|
2010-05-04 09:48:51 +00:00
|
|
|
* - sysinfo pointing to sysinfo memory, allocated temporarily
|
|
|
|
* - cs->selected and cs->sel_* states of the current / last selected cell.
|
|
|
|
*
|
2010-05-05 08:40:10 +00:00
|
|
|
*
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
* There are special states: GSM322_HPLMN_SEARCH, GSM322_PLMN_SEARCH
|
|
|
|
* and GSM322_ANY_SEARCH:
|
|
|
|
*
|
|
|
|
* GSM322_HPLMN_SEARCH is used to find a HPLMN. This is triggered
|
|
|
|
* by automatic cell selection.
|
|
|
|
*
|
|
|
|
* GSM322_PLMN_SEARCH is triggered when network search process is started.
|
|
|
|
* It will do a complete search. Also it is used before selecting PLMN from list.
|
|
|
|
*
|
|
|
|
* GSM322_ANY_SEARCH is similar to GSM322_PLMN_SEARCH, but it is done while
|
|
|
|
* camping on any cell. If there is a suitable and allowable cell found,
|
|
|
|
* it is indicated to the PLMN search process.
|
2010-05-05 08:40:10 +00:00
|
|
|
*
|
2010-04-25 16:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* PLMN selection process
|
|
|
|
*
|
|
|
|
* The PLMN (Public Land Mobile Network = Operator's Network) has two different
|
|
|
|
* search processes:
|
|
|
|
*
|
|
|
|
* 1. Automatic search
|
|
|
|
*
|
|
|
|
* 2. Manual search
|
|
|
|
*
|
|
|
|
* The process depends on states and events (finites state machine).
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* File format of BA list:
|
|
|
|
*
|
|
|
|
* uint16_t mcc
|
|
|
|
* uint16_t mcc
|
2011-03-16 08:52:01 +00:00
|
|
|
* uint8_t freq[128+38];
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
* where frequency 0 is bit 0 of first byte
|
|
|
|
*
|
2010-04-25 16:28:24 +00:00
|
|
|
* If not end-of-file, the next BA list is stored.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* List of lists:
|
|
|
|
*
|
|
|
|
* * subscr->plmn_list
|
|
|
|
*
|
2019-10-13 17:10:52 +00:00
|
|
|
* The "PLMN Selector list" stores preferred networks to select during PLMN
|
2010-04-25 16:28:24 +00:00
|
|
|
* search process. This list is also stored in the SIM.
|
|
|
|
*
|
|
|
|
* * subscr->plmn_na
|
|
|
|
*
|
|
|
|
* The "forbidden PLMNs" list stores all networks that rejected us. The stored
|
|
|
|
* network will not be used when searching PLMN automatically. This list is
|
|
|
|
* also stored din the SIM.
|
|
|
|
*
|
|
|
|
* * plmn->forbidden_la
|
|
|
|
*
|
|
|
|
* The "forbidden LAs for roaming" list stores all location areas where roaming
|
|
|
|
* was not allowed.
|
|
|
|
*
|
2011-03-16 08:52:01 +00:00
|
|
|
* * cs->list[1024+299]
|
2010-04-25 16:28:24 +00:00
|
|
|
*
|
2019-10-13 17:10:52 +00:00
|
|
|
* This list stores measurements and cell information during cell selection
|
2010-04-25 16:28:24 +00:00
|
|
|
* process. It can be used to speed up repeated cell selection.
|
|
|
|
*
|
|
|
|
* * cs->ba_list
|
|
|
|
*
|
|
|
|
* This list stores a map of frequencies used for a PLMN. If this lists exists
|
|
|
|
* for a PLMN, it helps to speedup cell scan process.
|
|
|
|
*
|
|
|
|
* * plmn->sorted_plmn
|
|
|
|
*
|
|
|
|
* This list is generated whenever a PLMN search is started and a list of PLMNs
|
|
|
|
* is required. It consists of home PLMN, PLMN Selector list, and PLMNs found
|
|
|
|
* during scan process.
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Cell re-selection process
|
|
|
|
*
|
|
|
|
* The cell re-selection process takes place when a "serving cell" is selected.
|
|
|
|
* The neighbour cells to be monitored for re-selection are given via SI2* of
|
|
|
|
* the serving cell.
|
|
|
|
*
|
|
|
|
* Therefore a list of neighbour cells is created or updated, when the cell
|
|
|
|
* allocation is received or changed by the network.
|
|
|
|
*
|
|
|
|
* All neighbour cells are monitored, but only up to 6 of the strongest cells
|
|
|
|
* are synced to, in order to read the BCCH data. A timer is used to re-read
|
|
|
|
* the BCCH data after 5 minutes. This timer is also used if sync or read
|
|
|
|
* fails.
|
|
|
|
*
|
2019-10-13 17:10:52 +00:00
|
|
|
* The C1 and C2 criterion is calculated for the currently monitored neighbour
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
* cells. During this process, a better neighbour cell will trigger cell
|
|
|
|
* re-selection.
|
|
|
|
*
|
|
|
|
* The cell re-selection is similar to the cell selection process, except that
|
|
|
|
* only neighbour cells are searched in order of their quality criterion C2.
|
|
|
|
*
|
|
|
|
* During camping, and monitoring neighbour cells, it is possible to enter
|
|
|
|
* dedicated mode at any time.
|
|
|
|
*
|
2010-04-25 16:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* event messages
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const struct value_string gsm322_event_names[] = {
|
|
|
|
{ GSM322_EVENT_SWITCH_ON, "EVENT_SWITCH_ON" },
|
|
|
|
{ GSM322_EVENT_SWITCH_OFF, "EVENT_SWITCH_OFF" },
|
|
|
|
{ GSM322_EVENT_SIM_INSERT, "EVENT_SIM_INSERT" },
|
|
|
|
{ GSM322_EVENT_SIM_REMOVE, "EVENT_SIM_REMOVE" },
|
|
|
|
{ GSM322_EVENT_REG_FAILED, "EVENT_REG_FAILED" },
|
|
|
|
{ GSM322_EVENT_ROAMING_NA, "EVENT_ROAMING_NA" },
|
|
|
|
{ GSM322_EVENT_INVALID_SIM, "EVENT_INVALID_SIM" },
|
|
|
|
{ GSM322_EVENT_REG_SUCCESS, "EVENT_REG_SUCCESS" },
|
|
|
|
{ GSM322_EVENT_NEW_PLMN, "EVENT_NEW_PLMN" },
|
|
|
|
{ GSM322_EVENT_ON_PLMN, "EVENT_ON_PLMN" },
|
2010-05-07 21:41:54 +00:00
|
|
|
{ GSM322_EVENT_PLMN_SEARCH_START,"EVENT_PLMN_SEARCH_START" },
|
|
|
|
{ GSM322_EVENT_PLMN_SEARCH_END, "EVENT_PLMN_SEARCH_END" },
|
2010-04-25 16:28:24 +00:00
|
|
|
{ GSM322_EVENT_USER_RESEL, "EVENT_USER_RESEL" },
|
|
|
|
{ GSM322_EVENT_PLMN_AVAIL, "EVENT_PLMN_AVAIL" },
|
2010-07-19 09:37:57 +00:00
|
|
|
{ GSM322_EVENT_CHOOSE_PLMN, "EVENT_CHOOSE_PLMN" },
|
2010-04-25 16:28:24 +00:00
|
|
|
{ GSM322_EVENT_SEL_MANUAL, "EVENT_SEL_MANUAL" },
|
|
|
|
{ GSM322_EVENT_SEL_AUTO, "EVENT_SEL_AUTO" },
|
|
|
|
{ GSM322_EVENT_CELL_FOUND, "EVENT_CELL_FOUND" },
|
|
|
|
{ GSM322_EVENT_NO_CELL_FOUND, "EVENT_NO_CELL_FOUND" },
|
|
|
|
{ GSM322_EVENT_LEAVE_IDLE, "EVENT_LEAVE_IDLE" },
|
|
|
|
{ GSM322_EVENT_RET_IDLE, "EVENT_RET_IDLE" },
|
|
|
|
{ GSM322_EVENT_CELL_RESEL, "EVENT_CELL_RESEL" },
|
|
|
|
{ GSM322_EVENT_SYSINFO, "EVENT_SYSINFO" },
|
2010-05-07 21:41:54 +00:00
|
|
|
{ GSM322_EVENT_HPLMN_SEARCH, "EVENT_HPLMN_SEARCH" },
|
2010-04-25 16:28:24 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *get_event_name(int value)
|
|
|
|
{
|
|
|
|
return get_value_string(gsm322_event_names, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* allocate a 03.22 event message */
|
|
|
|
struct msgb *gsm322_msgb_alloc(int msg_type)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct gsm322_msg *gm;
|
|
|
|
|
|
|
|
msg = msgb_alloc_headroom(sizeof(*gm), 0, "GSM 03.22 event");
|
|
|
|
if (!msg)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
gm = (struct gsm322_msg *)msgb_put(msg, sizeof(*gm));
|
|
|
|
gm->msg_type = msg_type;
|
|
|
|
|
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* queue PLMN selection message */
|
|
|
|
int gsm322_plmn_sendmsg(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
|
|
|
|
msgb_enqueue(&plmn->event_queue, msg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* queue cell selection message */
|
|
|
|
int gsm322_cs_sendmsg(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
|
|
|
|
msgb_enqueue(&cs->event_queue, msg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* support
|
|
|
|
*/
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
uint16_t index2arfcn(int index)
|
|
|
|
{
|
|
|
|
if (index >= 1024)
|
|
|
|
return (index-1024+512) | ARFCN_PCS;
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
|
|
|
int arfcn2index(uint16_t arfcn)
|
|
|
|
{
|
2012-11-15 09:42:18 +00:00
|
|
|
int is_pcs = arfcn & ARFCN_PCS;
|
|
|
|
arfcn &= ~ARFCN_FLAG_MASK;
|
|
|
|
if ((is_pcs) && (arfcn >= 512) && (arfcn <= 810))
|
2011-03-16 08:52:01 +00:00
|
|
|
return (arfcn & 1023)-512+1024;
|
|
|
|
return arfcn & 1023;
|
|
|
|
}
|
|
|
|
|
2012-11-15 09:42:18 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static char *bargraph(int value, int min, int max)
|
|
|
|
{
|
|
|
|
static char bar[128];
|
|
|
|
|
|
|
|
/* shift value to the range of min..max */
|
|
|
|
if (value < min)
|
|
|
|
value = 0;
|
|
|
|
else if (value > max)
|
|
|
|
value = max - min;
|
|
|
|
else
|
|
|
|
value -= min;
|
|
|
|
|
2017-11-08 11:35:08 +00:00
|
|
|
/* Prevent 'bar' buffer over-/under-run */
|
|
|
|
OSMO_ASSERT(value >= 0 && value < 128);
|
|
|
|
|
2017-11-02 10:51:19 +00:00
|
|
|
/* Prevent calling memset() with zero length */
|
|
|
|
if (value == 0)
|
|
|
|
return "";
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
memset(bar, '=', value);
|
|
|
|
bar[value] = '\0';
|
|
|
|
|
|
|
|
return bar;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int class_of_band(struct osmocom_ms *ms, int band)
|
|
|
|
{
|
|
|
|
struct gsm_settings *set = &ms->settings;
|
|
|
|
|
|
|
|
switch (band) {
|
|
|
|
case GSM_BAND_450:
|
|
|
|
case GSM_BAND_480:
|
|
|
|
return set->class_400;
|
|
|
|
break;
|
|
|
|
case GSM_BAND_850:
|
|
|
|
return set->class_850;
|
|
|
|
break;
|
|
|
|
case GSM_BAND_1800:
|
|
|
|
return set->class_dcs;
|
|
|
|
break;
|
|
|
|
case GSM_BAND_1900:
|
|
|
|
return set->class_pcs;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return set->class_900;
|
|
|
|
}
|
|
|
|
|
2010-07-16 10:52:38 +00:00
|
|
|
char *gsm_print_rxlev(uint8_t rxlev)
|
2010-07-15 17:11:36 +00:00
|
|
|
{
|
2018-08-11 11:55:09 +00:00
|
|
|
static char string[6];
|
2010-07-15 17:11:36 +00:00
|
|
|
if (rxlev == 0)
|
|
|
|
return "<=-110";
|
|
|
|
if (rxlev >= 63)
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
return ">=-47";
|
2010-07-15 17:11:36 +00:00
|
|
|
sprintf(string, "-%d", 110 - rxlev);
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* GSM 05.08 6.4 (special class 3 DCS 1800 MS case is omitted ) */
|
|
|
|
static int16_t calculate_c1(int log, int8_t rla_c, int8_t rxlev_acc_min,
|
|
|
|
int8_t ms_txpwr_max_cch, int8_t p)
|
|
|
|
{
|
|
|
|
int16_t a, b, c1, max_b_0;
|
|
|
|
|
|
|
|
a = rla_c - rxlev_acc_min;
|
|
|
|
b = ms_txpwr_max_cch - p;
|
|
|
|
|
|
|
|
max_b_0 = (b > 0) ? b : 0;
|
|
|
|
|
|
|
|
c1 = a - max_b_0;
|
|
|
|
|
|
|
|
LOGP(log, LOGL_INFO, "A (RLA_C (%d) - RXLEV_ACC_MIN (%d)) = %d\n",
|
|
|
|
rla_c, rxlev_acc_min, a);
|
|
|
|
LOGP(log, LOGL_INFO, "B (MS_TXPWR_MAX_CCH (%d) - p (%d)) = %d\n",
|
|
|
|
ms_txpwr_max_cch, p, b);
|
|
|
|
LOGP(log, LOGL_INFO, "C1 (A - MAX(B,0)) = %d\n", c1);
|
|
|
|
|
|
|
|
return c1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int16_t calculate_c2(int16_t c1, int serving, int last_serving,
|
|
|
|
int cell_resel_param_ind, uint8_t cell_resel_off, int t,
|
|
|
|
uint8_t penalty_time, uint8_t temp_offset) {
|
|
|
|
int16_t c2;
|
|
|
|
|
|
|
|
c2 = c1;
|
|
|
|
|
|
|
|
/* no reselect parameters. same process for serving and neighbour cells */
|
|
|
|
if (!cell_resel_param_ind) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "C2 = C1 = %d (because no extended "
|
|
|
|
"re-selection parameters available)\n", c2);
|
|
|
|
return c2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* special case, if PENALTY_TIME is '11111' */
|
|
|
|
if (penalty_time == 31) {
|
|
|
|
c2 -= (cell_resel_off << 1);
|
|
|
|
LOGP(DNB, LOGL_INFO, "C2 = C1 - CELL_RESELECT_OFFSET (%d) = %d "
|
|
|
|
"(special case)\n", cell_resel_off, c2);
|
|
|
|
return c2;
|
|
|
|
}
|
|
|
|
|
|
|
|
c2 += (cell_resel_off << 1);
|
|
|
|
|
|
|
|
/* parameters for serving cell */
|
|
|
|
if (serving) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "C2 = C1 + CELL_RESELECT_OFFSET (%d) = %d "
|
|
|
|
"(serving cell)\n", cell_resel_off, c2);
|
|
|
|
return c2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the cell is the last serving cell */
|
|
|
|
if (last_serving) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "C2 = C1 + CELL_RESELECT_OFFSET (%d) = %d "
|
|
|
|
"(last serving cell)\n", cell_resel_off, c2);
|
|
|
|
return c2;
|
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* penalty time reached */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (t >= (penalty_time + 1) * 20) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "C2 = C1 + CELL_RESELECT_OFFSET (%d) = %d "
|
|
|
|
"(PENALTY_TIME reached)\n", cell_resel_off, c2);
|
|
|
|
return c2;
|
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* penalty time not reached, subtract temporary offset */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (temp_offset < 7)
|
|
|
|
c2 -= temp_offset * 10;
|
|
|
|
else
|
|
|
|
c2 = -1000; /* infinite */
|
|
|
|
LOGP(DNB, LOGL_INFO, "C2 = C1 + CELL_RESELECT_OFFSET (%d) = %d "
|
|
|
|
"(PENALTY_TIME not reached, %d seconds left)\n", cell_resel_off,
|
|
|
|
c2, (penalty_time + 1) * 20 - t);
|
|
|
|
return c2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int gsm322_sync_to_cell(struct gsm322_cellsel *cs,
|
|
|
|
struct gsm322_neighbour * neighbour, int camping)
|
2010-06-20 20:19:25 +00:00
|
|
|
{
|
2010-06-28 13:33:14 +00:00
|
|
|
struct osmocom_ms *ms = cs->ms;
|
|
|
|
struct gsm48_sysinfo *s = cs->si;
|
2010-10-12 08:26:48 +00:00
|
|
|
struct rx_meas_stat *meas = &ms->meas;
|
2010-06-28 13:33:14 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->sync_pending) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Sync to ARFCN=%s, but there is a sync "
|
|
|
|
"already pending\n",gsm_print_arfcn(cs->arfcn));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-28 13:33:14 +00:00
|
|
|
cs->ccch_state = GSM322_CCCH_ST_INIT;
|
2010-09-29 13:24:12 +00:00
|
|
|
if (s && s->si3) {
|
2010-06-28 13:33:14 +00:00
|
|
|
if (s->ccch_conf == 1) {
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Sync to ARFCN=%s rxlev=%s "
|
|
|
|
"(Sysinfo, ccch mode COMB)\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn),
|
|
|
|
gsm_print_rxlev(cs->list[cs->arfci].rxlev));
|
2010-06-28 13:33:14 +00:00
|
|
|
cs->ccch_mode = CCCH_MODE_COMBINED;
|
|
|
|
} else {
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Sync to ARFCN=%s rxlev=%s "
|
|
|
|
"(Sysinfo, ccch mode NON-COMB)\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn),
|
|
|
|
gsm_print_rxlev(cs->list[cs->arfci].rxlev));
|
2010-06-28 13:33:14 +00:00
|
|
|
cs->ccch_mode = CCCH_MODE_NON_COMBINED;
|
|
|
|
}
|
|
|
|
} else {
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Sync to ARFCN=%s rxlev=%s (No sysinfo "
|
|
|
|
"yet, ccch mode NONE)\n", gsm_print_arfcn(cs->arfcn),
|
|
|
|
gsm_print_rxlev(cs->list[cs->arfci].rxlev));
|
2010-06-28 13:33:14 +00:00
|
|
|
cs->ccch_mode = CCCH_MODE_NONE;
|
|
|
|
}
|
|
|
|
|
2010-10-12 08:26:48 +00:00
|
|
|
meas->frames = meas->snr = meas->berr = meas->rxlev = 0;
|
2012-11-22 15:00:33 +00:00
|
|
|
cs->rxlev_sum_dbm = cs->rxlev_count = 0;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
|
|
|
cs->neighbour = neighbour;
|
|
|
|
|
|
|
|
if (camping) {
|
|
|
|
cs->rla_c_dbm = -128;
|
|
|
|
cs->c12_valid = 0;
|
|
|
|
/* keep neighbour cells! if they are old, they are re-read
|
|
|
|
* anyway, because re-read timer has expired. */
|
|
|
|
}
|
2010-10-12 08:26:48 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->sync_pending = 1;
|
2010-07-13 14:21:52 +00:00
|
|
|
l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
|
2010-06-20 20:19:25 +00:00
|
|
|
return l1ctl_tx_fbsb_req(ms, cs->arfcn,
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
L1CTL_FBSB_F_FB01SB, 100, 0,
|
2012-11-20 09:13:44 +00:00
|
|
|
cs->ccch_mode,
|
2012-11-22 15:00:33 +00:00
|
|
|
cs->list[cs->arfci].rxlev);
|
2010-06-20 20:19:25 +00:00
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* this is called whenever the serving cell is unselectied */
|
2010-06-20 11:19:06 +00:00
|
|
|
static void gsm322_unselect_cell(struct gsm322_cellsel *cs)
|
|
|
|
{
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!cs->selected)
|
|
|
|
return;
|
|
|
|
|
|
|
|
LOGP(DCS, LOGL_INFO, "Unselecting serving cell.\n");
|
|
|
|
|
2010-06-20 11:19:06 +00:00
|
|
|
cs->selected = 0;
|
2010-09-26 10:35:46 +00:00
|
|
|
if (cs->si)
|
|
|
|
cs->si->si5 = 0; /* unset SI5* */
|
2010-06-20 11:19:06 +00:00
|
|
|
cs->si = NULL;
|
|
|
|
memset(&cs->sel_si, 0, sizeof(cs->sel_si));
|
|
|
|
cs->sel_mcc = cs->sel_mnc = cs->sel_lac = cs->sel_id = 0;
|
|
|
|
}
|
|
|
|
|
2010-05-09 16:01:49 +00:00
|
|
|
/* print to DCS logging */
|
|
|
|
static void print_dcs(void *priv, const char *fmt, ...)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static char buffer[256] = "";
|
|
|
|
int in = strlen(buffer);
|
2010-05-09 16:01:49 +00:00
|
|
|
va_list args;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-05-09 16:01:49 +00:00
|
|
|
va_start(args, fmt);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
vsnprintf(buffer + in, sizeof(buffer) - in - 1, fmt, args);
|
|
|
|
buffer[sizeof(buffer) - in - 1] = '\0';
|
2010-05-09 16:01:49 +00:00
|
|
|
va_end(args);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (buffer[0] && buffer[strlen(buffer) - 1] == '\n') {
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "%s", buffer);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
buffer[0] = '\0';
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* del forbidden LA */
|
|
|
|
int gsm322_del_forbidden_la(struct osmocom_ms *ms, uint16_t mcc,
|
|
|
|
uint16_t mnc, uint16_t lac)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_la_list *la;
|
|
|
|
|
|
|
|
llist_for_each_entry(la, &plmn->forbidden_la, entry) {
|
|
|
|
if (la->mcc == mcc && la->mnc == mnc && la->lac == lac) {
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Delete from list of forbidden "
|
2010-06-20 11:19:06 +00:00
|
|
|
"LAs (mcc=%s, mnc=%s, lac=%04x)\n",
|
|
|
|
gsm_print_mcc(mcc), gsm_print_mnc(mnc), lac);
|
2010-04-25 16:28:24 +00:00
|
|
|
llist_del(&la->entry);
|
|
|
|
talloc_free(la);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* add forbidden LA */
|
|
|
|
int gsm322_add_forbidden_la(struct osmocom_ms *ms, uint16_t mcc,
|
|
|
|
uint16_t mnc, uint16_t lac, uint8_t cause)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_la_list *la;
|
|
|
|
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Add to list of forbidden LAs "
|
2010-06-20 11:19:06 +00:00
|
|
|
"(mcc=%s, mnc=%s, lac=%04x)\n", gsm_print_mcc(mcc),
|
|
|
|
gsm_print_mnc(mnc), lac);
|
2017-05-17 00:17:43 +00:00
|
|
|
la = talloc_zero(ms, struct gsm322_la_list);
|
2010-04-25 16:28:24 +00:00
|
|
|
if (!la)
|
|
|
|
return -ENOMEM;
|
|
|
|
la->mcc = mcc;
|
|
|
|
la->mnc = mnc;
|
|
|
|
la->lac = lac;
|
|
|
|
la->cause = cause;
|
|
|
|
llist_add_tail(&la->entry, &plmn->forbidden_la);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* search forbidden LA */
|
|
|
|
int gsm322_is_forbidden_la(struct osmocom_ms *ms, uint16_t mcc, uint16_t mnc,
|
|
|
|
uint16_t lac)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_la_list *la;
|
|
|
|
|
|
|
|
llist_for_each_entry(la, &plmn->forbidden_la, entry) {
|
|
|
|
if (la->mcc == mcc && la->mnc == mnc && la->lac == lac)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* search for PLMN in all BA lists */
|
|
|
|
static struct gsm322_ba_list *gsm322_find_ba_list(struct gsm322_cellsel *cs,
|
|
|
|
uint16_t mcc, uint16_t mnc)
|
|
|
|
{
|
|
|
|
struct gsm322_ba_list *ba, *ba_found = NULL;
|
|
|
|
|
|
|
|
/* search for BA list */
|
|
|
|
llist_for_each_entry(ba, &cs->ba_list, entry) {
|
|
|
|
if (ba->mcc == mcc
|
|
|
|
&& ba->mnc == mnc) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
ba_found = ba;
|
2010-04-25 16:28:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ba_found;
|
|
|
|
}
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* search available PLMN */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
int gsm322_is_plmn_avail_and_allow(struct gsm322_cellsel *cs, uint16_t mcc,
|
|
|
|
uint16_t mnc)
|
2010-05-02 17:13:47 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if ((cs->list[i].flags & GSM322_CS_FLAG_TEMP_AA)
|
|
|
|
&& cs->list[i].sysinfo
|
2010-05-04 09:48:51 +00:00
|
|
|
&& cs->list[i].sysinfo->mcc == mcc
|
2010-05-02 17:13:47 +00:00
|
|
|
&& cs->list[i].sysinfo->mnc == mnc)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-20 11:19:06 +00:00
|
|
|
/* search available HPLMN */
|
|
|
|
int gsm322_is_hplmn_avail(struct gsm322_cellsel *cs, char *imsi)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if ((cs->list[i].flags & GSM322_CS_FLAG_SYSINFO)
|
|
|
|
&& cs->list[i].sysinfo
|
2010-06-20 11:19:06 +00:00
|
|
|
&& gsm_match_mnc(cs->list[i].sysinfo->mcc,
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->list[i].sysinfo->mnc, imsi))
|
2010-06-20 11:19:06 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static const struct value_string gsm322_nb_state_names[] = {
|
|
|
|
{ GSM322_NB_NEW, "new" },
|
|
|
|
{ GSM322_NB_NOT_SUP, "not sup" },
|
|
|
|
{ GSM322_NB_RLA_C, "RLA_C" },
|
|
|
|
{ GSM322_NB_NO_SYNC, "no sync" },
|
|
|
|
{ GSM322_NB_NO_BCCH, "no BCCH" },
|
|
|
|
{ GSM322_NB_SYSINFO, "SYSINFO" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *get_nb_state_name(int value)
|
|
|
|
{
|
|
|
|
return get_value_string(gsm322_nb_state_names, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/*
|
|
|
|
* timer
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*plmn search timer event */
|
|
|
|
static void plmn_timer_timeout(void *arg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = arg;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "HPLMN search timer has fired.\n");
|
|
|
|
|
|
|
|
/* indicate PLMN selection T timeout */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_HPLMN_SEARCH);
|
|
|
|
if (!nmsg)
|
|
|
|
return;
|
|
|
|
gsm322_plmn_sendmsg(plmn->ms, nmsg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start plmn search timer */
|
|
|
|
static void start_plmn_timer(struct gsm322_plmn *plmn, int secs)
|
|
|
|
{
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Starting HPLMN search timer with %d minutes.\n",
|
|
|
|
secs / 60);
|
|
|
|
plmn->timer.cb = plmn_timer_timeout;
|
|
|
|
plmn->timer.data = plmn;
|
2011-05-15 12:23:02 +00:00
|
|
|
osmo_timer_schedule(&plmn->timer, secs, 0);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stop plmn search timer */
|
|
|
|
static void stop_plmn_timer(struct gsm322_plmn *plmn)
|
|
|
|
{
|
2011-05-15 12:23:02 +00:00
|
|
|
if (osmo_timer_pending(&plmn->timer)) {
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Stopping pending timer.\n");
|
2011-05-15 12:23:02 +00:00
|
|
|
osmo_timer_del(&plmn->timer);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start cell selection timer */
|
2010-05-07 21:41:54 +00:00
|
|
|
void start_cs_timer(struct gsm322_cellsel *cs, int sec, int micro)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Starting CS timer with %d seconds.\n", sec);
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->timer.cb = gsm322_cs_timeout;
|
|
|
|
cs->timer.data = cs;
|
2011-05-15 12:23:02 +00:00
|
|
|
osmo_timer_schedule(&cs->timer, sec, micro);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stop cell selection timer */
|
|
|
|
static void stop_cs_timer(struct gsm322_cellsel *cs)
|
|
|
|
{
|
2011-05-15 12:23:02 +00:00
|
|
|
if (osmo_timer_pending(&cs->timer)) {
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "stopping pending CS timer.\n");
|
2011-05-15 12:23:02 +00:00
|
|
|
osmo_timer_del(&cs->timer);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* the following timer is used to search again for allowable cell, after
|
|
|
|
* loss of coverage. (loss of any allowed PLMN) */
|
|
|
|
|
|
|
|
/* start any cell selection timer */
|
|
|
|
void start_any_timer(struct gsm322_cellsel *cs, int sec, int micro)
|
|
|
|
{
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "Starting 'any cell selection' timer with %d "
|
|
|
|
"seconds.\n", sec);
|
|
|
|
cs->any_timer.cb = gsm322_any_timeout;
|
|
|
|
cs->any_timer.data = cs;
|
|
|
|
osmo_timer_schedule(&cs->any_timer, sec, micro);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stop cell selection timer */
|
|
|
|
static void stop_any_timer(struct gsm322_cellsel *cs)
|
|
|
|
{
|
|
|
|
if (osmo_timer_pending(&cs->any_timer)) {
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "stopping pending 'any cell selection' "
|
|
|
|
"timer.\n");
|
|
|
|
osmo_timer_del(&cs->any_timer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/*
|
|
|
|
* state change
|
|
|
|
*/
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static const struct value_string gsm322_a_state_names[] = {
|
|
|
|
{ GSM322_A0_NULL, "A0 null"},
|
|
|
|
{ GSM322_A1_TRYING_RPLMN, "A1 trying RPLMN"},
|
|
|
|
{ GSM322_A2_ON_PLMN, "A2 on PLMN"},
|
|
|
|
{ GSM322_A3_TRYING_PLMN, "A3 trying PLMN"},
|
|
|
|
{ GSM322_A4_WAIT_FOR_PLMN, "A4 wait for PLMN to appear"},
|
|
|
|
{ GSM322_A5_HPLMN_SEARCH, "A5 HPLMN search"},
|
|
|
|
{ GSM322_A6_NO_SIM, "A6 no SIM inserted"},
|
|
|
|
{ 0, NULL }
|
2010-04-25 16:28:24 +00:00
|
|
|
};
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
const char *get_a_state_name(int value)
|
|
|
|
{
|
|
|
|
return get_value_string(gsm322_a_state_names, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct value_string gsm322_m_state_names[] = {
|
|
|
|
{ GSM322_M0_NULL, "M0 null"},
|
|
|
|
{ GSM322_M1_TRYING_RPLMN, "M1 trying RPLMN"},
|
|
|
|
{ GSM322_M2_ON_PLMN, "M2 on PLMN"},
|
|
|
|
{ GSM322_M3_NOT_ON_PLMN, "M3 not on PLMN"},
|
|
|
|
{ GSM322_M4_TRYING_PLMN, "M4 trying PLMN"},
|
|
|
|
{ GSM322_M5_NO_SIM, "M5 no SIM inserted"},
|
|
|
|
{ 0, NULL }
|
2010-04-25 16:28:24 +00:00
|
|
|
};
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
const char *get_m_state_name(int value)
|
|
|
|
{
|
|
|
|
return get_value_string(gsm322_m_state_names, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct value_string gsm322_cs_state_names[] = {
|
|
|
|
{ GSM322_C0_NULL, "C0 null"},
|
|
|
|
{ GSM322_C1_NORMAL_CELL_SEL, "C1 normal cell selection"},
|
|
|
|
{ GSM322_C2_STORED_CELL_SEL, "C2 stored cell selection"},
|
|
|
|
{ GSM322_C3_CAMPED_NORMALLY, "C3 camped normally"},
|
|
|
|
{ GSM322_C4_NORMAL_CELL_RESEL, "C4 normal cell re-selection"},
|
|
|
|
{ GSM322_C5_CHOOSE_CELL, "C5 choose cell"},
|
|
|
|
{ GSM322_C6_ANY_CELL_SEL, "C6 any cell selection"},
|
|
|
|
{ GSM322_C7_CAMPED_ANY_CELL, "C7 camped on any cell"},
|
|
|
|
{ GSM322_C8_ANY_CELL_RESEL, "C8 any cell re-selection"},
|
|
|
|
{ GSM322_C9_CHOOSE_ANY_CELL, "C9 choose any cell"},
|
|
|
|
{ GSM322_CONNECTED_MODE_1, "connected mode 1"},
|
|
|
|
{ GSM322_CONNECTED_MODE_2, "connected mode 2"},
|
|
|
|
{ GSM322_PLMN_SEARCH, "PLMN search"},
|
|
|
|
{ GSM322_HPLMN_SEARCH, "HPLMN search"},
|
|
|
|
{ GSM322_ANY_SEARCH, "ANY search"},
|
|
|
|
{ 0, NULL }
|
2010-04-25 16:28:24 +00:00
|
|
|
};
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
const char *get_cs_state_name(int value)
|
|
|
|
{
|
|
|
|
return get_value_string(gsm322_cs_state_names, value);
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* new automatic PLMN search state */
|
|
|
|
static void new_a_state(struct gsm322_plmn *plmn, int state)
|
|
|
|
{
|
2010-05-24 16:15:21 +00:00
|
|
|
if (plmn->ms->settings.plmn_mode != PLMN_MODE_AUTO) {
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DPLMN, LOGL_FATAL, "not in auto mode, please fix!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
stop_plmn_timer(plmn);
|
|
|
|
|
2010-06-16 17:19:40 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "new state '%s' -> '%s'\n",
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
get_a_state_name(plmn->state), get_a_state_name(state));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
plmn->state = state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* new manual PLMN search state */
|
|
|
|
static void new_m_state(struct gsm322_plmn *plmn, int state)
|
|
|
|
{
|
2010-05-24 16:15:21 +00:00
|
|
|
if (plmn->ms->settings.plmn_mode != PLMN_MODE_MANUAL) {
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DPLMN, LOGL_FATAL, "not in manual mode, please fix!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-06-16 17:19:40 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "new state '%s' -> '%s'\n",
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
get_m_state_name(plmn->state), get_m_state_name(state));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
plmn->state = state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* new Cell selection state */
|
|
|
|
static void new_c_state(struct gsm322_cellsel *cs, int state)
|
|
|
|
{
|
2010-06-16 17:19:40 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "new state '%s' -> '%s'\n",
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
get_cs_state_name(cs->state), get_cs_state_name(state));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* stop cell selection timer, if running */
|
|
|
|
stop_cs_timer(cs);
|
|
|
|
|
|
|
|
/* stop scanning of power measurement */
|
2010-04-29 18:46:11 +00:00
|
|
|
if (cs->powerscan) {
|
2010-07-15 10:27:51 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "changing state while power scanning\n");
|
|
|
|
l1ctl_tx_reset_req(cs->ms, L1CTL_RES_T_FULL);
|
2010-04-29 18:46:11 +00:00
|
|
|
cs->powerscan = 0;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
cs->state = state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* list of PLMNs
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* 4.4.3 create sorted list of PLMN
|
|
|
|
*
|
|
|
|
* the source of entries are
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
*
|
2010-04-25 16:28:24 +00:00
|
|
|
* - HPLMN
|
|
|
|
* - entries found in the SIM's PLMN Selector list
|
|
|
|
* - scanned PLMNs above -85 dB (random order)
|
|
|
|
* - scanned PLMNs below or equal -85 (by received level)
|
|
|
|
*
|
|
|
|
* NOTE:
|
|
|
|
*
|
|
|
|
* The list only includes networks found at last scan.
|
|
|
|
*
|
|
|
|
* The list always contains HPLMN if available, even if not used by PLMN
|
|
|
|
* search process at some conditions.
|
|
|
|
*
|
|
|
|
* The list contains all PLMNs even if not allowed, so entries have to be
|
|
|
|
* removed when selecting from the list. (In case we use manual cell selection,
|
|
|
|
* we need to provide non-allowed networks also.)
|
|
|
|
*/
|
|
|
|
static int gsm322_sort_list(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct gsm_sub_plmn_list *sim_entry;
|
|
|
|
struct gsm_sub_plmn_na *na_entry;
|
|
|
|
struct llist_head temp_list;
|
|
|
|
struct gsm322_plmn_list *temp, *found;
|
|
|
|
struct llist_head *lh, *lh2;
|
|
|
|
int i, entries, move;
|
2012-11-22 15:00:33 +00:00
|
|
|
uint8_t search = 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* flush list */
|
|
|
|
llist_for_each_safe(lh, lh2, &plmn->sorted_plmn) {
|
|
|
|
llist_del(lh);
|
|
|
|
talloc_free(lh);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a temporary list of all networks */
|
|
|
|
INIT_LLIST_HEAD(&temp_list);
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-05-04 09:48:51 +00:00
|
|
|
if (!(cs->list[i].flags & GSM322_CS_FLAG_TEMP_AA)
|
|
|
|
|| !cs->list[i].sysinfo)
|
2010-04-25 16:28:24 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* search if network has multiple cells */
|
|
|
|
found = NULL;
|
|
|
|
llist_for_each_entry(temp, &temp_list, entry) {
|
2010-05-02 17:13:47 +00:00
|
|
|
if (temp->mcc == cs->list[i].sysinfo->mcc
|
2010-05-09 09:40:41 +00:00
|
|
|
&& temp->mnc == cs->list[i].sysinfo->mnc) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
found = temp;
|
|
|
|
break;
|
2010-05-09 09:40:41 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
/* update or create */
|
|
|
|
if (found) {
|
2010-07-15 17:11:36 +00:00
|
|
|
if (cs->list[i].rxlev > found->rxlev)
|
|
|
|
found->rxlev = cs->list[i].rxlev;
|
2010-04-25 16:28:24 +00:00
|
|
|
} else {
|
2017-05-17 00:17:43 +00:00
|
|
|
temp = talloc_zero(ms, struct gsm322_plmn_list);
|
2010-04-25 16:28:24 +00:00
|
|
|
if (!temp)
|
|
|
|
return -ENOMEM;
|
2010-05-02 17:13:47 +00:00
|
|
|
temp->mcc = cs->list[i].sysinfo->mcc;
|
|
|
|
temp->mnc = cs->list[i].sysinfo->mnc;
|
2010-07-15 17:11:36 +00:00
|
|
|
temp->rxlev = cs->list[i].rxlev;
|
2010-04-25 16:28:24 +00:00
|
|
|
llist_add_tail(&temp->entry, &temp_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-05 08:40:10 +00:00
|
|
|
/* move Home PLMN, if in list, else add it */
|
2010-04-25 16:28:24 +00:00
|
|
|
if (subscr->sim_valid) {
|
|
|
|
found = NULL;
|
|
|
|
llist_for_each_entry(temp, &temp_list, entry) {
|
2010-06-20 11:19:06 +00:00
|
|
|
if (gsm_match_mnc(temp->mcc, temp->mnc, subscr->imsi)) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
found = temp;
|
2010-04-25 16:28:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (found) {
|
2010-05-05 08:40:10 +00:00
|
|
|
/* move */
|
2010-04-25 16:28:24 +00:00
|
|
|
llist_del(&found->entry);
|
|
|
|
llist_add_tail(&found->entry, &plmn->sorted_plmn);
|
2010-05-07 21:41:54 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* move entries if in SIM's PLMN Selector list */
|
|
|
|
llist_for_each_entry(sim_entry, &subscr->plmn_list, entry) {
|
|
|
|
found = NULL;
|
|
|
|
llist_for_each_entry(temp, &temp_list, entry) {
|
|
|
|
if (temp->mcc == sim_entry->mcc
|
|
|
|
&& temp->mnc == sim_entry->mnc) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
found = temp;
|
2010-04-25 16:28:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (found) {
|
|
|
|
llist_del(&found->entry);
|
|
|
|
llist_add_tail(&found->entry, &plmn->sorted_plmn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* move PLMN above -85 dBm in random order */
|
|
|
|
entries = 0;
|
|
|
|
llist_for_each_entry(temp, &temp_list, entry) {
|
2010-07-15 17:11:36 +00:00
|
|
|
if (rxlev2dbm(temp->rxlev) > -85)
|
2010-04-25 16:28:24 +00:00
|
|
|
entries++;
|
|
|
|
}
|
|
|
|
while(entries) {
|
2018-07-21 21:20:49 +00:00
|
|
|
move = layer23_random() % entries;
|
2010-04-25 16:28:24 +00:00
|
|
|
i = 0;
|
|
|
|
llist_for_each_entry(temp, &temp_list, entry) {
|
2010-07-15 17:11:36 +00:00
|
|
|
if (rxlev2dbm(temp->rxlev) > -85) {
|
2010-04-25 16:28:24 +00:00
|
|
|
if (i == move) {
|
|
|
|
llist_del(&temp->entry);
|
|
|
|
llist_add_tail(&temp->entry,
|
|
|
|
&plmn->sorted_plmn);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
entries--;
|
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* move other PLMN in decreasing order */
|
2010-04-25 16:28:24 +00:00
|
|
|
while(1) {
|
|
|
|
found = NULL;
|
|
|
|
llist_for_each_entry(temp, &temp_list, entry) {
|
|
|
|
if (!found
|
2010-07-15 17:11:36 +00:00
|
|
|
|| temp->rxlev > search) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
search = temp->rxlev;
|
2010-04-25 16:28:24 +00:00
|
|
|
found = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
break;
|
|
|
|
llist_del(&found->entry);
|
|
|
|
llist_add_tail(&found->entry, &plmn->sorted_plmn);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mark forbidden PLMNs, if in list of forbidden networks */
|
|
|
|
i = 0;
|
|
|
|
llist_for_each_entry(temp, &plmn->sorted_plmn, entry) {
|
|
|
|
llist_for_each_entry(na_entry, &subscr->plmn_na, entry) {
|
|
|
|
if (temp->mcc == na_entry->mcc
|
|
|
|
&& temp->mnc == na_entry->mnc) {
|
|
|
|
temp->cause = na_entry->cause;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-05-09 09:40:41 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Creating Sorted PLMN list. "
|
2010-07-15 17:11:36 +00:00
|
|
|
"(%02d: mcc %s mnc %s allowed %s rx-lev %s)\n",
|
2010-06-20 11:19:06 +00:00
|
|
|
i, gsm_print_mcc(temp->mcc),
|
|
|
|
gsm_print_mnc(temp->mnc), (temp->cause) ? "no ":"yes",
|
2010-07-15 17:11:36 +00:00
|
|
|
gsm_print_rxlev(temp->rxlev));
|
2010-04-25 16:28:24 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2010-05-05 08:40:10 +00:00
|
|
|
gsm322_dump_sorted_plmn(ms);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* handler for automatic search
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* go On PLMN state */
|
|
|
|
static int gsm322_a_go_on_plmn(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
|
|
|
|
new_a_state(plmn, GSM322_A2_ON_PLMN);
|
|
|
|
|
|
|
|
/* start timer, if on VPLMN of home country OR special case */
|
2010-06-20 11:19:06 +00:00
|
|
|
if (!gsm_match_mnc(plmn->mcc, plmn->mnc, subscr->imsi)
|
|
|
|
&& (subscr->always_search_hplmn
|
2010-08-28 09:46:36 +00:00
|
|
|
|| gsm_match_mcc(plmn->mcc, subscr->imsi))
|
|
|
|
&& subscr->sim_valid && subscr->t6m_hplmn)
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
start_plmn_timer(plmn, subscr->t6m_hplmn * 360);
|
2010-08-28 09:46:36 +00:00
|
|
|
else
|
2010-04-25 16:28:24 +00:00
|
|
|
stop_plmn_timer(plmn);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* go to Wait for PLMNs to appear state */
|
|
|
|
static int gsm322_a_go_wait_for_plmns(struct osmocom_ms *ms, struct msgb *msg)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
2010-05-13 12:51:22 +00:00
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct msgb *nmsg;
|
|
|
|
struct gsm322_msg *ngm;
|
2010-05-13 12:51:22 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
new_a_state(plmn, GSM322_A4_WAIT_FOR_PLMN);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* we must forward this, otherwise "Any cell selection"
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
* will not start automatically.
|
|
|
|
*/
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
ngm = (struct gsm322_msg *) nmsg->data;
|
|
|
|
ngm->limited = 1;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* no (more) PLMN in list */
|
|
|
|
static int gsm322_a_no_more_plmn(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
int found;
|
|
|
|
|
2010-05-05 08:40:10 +00:00
|
|
|
/* any allowable PLMN available? */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
found = gsm322_cs_select(ms, -1, 0, 0, 0);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* if no PLMN in list:
|
|
|
|
* this means that we are at a point where we camp on any cell or
|
2019-10-13 17:10:52 +00:00
|
|
|
* no cell is available. */
|
2010-04-25 16:28:24 +00:00
|
|
|
if (found < 0) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (subscr->plmn_valid) {
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Not any PLMN allowable. "
|
|
|
|
"Do limited search with RPLMN.\n");
|
|
|
|
plmn->mcc = subscr->plmn_mcc;
|
|
|
|
plmn->mnc = subscr->plmn_mnc;
|
|
|
|
} else
|
|
|
|
if (subscr->sim_valid) {
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Not any PLMN allowable. "
|
|
|
|
"Do limited search with HPLMN.\n");
|
|
|
|
plmn->mcc = subscr->mcc;
|
|
|
|
plmn->mnc = subscr->mnc;
|
|
|
|
} else {
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Not any PLMN allowable. "
|
|
|
|
"Do limited search with no PLMN.\n");
|
|
|
|
plmn->mcc = 0;
|
|
|
|
plmn->mnc = 0;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
return gsm322_a_go_wait_for_plmns(ms, msg);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* select first PLMN in list */
|
2010-05-02 17:13:47 +00:00
|
|
|
plmn->mcc = cs->list[found].sysinfo->mcc;
|
|
|
|
plmn->mnc = cs->list[found].sysinfo->mnc;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "PLMN available after searching PLMN list "
|
|
|
|
"(mcc=%s mnc=%s %s, %s)\n",
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm_print_mcc(plmn->mcc), gsm_print_mnc(plmn->mnc),
|
2010-04-29 18:46:11 +00:00
|
|
|
gsm_get_mcc(plmn->mcc), gsm_get_mnc(plmn->mcc, plmn->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* indicate New PLMN */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
/* go On PLMN */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
return gsm322_a_go_on_plmn(ms, msg);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* select first PLMN in list */
|
|
|
|
static int gsm322_a_sel_first_plmn(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
2010-05-07 21:41:54 +00:00
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct msgb *nmsg;
|
|
|
|
struct gsm322_plmn_list *plmn_entry;
|
|
|
|
struct gsm322_plmn_list *plmn_first = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* generate list */
|
|
|
|
gsm322_sort_list(ms);
|
|
|
|
|
|
|
|
/* select first entry */
|
|
|
|
i = 0;
|
|
|
|
llist_for_each_entry(plmn_entry, &plmn->sorted_plmn, entry) {
|
2010-05-07 21:41:54 +00:00
|
|
|
/* if last selected PLMN was HPLMN, we skip that */
|
2010-06-20 11:19:06 +00:00
|
|
|
if (gsm_match_mnc(plmn_entry->mcc, plmn_entry->mnc,
|
|
|
|
subscr->imsi)
|
2010-04-25 16:28:24 +00:00
|
|
|
&& plmn_entry->mcc == plmn->mcc
|
|
|
|
&& plmn_entry->mnc == plmn->mnc) {
|
2010-05-07 21:41:54 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Skip HPLMN, because it was "
|
|
|
|
"previously selected.\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
i++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* select first allowed network */
|
|
|
|
if (!plmn_entry->cause) {
|
|
|
|
plmn_first = plmn_entry;
|
|
|
|
break;
|
|
|
|
}
|
2010-07-17 11:44:11 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Skip PLMN (%02d: mcc=%s, mnc=%s), "
|
|
|
|
"because it is not allowed (cause %d).\n", i,
|
|
|
|
gsm_print_mcc(plmn_entry->mcc),
|
|
|
|
gsm_print_mnc(plmn_entry->mnc),
|
|
|
|
plmn_entry->cause);
|
2010-04-25 16:28:24 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
plmn->plmn_curr = i;
|
|
|
|
|
|
|
|
/* if no PLMN in list */
|
2010-04-26 09:21:18 +00:00
|
|
|
if (!plmn_first) {
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "No PLMN in list.\n");
|
|
|
|
gsm322_a_no_more_plmn(ms, msg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Selecting PLMN from list. (%02d: mcc=%s "
|
|
|
|
"mnc=%s %s, %s)\n", plmn->plmn_curr,
|
|
|
|
gsm_print_mcc(plmn_first->mcc), gsm_print_mnc(plmn_first->mnc),
|
|
|
|
gsm_get_mcc(plmn_first->mcc),
|
2010-04-29 18:46:11 +00:00
|
|
|
gsm_get_mnc(plmn_first->mcc, plmn_first->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* set current network */
|
|
|
|
plmn->mcc = plmn_first->mcc;
|
|
|
|
plmn->mnc = plmn_first->mnc;
|
|
|
|
|
|
|
|
new_a_state(plmn, GSM322_A3_TRYING_PLMN);
|
|
|
|
|
|
|
|
/* indicate New PLMN */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* select next PLMN in list */
|
|
|
|
static int gsm322_a_sel_next_plmn(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
struct gsm322_plmn_list *plmn_entry;
|
|
|
|
struct gsm322_plmn_list *plmn_next = NULL;
|
|
|
|
int i, ii;
|
|
|
|
|
|
|
|
/* select next entry from list */
|
|
|
|
i = 0;
|
|
|
|
ii = plmn->plmn_curr + 1;
|
|
|
|
llist_for_each_entry(plmn_entry, &plmn->sorted_plmn, entry) {
|
|
|
|
/* skip previously selected networks */
|
|
|
|
if (i < ii) {
|
|
|
|
i++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* select next allowed network */
|
|
|
|
if (!plmn_entry->cause) {
|
|
|
|
plmn_next = plmn_entry;
|
|
|
|
break;
|
|
|
|
}
|
2010-07-17 11:44:11 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Skip PLMN (%02d: mcc=%s, mnc=%s), "
|
|
|
|
"because it is not allowed (cause %d).\n", i,
|
|
|
|
gsm_print_mcc(plmn_entry->mcc),
|
|
|
|
gsm_print_mnc(plmn_entry->mnc),
|
|
|
|
plmn_entry->cause);
|
2010-04-25 16:28:24 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
plmn->plmn_curr = i;
|
|
|
|
|
|
|
|
/* if no more PLMN in list */
|
|
|
|
if (!plmn_next) {
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "No more PLMN in list.\n");
|
|
|
|
gsm322_a_no_more_plmn(ms, msg);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-17 11:44:11 +00:00
|
|
|
/* set next network */
|
|
|
|
plmn->mcc = plmn_next->mcc;
|
|
|
|
plmn->mnc = plmn_next->mnc;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Selecting PLMN from list. (%02d: mcc=%s "
|
|
|
|
"mnc=%s %s, %s)\n", plmn->plmn_curr,
|
2010-07-17 11:44:11 +00:00
|
|
|
gsm_print_mcc(plmn->mcc), gsm_print_mnc(plmn->mnc),
|
2010-04-29 18:46:11 +00:00
|
|
|
gsm_get_mcc(plmn->mcc), gsm_get_mnc(plmn->mcc, plmn->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
new_a_state(plmn, GSM322_A3_TRYING_PLMN);
|
|
|
|
|
|
|
|
/* indicate New PLMN */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* User re-selection event */
|
2010-05-07 21:41:54 +00:00
|
|
|
static int gsm322_a_user_resel(struct osmocom_ms *ms, struct msgb *msg)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
2010-05-07 21:41:54 +00:00
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_plmn_list *plmn_entry;
|
|
|
|
struct gsm322_plmn_list *plmn_found = NULL;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct msgb *nmsg;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
if (!subscr->sim_valid) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* try again later, if not idle */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->state == GSM322_CONNECTED_MODE_1
|
|
|
|
|| cs->state == GSM322_CONNECTED_MODE_2) {
|
2010-05-07 21:41:54 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Not idle, rejecting.\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* search current PLMN in list */
|
|
|
|
llist_for_each_entry(plmn_entry, &plmn->sorted_plmn, entry) {
|
|
|
|
if (plmn_entry->mcc == plmn->mcc
|
2011-07-17 10:23:59 +00:00
|
|
|
&& plmn_entry->mnc == plmn->mnc) {
|
2010-04-25 16:28:24 +00:00
|
|
|
plmn_found = plmn_entry;
|
|
|
|
break;
|
2011-07-17 10:23:59 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* abort if list is empty */
|
|
|
|
if (!plmn_found) {
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Selected PLMN not in list, strange!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Movin selected PLMN to the bottom of the list "
|
|
|
|
"and restarting PLMN search process.\n");
|
|
|
|
|
|
|
|
/* move entry to end of list */
|
|
|
|
llist_del(&plmn_found->entry);
|
|
|
|
llist_add_tail(&plmn_found->entry, &plmn->sorted_plmn);
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* tell MM that we selected a PLMN */
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_USER_PLMN_SEL);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* select first PLMN in list */
|
|
|
|
return gsm322_a_sel_first_plmn(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PLMN becomes available */
|
|
|
|
static int gsm322_a_plmn_avail(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (subscr->plmn_valid && plmn->mcc == gm->mcc
|
|
|
|
&& plmn->mnc == gm->mnc) {
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
|
|
|
new_m_state(plmn, GSM322_A1_TRYING_RPLMN);
|
|
|
|
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Last selected PLMN becomes available "
|
|
|
|
"again.\n");
|
|
|
|
|
|
|
|
/* indicate New PLMN */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
} else {
|
|
|
|
/* select first PLMN in list */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Some PLMN became available, start PLMN "
|
2010-04-25 16:28:24 +00:00
|
|
|
"search process.\n");
|
|
|
|
return gsm322_a_sel_first_plmn(ms, msg);
|
|
|
|
}
|
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* loss of radio coverage */
|
|
|
|
static int gsm322_a_loss_of_radio(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
int found;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* any allowable PLMN available */
|
|
|
|
found = gsm322_cs_select(ms, -1, 0, 0, 0);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* if PLMN in list */
|
|
|
|
if (found >= 0) {
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "PLMN available (mcc=%s mnc=%s "
|
|
|
|
"%s, %s)\n", gsm_print_mcc(
|
|
|
|
cs->list[found].sysinfo->mcc),
|
|
|
|
gsm_print_mnc(cs->list[found].sysinfo->mnc),
|
2010-05-02 17:13:47 +00:00
|
|
|
gsm_get_mcc(cs->list[found].sysinfo->mcc),
|
|
|
|
gsm_get_mnc(cs->list[found].sysinfo->mcc,
|
|
|
|
cs->list[found].sysinfo->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
return gsm322_a_sel_first_plmn(ms, msg);
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "PLMN not available after loss of coverage.\n");
|
2010-05-06 08:48:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
return gsm322_a_go_wait_for_plmns(ms, msg);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* MS is switched on OR SIM is inserted OR removed */
|
|
|
|
static int gsm322_a_switch_on(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
|
|
|
if (!subscr->sim_valid) {
|
2010-06-13 13:51:30 +00:00
|
|
|
LOGP(DSUM, LOGL_INFO, "SIM is removed\n");
|
2010-07-19 09:37:57 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "SIM is removed\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
new_a_state(plmn, GSM322_A6_NO_SIM);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if there is a registered PLMN */
|
|
|
|
if (subscr->plmn_valid) {
|
|
|
|
/* select the registered PLMN */
|
|
|
|
plmn->mcc = subscr->plmn_mcc;
|
|
|
|
plmn->mnc = subscr->plmn_mnc;
|
|
|
|
|
2010-06-06 18:19:46 +00:00
|
|
|
LOGP(DSUM, LOGL_INFO, "Start search of last registered PLMN "
|
2010-06-20 11:19:06 +00:00
|
|
|
"(mcc=%s mnc=%s %s, %s)\n", gsm_print_mcc(plmn->mcc),
|
|
|
|
gsm_print_mnc(plmn->mnc), gsm_get_mcc(plmn->mcc),
|
2010-06-06 18:19:46 +00:00
|
|
|
gsm_get_mnc(plmn->mcc, plmn->mnc));
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Use RPLMN (mcc=%s mnc=%s "
|
|
|
|
"%s, %s)\n", gsm_print_mcc(plmn->mcc),
|
|
|
|
gsm_print_mnc(plmn->mnc), gsm_get_mcc(plmn->mcc),
|
2010-04-29 18:46:11 +00:00
|
|
|
gsm_get_mnc(plmn->mcc, plmn->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
new_a_state(plmn, GSM322_A1_TRYING_RPLMN);
|
|
|
|
|
|
|
|
/* indicate New PLMN */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
plmn->mcc = plmn->mnc = 0;
|
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
/* initiate search at cell selection */
|
2010-06-06 18:19:46 +00:00
|
|
|
LOGP(DSUM, LOGL_INFO, "Search for network\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Switch on, no RPLMN, start PLMN search "
|
|
|
|
"first.\n");
|
2010-05-07 21:41:54 +00:00
|
|
|
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_PLMN_SEARCH_START);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* MS is switched off */
|
|
|
|
static int gsm322_a_switch_off(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
|
|
|
|
new_a_state(plmn, GSM322_A0_NULL);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-01 18:21:03 +00:00
|
|
|
static int gsm322_a_sim_insert(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "SIM already inserted when switched on.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* SIM is removed */
|
|
|
|
static int gsm322_a_sim_removed(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
|
|
|
/* indicate SIM remove to cell selection process */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_SIM_REMOVE);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* flush list of PLMNs */
|
|
|
|
gsm_subscr_del_forbidden_plmn(&ms->subscr, 0, 0);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return gsm322_a_switch_on(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* location update response: "Roaming not allowed" */
|
|
|
|
static int gsm322_a_roaming_na(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
/* store in list of forbidden LAs is done in gsm48* */
|
|
|
|
|
|
|
|
return gsm322_a_sel_first_plmn(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* On VPLMN of home country and timeout occurs */
|
2010-05-07 21:41:54 +00:00
|
|
|
static int gsm322_a_hplmn_search_start(struct osmocom_ms *ms, struct msgb *msg)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
2010-05-05 08:40:10 +00:00
|
|
|
/* try again later, if not idle and not camping */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->state != GSM322_C3_CAMPED_NORMALLY) {
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "Not camping normally, wait some more."
|
|
|
|
"\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
start_plmn_timer(plmn, 60);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_a_state(plmn, GSM322_A5_HPLMN_SEARCH);
|
|
|
|
|
|
|
|
/* initiate search at cell selection */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_HPLMN_SEARCH);
|
2010-04-25 16:28:24 +00:00
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* manual mode selected */
|
|
|
|
static int gsm322_a_sel_manual(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
2010-05-01 18:21:03 +00:00
|
|
|
struct msgb *nmsg;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* restart state machine */
|
|
|
|
gsm322_a_switch_off(ms, msg);
|
2010-05-24 16:15:21 +00:00
|
|
|
ms->settings.plmn_mode = PLMN_MODE_MANUAL;
|
2010-04-25 16:28:24 +00:00
|
|
|
gsm322_m_switch_on(ms, msg);
|
|
|
|
|
2010-05-01 18:21:03 +00:00
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_USER_PLMN_SEL);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* handler for manual search
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* display PLMNs and to Not on PLMN */
|
|
|
|
static int gsm322_m_display_plmns(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
2010-06-16 18:21:59 +00:00
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
int msg_type = gm->msg_type;
|
2010-05-09 09:40:41 +00:00
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm_sub_plmn_list *temp;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct msgb *nmsg;
|
|
|
|
struct gsm322_msg *ngm;
|
2010-05-09 09:40:41 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* generate list */
|
|
|
|
gsm322_sort_list(ms);
|
|
|
|
|
2010-06-13 17:18:15 +00:00
|
|
|
vty_notify(ms, NULL);
|
2010-06-16 18:21:59 +00:00
|
|
|
switch (msg_type) {
|
|
|
|
case GSM322_EVENT_REG_FAILED:
|
2010-06-20 11:19:06 +00:00
|
|
|
vty_notify(ms, "Failed to register to network %s, %s "
|
2010-06-16 18:21:59 +00:00
|
|
|
"(%s, %s)\n",
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm_print_mcc(plmn->mcc), gsm_print_mnc(plmn->mnc),
|
|
|
|
gsm_get_mcc(plmn->mcc),
|
2010-06-16 18:21:59 +00:00
|
|
|
gsm_get_mnc(plmn->mcc, plmn->mnc));
|
|
|
|
break;
|
|
|
|
case GSM322_EVENT_NO_CELL_FOUND:
|
2010-06-20 11:19:06 +00:00
|
|
|
vty_notify(ms, "No cell found for network %s, %s "
|
2010-06-16 18:21:59 +00:00
|
|
|
"(%s, %s)\n",
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm_print_mcc(plmn->mcc), gsm_print_mnc(plmn->mnc),
|
|
|
|
gsm_get_mcc(plmn->mcc),
|
2010-06-16 18:21:59 +00:00
|
|
|
gsm_get_mnc(plmn->mcc, plmn->mnc));
|
|
|
|
break;
|
|
|
|
case GSM322_EVENT_ROAMING_NA:
|
2010-06-20 11:19:06 +00:00
|
|
|
vty_notify(ms, "Roaming not allowed to network %s, %s "
|
2010-06-16 18:21:59 +00:00
|
|
|
"(%s, %s)\n",
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm_print_mcc(plmn->mcc), gsm_print_mnc(plmn->mnc),
|
|
|
|
gsm_get_mcc(plmn->mcc),
|
2010-06-16 18:21:59 +00:00
|
|
|
gsm_get_mnc(plmn->mcc, plmn->mnc));
|
|
|
|
break;
|
|
|
|
}
|
2010-05-09 09:40:41 +00:00
|
|
|
|
2010-06-16 18:21:59 +00:00
|
|
|
if (llist_empty(&plmn->sorted_plmn))
|
|
|
|
vty_notify(ms, "Search network!\n");
|
|
|
|
else {
|
|
|
|
vty_notify(ms, "Search or select from network:\n");
|
|
|
|
llist_for_each_entry(temp, &plmn->sorted_plmn, entry)
|
2010-06-20 11:19:06 +00:00
|
|
|
vty_notify(ms, " Network %s, %s (%s, %s)\n",
|
|
|
|
gsm_print_mcc(temp->mcc),
|
|
|
|
gsm_print_mnc(temp->mnc),
|
|
|
|
gsm_get_mcc(temp->mcc),
|
2010-06-16 18:21:59 +00:00
|
|
|
gsm_get_mnc(temp->mcc, temp->mnc));
|
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* go Not on PLMN state */
|
2010-06-16 18:21:59 +00:00
|
|
|
new_m_state(plmn, GSM322_M3_NOT_ON_PLMN);
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* we must forward this, otherwise "Any cell selection"
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
* will not start automatically.
|
|
|
|
* this way we get back to the last PLMN, in case we gained
|
|
|
|
* our coverage back.
|
|
|
|
*/
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
ngm = (struct gsm322_msg *) nmsg->data;
|
|
|
|
ngm->limited = 1;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
2010-06-16 18:21:59 +00:00
|
|
|
return 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
/* user starts reselection */
|
|
|
|
static int gsm322_m_user_resel(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-05-07 21:41:54 +00:00
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* unselect PLMN. after search, the process will wait until a PLMN is
|
|
|
|
* selected by the user. this prevents from switching back to the
|
|
|
|
* last selected PLMN and destroying the list of scanned networks.
|
|
|
|
*/
|
|
|
|
plmn->mcc = plmn->mnc = 0;
|
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
if (!subscr->sim_valid) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* try again later, if not idle */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->state == GSM322_CONNECTED_MODE_1
|
|
|
|
|| cs->state == GSM322_CONNECTED_MODE_2) {
|
2010-05-07 21:41:54 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Not idle, rejecting.\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initiate search at cell selection */
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "User re-select, start PLMN search first.\n");
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* tell MM that we selected a PLMN */
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_USER_PLMN_SEL);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
|
|
|
/* triffer PLMN search */
|
2010-05-07 21:41:54 +00:00
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_PLMN_SEARCH_START);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* MS is switched on OR SIM is inserted OR removed */
|
|
|
|
static int gsm322_m_switch_on(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
2010-05-07 21:41:54 +00:00
|
|
|
struct msgb *nmsg;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
if (!subscr->sim_valid) {
|
2010-06-13 13:51:30 +00:00
|
|
|
LOGP(DSUM, LOGL_INFO, "SIM is removed\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Switch on without SIM.\n");
|
|
|
|
new_m_state(plmn, GSM322_M5_NO_SIM);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if there is a registered PLMN */
|
|
|
|
if (subscr->plmn_valid) {
|
2010-05-02 17:13:47 +00:00
|
|
|
struct msgb *nmsg;
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* select the registered PLMN */
|
|
|
|
plmn->mcc = subscr->plmn_mcc;
|
|
|
|
plmn->mnc = subscr->plmn_mnc;
|
|
|
|
|
2010-06-06 18:19:46 +00:00
|
|
|
LOGP(DSUM, LOGL_INFO, "Start search of last registered PLMN "
|
2010-06-20 11:19:06 +00:00
|
|
|
"(mcc=%s mnc=%s %s, %s)\n", gsm_print_mcc(plmn->mcc),
|
|
|
|
gsm_print_mnc(plmn->mnc), gsm_get_mcc(plmn->mcc),
|
2010-06-06 18:19:46 +00:00
|
|
|
gsm_get_mnc(plmn->mcc, plmn->mnc));
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Use RPLMN (mcc=%s mnc=%s "
|
|
|
|
"%s, %s)\n", gsm_print_mcc(plmn->mcc),
|
|
|
|
gsm_print_mnc(plmn->mnc), gsm_get_mcc(plmn->mcc),
|
2010-04-29 18:46:11 +00:00
|
|
|
gsm_get_mnc(plmn->mcc, plmn->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
new_m_state(plmn, GSM322_M1_TRYING_RPLMN);
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* indicate New PLMN */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
plmn->mcc = plmn->mnc = 0;
|
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
/* initiate search at cell selection */
|
2010-06-06 18:19:46 +00:00
|
|
|
LOGP(DSUM, LOGL_INFO, "Search for network\n");
|
2010-05-07 21:41:54 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Switch on, start PLMN search first.\n");
|
|
|
|
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_PLMN_SEARCH_START);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* MS is switched off */
|
|
|
|
static int gsm322_m_switch_off(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
|
|
|
|
stop_plmn_timer(plmn);
|
|
|
|
|
|
|
|
new_m_state(plmn, GSM322_M0_NULL);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-01 18:21:03 +00:00
|
|
|
static int gsm322_m_sim_insert(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "SIM already inserted when switched on.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* SIM is removed */
|
|
|
|
static int gsm322_m_sim_removed(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
|
|
|
stop_plmn_timer(plmn);
|
|
|
|
|
|
|
|
/* indicate SIM remove to cell selection process */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_SIM_REMOVE);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* flush list of PLMNs */
|
|
|
|
gsm_subscr_del_forbidden_plmn(&ms->subscr, 0, 0);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return gsm322_m_switch_on(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* go to On PLMN state */
|
|
|
|
static int gsm322_m_go_on_plmn(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
|
|
|
|
/* set last registered PLMN */
|
|
|
|
subscr->plmn_valid = 1;
|
|
|
|
subscr->plmn_mcc = plmn->mcc;
|
|
|
|
subscr->plmn_mnc = plmn->mnc;
|
|
|
|
|
|
|
|
new_m_state(plmn, GSM322_M2_ON_PLMN);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* previously selected PLMN becomes available again */
|
|
|
|
static int gsm322_m_plmn_avail(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct msgb *nmsg;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
new_m_state(plmn, GSM322_M1_TRYING_RPLMN);
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "Last selected PLMN becomes available again.\n");
|
2010-05-02 17:13:47 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* indicate New PLMN */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
2010-05-02 17:13:47 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the user has selected given PLMN */
|
|
|
|
static int gsm322_m_choose_plmn(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
2010-07-19 09:37:57 +00:00
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
2010-05-02 17:13:47 +00:00
|
|
|
struct msgb *nmsg;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* use user selection */
|
|
|
|
plmn->mcc = gm->mcc;
|
|
|
|
plmn->mnc = gm->mnc;
|
|
|
|
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "User selects PLMN. (mcc=%s mnc=%s "
|
|
|
|
"%s, %s)\n", gsm_print_mcc(plmn->mcc), gsm_print_mnc(plmn->mnc),
|
2010-04-29 18:46:11 +00:00
|
|
|
gsm_get_mcc(plmn->mcc), gsm_get_mnc(plmn->mcc, plmn->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-07-19 09:37:57 +00:00
|
|
|
/* if selected PLMN is in list of forbidden PLMNs */
|
|
|
|
gsm_subscr_del_forbidden_plmn(subscr, plmn->mcc, plmn->mnc);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
new_m_state(plmn, GSM322_M4_TRYING_PLMN);
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* tell MM that we selected a PLMN */
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_USER_PLMN_SEL);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* indicate New PLMN */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NEW_PLMN);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* auto mode selected */
|
|
|
|
static int gsm322_m_sel_auto(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
2010-05-01 18:21:03 +00:00
|
|
|
struct msgb *nmsg;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* restart state machine */
|
|
|
|
gsm322_m_switch_off(ms, msg);
|
2010-05-24 16:15:21 +00:00
|
|
|
ms->settings.plmn_mode = PLMN_MODE_AUTO;
|
2010-04-25 16:28:24 +00:00
|
|
|
gsm322_a_switch_on(ms, msg);
|
|
|
|
|
2010-05-01 18:21:03 +00:00
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_USER_PLMN_SEL);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if no cell is found in other states than in *_TRYING_* states */
|
|
|
|
static int gsm322_am_no_cell_found(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
|
|
|
/* Tell cell selection process to handle "no cell found". */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NO_CELL_FOUND);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cell scanning process
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* select a suitable and allowable cell */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static int gsm322_cs_select(struct osmocom_ms *ms, int index, uint16_t mcc,
|
|
|
|
uint16_t mnc, int any)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-10-15 18:50:25 +00:00
|
|
|
struct gsm_settings *set = &ms->settings;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
2010-05-02 17:13:47 +00:00
|
|
|
struct gsm48_sysinfo *s;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
int start, end, i, found = -1, power = 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
uint8_t flags, mask;
|
|
|
|
uint16_t acc_class;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
int16_t c1;
|
|
|
|
enum gsm_band band;
|
|
|
|
int class;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* set our access class depending on the cell selection type */
|
2010-04-25 16:28:24 +00:00
|
|
|
if (any) {
|
|
|
|
acc_class = subscr->acc_class | 0x0400; /* add emergency */
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Select using access class with "
|
|
|
|
"Emergency class.\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
} else {
|
2010-05-22 09:27:33 +00:00
|
|
|
acc_class = subscr->acc_class;
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Select using access class \n");
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* flags to match */
|
|
|
|
mask = GSM322_CS_FLAG_SUPPORT | GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL | GSM322_CS_FLAG_SYSINFO;
|
2010-06-14 19:38:06 +00:00
|
|
|
if (cs->state == GSM322_C2_STORED_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C5_CHOOSE_CELL)
|
2010-04-25 16:28:24 +00:00
|
|
|
mask |= GSM322_CS_FLAG_BA;
|
2019-10-13 17:10:52 +00:00
|
|
|
flags = mask; /* all masked flags are required */
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* loop through all scanned frequencies and select cell.
|
|
|
|
* if an index is given (arfci), we just check this cell only */
|
2012-02-02 07:39:56 +00:00
|
|
|
if (index >= 0) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
start = end = index;
|
2012-02-02 07:39:56 +00:00
|
|
|
} else {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
start = 0; end = 1023+299;
|
2012-02-02 07:39:56 +00:00
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
for (i = start; i <= end; i++) {
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->list[i].flags &= ~GSM322_CS_FLAG_TEMP_AA;
|
2010-05-02 17:13:47 +00:00
|
|
|
s = cs->list[i].sysinfo;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* channel has no information for us */
|
2010-05-04 09:48:51 +00:00
|
|
|
if (!s || (cs->list[i].flags & mask) != flags) {
|
2010-04-25 16:28:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* check C1 criteria not fulfilled */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
// TODO: class 3 DCS mobile
|
2019-05-22 19:57:34 +00:00
|
|
|
gsm_arfcn2band_rc(index2arfcn(i), &band);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
class = class_of_band(ms, band);
|
|
|
|
c1 = calculate_c1(DCS, rxlev2dbm(cs->list[i].rxlev),
|
|
|
|
s->rxlev_acc_min_db,
|
|
|
|
ms_pwr_dbm(band, s->ms_txpwr_max_cch),
|
|
|
|
ms_class_gmsk_dbm(band, class));
|
|
|
|
if (!set->stick && c1 < 0) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: C1 criterion "
|
|
|
|
"not met. (C1 = %d)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)), c1);
|
2010-04-25 16:28:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if cell is barred and we don't override */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!subscr->acc_barr
|
2010-04-25 16:28:24 +00:00
|
|
|
&& (cs->list[i].flags & GSM322_CS_FLAG_BARRED)) {
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: Cell is "
|
|
|
|
"barred.\n", gsm_print_arfcn(index2arfcn(i)));
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
continue;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* if we have no access to the cell and we don't override */
|
|
|
|
if (!subscr->acc_barr
|
|
|
|
&& !(acc_class & (s->class_barr ^ 0xffff))) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: Class is "
|
|
|
|
"barred for our access. (access=%04x "
|
|
|
|
"barred=%04x)\n",
|
2011-03-16 08:52:01 +00:00
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
acc_class, s->class_barr);
|
|
|
|
continue;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* store temporary available and allowable flag */
|
|
|
|
cs->list[i].flags |= GSM322_CS_FLAG_TEMP_AA;
|
|
|
|
|
|
|
|
/* if cell is in list of forbidden LAs */
|
|
|
|
if ((cs->list[i].flags & GSM322_CS_FLAG_FORBIDD)) {
|
|
|
|
if (!any) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: Cell is "
|
|
|
|
"in list of forbidden LAs. (mcc=%s "
|
|
|
|
"mnc=%s lai=%04x)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
|
|
|
gsm_print_mcc(s->mcc),
|
|
|
|
gsm_print_mnc(s->mnc), s->lac);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
LOGP(DCS, LOGL_INFO, "Accept ARFCN %s: Cell is in "
|
|
|
|
"list of forbidden LAs, but we search for any "
|
|
|
|
"cell. (mcc=%s mnc=%s lai=%04x)\n",
|
2011-03-16 08:52:01 +00:00
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
gsm_print_mcc(s->mcc),
|
|
|
|
gsm_print_mnc(s->mnc), s->lac);
|
|
|
|
cs->list[i].flags &= ~GSM322_CS_FLAG_TEMP_AA;
|
2010-07-17 11:44:11 +00:00
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* if cell is in list of forbidden PLMNs */
|
|
|
|
if (gsm_subscr_is_forbidden_plmn(subscr, s->mcc, s->mnc)) {
|
|
|
|
if (!any) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: Cell is "
|
|
|
|
"in list of forbidden PLMNs. (mcc=%s "
|
|
|
|
"mnc=%s)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
|
|
|
gsm_print_mcc(s->mcc),
|
|
|
|
gsm_print_mnc(s->mnc));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
LOGP(DCS, LOGL_INFO, "Accept ARFCN %s: Cell is in list "
|
|
|
|
"of forbidden PLMNs, but we search for any "
|
|
|
|
"cell. (mcc=%s mnc=%s)\n",
|
2011-03-16 08:52:01 +00:00
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
gsm_print_mcc(s->mcc), gsm_print_mnc(s->mnc));
|
|
|
|
cs->list[i].flags &= ~GSM322_CS_FLAG_TEMP_AA;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* if we search a specific PLMN, but it does not match */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!any && mcc && (mcc != s->mcc
|
|
|
|
|| mnc != s->mnc)) {
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: PLMN of cell "
|
2010-06-20 11:19:06 +00:00
|
|
|
"does not match target PLMN. (mcc=%s "
|
2011-03-16 08:52:01 +00:00
|
|
|
"mnc=%s)\n", gsm_print_arfcn(index2arfcn(i)),
|
|
|
|
gsm_print_mcc(s->mcc),
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm_print_mnc(s->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Cell ARFCN %s: Cell found, (rxlev=%s "
|
|
|
|
"mcc=%s mnc=%s lac=%04x %s, %s)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
2010-07-15 17:11:36 +00:00
|
|
|
gsm_print_rxlev(cs->list[i].rxlev),
|
|
|
|
gsm_print_mcc(s->mcc), gsm_print_mnc(s->mnc), s->lac,
|
|
|
|
gsm_get_mcc(s->mcc), gsm_get_mnc(s->mcc, s->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* find highest power cell */
|
2010-07-15 17:11:36 +00:00
|
|
|
if (found < 0 || cs->list[i].rxlev > power) {
|
|
|
|
power = cs->list[i].rxlev;
|
2010-04-25 16:28:24 +00:00
|
|
|
found = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found >= 0)
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Cell ARFCN %s selected.\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(found)));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* re-select a suitable and allowable cell */
|
|
|
|
static int gsm322_cs_reselect(struct osmocom_ms *ms, uint16_t mcc,
|
|
|
|
uint16_t mnc, int any)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct gsm48_sysinfo *s = cs->si;
|
|
|
|
int i = cs->arfci;
|
|
|
|
uint16_t acc_class;
|
|
|
|
|
|
|
|
/* set our access class depending on the cell selection type */
|
|
|
|
if (any) {
|
|
|
|
acc_class = subscr->acc_class | 0x0400; /* add emergency */
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "Select using access class with "
|
|
|
|
"Emergency class.\n");
|
|
|
|
} else {
|
|
|
|
acc_class = subscr->acc_class;
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "Select using access class \n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if cell is barred and we don't override */
|
|
|
|
if (!subscr->acc_barr
|
|
|
|
&& (cs->list[i].flags & GSM322_CS_FLAG_BARRED)) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: Cell is barred.\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if cell is in list of forbidden LAs */
|
|
|
|
if (!any && (cs->list[i].flags & GSM322_CS_FLAG_FORBIDD)) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: Cell is in list of "
|
|
|
|
"forbidden LAs. (mcc=%s mnc=%s lai=%04x)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)), gsm_print_mcc(s->mcc),
|
|
|
|
gsm_print_mnc(s->mnc), s->lac);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if cell is in list of forbidden PLMNs */
|
|
|
|
if (!any && gsm_subscr_is_forbidden_plmn(subscr, s->mcc, s->mnc)) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: Cell is in "
|
|
|
|
"list of forbidden PLMNs. (mcc=%s mnc=%s)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
|
|
|
gsm_print_mcc(s->mcc), gsm_print_mnc(s->mnc));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we have no access to the cell and we don't override */
|
|
|
|
if (!subscr->acc_barr
|
|
|
|
&& !(acc_class & (s->class_barr ^ 0xffff))) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: Class is barred for our "
|
|
|
|
"access. (access=%04x barred=%04x)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)), acc_class,
|
|
|
|
s->class_barr);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we search a specific PLMN, but it does not match */
|
|
|
|
if (!any && mcc && (mcc != s->mcc
|
|
|
|
|| mnc != s->mnc)) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip ARFCN %s: PLMN of cell "
|
|
|
|
"does not match target PLMN. (mcc=%s mnc=%s)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)), gsm_print_mcc(s->mcc),
|
|
|
|
gsm_print_mnc(s->mnc));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOGP(DCS, LOGL_INFO, "Cell ARFCN %s: Neighbour cell accepted, "
|
|
|
|
"(rxlev=%s mcc=%s mnc=%s lac=%04x %s, %s)\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
|
|
|
gsm_print_rxlev(cs->list[i].rxlev),
|
|
|
|
gsm_print_mcc(s->mcc), gsm_print_mnc(s->mnc), s->lac,
|
|
|
|
gsm_get_mcc(s->mcc), gsm_get_mnc(s->mcc, s->mnc));
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this processes the end of frequency scanning or cell searches */
|
|
|
|
static int gsm322_search_end(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
struct gsm322_msg *ngm;
|
|
|
|
int msg_type = -1; /* no message to be sent */
|
|
|
|
int tune_back = 0, mcc = 0, mnc = 0;
|
|
|
|
int found;
|
|
|
|
|
|
|
|
switch (cs->state) {
|
|
|
|
case GSM322_ANY_SEARCH:
|
|
|
|
/* special case for 'any cell' search */
|
|
|
|
LOGP(DCS, LOGL_INFO, "Any cell search finished.\n");
|
|
|
|
|
|
|
|
/* create AA flag */
|
|
|
|
found = gsm322_cs_select(ms, -1, 0, 0, 0);
|
|
|
|
|
|
|
|
/* if no cell is found, or if we don't wait for any available
|
|
|
|
* and allowable PLMN to appear, we just continue to camp */
|
|
|
|
if (ms->settings.plmn_mode != PLMN_MODE_AUTO
|
|
|
|
|| plmn->state != GSM322_A4_WAIT_FOR_PLMN
|
|
|
|
|| found < 0) {
|
|
|
|
tune_back = 1;
|
|
|
|
gsm322_c_camp_any_cell(ms, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* indicate available PLMN, include selected PLMN, if found */
|
|
|
|
msg_type = GSM322_EVENT_PLMN_AVAIL;
|
|
|
|
if (gsm322_is_plmn_avail_and_allow(cs, plmn->mcc, plmn->mnc)) {
|
|
|
|
/* set what PLMN becomes available */
|
|
|
|
mcc = plmn->mcc;
|
|
|
|
mnc = plmn->mnc;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C0_NULL);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GSM322_PLMN_SEARCH:
|
|
|
|
/* special case for PLMN search */
|
|
|
|
msg_type = GSM322_EVENT_PLMN_SEARCH_END;
|
|
|
|
LOGP(DCS, LOGL_INFO, "PLMN search finished.\n");
|
|
|
|
|
|
|
|
/* create AA flag */
|
|
|
|
gsm322_cs_select(ms, -1, 0, 0, 0);
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C0_NULL);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GSM322_HPLMN_SEARCH:
|
|
|
|
/* special case for HPLMN search */
|
|
|
|
msg_type = GSM322_EVENT_NO_CELL_FOUND;
|
|
|
|
LOGP(DCS, LOGL_INFO, "HPLMN search finished, no cell.\n");
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C3_CAMPED_NORMALLY);
|
|
|
|
|
|
|
|
tune_back = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* we start normal cell selection if this fails */
|
|
|
|
if (cs->state == GSM322_C2_STORED_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C5_CHOOSE_CELL) {
|
|
|
|
/* tell CS to start over */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NO_CELL_FOUND);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_c_event(ms, nmsg);
|
|
|
|
msgb_free(nmsg);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* on other cell selection, indicate "no cell found" */
|
|
|
|
/* NOTE: PLMN search process handles it.
|
|
|
|
* If not handled there, CS process gets indicated.
|
|
|
|
* If we would continue to process CS, then we might get
|
|
|
|
* our list of scanned cells disturbed.
|
|
|
|
*/
|
|
|
|
LOGP(DCS, LOGL_INFO, "Cell search finished without result.\n");
|
|
|
|
msg_type = GSM322_EVENT_NO_CELL_FOUND;
|
|
|
|
|
|
|
|
/* stay in null-state until any cell selectio is triggered or
|
|
|
|
* new plmn is indicated.
|
|
|
|
*/
|
|
|
|
new_c_state(cs, GSM322_C0_NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (msg_type > -1) {
|
|
|
|
/* send result to PLMN process, to trigger next CS event */
|
|
|
|
nmsg = gsm322_msgb_alloc(msg_type);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
ngm = (struct gsm322_msg *) nmsg->data;
|
|
|
|
ngm->mcc = mcc;
|
2017-05-16 21:27:06 +00:00
|
|
|
ngm->mnc = mnc;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
gsm322_plmn_sendmsg(ms, nmsg);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cs->selected && tune_back) {
|
|
|
|
/* tuning back */
|
|
|
|
cs->arfcn = cs->sel_arfcn;
|
|
|
|
cs->arfci = arfcn2index(cs->arfcn);
|
|
|
|
if (!cs->list[cs->arfci].sysinfo)
|
2017-05-17 00:17:43 +00:00
|
|
|
cs->list[cs->arfci].sysinfo = talloc_zero(ms,
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm48_sysinfo);
|
|
|
|
if (!cs->list[cs->arfci].sysinfo)
|
|
|
|
exit(-ENOMEM);
|
|
|
|
cs->list[cs->arfci].flags |= GSM322_CS_FLAG_SYSINFO;
|
|
|
|
memcpy(cs->list[cs->arfci].sysinfo, &cs->sel_si,
|
|
|
|
sizeof(struct gsm48_sysinfo));
|
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
|
|
|
cs->sel_mcc = cs->si->mcc;
|
|
|
|
cs->sel_mnc = cs->si->mnc;
|
|
|
|
cs->sel_lac = cs->si->lac;
|
|
|
|
cs->sel_id = cs->si->cell_id;
|
|
|
|
LOGP(DCS, LOGL_INFO, "Tuning back to frequency %s after full "
|
|
|
|
"search.\n", gsm_print_arfcn(cs->arfcn));
|
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
gsm322_sync_to_cell(cs, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* tune to first/next unscanned frequency and search for PLMN */
|
|
|
|
static int gsm322_cs_scan(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-10-01 19:21:33 +00:00
|
|
|
int i;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
int j, band = 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
uint8_t mask, flags;
|
2010-04-29 18:46:11 +00:00
|
|
|
uint32_t weight = 0, test = cs->scan_state;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* search for strongest unscanned cell */
|
|
|
|
mask = GSM322_CS_FLAG_SUPPORT | GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL;
|
2010-06-14 19:38:06 +00:00
|
|
|
if (cs->state == GSM322_C2_STORED_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C5_CHOOSE_CELL)
|
2010-04-25 16:28:24 +00:00
|
|
|
mask |= GSM322_CS_FLAG_BA;
|
2019-10-13 17:10:52 +00:00
|
|
|
flags = mask; /* all masked flags are required */
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
j = 0; /* make gcc happy */
|
|
|
|
if (!ms->settings.skip_max_per_band) {
|
|
|
|
/* skip if band has enough freqs. scanned (3.2.1) */
|
|
|
|
for (j = 0; gsm_sup_smax[j].max; j++) {
|
|
|
|
if (gsm_sup_smax[j].end >
|
|
|
|
gsm_sup_smax[j].start) {
|
|
|
|
if (gsm_sup_smax[j].start <= i
|
|
|
|
&& gsm_sup_smax[j].end >= i)
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
if (gsm_sup_smax[j].start <= i
|
|
|
|
&& 1023 >= i)
|
|
|
|
break;
|
|
|
|
if (0 <= i
|
|
|
|
&& gsm_sup_smax[j].end >= i)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (gsm_sup_smax[j].max) {
|
|
|
|
if (gsm_sup_smax[j].temp == gsm_sup_smax[j].max)
|
|
|
|
continue;
|
2010-04-29 18:46:11 +00:00
|
|
|
}
|
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
2010-04-29 18:46:11 +00:00
|
|
|
/* search for unscanned frequency */
|
2010-04-25 16:28:24 +00:00
|
|
|
if ((cs->list[i].flags & mask) == flags) {
|
|
|
|
/* weight depends on the power level
|
|
|
|
* if it is the same, it depends on arfcn
|
|
|
|
*/
|
2010-07-15 17:11:36 +00:00
|
|
|
test = cs->list[i].rxlev + 1;
|
2010-04-29 18:46:11 +00:00
|
|
|
test = (test << 16) | i;
|
|
|
|
if (test >= cs->scan_state)
|
2010-04-25 16:28:24 +00:00
|
|
|
continue;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (test > weight) {
|
2010-04-29 18:46:11 +00:00
|
|
|
weight = test;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
band = j;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
cs->scan_state = weight;
|
|
|
|
|
|
|
|
/* if all frequencies have been searched */
|
|
|
|
if (!weight) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
gsm322_dump_cs_list(cs, GSM322_CS_FLAG_SYSINFO, print_dcs,
|
|
|
|
NULL);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* selection process done, process (negative) result */
|
|
|
|
return gsm322_search_end(ms);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* NOTE: We might already have system information from previous
|
2019-10-13 17:10:52 +00:00
|
|
|
* scan. But we need recent information, so we scan again!
|
2010-04-25 16:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Tune to frequency for a while, to receive broadcasts. */
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->arfci = weight & 0xffff;
|
|
|
|
cs->arfcn = index2arfcn(cs->arfci);
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "Scanning frequency %s (rxlev %s).\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn),
|
|
|
|
gsm_print_rxlev(cs->list[cs->arfci].rxlev));
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-05-05 08:40:10 +00:00
|
|
|
/* Allocate/clean system information. */
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->list[cs->arfci].flags &= ~GSM322_CS_FLAG_SYSINFO;
|
|
|
|
if (cs->list[cs->arfci].sysinfo)
|
|
|
|
memset(cs->list[cs->arfci].sysinfo, 0,
|
2010-05-05 08:40:10 +00:00
|
|
|
sizeof(struct gsm48_sysinfo));
|
|
|
|
else
|
2017-05-17 00:17:43 +00:00
|
|
|
cs->list[cs->arfci].sysinfo = talloc_zero(ms,
|
2010-05-04 09:48:51 +00:00
|
|
|
struct gsm48_sysinfo);
|
2011-03-16 08:52:01 +00:00
|
|
|
if (!cs->list[cs->arfci].sysinfo)
|
2010-05-02 17:13:47 +00:00
|
|
|
exit(-ENOMEM);
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->sync_retries = 0;
|
|
|
|
gsm322_sync_to_cell(cs, NULL, 0);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-04-29 18:46:11 +00:00
|
|
|
/* increase scan counter for each maximum scan range */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!ms->settings.skip_max_per_band && gsm_sup_smax[band].max) {
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "%d frequencies left in band %d..%d\n",
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
gsm_sup_smax[band].max - gsm_sup_smax[band].temp,
|
|
|
|
gsm_sup_smax[band].start, gsm_sup_smax[band].end);
|
|
|
|
gsm_sup_smax[band].temp++;
|
2010-05-22 09:27:33 +00:00
|
|
|
}
|
2010-05-07 21:41:54 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check if cell is now suitable and allowable */
|
|
|
|
static int gsm322_cs_store(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-05-04 09:48:51 +00:00
|
|
|
struct gsm48_sysinfo *s = cs->si;
|
2010-05-06 08:48:24 +00:00
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct msgb *nmsg;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm322_msg *ngm;
|
2010-05-06 08:48:24 +00:00
|
|
|
int found, any = 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
if (cs->state != GSM322_C2_STORED_CELL_SEL
|
|
|
|
&& cs->state != GSM322_C1_NORMAL_CELL_SEL
|
|
|
|
&& cs->state != GSM322_C6_ANY_CELL_SEL
|
|
|
|
&& cs->state != GSM322_C4_NORMAL_CELL_RESEL
|
|
|
|
&& cs->state != GSM322_C8_ANY_CELL_RESEL
|
|
|
|
&& cs->state != GSM322_C5_CHOOSE_CELL
|
2010-05-05 08:40:10 +00:00
|
|
|
&& cs->state != GSM322_C9_CHOOSE_ANY_CELL
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
&& cs->state != GSM322_ANY_SEARCH
|
2010-05-07 21:41:54 +00:00
|
|
|
&& cs->state != GSM322_PLMN_SEARCH
|
2010-05-05 08:40:10 +00:00
|
|
|
&& cs->state != GSM322_HPLMN_SEARCH) {
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DCS, LOGL_FATAL, "This must only happen during cell "
|
|
|
|
"(re-)selection, please fix!\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* store sysinfo */
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->list[cs->arfci].flags |= GSM322_CS_FLAG_SYSINFO;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (s->cell_barr && !(s->sp && s->sp_cbq))
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->list[cs->arfci].flags |= GSM322_CS_FLAG_BARRED;
|
2010-04-25 16:28:24 +00:00
|
|
|
else
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->list[cs->arfci].flags &= ~GSM322_CS_FLAG_BARRED;
|
2010-05-02 17:13:47 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* store selected network */
|
|
|
|
if (s->mcc) {
|
|
|
|
if (gsm322_is_forbidden_la(ms, s->mcc, s->mnc, s->lac))
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->list[cs->arfci].flags |= GSM322_CS_FLAG_FORBIDD;
|
2010-04-25 16:28:24 +00:00
|
|
|
else
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->list[cs->arfci].flags &= ~GSM322_CS_FLAG_FORBIDD;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Scan frequency %s: Cell found. (rxlev %s "
|
|
|
|
"mcc %s mnc %s lac %04x)\n", gsm_print_arfcn(cs->arfcn),
|
|
|
|
gsm_print_rxlev(cs->list[cs->arfci].rxlev),
|
2010-07-15 17:11:36 +00:00
|
|
|
gsm_print_mcc(s->mcc), gsm_print_mnc(s->mnc), s->lac);
|
2010-05-02 17:13:47 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* selected PLMN (auto) becomes available during "any search" */
|
|
|
|
if (ms->settings.plmn_mode == PLMN_MODE_AUTO
|
|
|
|
&& (cs->state == GSM322_ANY_SEARCH
|
|
|
|
|| cs->state == GSM322_C6_ANY_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C8_ANY_CELL_RESEL
|
|
|
|
|| cs->state == GSM322_C9_CHOOSE_ANY_CELL)
|
|
|
|
&& plmn->state == GSM322_A4_WAIT_FOR_PLMN
|
|
|
|
&& s->mcc == plmn->mcc && s->mnc == plmn->mnc) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Candidate network to become available "
|
|
|
|
"again\n");
|
|
|
|
found = gsm322_cs_select(ms, cs->arfci, s->mcc, s->mnc, 0);
|
|
|
|
if (found >= 0) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Selected PLMN in \"A4_WAIT_F"
|
|
|
|
"OR_PLMN\" state becomes available.\n");
|
|
|
|
indicate_plmn_avail:
|
|
|
|
/* PLMN becomes available */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_PLMN_AVAIL);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
/* set what PLMN becomes available */
|
|
|
|
ngm = (struct gsm322_msg *) nmsg->data;
|
|
|
|
ngm->mcc = plmn->mcc;
|
|
|
|
ngm->mnc = plmn->mcc;
|
|
|
|
gsm322_plmn_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C0_NULL);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* selected PLMN (manual) becomes available during "any search" */
|
|
|
|
if (ms->settings.plmn_mode == PLMN_MODE_MANUAL
|
|
|
|
&& (cs->state == GSM322_ANY_SEARCH
|
|
|
|
|| cs->state == GSM322_C6_ANY_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C8_ANY_CELL_RESEL
|
|
|
|
|| cs->state == GSM322_C9_CHOOSE_ANY_CELL)
|
|
|
|
&& plmn->state == GSM322_M3_NOT_ON_PLMN
|
|
|
|
&& s->mcc == plmn->mcc && s->mnc == plmn->mnc) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Candidate network to become available "
|
|
|
|
"again\n");
|
|
|
|
found = gsm322_cs_select(ms, cs->arfci, s->mcc, s->mnc, 0);
|
|
|
|
if (found >= 0) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Current selected PLMN in \"M3_N"
|
|
|
|
"OT_ON_PLMN\" state becomes available.\n");
|
|
|
|
goto indicate_plmn_avail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
/* special case for PLMN search */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->state == GSM322_PLMN_SEARCH
|
|
|
|
|| cs->state == GSM322_ANY_SEARCH)
|
2010-05-07 21:41:54 +00:00
|
|
|
/* tune to next cell */
|
|
|
|
return gsm322_cs_scan(ms);
|
|
|
|
|
|
|
|
/* special case for HPLMN search */
|
|
|
|
if (cs->state == GSM322_HPLMN_SEARCH) {
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
2010-06-20 11:19:06 +00:00
|
|
|
if (!gsm322_is_hplmn_avail(cs, subscr->imsi))
|
2010-05-07 21:41:54 +00:00
|
|
|
/* tune to next cell */
|
|
|
|
return gsm322_cs_scan(ms);
|
|
|
|
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_CELL_FOUND);
|
|
|
|
LOGP(DCS, LOGL_INFO, "HPLMN search finished, cell found.\n");
|
2010-05-02 17:13:47 +00:00
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_plmn_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-05-06 08:48:24 +00:00
|
|
|
/* just see, if we search for any cell */
|
|
|
|
if (cs->state == GSM322_C6_ANY_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C8_ANY_CELL_RESEL
|
|
|
|
|| cs->state == GSM322_C9_CHOOSE_ANY_CELL)
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
any = 1;
|
2010-05-06 08:48:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->state == GSM322_C4_NORMAL_CELL_RESEL
|
|
|
|
|| cs->state == GSM322_C8_ANY_CELL_RESEL)
|
|
|
|
found = gsm322_cs_reselect(ms, cs->mcc, cs->mnc, any);
|
|
|
|
else
|
|
|
|
found = gsm322_cs_select(ms, -1, cs->mcc, cs->mnc, any);
|
2010-05-06 08:48:24 +00:00
|
|
|
|
|
|
|
/* if not found */
|
|
|
|
if (found < 0) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Cell not suitable and allowable.\n");
|
|
|
|
/* tune to next cell */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->state == GSM322_C4_NORMAL_CELL_RESEL
|
|
|
|
|| cs->state == GSM322_C8_ANY_CELL_RESEL)
|
|
|
|
return gsm322_nb_scan(ms);
|
|
|
|
else
|
|
|
|
return gsm322_cs_scan(ms);
|
2010-05-06 08:48:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LOGP(DCS, LOGL_INFO, "Tune to frequency %d.\n", found);
|
|
|
|
/* tune */
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->arfci = found;
|
|
|
|
cs->arfcn = index2arfcn(cs->arfci);
|
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
gsm322_sync_to_cell(cs, NULL, 0);
|
2010-05-06 08:48:24 +00:00
|
|
|
|
|
|
|
/* set selected cell */
|
|
|
|
cs->selected = 1;
|
|
|
|
cs->sel_arfcn = cs->arfcn;
|
|
|
|
memcpy(&cs->sel_si, cs->si, sizeof(cs->sel_si));
|
|
|
|
cs->sel_mcc = cs->si->mcc;
|
|
|
|
cs->sel_mnc = cs->si->mnc;
|
|
|
|
cs->sel_lac = cs->si->lac;
|
|
|
|
cs->sel_id = cs->si->cell_id;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (ms->rrlayer.monitor) {
|
|
|
|
vty_notify(ms, "MON: %scell selected ARFCN=%s MCC=%s MNC=%s "
|
|
|
|
"LAC=0x%04x cellid=0x%04x (%s %s)\n",
|
|
|
|
(any) ? "any " : "", gsm_print_arfcn(cs->sel_arfcn),
|
|
|
|
gsm_print_mcc(cs->sel_mcc), gsm_print_mnc(cs->sel_mnc),
|
|
|
|
cs->sel_lac, cs->sel_id,
|
|
|
|
gsm_get_mcc(cs->sel_mcc),
|
|
|
|
gsm_get_mnc(cs->sel_mcc, cs->sel_mnc));
|
|
|
|
}
|
2010-05-06 08:48:24 +00:00
|
|
|
|
|
|
|
/* tell CS process about available cell */
|
|
|
|
LOGP(DCS, LOGL_INFO, "Cell available.\n");
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_CELL_FOUND);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_c_event(ms, nmsg);
|
|
|
|
msgb_free(nmsg);
|
|
|
|
|
|
|
|
return 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* process system information when returning to idle mode */
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_ba_list *gsm322_cs_sysinfo_sacch(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-10-12 08:48:08 +00:00
|
|
|
struct gsm48_sysinfo *s;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_ba_list *ba = NULL;
|
2011-03-16 08:52:01 +00:00
|
|
|
int i, refer_pcs;
|
|
|
|
uint8_t freq[128+38];
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-10-12 08:48:08 +00:00
|
|
|
if (!cs) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "No BA, because no cell selected\n");
|
|
|
|
return ba;
|
|
|
|
}
|
|
|
|
s = cs->si;
|
|
|
|
if (!s) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "No BA, because no sysinfo\n");
|
|
|
|
return ba;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* collect system information received during dedicated mode */
|
2010-10-24 12:55:31 +00:00
|
|
|
if (s->si5 && (!s->nb_ext_ind_si5 || s->si5bis)) {
|
2010-04-25 16:28:24 +00:00
|
|
|
/* find or create ba list */
|
|
|
|
ba = gsm322_find_ba_list(cs, s->mcc, s->mnc);
|
|
|
|
if (!ba) {
|
2017-05-17 00:17:43 +00:00
|
|
|
ba = talloc_zero(ms, struct gsm322_ba_list);
|
2010-04-25 16:28:24 +00:00
|
|
|
if (!ba)
|
|
|
|
return NULL;
|
|
|
|
ba->mcc = s->mcc;
|
|
|
|
ba->mnc = s->mnc;
|
|
|
|
llist_add_tail(&ba->entry, &cs->ba_list);
|
|
|
|
}
|
|
|
|
/* update (add) ba list */
|
2011-03-16 08:52:01 +00:00
|
|
|
refer_pcs = gsm_refer_pcs(cs->arfcn, s);
|
2010-09-26 10:35:46 +00:00
|
|
|
memset(freq, 0, sizeof(freq));
|
2010-04-25 16:28:24 +00:00
|
|
|
for (i = 0; i <= 1023; i++) {
|
2010-09-26 10:35:46 +00:00
|
|
|
if ((s->freq[i].mask & (FREQ_TYPE_SERV
|
2011-03-16 08:52:01 +00:00
|
|
|
| FREQ_TYPE_NCELL | FREQ_TYPE_REP))) {
|
|
|
|
if (refer_pcs && i >= 512 && i <= 810)
|
|
|
|
freq[(i-512+1024) >> 3] |= (1 << (i&7));
|
|
|
|
else
|
|
|
|
freq[i >> 3] |= (1 << (i & 7));
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
if (!!memcmp(freq, ba->freq, sizeof(freq))) {
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "New BA list (mcc=%s mnc=%s "
|
|
|
|
"%s, %s).\n", gsm_print_mcc(ba->mcc),
|
|
|
|
gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
|
2010-04-29 18:46:11 +00:00
|
|
|
gsm_get_mnc(ba->mcc, ba->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
memcpy(ba->freq, freq, sizeof(freq));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ba;
|
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* store BA whenever a system information changes */
|
2010-05-02 17:13:47 +00:00
|
|
|
static int gsm322_store_ba_list(struct gsm322_cellsel *cs,
|
|
|
|
struct gsm48_sysinfo *s)
|
|
|
|
{
|
|
|
|
struct gsm322_ba_list *ba;
|
2011-03-16 08:52:01 +00:00
|
|
|
int i, refer_pcs;
|
|
|
|
uint8_t freq[128+38];
|
2010-05-02 17:13:47 +00:00
|
|
|
|
|
|
|
/* find or create ba list */
|
|
|
|
ba = gsm322_find_ba_list(cs, s->mcc, s->mnc);
|
|
|
|
if (!ba) {
|
2017-05-17 00:17:43 +00:00
|
|
|
ba = talloc_zero(cs->ms, struct gsm322_ba_list);
|
2010-05-02 17:13:47 +00:00
|
|
|
if (!ba)
|
|
|
|
return -ENOMEM;
|
|
|
|
ba->mcc = s->mcc;
|
|
|
|
ba->mnc = s->mnc;
|
|
|
|
llist_add_tail(&ba->entry, &cs->ba_list);
|
|
|
|
}
|
|
|
|
/* update ba list */
|
2011-03-16 08:52:01 +00:00
|
|
|
refer_pcs = gsm_refer_pcs(cs->arfcn, s);
|
2010-05-02 17:13:47 +00:00
|
|
|
memset(freq, 0, sizeof(freq));
|
2011-03-16 08:52:01 +00:00
|
|
|
freq[(cs->arfci) >> 3] |= (1 << (cs->arfci & 7));
|
2010-05-02 17:13:47 +00:00
|
|
|
for (i = 0; i <= 1023; i++) {
|
|
|
|
if ((s->freq[i].mask &
|
2011-03-16 08:52:01 +00:00
|
|
|
(FREQ_TYPE_SERV | FREQ_TYPE_NCELL | FREQ_TYPE_REP))) {
|
|
|
|
if (refer_pcs && i >= 512 && i <= 810)
|
|
|
|
freq[(i-512+1024) >> 3] |= (1 << (i & 7));
|
|
|
|
else
|
|
|
|
freq[i >> 3] |= (1 << (i & 7));
|
|
|
|
}
|
2010-05-02 17:13:47 +00:00
|
|
|
}
|
|
|
|
if (!!memcmp(freq, ba->freq, sizeof(freq))) {
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "New BA list (mcc=%s mnc=%s "
|
|
|
|
"%s, %s).\n", gsm_print_mcc(ba->mcc),
|
|
|
|
gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
|
2010-05-02 17:13:47 +00:00
|
|
|
gsm_get_mnc(ba->mcc, ba->mnc));
|
|
|
|
memcpy(ba->freq, freq, sizeof(freq));
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* process system information during camping on a cell */
|
|
|
|
static int gsm322_c_camp_sysinfo_bcch(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
2010-07-13 14:21:52 +00:00
|
|
|
// struct gsm48_rrlayer *rr = &ms->rrlayer;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-05-02 17:13:47 +00:00
|
|
|
struct gsm48_sysinfo *s = cs->si;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* start in case we are camping on neighbour cell */
|
|
|
|
if ((cs->state == GSM322_C3_CAMPED_NORMALLY
|
|
|
|
|| cs->state == GSM322_C7_CAMPED_ANY_CELL)
|
|
|
|
&& (cs->neighbour)) {
|
|
|
|
if (s->si3 || s->si4) {
|
|
|
|
stop_cs_timer(cs);
|
|
|
|
LOGP(DCS, LOGL_INFO, "Relevant sysinfo of neighbour "
|
|
|
|
"cell is now received or updated.\n");
|
|
|
|
return gsm322_nb_read(cs, 1);
|
|
|
|
}
|
|
|
|
return 0;
|
2010-05-06 08:48:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* Store BA if we have full system info about cells and neighbor cells.
|
2010-05-02 17:13:47 +00:00
|
|
|
* Depending on the extended bit in the channel description,
|
2019-10-13 17:10:52 +00:00
|
|
|
* we require more or less system information about neighbor cells
|
2010-05-02 17:13:47 +00:00
|
|
|
*/
|
|
|
|
if (s->mcc
|
|
|
|
&& s->mnc
|
|
|
|
&& (gm->sysinfo == GSM48_MT_RR_SYSINFO_1
|
|
|
|
|| gm->sysinfo == GSM48_MT_RR_SYSINFO_2
|
|
|
|
|| gm->sysinfo == GSM48_MT_RR_SYSINFO_2bis
|
|
|
|
|| gm->sysinfo == GSM48_MT_RR_SYSINFO_2ter)
|
|
|
|
&& s->si1
|
|
|
|
&& s->si2
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
&& (!s->nb_ext_ind_si2
|
2010-05-02 17:13:47 +00:00
|
|
|
|| (s->si2bis && s->nb_ext_ind_si2 && !s->nb_ext_ind_si2bis)
|
|
|
|
|| (s->si2bis && s->si2ter && s->nb_ext_ind_si2
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
&& s->nb_ext_ind_si2bis)))
|
2010-05-02 17:13:47 +00:00
|
|
|
gsm322_store_ba_list(cs, s);
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* update sel_si, if all relevant system information received */
|
2010-05-02 17:13:47 +00:00
|
|
|
if (s->si1 && s->si2 && s->si3
|
|
|
|
&& (!s->nb_ext_ind_si2
|
|
|
|
|| (s->si2bis && s->nb_ext_ind_si2 && !s->nb_ext_ind_si2bis)
|
|
|
|
|| (s->si2bis && s->si2ter && s->nb_ext_ind_si2
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
&& s->nb_ext_ind_si2bis))) {
|
2010-05-02 17:13:47 +00:00
|
|
|
if (cs->selected) {
|
2010-05-02 17:40:52 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Sysinfo of selected cell is "
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
"now received or updated.\n");
|
2010-05-02 17:13:47 +00:00
|
|
|
memcpy(&cs->sel_si, s, sizeof(cs->sel_si));
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
|
|
|
/* start in case we are camping on serving cell */
|
|
|
|
if (cs->state == GSM322_C3_CAMPED_NORMALLY
|
|
|
|
|| cs->state == GSM322_C7_CAMPED_ANY_CELL)
|
|
|
|
gsm322_nb_start(ms, 0);
|
2010-05-02 17:13:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check for barred cell */
|
2010-04-25 16:28:24 +00:00
|
|
|
if (gm->sysinfo == GSM48_MT_RR_SYSINFO_1) {
|
|
|
|
/* check if cell becomes barred */
|
2010-05-10 22:06:37 +00:00
|
|
|
if (!subscr->acc_barr && s->cell_barr
|
2011-03-16 08:52:01 +00:00
|
|
|
&& !(cs->list[cs->arfci].sysinfo
|
|
|
|
&& cs->list[cs->arfci].sysinfo->sp
|
|
|
|
&& cs->list[cs->arfci].sysinfo->sp_cbq)) {
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Cell becomes barred.\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (ms->rrlayer.monitor)
|
|
|
|
vty_notify(ms, "MON: trigger cell re-selection"
|
|
|
|
": cell becomes barred\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
trigger_resel:
|
|
|
|
/* mark cell as unscanned */
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->list[cs->arfci].flags &= ~GSM322_CS_FLAG_SYSINFO;
|
|
|
|
if (cs->list[cs->arfci].sysinfo) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "free sysinfo arfcn=%s\n",
|
2011-03-16 08:52:01 +00:00
|
|
|
gsm_print_arfcn(cs->arfcn));
|
2020-02-29 17:39:05 +00:00
|
|
|
if (cs->si == cs->list[cs->arfci].sysinfo)
|
|
|
|
cs->si = NULL;
|
2011-03-16 08:52:01 +00:00
|
|
|
talloc_free(cs->list[cs->arfci].sysinfo);
|
|
|
|
cs->list[cs->arfci].sysinfo = NULL;
|
2010-05-04 09:48:51 +00:00
|
|
|
}
|
|
|
|
/* trigger reselection without queueing,
|
|
|
|
* because other sysinfo message may be queued
|
|
|
|
* before
|
|
|
|
*/
|
2010-04-25 16:28:24 +00:00
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_CELL_RESEL);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
2010-05-04 09:48:51 +00:00
|
|
|
gsm322_c_event(ms, nmsg);
|
|
|
|
msgb_free(nmsg);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* check if cell access becomes barred */
|
|
|
|
if (!((subscr->acc_class & 0xfbff)
|
2010-05-02 17:13:47 +00:00
|
|
|
& (s->class_barr ^ 0xffff))) {
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Cell access becomes barred.\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (ms->rrlayer.monitor)
|
|
|
|
vty_notify(ms, "MON: trigger cell re-selection"
|
|
|
|
": access to cell becomes barred\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
goto trigger_resel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-06 08:48:24 +00:00
|
|
|
/* check if MCC, MNC, LAC, cell ID changes */
|
2010-05-04 09:48:51 +00:00
|
|
|
if (cs->sel_mcc != s->mcc || cs->sel_mnc != s->mnc
|
|
|
|
|| cs->sel_lac != s->lac) {
|
|
|
|
LOGP(DCS, LOGL_NOTICE, "Cell changes location area. "
|
|
|
|
"This is not good!\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (ms->rrlayer.monitor)
|
|
|
|
vty_notify(ms, "MON: trigger cell re-selection: "
|
|
|
|
"cell changes LAI\n");
|
2010-05-04 09:48:51 +00:00
|
|
|
goto trigger_resel;
|
|
|
|
}
|
2010-05-06 08:48:24 +00:00
|
|
|
if (cs->sel_id != s->cell_id) {
|
|
|
|
LOGP(DCS, LOGL_NOTICE, "Cell changes cell ID. "
|
|
|
|
"This is not good!\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (ms->rrlayer.monitor)
|
|
|
|
vty_notify(ms, "MON: trigger cell re-selection: "
|
|
|
|
"cell changes cell ID\n");
|
2010-05-06 08:48:24 +00:00
|
|
|
goto trigger_resel;
|
|
|
|
}
|
2010-05-04 09:48:51 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* process system information during channel scanning */
|
|
|
|
static int gsm322_c_scan_sysinfo_bcch(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-05-02 17:13:47 +00:00
|
|
|
struct gsm48_sysinfo *s = cs->si;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
|
|
|
|
/* no sysinfo if we are not done with power scan */
|
|
|
|
if (cs->powerscan) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Ignoring sysinfo during power scan.\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* Store BA if we have full system info about cells and neighbor cells.
|
2010-04-25 16:28:24 +00:00
|
|
|
* Depending on the extended bit in the channel description,
|
2019-10-13 17:10:52 +00:00
|
|
|
* we require more or less system information about neighbor cells
|
2010-04-25 16:28:24 +00:00
|
|
|
*/
|
|
|
|
if (s->mcc
|
|
|
|
&& s->mnc
|
|
|
|
&& (gm->sysinfo == GSM48_MT_RR_SYSINFO_1
|
|
|
|
|| gm->sysinfo == GSM48_MT_RR_SYSINFO_2
|
|
|
|
|| gm->sysinfo == GSM48_MT_RR_SYSINFO_2bis
|
|
|
|
|| gm->sysinfo == GSM48_MT_RR_SYSINFO_2ter)
|
|
|
|
&& s->si1
|
|
|
|
&& s->si2
|
2010-10-24 12:55:31 +00:00
|
|
|
&& (!s->nb_ext_ind_si2 || s->si2bis)
|
|
|
|
&& (!s->si2ter_ind || s->si2ter))
|
2010-05-02 17:13:47 +00:00
|
|
|
gsm322_store_ba_list(cs, s);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* all relevant system information received */
|
2010-04-25 16:28:24 +00:00
|
|
|
if (s->si1 && s->si2 && s->si3
|
2010-10-24 12:55:31 +00:00
|
|
|
&& (!s->nb_ext_ind_si2 || s->si2bis)
|
|
|
|
&& (!s->si2ter_ind || s->si2ter)) {
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Received relevant sysinfo.\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
/* stop timer */
|
|
|
|
stop_cs_timer(cs);
|
|
|
|
|
2010-06-06 18:19:46 +00:00
|
|
|
//gsm48_sysinfo_dump(s, print_dcs, NULL);
|
2010-04-29 18:46:11 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* store sysinfo and continue scan */
|
|
|
|
return gsm322_cs_store(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* wait for more sysinfo or timeout */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gsm322_cs_timeout(void *arg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = arg;
|
|
|
|
struct osmocom_ms *ms = cs->ms;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->neighbour) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Neighbour cell read failed.\n");
|
|
|
|
gsm322_nb_read(cs, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-05-06 08:48:24 +00:00
|
|
|
/* if we have no lock, we retry */
|
2010-05-07 21:41:54 +00:00
|
|
|
if (cs->ccch_state != GSM322_CCCH_ST_SYNC)
|
2010-09-29 13:24:12 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Cell selection failed, sync timeout.\n");
|
2010-05-07 21:41:54 +00:00
|
|
|
else
|
2010-09-29 13:24:12 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Cell selection failed, read timeout.\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* remove system information */
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->list[cs->arfci].flags &= ~GSM322_CS_FLAG_SYSINFO;
|
|
|
|
if (cs->list[cs->arfci].sysinfo) {
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "free sysinfo arfcn=%s\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn));
|
2020-02-29 17:39:05 +00:00
|
|
|
if (cs->si == cs->list[cs->arfci].sysinfo)
|
|
|
|
cs->si = NULL;
|
2011-03-16 08:52:01 +00:00
|
|
|
talloc_free(cs->list[cs->arfci].sysinfo);
|
|
|
|
cs->list[cs->arfci].sysinfo = NULL;
|
2010-05-02 17:13:47 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* tune to next cell */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->state == GSM322_C4_NORMAL_CELL_RESEL
|
|
|
|
|| cs->state == GSM322_C8_ANY_CELL_RESEL)
|
|
|
|
gsm322_nb_scan(ms);
|
|
|
|
else
|
|
|
|
gsm322_cs_scan(ms);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* power scan process
|
|
|
|
*/
|
|
|
|
|
2010-05-06 08:48:24 +00:00
|
|
|
/* search for block of unscanned frequencies and start scanning */
|
2010-04-25 16:28:24 +00:00
|
|
|
static int gsm322_cs_powerscan(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-07-13 14:21:52 +00:00
|
|
|
struct gsm_settings *set = &ms->settings;
|
2010-04-25 16:28:24 +00:00
|
|
|
int i, s = -1, e;
|
2012-11-16 16:16:40 +00:00
|
|
|
char s_text[ARFCN_TEXT_LEN], e_text[ARFCN_TEXT_LEN];
|
2010-04-25 16:28:24 +00:00
|
|
|
uint8_t mask, flags;
|
|
|
|
|
|
|
|
again:
|
|
|
|
|
|
|
|
mask = GSM322_CS_FLAG_SUPPORT | GSM322_CS_FLAG_POWER;
|
|
|
|
flags = GSM322_CS_FLAG_SUPPORT;
|
2010-07-13 14:21:52 +00:00
|
|
|
|
|
|
|
/* in case of sticking to a cell, we only select it */
|
|
|
|
if (set->stick) {
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Scanning power for sticked cell.\n");
|
2011-03-16 08:52:01 +00:00
|
|
|
i = arfcn2index(set->stick_arfcn);
|
2010-07-13 14:21:52 +00:00
|
|
|
if ((cs->list[i].flags & mask) == flags)
|
2010-04-25 16:28:24 +00:00
|
|
|
s = e = i;
|
2010-07-13 14:21:52 +00:00
|
|
|
} else {
|
|
|
|
/* search for first frequency to scan */
|
|
|
|
if (cs->state == GSM322_C2_STORED_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C5_CHOOSE_CELL) {
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Scanning power for stored BA "
|
2010-07-13 14:21:52 +00:00
|
|
|
"list.\n");
|
|
|
|
mask |= GSM322_CS_FLAG_BA;
|
|
|
|
flags |= GSM322_CS_FLAG_BA;
|
2010-10-01 19:21:33 +00:00
|
|
|
} else
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "Scanning power for all "
|
2010-07-13 14:21:52 +00:00
|
|
|
"frequencies.\n");
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-07-13 14:21:52 +00:00
|
|
|
if ((cs->list[i].flags & mask) == flags) {
|
|
|
|
s = e = i;
|
|
|
|
break;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if there is no more frequency, we can tune to that cell */
|
|
|
|
if (s < 0) {
|
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
/* stop power level scanning */
|
|
|
|
cs->powerscan = 0;
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
/* check if no signal is found */
|
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-04-25 16:28:24 +00:00
|
|
|
if ((cs->list[i].flags & GSM322_CS_FLAG_SIGNAL))
|
|
|
|
found++;
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Found no frequency.\n");
|
|
|
|
/* on normal cell selection, start over */
|
|
|
|
if (cs->state == GSM322_C1_NORMAL_CELL_SEL) {
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-04-25 16:28:24 +00:00
|
|
|
/* clear flag that this was scanned */
|
|
|
|
cs->list[i].flags &=
|
|
|
|
~(GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL
|
|
|
|
| GSM322_CS_FLAG_SYSINFO);
|
|
|
|
}
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* freq. scan process done, process (negative) result */
|
|
|
|
return gsm322_search_end(ms);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
LOGP(DCS, LOGL_INFO, "Found %d frequencies.\n", found);
|
|
|
|
cs->scan_state = 0xffffffff; /* higher than high */
|
2010-04-29 18:46:11 +00:00
|
|
|
/* clear counter of scanned frequencies of each range */
|
|
|
|
for (i = 0; gsm_sup_smax[i].max; i++)
|
|
|
|
gsm_sup_smax[i].temp = 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
return gsm322_cs_scan(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* search last frequency to scan (en block) */
|
|
|
|
e = i;
|
2010-07-13 14:21:52 +00:00
|
|
|
if (!set->stick) {
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = s + 1; i <= 1023+299; i++) {
|
|
|
|
if (i == 1024)
|
|
|
|
break;
|
2010-07-13 14:21:52 +00:00
|
|
|
if ((cs->list[i].flags & mask) == flags)
|
|
|
|
e = i;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
2018-08-11 11:56:16 +00:00
|
|
|
osmo_strlcpy(s_text, gsm_print_arfcn(index2arfcn(s)), ARFCN_TEXT_LEN);
|
|
|
|
osmo_strlcpy(e_text, gsm_print_arfcn(index2arfcn(e)), ARFCN_TEXT_LEN);
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Scanning frequencies. (%s..%s)\n",
|
2012-11-16 16:16:40 +00:00
|
|
|
s_text,
|
|
|
|
e_text);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-04-29 18:46:11 +00:00
|
|
|
/* start scan on radio interface */
|
2010-07-15 10:27:51 +00:00
|
|
|
if (!cs->powerscan) {
|
|
|
|
l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
|
|
|
|
cs->powerscan = 1;
|
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->sync_pending = 0;
|
2011-03-16 08:52:01 +00:00
|
|
|
return l1ctl_tx_pm_req_range(ms, index2arfcn(s), index2arfcn(e));
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
2010-11-13 18:45:09 +00:00
|
|
|
int gsm322_l1_signal(unsigned int subsys, unsigned int signal,
|
2010-04-29 18:46:11 +00:00
|
|
|
void *handler_data, void *signal_data)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
2010-04-29 18:46:11 +00:00
|
|
|
struct osmocom_ms *ms;
|
|
|
|
struct gsm322_cellsel *cs;
|
|
|
|
struct osmobb_meas_res *mr;
|
2010-09-26 10:35:46 +00:00
|
|
|
struct osmobb_fbsb_res *fr;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct osmobb_neigh_pm_ind *ni;
|
2010-04-29 18:46:11 +00:00
|
|
|
int i;
|
2010-07-15 17:11:36 +00:00
|
|
|
int8_t rxlev;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-04-29 18:46:11 +00:00
|
|
|
if (subsys != SS_L1CTL)
|
|
|
|
return 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-04-29 18:46:11 +00:00
|
|
|
switch (signal) {
|
|
|
|
case S_L1CTL_PM_RES:
|
|
|
|
mr = signal_data;
|
|
|
|
ms = mr->ms;
|
|
|
|
cs = &ms->cellsel;
|
|
|
|
if (!cs->powerscan)
|
|
|
|
return -EINVAL;
|
2011-03-16 08:52:01 +00:00
|
|
|
i = arfcn2index(mr->band_arfcn);
|
2010-07-15 17:11:36 +00:00
|
|
|
rxlev = mr->rx_lev;
|
2010-09-29 13:28:04 +00:00
|
|
|
if ((cs->list[i].flags & GSM322_CS_FLAG_POWER)) {
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_ERROR, "Getting PM for ARFCN %s "
|
2010-09-29 13:28:04 +00:00
|
|
|
"twice. Overwriting the first! Please fix "
|
2011-03-16 08:52:01 +00:00
|
|
|
"prim_pm.c\n", gsm_print_arfcn(index2arfcn(i)));
|
2010-09-29 13:28:04 +00:00
|
|
|
}
|
2010-07-15 17:11:36 +00:00
|
|
|
cs->list[i].rxlev = rxlev;
|
2010-04-29 18:46:11 +00:00
|
|
|
cs->list[i].flags |= GSM322_CS_FLAG_POWER;
|
2010-09-29 13:28:04 +00:00
|
|
|
cs->list[i].flags &= ~GSM322_CS_FLAG_SIGNAL;
|
2010-07-13 14:21:52 +00:00
|
|
|
/* if minimum level is reached or if we stick to a cell */
|
2012-11-22 15:00:33 +00:00
|
|
|
if (rxlev2dbm(rxlev) >= ms->settings.min_rxlev_dbm
|
2010-07-13 14:21:52 +00:00
|
|
|
|| ms->settings.stick) {
|
2010-04-29 18:46:11 +00:00
|
|
|
cs->list[i].flags |= GSM322_CS_FLAG_SIGNAL;
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Found signal (ARFCN %s "
|
|
|
|
"rxlev %s (%d))\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)),
|
2010-07-15 17:11:36 +00:00
|
|
|
gsm_print_rxlev(rxlev), rxlev);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
} else
|
|
|
|
/* no signal found, free sysinfo, if allocated */
|
|
|
|
if (cs->list[i].sysinfo) {
|
|
|
|
cs->list[i].flags &= ~GSM322_CS_FLAG_SYSINFO;
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "free sysinfo ARFCN=%s\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)));
|
2020-02-29 17:39:05 +00:00
|
|
|
if (cs->si == cs->list[i].sysinfo)
|
|
|
|
cs->si = NULL;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
talloc_free(cs->list[i].sysinfo);
|
|
|
|
cs->list[i].sysinfo = NULL;
|
2010-04-29 18:46:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case S_L1CTL_PM_DONE:
|
2010-10-01 19:21:33 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "Done with power scanning range.\n");
|
2010-04-29 18:46:11 +00:00
|
|
|
ms = signal_data;
|
|
|
|
cs = &ms->cellsel;
|
|
|
|
if (!cs->powerscan)
|
|
|
|
return -EINVAL;
|
|
|
|
gsm322_cs_powerscan(ms);
|
|
|
|
break;
|
2010-05-19 19:41:24 +00:00
|
|
|
case S_L1CTL_FBSB_RESP:
|
2010-09-26 10:35:46 +00:00
|
|
|
fr = signal_data;
|
|
|
|
ms = fr->ms;
|
2010-04-29 18:46:11 +00:00
|
|
|
cs = &ms->cellsel;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (cs->powerscan)
|
|
|
|
return -EINVAL;
|
|
|
|
cs->sync_pending = 0;
|
|
|
|
if (cs->arfcn != fr->band_arfcn) {
|
|
|
|
LOGP(DCS, LOGL_NOTICE, "Channel synched on "
|
|
|
|
"wrong ARFCN=%d, syncing on right ARFCN again"
|
|
|
|
"...\n", fr->band_arfcn);
|
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
gsm322_sync_to_cell(cs, cs->neighbour, 0);
|
|
|
|
break;
|
|
|
|
}
|
2010-05-07 21:41:54 +00:00
|
|
|
if (cs->ccch_state == GSM322_CCCH_ST_INIT) {
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Channel synched. (ARFCN=%s, "
|
|
|
|
"snr=%u, BSIC=%u)\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn), fr->snr, fr->bsic);
|
2010-05-07 21:41:54 +00:00
|
|
|
cs->ccch_state = GSM322_CCCH_ST_SYNC;
|
2010-09-26 10:35:46 +00:00
|
|
|
if (cs->si)
|
|
|
|
cs->si->bsic = fr->bsic;
|
2010-05-06 08:48:24 +00:00
|
|
|
|
2010-04-29 18:46:11 +00:00
|
|
|
/* set timer for reading BCCH */
|
|
|
|
if (cs->state == GSM322_C2_STORED_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C1_NORMAL_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C6_ANY_CELL_SEL
|
|
|
|
|| cs->state == GSM322_C4_NORMAL_CELL_RESEL
|
|
|
|
|| cs->state == GSM322_C8_ANY_CELL_RESEL
|
|
|
|
|| cs->state == GSM322_C5_CHOOSE_CELL
|
2010-05-05 08:40:10 +00:00
|
|
|
|| cs->state == GSM322_C9_CHOOSE_ANY_CELL
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|| cs->state == GSM322_ANY_SEARCH
|
2010-05-07 21:41:54 +00:00
|
|
|
|| cs->state == GSM322_PLMN_SEARCH
|
2010-05-05 08:40:10 +00:00
|
|
|
|| cs->state == GSM322_HPLMN_SEARCH)
|
2010-05-04 09:48:51 +00:00
|
|
|
start_cs_timer(cs, ms->support.scan_to, 0);
|
2010-04-29 18:46:11 +00:00
|
|
|
// TODO: timer depends on BCCH config
|
2010-10-12 08:26:48 +00:00
|
|
|
|
|
|
|
/* set downlink signalling failure criterion */
|
|
|
|
ms->meas.ds_fail = ms->meas.dsc = ms->settings.dsc_max;
|
|
|
|
LOGP(DRR, LOGL_INFO, "using DSC of %d\n", ms->meas.dsc);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
|
|
|
/* start in case we are camping on serving/neighbour
|
|
|
|
* cell */
|
|
|
|
if (cs->state == GSM322_C3_CAMPED_NORMALLY
|
|
|
|
|| cs->state == GSM322_C7_CAMPED_ANY_CELL) {
|
|
|
|
if (cs->neighbour)
|
|
|
|
gsm322_nb_synced(cs, 1);
|
|
|
|
else
|
|
|
|
gsm322_nb_start(ms, 1);
|
|
|
|
}
|
2010-04-29 18:46:11 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-05-22 09:27:33 +00:00
|
|
|
case S_L1CTL_FBSB_ERR:
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
fr = signal_data;
|
|
|
|
ms = fr->ms;
|
|
|
|
cs = &ms->cellsel;
|
|
|
|
if (cs->powerscan)
|
|
|
|
return -EINVAL;
|
|
|
|
cs->sync_pending = 0;
|
|
|
|
/* retry */
|
|
|
|
if (cs->sync_retries) {
|
2010-09-29 13:24:12 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Channel sync error, try again\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->sync_retries--;
|
|
|
|
gsm322_sync_to_cell(cs, cs->neighbour, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (cs->arfcn != fr->band_arfcn) {
|
|
|
|
LOGP(DCS, LOGL_NOTICE, "Channel synched failed on "
|
|
|
|
"wrong ARFCN=%d, syncing on right ARFCN again"
|
|
|
|
"...\n", fr->band_arfcn);
|
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
gsm322_sync_to_cell(cs, cs->neighbour, 0);
|
2010-06-13 12:09:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-06-05 19:46:10 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Channel sync error.\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* no sync, free sysinfo, if allocated */
|
|
|
|
if (cs->list[cs->arfci].sysinfo) {
|
|
|
|
cs->list[cs->arfci].flags &= ~GSM322_CS_FLAG_SYSINFO;
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "free sysinfo ARFCN=%s\n",
|
|
|
|
gsm_print_arfcn(index2arfcn(cs->arfci)));
|
2019-05-02 13:44:54 +00:00
|
|
|
if (cs->si == cs->list[cs->arfci].sysinfo)
|
|
|
|
cs->si = NULL;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
talloc_free(cs->list[cs->arfci].sysinfo);
|
|
|
|
cs->list[cs->arfci].sysinfo = NULL;
|
2010-05-22 09:27:33 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
}
|
|
|
|
if (cs->selected && cs->sel_arfcn == cs->arfcn) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Unselect cell due to sync "
|
|
|
|
"error!\n");
|
|
|
|
/* unset selected cell */
|
|
|
|
gsm322_unselect_cell(cs);
|
|
|
|
}
|
2010-05-24 03:38:24 +00:00
|
|
|
stop_cs_timer(cs);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
|
|
|
/* start in case we are camping on neighbour * cell */
|
|
|
|
if (cs->state == GSM322_C3_CAMPED_NORMALLY
|
|
|
|
|| cs->state == GSM322_C7_CAMPED_ANY_CELL) {
|
|
|
|
if (cs->neighbour) {
|
|
|
|
gsm322_nb_synced(cs, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gsm322_cs_loss(cs);
|
2010-05-22 09:27:33 +00:00
|
|
|
break;
|
2010-10-12 08:26:48 +00:00
|
|
|
case S_L1CTL_LOSS_IND:
|
|
|
|
ms = signal_data;
|
|
|
|
cs = &ms->cellsel;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Loss of CCCH.\n");
|
|
|
|
if (cs->selected && cs->sel_arfcn == cs->arfcn) {
|
2012-01-02 01:21:19 +00:00
|
|
|
/* do not unselect cell */
|
|
|
|
LOGP(DCS, LOGL_INFO, "Keep cell selected after loss, "
|
|
|
|
"so we can use the Neighbour cell information "
|
|
|
|
"for cell re-selection.\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
}
|
|
|
|
stop_cs_timer(cs);
|
2010-10-12 08:26:48 +00:00
|
|
|
gsm322_cs_loss(cs);
|
|
|
|
break;
|
2010-06-26 11:12:25 +00:00
|
|
|
case S_L1CTL_RESET:
|
2010-07-14 10:21:35 +00:00
|
|
|
ms = signal_data;
|
|
|
|
if (ms->mmlayer.power_off_idle) {
|
2010-11-14 11:52:57 +00:00
|
|
|
mobile_exit(ms, 1);
|
2010-11-13 18:45:09 +00:00
|
|
|
return 0;
|
2010-07-14 10:21:35 +00:00
|
|
|
}
|
2010-06-26 11:12:25 +00:00
|
|
|
break;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
case S_L1CTL_NEIGH_PM_IND:
|
|
|
|
ni = signal_data;
|
|
|
|
ms = ni->ms;
|
|
|
|
#ifdef COMMING_LATE_R
|
|
|
|
/* in dedicated mode */
|
|
|
|
if (ms->rrlayer.dm_est)
|
|
|
|
gsm48_rr_meas_ind(ms, ni->band_arfcn, ni->rx_lev);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
/* in camping mode */
|
|
|
|
if ((ms->cellsel.state == GSM322_C3_CAMPED_NORMALLY
|
|
|
|
|| ms->cellsel.state == GSM322_C7_CAMPED_ANY_CELL)
|
|
|
|
&& !ms->cellsel.neighbour)
|
|
|
|
gsm322_nb_meas_ind(ms, ni->band_arfcn, ni->rx_lev);
|
|
|
|
break;
|
2010-04-29 18:46:11 +00:00
|
|
|
}
|
2010-05-22 09:27:33 +00:00
|
|
|
|
2010-04-29 18:46:11 +00:00
|
|
|
return 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
static void gsm322_cs_loss(void *arg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = arg;
|
|
|
|
struct osmocom_ms *ms = cs->ms;
|
2010-10-12 08:48:08 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if ((cs->state == GSM322_C3_CAMPED_NORMALLY
|
|
|
|
|| cs->state == GSM322_C7_CAMPED_ANY_CELL)
|
|
|
|
&& !cs->neighbour) {
|
2010-05-08 14:31:27 +00:00
|
|
|
struct msgb *nmsg;
|
|
|
|
|
2010-10-13 18:30:59 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Loss of CCCH, Trigger "
|
|
|
|
"re-selection.\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (ms->rrlayer.monitor)
|
|
|
|
vty_notify(ms, "MON: trigger cell "
|
|
|
|
"re-selection: loss of signal\n");
|
2010-05-08 14:31:27 +00:00
|
|
|
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_CELL_RESEL);
|
|
|
|
if (!nmsg)
|
|
|
|
return;
|
|
|
|
gsm322_c_event(ms, nmsg);
|
|
|
|
msgb_free(nmsg);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
} else
|
|
|
|
if (cs->state == GSM322_CONNECTED_MODE_1
|
|
|
|
|| cs->state == GSM322_CONNECTED_MODE_2) {
|
2010-10-13 18:30:59 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Loss of SACCH, Trigger RR "
|
|
|
|
"abort.\n");
|
|
|
|
|
|
|
|
/* keep cell info for re-selection */
|
|
|
|
|
2010-06-12 16:16:54 +00:00
|
|
|
gsm48_rr_los(ms);
|
2019-10-13 17:10:52 +00:00
|
|
|
/* be sure that nothing else is done after here
|
2010-06-13 12:09:30 +00:00
|
|
|
* because the function call above may cause
|
|
|
|
* to return from idle state and trigger cell re-sel.
|
|
|
|
*/
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
|
|
|
return;
|
2010-05-08 14:31:27 +00:00
|
|
|
}
|
2010-05-07 21:41:54 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
gsm322_cs_timeout(cs);
|
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/*
|
|
|
|
* handler for cell selection process
|
|
|
|
*/
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* start any cell search */
|
|
|
|
static int gsm322_c_any_search(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_ANY_SEARCH);
|
|
|
|
|
|
|
|
/* mark all frequencies as scanned */
|
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
|
|
|
cs->list[i].flags &= ~(GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL
|
|
|
|
| GSM322_CS_FLAG_SYSINFO);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start power scan */
|
|
|
|
return gsm322_cs_powerscan(ms);
|
|
|
|
}
|
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
/* start PLMN search */
|
|
|
|
static int gsm322_c_plmn_search(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_PLMN_SEARCH);
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* mark all frequencies as scanned */
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-05-07 21:41:54 +00:00
|
|
|
cs->list[i].flags &= ~(GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL
|
|
|
|
| GSM322_CS_FLAG_SYSINFO);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* unset selected cell */
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm322_unselect_cell(cs);
|
2010-05-07 21:41:54 +00:00
|
|
|
|
|
|
|
/* start power scan */
|
|
|
|
return gsm322_cs_powerscan(ms);
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* start HPLMN search */
|
|
|
|
static int gsm322_c_hplmn_search(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2011-03-16 08:52:01 +00:00
|
|
|
int i, sel_i = arfcn2index(cs->sel_arfcn);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
new_c_state(cs, GSM322_HPLMN_SEARCH);
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* mark all frequencies except our own BA as unscanned */
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
|
|
|
if (i != sel_i
|
2010-05-07 21:41:54 +00:00
|
|
|
&& (cs->list[i].flags & GSM322_CS_FLAG_SYSINFO)
|
2010-05-02 17:13:47 +00:00
|
|
|
&& !(cs->list[i].flags & GSM322_CS_FLAG_BA)) {
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->list[i].flags &= ~(GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL
|
|
|
|
| GSM322_CS_FLAG_SYSINFO);
|
2010-05-02 17:13:47 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* start power scan */
|
|
|
|
return gsm322_cs_powerscan(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start stored cell selection */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static int gsm322_c_stored_cell_sel(struct osmocom_ms *ms,
|
|
|
|
struct gsm322_ba_list *ba)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
int i;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* we weed to rescan */
|
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
|
|
|
cs->list[i].flags &= ~(GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL
|
|
|
|
| GSM322_CS_FLAG_SYSINFO);
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
new_c_state(cs, GSM322_C2_STORED_CELL_SEL);
|
|
|
|
|
|
|
|
/* flag all frequencies that are in current band allocation */
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-04-25 16:28:24 +00:00
|
|
|
if ((ba->freq[i >> 3] & (1 << (i & 7))))
|
|
|
|
cs->list[i].flags |= GSM322_CS_FLAG_BA;
|
|
|
|
else
|
|
|
|
cs->list[i].flags &= ~GSM322_CS_FLAG_BA;
|
|
|
|
}
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* unset selected cell */
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm322_unselect_cell(cs);
|
2010-05-02 17:13:47 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* start power scan */
|
|
|
|
return gsm322_cs_powerscan(ms);
|
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* start normal cell selection */
|
2010-04-25 16:28:24 +00:00
|
|
|
static int gsm322_c_normal_cell_sel(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
int i;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* except for stored cell selection state, we weed to rescan */
|
2010-04-25 16:28:24 +00:00
|
|
|
if (cs->state != GSM322_C2_STORED_CELL_SEL) {
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->list[i].flags &= ~(GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL
|
|
|
|
| GSM322_CS_FLAG_SYSINFO);
|
2010-05-02 17:13:47 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C1_NORMAL_CELL_SEL);
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* unset selected cell */
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm322_unselect_cell(cs);
|
2010-05-02 17:13:47 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* start power scan */
|
|
|
|
return gsm322_cs_powerscan(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start any cell selection */
|
|
|
|
static int gsm322_c_any_cell_sel(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
int msg_type = gm->msg_type;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2010-05-09 09:40:41 +00:00
|
|
|
/* in case we already tried any cell (re-)selection, power scan again */
|
2010-05-24 23:15:15 +00:00
|
|
|
if (cs->state == GSM322_C0_NULL
|
|
|
|
|| cs->state == GSM322_C6_ANY_CELL_SEL
|
2010-05-09 09:40:41 +00:00
|
|
|
|| cs->state == GSM322_C8_ANY_CELL_RESEL) {
|
2010-05-24 23:15:15 +00:00
|
|
|
int i;
|
2010-05-01 18:21:03 +00:00
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->list[i].flags &= ~(GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL
|
|
|
|
| GSM322_CS_FLAG_SYSINFO);
|
2010-05-02 17:13:47 +00:00
|
|
|
}
|
2010-05-24 23:15:15 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* indicate to MM that we lost coverage.
|
|
|
|
* this is the only case where we really have no coverage.
|
2019-10-13 17:10:52 +00:00
|
|
|
* we tell MM, so it will enter the "No Cell Available" state. */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (msg_type == GSM322_EVENT_NO_CELL_FOUND) {
|
|
|
|
struct msgb *nmsg;
|
2010-05-24 23:15:15 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* tell that we have no cell found
|
|
|
|
* (not any cell at all) */
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(
|
|
|
|
GSM48_MM_EVENT_NO_CELL_FOUND);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
new_c_state(cs, GSM322_C6_ANY_CELL_SEL);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->mcc = cs->mnc = 0;
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* unset selected cell */
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm322_unselect_cell(cs);
|
2010-05-02 17:13:47 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* start power scan */
|
|
|
|
return gsm322_cs_powerscan(ms);
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
static void gsm322_any_timeout(void *arg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = arg;
|
|
|
|
struct osmocom_ms *ms = cs->ms;
|
|
|
|
|
|
|
|
/* the timer may still run when not camping, so we ignore it.
|
|
|
|
* it will be restarted whenever the 'camped on any cell' state
|
|
|
|
* is reached. */
|
|
|
|
if (cs->state != GSM322_C7_CAMPED_ANY_CELL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* in case the time has been started before SIM was removed */
|
|
|
|
if (!ms->subscr.sim_valid)
|
|
|
|
return;
|
|
|
|
|
|
|
|
LOGP(DCS, LOGL_INFO, "'Any cell selection timer' timed out. "
|
|
|
|
"Starting special search to find allowed PLMNs.\n");
|
|
|
|
|
|
|
|
gsm322_c_any_search(ms, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sim is removed, proceed with any cell selection */
|
|
|
|
static int gsm322_c_sim_remove(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct llist_head *lh, *lh2;
|
|
|
|
|
|
|
|
/* flush list of forbidden LAs */
|
|
|
|
llist_for_each_safe(lh, lh2, &plmn->forbidden_la) {
|
|
|
|
llist_del(lh);
|
|
|
|
talloc_free(lh);
|
|
|
|
}
|
|
|
|
return gsm322_c_any_cell_sel(ms, msg);
|
|
|
|
}
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* start normal cell re-selection */
|
2010-04-25 16:28:24 +00:00
|
|
|
static int gsm322_c_normal_cell_resel(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct msgb *nmsg;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* store last camped cell. this is required for next cell
|
|
|
|
* monitoring reselection criterion */
|
|
|
|
cs->last_serving_arfcn = cs->sel_arfcn;
|
|
|
|
cs->last_serving_valid = 1;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* unset selected cell */
|
|
|
|
gsm322_unselect_cell(cs);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* tell MM that we lost coverage */
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_LOST_COVERAGE);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C4_NORMAL_CELL_RESEL);
|
|
|
|
|
|
|
|
/* start scanning neighbour cells for reselection */
|
|
|
|
return gsm322_nb_scan(ms);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* start any cell re-selection */
|
|
|
|
static int gsm322_c_any_cell_resel(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct msgb *nmsg;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* store last camped cell. this is required for next cell
|
|
|
|
* monitoring reselection criterion */
|
|
|
|
cs->last_serving_arfcn = cs->sel_arfcn;
|
|
|
|
cs->last_serving_valid = 1;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* unset selected cell */
|
|
|
|
gsm322_unselect_cell(cs);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* tell MM that we lost coverage */
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_LOST_COVERAGE);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C8_ANY_CELL_RESEL);
|
|
|
|
|
|
|
|
/* start scanning neighbour cells for reselection */
|
|
|
|
return gsm322_nb_scan(ms);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
2010-07-17 09:37:58 +00:00
|
|
|
/* a suitable cell was found, so we camp normally */
|
|
|
|
static int gsm322_c_camp_normally(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DSUM, LOGL_INFO, "Camping normally on cell (ARFCN=%s mcc=%s "
|
|
|
|
"mnc=%s %s, %s)\n", gsm_print_arfcn(cs->sel_arfcn),
|
|
|
|
gsm_print_mcc(cs->sel_mcc),
|
2010-07-17 09:37:58 +00:00
|
|
|
gsm_print_mnc(cs->sel_mnc), gsm_get_mcc(cs->sel_mcc),
|
|
|
|
gsm_get_mnc(cs->sel_mcc, cs->sel_mnc));
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* if we did cell reselection, we have a valid last serving cell */
|
|
|
|
if (cs->state != GSM322_C4_NORMAL_CELL_RESEL)
|
|
|
|
cs->last_serving_valid = 0;
|
|
|
|
|
2010-07-17 09:37:58 +00:00
|
|
|
/* tell that we have selected a (new) cell */
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_CELL_SELECTED);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C3_CAMPED_NORMALLY);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* any cell was found, so we camp on any cell */
|
2010-07-17 09:37:58 +00:00
|
|
|
static int gsm322_c_camp_any_cell(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DSUM, LOGL_INFO, "Camping on any cell (ARFCN=%s mcc=%s "
|
|
|
|
"mnc=%s %s, %s)\n", gsm_print_arfcn(cs->sel_arfcn),
|
|
|
|
gsm_print_mcc(cs->sel_mcc),
|
2010-07-17 09:37:58 +00:00
|
|
|
gsm_print_mnc(cs->sel_mnc), gsm_get_mcc(cs->sel_mcc),
|
|
|
|
gsm_get_mnc(cs->sel_mcc, cs->sel_mnc));
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* (re-)starting 'any cell selection' timer to look for coverage of
|
|
|
|
* allowed PLMNs.
|
|
|
|
* start timer, if not running.
|
|
|
|
* restart timer, if we just entered the 'camped any cell' state */
|
|
|
|
if (ms->subscr.sim_valid
|
|
|
|
&& (cs->state != GSM322_C8_ANY_CELL_RESEL
|
|
|
|
|| !osmo_timer_pending(&cs->any_timer))) {
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
|
|
|
|
stop_any_timer(cs);
|
|
|
|
if (ms->settings.plmn_mode == PLMN_MODE_MANUAL
|
|
|
|
&& (!plmn->mcc
|
|
|
|
|| gsm_subscr_is_forbidden_plmn(&ms->subscr, plmn->mcc,
|
|
|
|
plmn->mnc))) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Not starting 'any search' timer, "
|
|
|
|
"because no selected PLMN or forbidden\n");
|
|
|
|
} else
|
|
|
|
start_any_timer(cs, ms->subscr.any_timeout, 0);
|
|
|
|
}
|
2010-07-17 09:37:58 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* if we did cell reselection, we have a valid last serving cell */
|
|
|
|
if (cs->state != GSM322_C8_ANY_CELL_RESEL)
|
|
|
|
cs->last_serving_valid = 0;
|
|
|
|
|
|
|
|
/* tell that we have selected a (new) cell.
|
|
|
|
* this cell iss not allowable, so the MM state will enter limited
|
|
|
|
* service */
|
|
|
|
if (cs->state != GSM322_C7_CAMPED_ANY_CELL) {
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_CELL_SELECTED);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
}
|
2010-07-17 09:37:58 +00:00
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C7_CAMPED_ANY_CELL);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* create temporary ba range with given frequency ranges */
|
|
|
|
struct gsm322_ba_list *gsm322_cs_ba_range(struct osmocom_ms *ms,
|
2011-03-16 08:52:01 +00:00
|
|
|
uint32_t *range, uint8_t ranges, uint8_t refer_pcs)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
|
|
|
static struct gsm322_ba_list ba;
|
2011-03-16 08:52:01 +00:00
|
|
|
int lower, higher;
|
2012-11-16 16:16:40 +00:00
|
|
|
char lower_text[ARFCN_TEXT_LEN], higher_text[ARFCN_TEXT_LEN];
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
memset(&ba, 0, sizeof(ba));
|
|
|
|
|
|
|
|
while(ranges--) {
|
|
|
|
lower = *range & 1023;
|
|
|
|
higher = (*range >> 16) & 1023;
|
2011-03-16 08:52:01 +00:00
|
|
|
if (refer_pcs && lower >= 512 && lower <= 810) {
|
|
|
|
if (higher < 512 || higher > 810 || higher < lower) {
|
|
|
|
LOGP(DCS, LOGL_NOTICE, "Illegal PCS range: "
|
|
|
|
"%d..%d\n", lower, higher);
|
|
|
|
range++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
lower += 1024-512;
|
|
|
|
higher += 1024-512;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
range++;
|
2018-08-11 11:56:16 +00:00
|
|
|
osmo_strlcpy(lower_text, gsm_print_arfcn(index2arfcn(lower)), ARFCN_TEXT_LEN);
|
|
|
|
osmo_strlcpy(higher_text, gsm_print_arfcn(index2arfcn(higher)), ARFCN_TEXT_LEN);
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Use BA range: %s..%s\n",
|
2012-11-16 16:16:40 +00:00
|
|
|
lower_text,
|
|
|
|
higher_text);
|
2010-04-25 16:28:24 +00:00
|
|
|
/* GSM 05.08 6.3 */
|
|
|
|
while (1) {
|
|
|
|
ba.freq[lower >> 3] |= 1 << (lower & 7);
|
|
|
|
if (lower == higher)
|
|
|
|
break;
|
2011-03-16 08:52:01 +00:00
|
|
|
lower++;
|
2019-10-13 17:10:52 +00:00
|
|
|
/* wrap around, only if not PCS */
|
2011-03-16 08:52:01 +00:00
|
|
|
if (lower == 1024)
|
|
|
|
lower = 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return &ba;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* common part of gsm322_c_choose_cell and gsm322_c_choose_any_cell */
|
|
|
|
static int gsm322_cs_choose(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-06-12 16:16:54 +00:00
|
|
|
struct gsm48_rrlayer *rr = &ms->rrlayer;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_ba_list *ba = NULL;
|
|
|
|
int i;
|
|
|
|
|
2010-06-12 16:16:54 +00:00
|
|
|
/* NOTE: The call to this function is synchron to RR layer, so
|
|
|
|
* we may access the BA range there.
|
|
|
|
*/
|
|
|
|
if (rr->ba_ranges)
|
2011-03-16 08:52:01 +00:00
|
|
|
ba = gsm322_cs_ba_range(ms, rr->ba_range, rr->ba_ranges,
|
|
|
|
gsm_refer_pcs(cs->sel_arfcn, &cs->sel_si));
|
2010-04-25 16:28:24 +00:00
|
|
|
else {
|
|
|
|
LOGP(DCS, LOGL_INFO, "No BA range(s), try sysinfo.\n");
|
|
|
|
/* get and update BA of last received sysinfo 5* */
|
|
|
|
ba = gsm322_cs_sysinfo_sacch(ms);
|
2010-06-14 19:38:06 +00:00
|
|
|
if (!ba) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "No BA on sysinfo, try stored "
|
|
|
|
"BA list.\n");
|
2010-05-02 17:13:47 +00:00
|
|
|
ba = gsm322_find_ba_list(cs, cs->sel_si.mcc,
|
|
|
|
cs->sel_si.mnc);
|
2010-06-14 19:38:06 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!ba) {
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "No BA list to use.\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* tell CS to start over */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NO_CELL_FOUND);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
2010-05-04 09:48:51 +00:00
|
|
|
gsm322_c_event(ms, nmsg);
|
|
|
|
msgb_free(nmsg);
|
|
|
|
|
|
|
|
return 0;
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* flag all frequencies that are in current band allocation */
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-04-25 16:28:24 +00:00
|
|
|
if (cs->state == GSM322_C5_CHOOSE_CELL) {
|
2010-06-14 19:38:06 +00:00
|
|
|
if ((ba->freq[i >> 3] & (1 << (i & 7)))) {
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->list[i].flags |= GSM322_CS_FLAG_BA;
|
2010-06-14 19:38:06 +00:00
|
|
|
} else {
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->list[i].flags &= ~GSM322_CS_FLAG_BA;
|
2010-06-14 19:38:06 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
cs->list[i].flags &= ~(GSM322_CS_FLAG_POWER
|
|
|
|
| GSM322_CS_FLAG_SIGNAL
|
|
|
|
| GSM322_CS_FLAG_SYSINFO);
|
|
|
|
}
|
2010-05-02 17:13:47 +00:00
|
|
|
|
|
|
|
/* unset selected cell */
|
2010-06-20 11:19:06 +00:00
|
|
|
gsm322_unselect_cell(cs);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* start power scan */
|
|
|
|
return gsm322_cs_powerscan(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start 'Choose cell' after returning to idle mode */
|
|
|
|
static int gsm322_c_choose_cell(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-07-17 09:37:58 +00:00
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
|
|
|
|
/* After location updating, we choose the last cell */
|
|
|
|
if (gm->same_cell) {
|
2010-07-19 09:37:57 +00:00
|
|
|
struct msgb *nmsg;
|
|
|
|
|
2010-07-17 09:37:58 +00:00
|
|
|
if (!cs->selected) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Cell not selected anymore, "
|
|
|
|
"choose cell!\n");
|
|
|
|
goto choose;
|
2010-07-17 09:37:58 +00:00
|
|
|
}
|
|
|
|
cs->arfcn = cs->sel_arfcn;
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->arfci = arfcn2index(cs->arfcn);
|
2010-07-17 09:37:58 +00:00
|
|
|
|
|
|
|
/* be sure to go to current camping frequency on return */
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Selecting ARFCN %s. after LOC.UPD.\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn));
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
gsm322_sync_to_cell(cs, NULL, 0);
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!cs->si) {
|
2017-11-15 08:52:26 +00:00
|
|
|
LOGP(DCS, LOGL_FATAL, "No SI when ret.idle, please fix!\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
exit(0L);
|
|
|
|
}
|
2010-07-17 09:37:58 +00:00
|
|
|
|
2010-07-17 11:44:11 +00:00
|
|
|
new_c_state(cs, GSM322_C3_CAMPED_NORMALLY);
|
|
|
|
|
2010-07-19 09:37:57 +00:00
|
|
|
/* tell that we have selected the cell, so RR returns IDLE */
|
|
|
|
nmsg = gsm48_mmevent_msgb_alloc(GSM48_MM_EVENT_CELL_SELECTED);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm48_mmevent_msg(ms, nmsg);
|
|
|
|
|
2010-07-17 11:44:11 +00:00
|
|
|
return 0;
|
2010-07-17 09:37:58 +00:00
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
choose:
|
2010-04-25 16:28:24 +00:00
|
|
|
new_c_state(cs, GSM322_C5_CHOOSE_CELL);
|
|
|
|
|
|
|
|
return gsm322_cs_choose(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start 'Choose any cell' after returning to idle mode */
|
|
|
|
static int gsm322_c_choose_any_cell(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_C9_CHOOSE_ANY_CELL);
|
|
|
|
|
|
|
|
return gsm322_cs_choose(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* a new PLMN is selected by PLMN search process */
|
|
|
|
static int gsm322_c_new_plmn(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_ba_list *ba;
|
|
|
|
|
|
|
|
cs->mcc = plmn->mcc;
|
|
|
|
cs->mnc = plmn->mnc;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (gm->limited) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Selected PLMN with limited service.\n");
|
|
|
|
return gsm322_c_any_cell_sel(ms, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
LOGP(DSUM, LOGL_INFO, "Selecting PLMN (mcc=%s mnc=%s %s, %s)\n",
|
|
|
|
gsm_print_mcc(cs->mcc), gsm_print_mnc(cs->mnc),
|
|
|
|
gsm_get_mcc(cs->mcc), gsm_get_mnc(cs->mcc, cs->mnc));
|
2010-06-06 18:19:46 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* search for BA list */
|
|
|
|
ba = gsm322_find_ba_list(cs, plmn->mcc, plmn->mnc);
|
|
|
|
|
|
|
|
if (ba) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Start stored cell selection.\n");
|
|
|
|
return gsm322_c_stored_cell_sel(ms, ba);
|
|
|
|
} else {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Start normal cell selection.\n");
|
|
|
|
return gsm322_c_normal_cell_sel(ms, msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* go connected mode */
|
|
|
|
static int gsm322_c_conn_mode_1(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* check for error */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!cs->selected) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "No cell selected, please fix!\n");
|
|
|
|
exit(0L);
|
|
|
|
}
|
2010-05-02 17:13:47 +00:00
|
|
|
cs->arfcn = cs->sel_arfcn;
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->arfci = arfcn2index(cs->arfcn);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* maybe we are currently syncing to neighbours */
|
|
|
|
stop_cs_timer(cs);
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_CONNECTED_MODE_1);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* be sure to go to current camping frequency on return */
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Going to camping (normal) ARFCN %s.\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn));
|
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!cs->si) {
|
2017-11-15 08:52:26 +00:00
|
|
|
LOGP(DCS, LOGL_FATAL, "No SI when leaving idle, please fix!\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
exit(0L);
|
|
|
|
}
|
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
gsm322_sync_to_cell(cs, NULL, 1);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int gsm322_c_conn_mode_2(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* check for error */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!cs->selected) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "No cell selected, please fix!\n");
|
|
|
|
exit(0L);
|
|
|
|
}
|
2010-05-02 17:13:47 +00:00
|
|
|
cs->arfcn = cs->sel_arfcn;
|
2011-03-16 08:52:01 +00:00
|
|
|
cs->arfci = arfcn2index(cs->arfcn);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
stop_cs_timer(cs);
|
|
|
|
|
|
|
|
new_c_state(cs, GSM322_CONNECTED_MODE_2);
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* be sure to go to current camping frequency on return */
|
2011-03-16 08:52:01 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Going to camping (any cell) ARFCN %s.\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn));
|
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!cs->si) {
|
2017-11-15 08:52:26 +00:00
|
|
|
LOGP(DCS, LOGL_FATAL, "No SI when leaving idle, please fix!\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
exit(0L);
|
|
|
|
}
|
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
gsm322_sync_to_cell(cs, NULL, 1);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* switch on */
|
|
|
|
static int gsm322_c_switch_on(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
|
|
|
|
/* if no SIM is is MS */
|
2010-04-29 18:46:11 +00:00
|
|
|
if (!subscr->sim_valid) {
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Switch on without SIM.\n");
|
|
|
|
return gsm322_c_any_cell_sel(ms, msg);
|
2010-04-29 18:46:11 +00:00
|
|
|
}
|
2010-09-18 19:15:15 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Switch on with SIM inserted.\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* stay in NULL state until PLMN is selected */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* state machines
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* state machine for automatic PLMN selection events */
|
|
|
|
static struct plmnastatelist {
|
|
|
|
uint32_t states;
|
|
|
|
int type;
|
|
|
|
int (*rout) (struct osmocom_ms *ms, struct msgb *msg);
|
|
|
|
} plmnastatelist[] = {
|
|
|
|
{SBIT(GSM322_A0_NULL),
|
|
|
|
GSM322_EVENT_SWITCH_ON, gsm322_a_switch_on},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-07-17 11:44:11 +00:00
|
|
|
/* special case for full search */
|
2010-05-07 21:41:54 +00:00
|
|
|
{SBIT(GSM322_A0_NULL),
|
|
|
|
GSM322_EVENT_PLMN_SEARCH_END, gsm322_a_sel_first_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SWITCH_OFF, gsm322_a_switch_off},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-09-18 19:15:15 +00:00
|
|
|
{SBIT(GSM322_A0_NULL) | SBIT(GSM322_A6_NO_SIM),
|
2010-04-25 16:28:24 +00:00
|
|
|
GSM322_EVENT_SIM_INSERT, gsm322_a_switch_on},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-05-01 18:21:03 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SIM_INSERT, gsm322_a_sim_insert},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SIM_REMOVE, gsm322_a_sim_removed},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_INVALID_SIM, gsm322_a_sim_removed},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A1_TRYING_RPLMN),
|
|
|
|
GSM322_EVENT_REG_FAILED, gsm322_a_sel_first_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-06-13 13:51:30 +00:00
|
|
|
{SBIT(GSM322_A1_TRYING_RPLMN),
|
|
|
|
GSM322_EVENT_ROAMING_NA, gsm322_a_sel_first_plmn},
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A1_TRYING_RPLMN),
|
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_a_sel_first_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A1_TRYING_RPLMN) | SBIT(GSM322_A3_TRYING_PLMN),
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
GSM322_EVENT_REG_SUCCESS, gsm322_a_go_on_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A2_ON_PLMN),
|
|
|
|
GSM322_EVENT_ROAMING_NA, gsm322_a_roaming_na},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A2_ON_PLMN),
|
2010-05-07 21:41:54 +00:00
|
|
|
GSM322_EVENT_HPLMN_SEARCH, gsm322_a_hplmn_search_start},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A2_ON_PLMN),
|
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_a_loss_of_radio},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A2_ON_PLMN),
|
2010-05-07 21:41:54 +00:00
|
|
|
GSM322_EVENT_USER_RESEL, gsm322_a_user_resel},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A3_TRYING_PLMN),
|
|
|
|
GSM322_EVENT_REG_FAILED, gsm322_a_sel_next_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-06-13 13:51:30 +00:00
|
|
|
{SBIT(GSM322_A3_TRYING_PLMN),
|
|
|
|
GSM322_EVENT_ROAMING_NA, gsm322_a_sel_next_plmn},
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A3_TRYING_PLMN),
|
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_a_sel_next_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A5_HPLMN_SEARCH),
|
2010-05-07 21:41:54 +00:00
|
|
|
GSM322_EVENT_CELL_FOUND, gsm322_a_sel_first_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A5_HPLMN_SEARCH),
|
2010-05-07 21:41:54 +00:00
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_a_go_on_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_A4_WAIT_FOR_PLMN),
|
|
|
|
GSM322_EVENT_PLMN_AVAIL, gsm322_a_plmn_avail},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SEL_MANUAL, gsm322_a_sel_manual},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_am_no_cell_found},
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PLMNASLLEN \
|
|
|
|
(sizeof(plmnastatelist) / sizeof(struct plmnastatelist))
|
|
|
|
|
|
|
|
static int gsm322_a_event(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
int msg_type = gm->msg_type;
|
|
|
|
int rc;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "(ms %s) Event '%s' for automatic PLMN "
|
2010-06-16 17:19:40 +00:00
|
|
|
"selection in state '%s'\n", ms->name, get_event_name(msg_type),
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
get_a_state_name(plmn->state));
|
2010-04-25 16:28:24 +00:00
|
|
|
/* find function for current state and message */
|
|
|
|
for (i = 0; i < PLMNASLLEN; i++)
|
|
|
|
if ((msg_type == plmnastatelist[i].type)
|
|
|
|
&& ((1 << plmn->state) & plmnastatelist[i].states))
|
|
|
|
break;
|
|
|
|
if (i == PLMNASLLEN) {
|
|
|
|
LOGP(DPLMN, LOGL_NOTICE, "Event unhandled at this state.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = plmnastatelist[i].rout(ms, msg);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* state machine for manual PLMN selection events */
|
|
|
|
static struct plmnmstatelist {
|
|
|
|
uint32_t states;
|
|
|
|
int type;
|
|
|
|
int (*rout) (struct osmocom_ms *ms, struct msgb *msg);
|
|
|
|
} plmnmstatelist[] = {
|
|
|
|
{SBIT(GSM322_M0_NULL),
|
|
|
|
GSM322_EVENT_SWITCH_ON, gsm322_m_switch_on},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-05-13 12:51:22 +00:00
|
|
|
{SBIT(GSM322_M0_NULL) | SBIT(GSM322_M3_NOT_ON_PLMN) |
|
|
|
|
SBIT(GSM322_M2_ON_PLMN),
|
2010-05-07 21:41:54 +00:00
|
|
|
GSM322_EVENT_PLMN_SEARCH_END, gsm322_m_display_plmns},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SWITCH_OFF, gsm322_m_switch_off},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-09-18 19:15:15 +00:00
|
|
|
{SBIT(GSM322_M0_NULL) | SBIT(GSM322_M5_NO_SIM),
|
2010-04-25 16:28:24 +00:00
|
|
|
GSM322_EVENT_SIM_INSERT, gsm322_m_switch_on},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-05-01 18:21:03 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SIM_INSERT, gsm322_m_sim_insert},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SIM_REMOVE, gsm322_m_sim_removed},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M1_TRYING_RPLMN),
|
|
|
|
GSM322_EVENT_REG_FAILED, gsm322_m_display_plmns},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-06-13 13:51:30 +00:00
|
|
|
{SBIT(GSM322_M1_TRYING_RPLMN),
|
|
|
|
GSM322_EVENT_ROAMING_NA, gsm322_m_display_plmns},
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M1_TRYING_RPLMN),
|
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_m_display_plmns},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M1_TRYING_RPLMN),
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
GSM322_EVENT_REG_SUCCESS, gsm322_m_go_on_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M2_ON_PLMN),
|
|
|
|
GSM322_EVENT_ROAMING_NA, gsm322_m_display_plmns},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* undocumented case, where we loose coverage */
|
|
|
|
{SBIT(GSM322_M2_ON_PLMN),
|
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_m_display_plmns},
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M1_TRYING_RPLMN) | SBIT(GSM322_M2_ON_PLMN) |
|
|
|
|
SBIT(GSM322_M4_TRYING_PLMN),
|
|
|
|
GSM322_EVENT_INVALID_SIM, gsm322_m_sim_removed},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-05-13 12:51:22 +00:00
|
|
|
{SBIT(GSM322_M3_NOT_ON_PLMN) | SBIT(GSM322_M2_ON_PLMN),
|
2010-05-07 21:41:54 +00:00
|
|
|
GSM322_EVENT_USER_RESEL, gsm322_m_user_resel},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M3_NOT_ON_PLMN),
|
|
|
|
GSM322_EVENT_PLMN_AVAIL, gsm322_m_plmn_avail},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* choose plmn is only specified when 'not on PLMN', but it makes
|
|
|
|
* sense to select cell from other states too. */
|
|
|
|
{SBIT(GSM322_M3_NOT_ON_PLMN) | SBIT(GSM322_M2_ON_PLMN) |
|
|
|
|
SBIT(GSM322_M1_TRYING_RPLMN) | SBIT(GSM322_M4_TRYING_PLMN),
|
2010-07-19 09:37:57 +00:00
|
|
|
GSM322_EVENT_CHOOSE_PLMN, gsm322_m_choose_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M4_TRYING_PLMN),
|
|
|
|
GSM322_EVENT_REG_SUCCESS, gsm322_m_go_on_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* we also display available PLMNs after trying to register.
|
|
|
|
* this is not standard. we need that so the user knows
|
|
|
|
* that registration failed, and the user can select a new network. */
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M4_TRYING_PLMN),
|
2010-06-16 18:21:59 +00:00
|
|
|
GSM322_EVENT_REG_FAILED, gsm322_m_display_plmns},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-06-13 13:51:30 +00:00
|
|
|
{SBIT(GSM322_M4_TRYING_PLMN),
|
2010-06-16 18:21:59 +00:00
|
|
|
GSM322_EVENT_ROAMING_NA, gsm322_m_display_plmns},
|
2010-06-13 13:51:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_M4_TRYING_PLMN),
|
2010-06-16 18:21:59 +00:00
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_m_display_plmns},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SEL_AUTO, gsm322_m_sel_auto},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_am_no_cell_found},
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PLMNMSLLEN \
|
|
|
|
(sizeof(plmnmstatelist) / sizeof(struct plmnmstatelist))
|
|
|
|
|
|
|
|
static int gsm322_m_event(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
int msg_type = gm->msg_type;
|
|
|
|
int rc;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "(ms %s) Event '%s' for manual PLMN selection "
|
2010-06-16 17:19:40 +00:00
|
|
|
"in state '%s'\n", ms->name, get_event_name(msg_type),
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
get_m_state_name(plmn->state));
|
2010-04-25 16:28:24 +00:00
|
|
|
/* find function for current state and message */
|
|
|
|
for (i = 0; i < PLMNMSLLEN; i++)
|
|
|
|
if ((msg_type == plmnmstatelist[i].type)
|
|
|
|
&& ((1 << plmn->state) & plmnmstatelist[i].states))
|
|
|
|
break;
|
|
|
|
if (i == PLMNMSLLEN) {
|
|
|
|
LOGP(DPLMN, LOGL_NOTICE, "Event unhandled at this state.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = plmnmstatelist[i].rout(ms, msg);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dequeue GSM 03.22 PLMN events */
|
|
|
|
int gsm322_plmn_dequeue(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct msgb *msg;
|
|
|
|
int work = 0;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
while ((msg = msgb_dequeue(&plmn->event_queue))) {
|
|
|
|
/* send event to PLMN select process */
|
2010-05-24 16:15:21 +00:00
|
|
|
if (ms->settings.plmn_mode == PLMN_MODE_AUTO)
|
2010-04-25 16:28:24 +00:00
|
|
|
gsm322_a_event(ms, msg);
|
|
|
|
else
|
|
|
|
gsm322_m_event(ms, msg);
|
|
|
|
msgb_free(msg);
|
|
|
|
work = 1; /* work done */
|
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return work;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* state machine for channel selection events */
|
|
|
|
static struct cellselstatelist {
|
|
|
|
uint32_t states;
|
|
|
|
int type;
|
|
|
|
int (*rout) (struct osmocom_ms *ms, struct msgb *msg);
|
|
|
|
} cellselstatelist[] = {
|
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_SWITCH_ON, gsm322_c_switch_on},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
GSM322_EVENT_SIM_REMOVE, gsm322_c_sim_remove},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_NEW_PLMN, gsm322_c_new_plmn},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-05-07 21:41:54 +00:00
|
|
|
{ALL_STATES,
|
|
|
|
GSM322_EVENT_PLMN_SEARCH_START, gsm322_c_plmn_search},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C1_NORMAL_CELL_SEL) | SBIT(GSM322_C2_STORED_CELL_SEL) |
|
|
|
|
SBIT(GSM322_C4_NORMAL_CELL_RESEL) | SBIT(GSM322_C5_CHOOSE_CELL),
|
|
|
|
GSM322_EVENT_CELL_FOUND, gsm322_c_camp_normally},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C9_CHOOSE_ANY_CELL) | SBIT(GSM322_C6_ANY_CELL_SEL) |
|
2010-05-04 09:48:51 +00:00
|
|
|
SBIT(GSM322_C8_ANY_CELL_RESEL),
|
2010-04-25 16:28:24 +00:00
|
|
|
GSM322_EVENT_CELL_FOUND, gsm322_c_camp_any_cell},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C1_NORMAL_CELL_SEL) | SBIT(GSM322_C6_ANY_CELL_SEL) |
|
2010-04-29 18:46:11 +00:00
|
|
|
SBIT(GSM322_C9_CHOOSE_ANY_CELL) | SBIT(GSM322_C8_ANY_CELL_RESEL) |
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
SBIT(GSM322_C0_NULL) /* after search */,
|
2010-04-25 16:28:24 +00:00
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_c_any_cell_sel},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C2_STORED_CELL_SEL) | SBIT(GSM322_C5_CHOOSE_CELL) |
|
|
|
|
SBIT(GSM322_C4_NORMAL_CELL_RESEL),
|
|
|
|
GSM322_EVENT_NO_CELL_FOUND, gsm322_c_normal_cell_sel},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C3_CAMPED_NORMALLY),
|
|
|
|
GSM322_EVENT_LEAVE_IDLE, gsm322_c_conn_mode_1},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C7_CAMPED_ANY_CELL),
|
|
|
|
GSM322_EVENT_LEAVE_IDLE, gsm322_c_conn_mode_2},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
{SBIT(GSM322_CONNECTED_MODE_1),
|
2010-04-25 16:28:24 +00:00
|
|
|
GSM322_EVENT_RET_IDLE, gsm322_c_choose_cell},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
{SBIT(GSM322_CONNECTED_MODE_2),
|
2010-04-25 16:28:24 +00:00
|
|
|
GSM322_EVENT_RET_IDLE, gsm322_c_choose_any_cell},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C3_CAMPED_NORMALLY),
|
|
|
|
GSM322_EVENT_CELL_RESEL, gsm322_c_normal_cell_resel},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C7_CAMPED_ANY_CELL),
|
|
|
|
GSM322_EVENT_CELL_RESEL, gsm322_c_any_cell_resel},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C7_CAMPED_ANY_CELL),
|
|
|
|
GSM322_EVENT_CELL_FOUND, gsm322_c_normal_cell_sel},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C1_NORMAL_CELL_SEL) | SBIT(GSM322_C2_STORED_CELL_SEL) |
|
|
|
|
SBIT(GSM322_C4_NORMAL_CELL_RESEL) | SBIT(GSM322_C5_CHOOSE_CELL) |
|
2010-04-29 18:46:11 +00:00
|
|
|
SBIT(GSM322_C9_CHOOSE_ANY_CELL) | SBIT(GSM322_C8_ANY_CELL_RESEL) |
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
SBIT(GSM322_C6_ANY_CELL_SEL) | SBIT(GSM322_ANY_SEARCH) |
|
|
|
|
SBIT(GSM322_PLMN_SEARCH) | SBIT(GSM322_HPLMN_SEARCH) ,
|
2010-04-25 16:28:24 +00:00
|
|
|
GSM322_EVENT_SYSINFO, gsm322_c_scan_sysinfo_bcch},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-29 18:46:11 +00:00
|
|
|
{SBIT(GSM322_C3_CAMPED_NORMALLY) | SBIT(GSM322_C7_CAMPED_ANY_CELL),
|
2010-04-25 16:28:24 +00:00
|
|
|
GSM322_EVENT_SYSINFO, gsm322_c_camp_sysinfo_bcch},
|
2010-06-13 12:09:30 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
{SBIT(GSM322_C3_CAMPED_NORMALLY),
|
2010-05-07 21:41:54 +00:00
|
|
|
GSM322_EVENT_HPLMN_SEARCH, gsm322_c_hplmn_search},
|
2010-04-25 16:28:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define CELLSELSLLEN \
|
|
|
|
(sizeof(cellselstatelist) / sizeof(struct cellselstatelist))
|
|
|
|
|
|
|
|
int gsm322_c_event(struct osmocom_ms *ms, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm322_msg *gm = (struct gsm322_msg *) msg->data;
|
|
|
|
int msg_type = gm->msg_type;
|
|
|
|
int rc;
|
|
|
|
int i;
|
|
|
|
|
2010-09-29 13:29:31 +00:00
|
|
|
if (msg_type != GSM322_EVENT_SYSINFO)
|
|
|
|
LOGP(DCS, LOGL_INFO, "(ms %s) Event '%s' for Cell selection "
|
|
|
|
"in state '%s'\n", ms->name, get_event_name(msg_type),
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
get_cs_state_name(cs->state));
|
2010-04-25 16:28:24 +00:00
|
|
|
/* find function for current state and message */
|
|
|
|
for (i = 0; i < CELLSELSLLEN; i++)
|
|
|
|
if ((msg_type == cellselstatelist[i].type)
|
|
|
|
&& ((1 << cs->state) & cellselstatelist[i].states))
|
|
|
|
break;
|
|
|
|
if (i == CELLSELSLLEN) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (msg_type != GSM322_EVENT_SYSINFO)
|
|
|
|
LOGP(DCS, LOGL_NOTICE, "Event unhandled at this state."
|
|
|
|
"\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = cellselstatelist[i].rout(ms, msg);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dequeue GSM 03.22 cell selection events */
|
|
|
|
int gsm322_cs_dequeue(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct msgb *msg;
|
|
|
|
int work = 0;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
while ((msg = msgb_dequeue(&cs->event_queue))) {
|
|
|
|
/* send event to cell selection process */
|
|
|
|
gsm322_c_event(ms, msg);
|
|
|
|
msgb_free(msg);
|
|
|
|
work = 1; /* work done */
|
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
return work;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/*
|
|
|
|
* neighbour cell measurement process in idle mode
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct gsm322_neighbour *gsm322_nb_alloc(struct gsm322_cellsel *cs,
|
|
|
|
uint16_t arfcn)
|
|
|
|
{
|
|
|
|
struct gsm322_neighbour *nb;
|
|
|
|
time_t now;
|
|
|
|
|
|
|
|
time(&now);
|
|
|
|
|
2017-05-17 00:17:43 +00:00
|
|
|
nb = talloc_zero(cs->ms, struct gsm322_neighbour);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!nb)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
nb->cs = cs;
|
|
|
|
nb->arfcn = arfcn;
|
|
|
|
nb->rla_c_dbm = -128;
|
|
|
|
nb->created = now;
|
|
|
|
llist_add_tail(&nb->entry, &cs->nb_list);
|
|
|
|
|
|
|
|
return nb;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gsm322_nb_free(struct gsm322_neighbour *nb)
|
|
|
|
{
|
|
|
|
llist_del(&nb->entry);
|
|
|
|
talloc_free(nb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check and calculate reselection criterion for all 6 neighbour cells and
|
|
|
|
* return, if cell reselection has to be triggered */
|
|
|
|
static int gsm322_nb_check(struct osmocom_ms *ms, int any)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm_subscriber *subscr = &ms->subscr;
|
|
|
|
struct gsm_settings *set = &ms->settings;
|
|
|
|
struct gsm48_sysinfo *s;
|
|
|
|
int i = 0, reselect = 0;
|
|
|
|
uint16_t acc_class;
|
2019-05-22 19:57:34 +00:00
|
|
|
int class;
|
|
|
|
enum gsm_band band;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm322_neighbour *nb;
|
|
|
|
time_t now;
|
|
|
|
char arfcn_text[10];
|
|
|
|
|
|
|
|
time(&now);
|
|
|
|
|
|
|
|
/* set out access class depending on the cell selection type */
|
|
|
|
if (any) {
|
|
|
|
acc_class = (subscr->acc_class | 0x0400); /* add emergency */
|
|
|
|
LOGP(DNB, LOGL_DEBUG, "Re-select using access class with "
|
|
|
|
"Emergency class.\n");
|
|
|
|
} else {
|
|
|
|
acc_class = subscr->acc_class;
|
|
|
|
LOGP(DNB, LOGL_DEBUG, "Re-select using access class.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ms->rrlayer.monitor) {
|
|
|
|
vty_notify(ms, "MON: cell ARFCN LAC C1 C2 CRH RLA_C "
|
|
|
|
"bargraph\n");
|
|
|
|
snprintf(arfcn_text, 10, "%s ",
|
|
|
|
gsm_print_arfcn(cs->sel_arfcn));
|
|
|
|
arfcn_text[9] = '\0';
|
|
|
|
vty_notify(ms, "MON: serving %s 0x%04x %3d %3d %4d "
|
|
|
|
"%s\n", arfcn_text, cs->sel_lac, cs->c1, cs->c2,
|
|
|
|
cs->rla_c_dbm, bargraph(cs->rla_c_dbm / 2, -55, -24));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* loop through all neighbour cells and select best cell */
|
|
|
|
llist_for_each_entry(nb, &cs->nb_list, entry) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Checking cell of ARFCN %s for cell "
|
|
|
|
"re-selection.\n", gsm_print_arfcn(nb->arfcn));
|
|
|
|
s = cs->list[arfcn2index(nb->arfcn)].sysinfo;
|
|
|
|
nb->checked_for_resel = 0;
|
|
|
|
nb->suitable_allowable = 0;
|
|
|
|
nb->c12_valid = 1;
|
|
|
|
nb->prio_low = 0;
|
|
|
|
|
|
|
|
if (nb->state == GSM322_NB_NOT_SUP) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Skip cell: ARFCN not supported."
|
|
|
|
"\n");
|
|
|
|
if (ms->rrlayer.monitor) {
|
|
|
|
snprintf(arfcn_text, 10, "%s ",
|
|
|
|
gsm_print_arfcn(nb->arfcn));
|
|
|
|
arfcn_text[9] = '\0';
|
|
|
|
vty_notify(ms, "MON: nb %2d %s ARFCN not "
|
|
|
|
"supported\n", i + 1, arfcn_text);
|
|
|
|
}
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
/* check if we have successfully read BCCH */
|
|
|
|
if (!s || nb->state != GSM322_NB_SYSINFO) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Skip cell: There are no system "
|
2019-10-13 17:10:52 +00:00
|
|
|
"information available.\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (ms->rrlayer.monitor) {
|
|
|
|
snprintf(arfcn_text, 10, "%s ",
|
|
|
|
gsm_print_arfcn(nb->arfcn));
|
|
|
|
arfcn_text[9] = '\0';
|
|
|
|
vty_notify(ms, "MON: nb %2d %s "
|
|
|
|
" %4d %s\n",
|
|
|
|
i + 1, arfcn_text, nb->rla_c_dbm,
|
|
|
|
bargraph(nb->rla_c_dbm / 2, -55, -24));
|
|
|
|
}
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get prio */
|
|
|
|
if (s->sp && s->sp_cbq)
|
|
|
|
nb->prio_low = 1;
|
|
|
|
|
|
|
|
/* get C1 & C2 */
|
2019-05-22 19:57:34 +00:00
|
|
|
gsm_arfcn2band_rc(nb->arfcn, &band);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
class = class_of_band(ms, band);
|
|
|
|
nb->c1 = calculate_c1(DNB, nb->rla_c_dbm, s->rxlev_acc_min_db,
|
|
|
|
ms_pwr_dbm(band, s->ms_txpwr_max_cch),
|
|
|
|
ms_class_gmsk_dbm(band, class));
|
|
|
|
nb->c2 = calculate_c2(nb->c1, 0,
|
|
|
|
(cs->last_serving_valid
|
|
|
|
&& cs->last_serving_arfcn == nb->arfcn),
|
|
|
|
s->sp, s->sp_cro, now - nb->created, s->sp_pt,
|
|
|
|
s->sp_to);
|
|
|
|
nb->c12_valid = 1;
|
|
|
|
|
|
|
|
/* calculate CRH depending on LAI */
|
|
|
|
if (cs->sel_mcc == s->mcc && cs->sel_mnc == s->mnc
|
|
|
|
&& cs->sel_lac == s->lac) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "-> Cell of is in the same LA, "
|
|
|
|
"so CRH = 0\n");
|
|
|
|
nb->crh = 0;
|
|
|
|
} else if (any) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "-> Cell of is in a different LA, "
|
|
|
|
"but service is limited, so CRH = 0\n");
|
|
|
|
nb->crh = 0;
|
|
|
|
} else {
|
|
|
|
nb->crh = s->cell_resel_hyst_db;
|
|
|
|
LOGP(DNB, LOGL_INFO, "-> Cell of is in a different LA, "
|
|
|
|
"and service is normal, so CRH = %d\n",
|
|
|
|
nb->crh);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ms->rrlayer.monitor) {
|
|
|
|
snprintf(arfcn_text, 10, "%s ",
|
|
|
|
gsm_print_arfcn(nb->arfcn));
|
|
|
|
arfcn_text[9] = '\0';
|
|
|
|
vty_notify(ms, "MON: nb %2d %s 0x%04x %3d %3d %2d"
|
|
|
|
" %4d %s\n", i + 1, arfcn_text, s->lac,
|
|
|
|
nb->c1, nb->c2, nb->crh, nb->rla_c_dbm,
|
|
|
|
bargraph(nb->rla_c_dbm / 2, -55, -24));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if cell is barred and we don't override */
|
|
|
|
if (s->cell_barr && !(s->sp && s->sp_cbq)) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Skip cell: Cell is barred.\n");
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we have no access to the cell and we don't override */
|
|
|
|
if (!subscr->acc_barr
|
|
|
|
&& !(acc_class & (s->class_barr ^ 0xffff))) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Skip cell: Class is "
|
|
|
|
"barred for our access. (access=%04x "
|
|
|
|
"barred=%04x)\n", acc_class, s->class_barr);
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check if LA is forbidden */
|
|
|
|
if (any && gsm322_is_forbidden_la(ms, s->mcc, s->mnc, s->lac)) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Skip cell: Cell has "
|
|
|
|
"forbidden LA.\n");
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check if we have same PLMN */
|
|
|
|
if (!any && (cs->sel_mcc != s->mcc || cs->sel_mnc != s->mnc)) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Skip cell: PLMN of cell "
|
|
|
|
"does not match target PLMN. (cell: mcc=%s "
|
|
|
|
"mnc=%s)\n", gsm_print_mcc(s->mcc),
|
|
|
|
gsm_print_mnc(s->mnc));
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check criterion C1 */
|
|
|
|
if (nb->c1 < 0) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Skip cell: C1 criterion "
|
|
|
|
" (>0) not met. (C1 = %d)\n", nb->c1);
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we can use this cell, if it is better */
|
|
|
|
nb->suitable_allowable = 1;
|
|
|
|
|
|
|
|
/* check priority */
|
|
|
|
if (!cs->prio_low && nb->prio_low) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Skip cell: cell has low "
|
|
|
|
"priority, but serving cell has normal "
|
|
|
|
"prio.\n");
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
if (cs->prio_low && !nb->prio_low) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Found cell: cell has normal "
|
|
|
|
"priority, but serving cell has low prio.\n");
|
|
|
|
reselect = 1;
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find better cell */
|
|
|
|
if (nb->c2 - nb->crh > cs->c2) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Found cell: cell is better "
|
|
|
|
"than serving cell.\n");
|
|
|
|
reselect = 1;
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
cont:
|
|
|
|
if (++i == GSM58_NB_NUMBER)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!i) {
|
|
|
|
if (ms->rrlayer.monitor)
|
|
|
|
vty_notify(ms, "MON: no neighbour cells\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cs->resel_when + GSM58_RESEL_THRESHOLD >= now) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Found better neighbour cell, but "
|
|
|
|
"reselection threshold not reached.\n");
|
|
|
|
reselect = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reselect && set->stick) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Don't trigger cell re-selection, because "
|
|
|
|
"we stick to serving cell.\n");
|
|
|
|
reselect = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return reselect;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* select a suitable and allowable cell */
|
|
|
|
static int gsm322_nb_scan(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm_settings *set = &ms->settings;
|
|
|
|
int i = 0;
|
|
|
|
struct gsm322_neighbour *nb, *best_nb_low = NULL, *best_nb_normal = 0;
|
|
|
|
int16_t best_low = -32768, best_normal = -32768;
|
|
|
|
|
|
|
|
if (set->stick) {
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "Do not re-select cell, because we stick "
|
|
|
|
" to a cell.\n");
|
|
|
|
goto no_cell_found;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!cs->c12_valid) {
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "Do not re-select cell, because there "
|
|
|
|
" are no valid C1 and C2.\n");
|
|
|
|
goto no_cell_found;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* loop through all neighbour cells and select best cell */
|
|
|
|
llist_for_each_entry(nb, &cs->nb_list, entry) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Checking cell with ARFCN %s for cell "
|
|
|
|
"re-selection. (C2 = %d)\n", gsm_print_arfcn(nb->arfcn),
|
|
|
|
nb->c2);
|
|
|
|
/* track which cells have been checked do far */
|
|
|
|
if (nb->checked_for_resel) {
|
2019-10-13 17:10:52 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Skip cell: already tried to "
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
"select.\n");
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check if we can use this cell */
|
|
|
|
if (!nb->suitable_allowable) {
|
|
|
|
LOGP(DCS, LOGL_INFO, "Skip cell: not suitable and/or "
|
|
|
|
"allowable.\n");
|
|
|
|
goto cont;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check if cell is "better" */
|
|
|
|
if (nb->prio_low) {
|
|
|
|
if (nb->c2 - nb->crh > best_low) {
|
|
|
|
best_low = nb->c2 - nb->crh;
|
|
|
|
best_nb_low = nb;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (nb->c2 - nb->crh > best_normal) {
|
|
|
|
best_normal = nb->c2 - nb->crh;
|
|
|
|
best_nb_normal = nb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cont:
|
|
|
|
if (++i == GSM58_NB_NUMBER)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
nb = NULL;
|
|
|
|
if (best_nb_normal) {
|
|
|
|
nb = best_nb_normal;
|
|
|
|
LOGP(DCS, LOGL_INFO, "Best neighbour cell with ARFCN %s "
|
|
|
|
"selected. (normal priority)\n",
|
|
|
|
gsm_print_arfcn(nb->arfcn));
|
|
|
|
}
|
|
|
|
if (best_nb_low) {
|
|
|
|
nb = best_nb_low;
|
|
|
|
LOGP(DCS, LOGL_INFO, "Best neighbour cell with ARFCN %s "
|
|
|
|
"selected. (low priority)\n",
|
|
|
|
gsm_print_arfcn(nb->arfcn));
|
|
|
|
}
|
|
|
|
if (!nb) {
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
|
|
|
LOGP(DCS, LOGL_INFO, "No (more) acceptable neighbour cell "
|
|
|
|
"available\n");
|
|
|
|
|
|
|
|
no_cell_found:
|
|
|
|
/* Tell cell selection process to handle "no cell found". */
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_NO_CELL_FOUND);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_cs_sendmsg(ms, nmsg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
nb->checked_for_resel = 1;
|
|
|
|
|
|
|
|
/* NOTE: We might already have system information from previous
|
2019-10-13 17:10:52 +00:00
|
|
|
* scan. But we need recent information, so we scan again!
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Tune to frequency for a while, to receive broadcasts. */
|
|
|
|
cs->arfcn = nb->arfcn;
|
|
|
|
cs->arfci = arfcn2index(cs->arfcn);
|
|
|
|
LOGP(DCS, LOGL_DEBUG, "Scanning ARFCN %s of neighbour "
|
|
|
|
"cell during cell reselection.\n", gsm_print_arfcn(cs->arfcn));
|
|
|
|
/* Allocate/clean system information. */
|
|
|
|
cs->list[cs->arfci].flags &= ~GSM322_CS_FLAG_SYSINFO;
|
|
|
|
if (cs->list[cs->arfci].sysinfo)
|
|
|
|
memset(cs->list[cs->arfci].sysinfo, 0,
|
|
|
|
sizeof(struct gsm48_sysinfo));
|
|
|
|
else
|
2017-05-17 00:17:43 +00:00
|
|
|
cs->list[cs->arfci].sysinfo = talloc_zero(ms,
|
|
|
|
struct gsm48_sysinfo);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (!cs->list[cs->arfci].sysinfo)
|
|
|
|
exit(-ENOMEM);
|
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
return gsm322_sync_to_cell(cs, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start/modify measurement process with the current list of neighbour cells.
|
|
|
|
* only do that if: 1. we are camping 2. we are on serving cell */
|
|
|
|
static int gsm322_nb_start(struct osmocom_ms *ms, int synced)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm48_sysinfo *s = &cs->sel_si;
|
|
|
|
struct gsm322_neighbour *nb, *nb2;
|
|
|
|
int i, num;
|
|
|
|
uint8_t map[128];
|
|
|
|
uint16_t nc[32];
|
|
|
|
uint8_t changed = 0;
|
|
|
|
int refer_pcs, index;
|
|
|
|
uint16_t arfcn;
|
|
|
|
|
|
|
|
if (cs->ms->settings.no_neighbour)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (synced)
|
|
|
|
cs->nb_meas_set = 0;
|
|
|
|
|
|
|
|
refer_pcs = gsm_refer_pcs(cs->sel_arfcn, s);
|
|
|
|
|
|
|
|
/* remove all neighbours that are not in list anymore */
|
|
|
|
memset(map, 0, sizeof(map));
|
|
|
|
llist_for_each_entry_safe(nb, nb2, &cs->nb_list, entry) {
|
|
|
|
i = nb->arfcn & 1023;
|
|
|
|
map[i >> 3] |= (1 << (i & 7));
|
|
|
|
#ifndef TEST_INCLUDE_SERV
|
|
|
|
if (!(s->freq[i].mask & FREQ_TYPE_NCELL)) {
|
|
|
|
#else
|
|
|
|
if (!(s->freq[i].mask & (FREQ_TYPE_NCELL | FREQ_TYPE_SERV))) {
|
|
|
|
#endif
|
|
|
|
LOGP(DNB, LOGL_INFO, "Removing neighbour cell %s from "
|
|
|
|
"list.\n", gsm_print_arfcn(nb->arfcn));
|
|
|
|
gsm322_nb_free(nb);
|
|
|
|
changed = 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
#ifndef TEST_INCLUDE_SERV
|
|
|
|
if (nb->arfcn == cs->sel_arfcn) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Removing serving cell %s (former "
|
|
|
|
"neighbour cell).\n",
|
|
|
|
gsm_print_arfcn(nb->arfcn));
|
|
|
|
gsm322_nb_free(nb);
|
|
|
|
changed = 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* add missing entries to list */
|
|
|
|
for (i = 0; i <= 1023; i++) {
|
|
|
|
#ifndef TEST_INCLUDE_SERV
|
|
|
|
if ((s->freq[i].mask & FREQ_TYPE_NCELL) &&
|
|
|
|
!(map[i >> 3] & (1 << (i & 7)))) {
|
|
|
|
#else
|
|
|
|
if ((s->freq[i].mask & (FREQ_TYPE_NCELL | FREQ_TYPE_SERV)) &&
|
|
|
|
!(map[i >> 3] & (1 << (i & 7)))) {
|
|
|
|
#endif
|
|
|
|
index = i;
|
|
|
|
if (refer_pcs && i >= 512 && i <= 810)
|
|
|
|
index = i-512+1024;
|
|
|
|
arfcn = index2arfcn(index);
|
|
|
|
#ifndef TEST_INCLUDE_SERV
|
|
|
|
if (arfcn == cs->sel_arfcn) {
|
|
|
|
LOGP(DNB, LOGL_INFO, "Omitting serving cell %s."
|
|
|
|
"\n", gsm_print_arfcn(cs->arfcn));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
nb = gsm322_nb_alloc(cs, arfcn);
|
|
|
|
LOGP(DNB, LOGL_INFO, "Adding neighbour cell %s to "
|
|
|
|
"list.\n", gsm_print_arfcn(nb->arfcn));
|
|
|
|
if (!(cs->list[index].flags & GSM322_CS_FLAG_SUPPORT))
|
|
|
|
nb->state = GSM322_NB_NOT_SUP;
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if nothing has changed, we are done */
|
|
|
|
if (!changed && cs->nb_meas_set)
|
|
|
|
return 0;
|
|
|
|
|
2019-10-13 17:10:52 +00:00
|
|
|
/* start neighbour cell measurement task */
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
num = 0;
|
|
|
|
llist_for_each_entry(nb, &cs->nb_list, entry) {
|
|
|
|
if (nb->state == GSM322_NB_NOT_SUP)
|
|
|
|
continue;
|
|
|
|
/* it should not happen that there are more than 32 nb-cells */
|
|
|
|
if (num == 32)
|
|
|
|
break;
|
|
|
|
nc[num] = nb->arfcn;
|
|
|
|
num++;
|
|
|
|
}
|
|
|
|
LOGP(DNB, LOGL_INFO, "Sending list of neighbour cells to layer1.\n");
|
|
|
|
l1ctl_tx_neigh_pm_req(ms, num, nc);
|
|
|
|
cs->nb_meas_set = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* a complete set of measurements are received, calculate the RLA_C, sort */
|
|
|
|
static int gsm322_nb_trigger_event(struct gsm322_cellsel *cs)
|
|
|
|
{
|
|
|
|
struct osmocom_ms *ms = cs->ms;
|
|
|
|
struct gsm322_neighbour *nb, *nb_sync = NULL, *nb_again = NULL;
|
|
|
|
int i = 0;
|
|
|
|
time_t now;
|
|
|
|
|
|
|
|
time(&now);
|
|
|
|
|
|
|
|
/* check the list for reading neighbour cell's BCCH */
|
|
|
|
llist_for_each_entry(nb, &cs->nb_list, entry) {
|
2012-11-22 15:00:33 +00:00
|
|
|
if (nb->rla_c_dbm >= cs->ms->settings.min_rxlev_dbm) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/* select the strongest unsynced cell */
|
|
|
|
if (nb->state == GSM322_NB_RLA_C) {
|
|
|
|
nb_sync = nb;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
if (nb->state == GSM322_NB_SYSINFO) {
|
|
|
|
printf("%d time to sync again: %u\n", nb->arfcn, now + GSM58_READ_AGAIN - nb->when);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/* select the strongest cell to be read/try again */
|
|
|
|
if (!nb_again) {
|
|
|
|
if ((nb->state == GSM322_NB_NO_SYNC
|
|
|
|
|| nb->state == GSM322_NB_NO_BCCH)
|
|
|
|
&& nb->when + GSM58_TRY_AGAIN <= now)
|
|
|
|
nb_again = nb;
|
|
|
|
else
|
|
|
|
if (nb->state == GSM322_NB_SYSINFO
|
|
|
|
&& nb->when + GSM58_READ_AGAIN <= now)
|
|
|
|
nb_again = nb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (++i == GSM58_NB_NUMBER)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* trigger sync to neighbour cell, priorize the untested cell */
|
|
|
|
if (nb_sync || nb_again) {
|
|
|
|
if (nb_sync) {
|
|
|
|
nb = nb_sync;
|
|
|
|
cs->arfcn = nb->arfcn;
|
|
|
|
cs->arfci = arfcn2index(cs->arfcn);
|
|
|
|
LOGP(DNB, LOGL_INFO, "Syncing to new neighbour cell "
|
|
|
|
"%s.\n", gsm_print_arfcn(cs->arfcn));
|
|
|
|
} else {
|
|
|
|
nb = nb_again;
|
|
|
|
cs->arfcn = nb->arfcn;
|
|
|
|
cs->arfci = arfcn2index(cs->arfcn);
|
|
|
|
LOGP(DNB, LOGL_INFO, "Syncing again to neighbour cell "
|
|
|
|
"%s after timerout.\n",
|
|
|
|
gsm_print_arfcn(cs->arfcn));
|
|
|
|
}
|
|
|
|
/* Allocate/clean system information. */
|
|
|
|
cs->list[cs->arfci].flags &= ~GSM322_CS_FLAG_SYSINFO;
|
|
|
|
if (cs->list[cs->arfci].sysinfo)
|
|
|
|
memset(cs->list[cs->arfci].sysinfo, 0,
|
|
|
|
sizeof(struct gsm48_sysinfo));
|
|
|
|
else
|
2017-05-17 00:17:43 +00:00
|
|
|
cs->list[cs->arfci].sysinfo = talloc_zero(ms,
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
struct gsm48_sysinfo);
|
|
|
|
if (!cs->list[cs->arfci].sysinfo)
|
|
|
|
exit(-ENOMEM);
|
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
|
|
|
cs->sync_retries = SYNC_RETRIES;
|
|
|
|
return gsm322_sync_to_cell(cs, nb, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gsm322_nb_check(ms, (cs->state == GSM322_C7_CAMPED_ANY_CELL)) > 0) {
|
|
|
|
struct msgb *nmsg;
|
|
|
|
|
|
|
|
LOGP(DNB, LOGL_INFO, "Better neighbour cell triggers cell "
|
|
|
|
"reselection.\n");
|
|
|
|
|
|
|
|
if (ms->rrlayer.monitor)
|
|
|
|
vty_notify(ms, "MON: trigger cell re-selection: "
|
|
|
|
"better cell\n");
|
|
|
|
|
|
|
|
cs->resel_when = now;
|
|
|
|
|
|
|
|
/* unset selected cell */
|
|
|
|
gsm322_unselect_cell(cs);
|
|
|
|
|
|
|
|
nmsg = gsm322_msgb_alloc(GSM322_EVENT_CELL_RESEL);
|
|
|
|
if (!nmsg)
|
|
|
|
return -ENOMEM;
|
|
|
|
gsm322_c_event(ms, nmsg);
|
|
|
|
msgb_free(nmsg);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cs->neighbour) {
|
|
|
|
cs->arfcn = cs->sel_arfcn;
|
|
|
|
cs->arfci = arfcn2index(cs->arfcn);
|
|
|
|
cs->si = cs->list[cs->arfci].sysinfo;
|
|
|
|
if (!cs->si) {
|
2017-11-15 08:52:26 +00:00
|
|
|
LOGP(DNB, LOGL_FATAL, "No SI after neighbour scan, please fix!\n");
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
exit(0L);
|
|
|
|
}
|
|
|
|
LOGP(DNB, LOGL_INFO, "Syncing back to serving cell\n");
|
|
|
|
cs->sync_retries = SYNC_RETRIES_SERVING;
|
|
|
|
return gsm322_sync_to_cell(cs, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do nothing */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* we (successfully) synced to a neighbour */
|
|
|
|
static int gsm322_nb_synced(struct gsm322_cellsel *cs, int yes)
|
|
|
|
{
|
|
|
|
time_t now;
|
|
|
|
|
|
|
|
LOGP(DNB, LOGL_INFO, "%s to neighbour cell %d.\n",
|
|
|
|
(yes) ? "Synced" : "Failed to sync", cs->arfcn);
|
|
|
|
|
|
|
|
if (yes) {
|
|
|
|
start_cs_timer(cs, GSM322_NB_TIMEOUT, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
cs->neighbour->state = GSM322_NB_NO_SYNC;
|
|
|
|
time(&now);
|
|
|
|
cs->neighbour->when = now;
|
|
|
|
|
|
|
|
return gsm322_nb_trigger_event(cs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we (successfully) read the neighbour */
|
|
|
|
static int gsm322_nb_read(struct gsm322_cellsel *cs, int yes)
|
|
|
|
{
|
|
|
|
time_t now;
|
|
|
|
|
|
|
|
LOGP(DNB, LOGL_INFO, "%s from neighbour cell %d (rxlev %s).\n",
|
|
|
|
(yes) ? "Read" : "Failed to read",
|
|
|
|
cs->arfcn, gsm_print_rxlev(cs->list[cs->arfci].rxlev));
|
|
|
|
|
|
|
|
cs->neighbour->state = (yes) ? GSM322_NB_SYSINFO : GSM322_NB_NO_BCCH;
|
|
|
|
time(&now);
|
|
|
|
cs->neighbour->when = now;
|
|
|
|
|
|
|
|
return gsm322_nb_trigger_event(cs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* a complete set of measurements are received, calculate the RLA_C, sort */
|
|
|
|
static int gsm322_nb_new_rxlev(struct gsm322_cellsel *cs)
|
|
|
|
{
|
|
|
|
struct gsm322_neighbour *nb, *strongest_nb;
|
|
|
|
int i = 0;
|
|
|
|
int8_t strongest;
|
|
|
|
struct llist_head sorted;
|
|
|
|
struct llist_head *lh, *lh2;
|
|
|
|
struct gsm48_sysinfo *s = &cs->sel_si;
|
2019-05-22 19:57:34 +00:00
|
|
|
enum gsm_band band;
|
|
|
|
int class;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
2019-05-22 19:57:34 +00:00
|
|
|
gsm_arfcn2band_rc(cs->arfcn, &band);
|
|
|
|
class = class_of_band(cs->ms, band);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
|
|
|
|
/* calculate the RAL_C of serving cell */
|
|
|
|
if (cs->rxlev_count) {
|
2012-11-22 15:00:33 +00:00
|
|
|
cs->rla_c_dbm = (cs->rxlev_sum_dbm + (cs->rxlev_count / 2))
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/ cs->rxlev_count;
|
2012-11-22 15:00:33 +00:00
|
|
|
cs->rxlev_sum_dbm = 0;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->rxlev_count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOGP(DNB, LOGL_INFO, "RLA_C of serving cell: %d\n", cs->rla_c_dbm);
|
|
|
|
|
|
|
|
/* calculate C1 criterion, SI 3 carries complete neighbour cell info */
|
|
|
|
cs->prio_low = 0;
|
|
|
|
if (s && (s->si3 || s->si4)) {
|
|
|
|
cs->c1 = calculate_c1(DNB, cs->rla_c_dbm, s->rxlev_acc_min_db,
|
|
|
|
ms_pwr_dbm(band, s->ms_txpwr_max_cch),
|
|
|
|
ms_class_gmsk_dbm(band, class));
|
|
|
|
cs->c2 = calculate_c2(cs->c1, 1, 0, s->sp, s->sp_cro, 0, s->sp_pt, s->sp_to);
|
|
|
|
cs->c12_valid = 1;
|
|
|
|
|
|
|
|
if (s->sp && s->sp_cbq)
|
|
|
|
cs->prio_low = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* calculate the RAL_C of neighbours */
|
|
|
|
llist_for_each_entry(nb, &cs->nb_list, entry) {
|
|
|
|
if (nb->state == GSM322_NB_NOT_SUP)
|
|
|
|
continue;
|
|
|
|
/* if sysinfo is gone due to scanning, mark neighbour as
|
|
|
|
* unscanned. */
|
|
|
|
if (nb->state == GSM322_NB_SYSINFO) {
|
|
|
|
if (!cs->list[arfcn2index(nb->arfcn)].sysinfo) {
|
|
|
|
nb->state = GSM322_NB_NO_BCCH;
|
|
|
|
nb->when = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nb->rla_c_dbm =
|
2012-11-22 15:00:33 +00:00
|
|
|
(nb->rxlev_sum_dbm + (nb->rxlev_count / 2))
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
/ nb->rxlev_count;
|
|
|
|
nb->rxlev_count = 0;
|
2012-11-22 15:00:33 +00:00
|
|
|
nb->rxlev_sum_dbm = 0;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (nb->state == GSM322_NB_NEW)
|
|
|
|
nb->state = GSM322_NB_RLA_C;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sort the 6 strongest */
|
|
|
|
INIT_LLIST_HEAD(&sorted);
|
|
|
|
|
|
|
|
/* detach up to 6 of the strongest neighbour cells from list and put
|
|
|
|
* them in the "sorted" list */
|
|
|
|
while (!llist_empty(&cs->nb_list)) {
|
|
|
|
strongest = -128;
|
|
|
|
strongest_nb = NULL;
|
|
|
|
llist_for_each_entry(nb, &cs->nb_list, entry) {
|
|
|
|
if (nb->state == GSM322_NB_NOT_SUP)
|
|
|
|
continue;
|
|
|
|
if (nb->rla_c_dbm > strongest) {
|
|
|
|
strongest = nb->rla_c_dbm;
|
|
|
|
strongest_nb = nb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strongest_nb == NULL) /* this should not happen */
|
|
|
|
break;
|
|
|
|
LOGP(DNB, LOGL_INFO, "#%d ARFCN=%d RLA_C=%d\n",
|
|
|
|
i+1, strongest_nb->arfcn, strongest_nb->rla_c_dbm);
|
|
|
|
llist_del(&strongest_nb->entry);
|
|
|
|
llist_add(&strongest_nb->entry, &sorted);
|
|
|
|
if (++i == GSM58_NB_NUMBER)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* take the sorted list and attat it to the head of the neighbour cell
|
|
|
|
* list */
|
|
|
|
llist_for_each_safe(lh, lh2, &sorted) {
|
|
|
|
llist_del(lh);
|
|
|
|
llist_add(lh, &cs->nb_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
return gsm322_nb_trigger_event(cs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* accumulate the measurement results and check if there is a complete set for
|
|
|
|
* all neighbour cells received. */
|
|
|
|
static int gsm322_nb_meas_ind(struct osmocom_ms *ms, uint16_t arfcn,
|
|
|
|
uint8_t rx_lev)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct gsm322_neighbour *nb;
|
|
|
|
int enough_results = 1, result = 0;
|
|
|
|
|
|
|
|
llist_for_each_entry(nb, &cs->nb_list, entry) {
|
|
|
|
if (nb->state == GSM322_NB_NOT_SUP)
|
|
|
|
continue;
|
|
|
|
if (arfcn != nb->arfcn) {
|
|
|
|
if (nb->rxlev_count < RLA_C_NUM)
|
|
|
|
enough_results = 0;
|
|
|
|
continue;
|
|
|
|
}
|
2012-11-22 15:00:33 +00:00
|
|
|
nb->rxlev_sum_dbm += rx_lev - 110;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
nb->rxlev_count++;
|
|
|
|
LOGP(DNB, LOGL_INFO, "Measurement result for ARFCN %s: %d\n",
|
|
|
|
gsm_print_arfcn(arfcn), rx_lev - 110);
|
|
|
|
|
|
|
|
if (nb->rxlev_count < RLA_C_NUM)
|
|
|
|
enough_results = 0;
|
|
|
|
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!result)
|
|
|
|
LOGP(DNB, LOGL_INFO, "Measurement result for ARFCN %s not "
|
|
|
|
"requested. (not a bug)\n", gsm_print_arfcn(arfcn));
|
|
|
|
|
|
|
|
if (enough_results)
|
|
|
|
return gsm322_nb_new_rxlev(cs);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int gsm322_meas(struct osmocom_ms *ms, uint8_t rx_lev)
|
|
|
|
{
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
|
|
|
|
if (cs->neighbour)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2012-11-22 15:00:33 +00:00
|
|
|
cs->rxlev_sum_dbm += rx_lev - 110;
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
cs->rxlev_count++;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/*
|
|
|
|
* dump lists
|
|
|
|
*/
|
|
|
|
|
|
|
|
int gsm322_dump_sorted_plmn(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_plmn_list *temp;
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "MCC |MNC |allowed|rx-lev\n");
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "-------+-------+-------+-------\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
llist_for_each_entry(temp, &plmn->sorted_plmn, entry) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DPLMN, LOGL_INFO, "%s |%s%s |%s |%s\n",
|
|
|
|
gsm_print_mcc(temp->mcc), gsm_print_mnc(temp->mnc),
|
2010-06-20 11:19:06 +00:00
|
|
|
((temp->mnc & 0x00f) == 0x00f) ? " ":"",
|
2010-07-15 17:11:36 +00:00
|
|
|
(temp->cause) ? "no ":"yes",
|
|
|
|
gsm_print_rxlev(temp->rxlev));
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-09 16:01:49 +00:00
|
|
|
int gsm322_dump_cs_list(struct gsm322_cellsel *cs, uint8_t flags,
|
|
|
|
void (*print)(void *, const char *, ...), void *priv)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
2010-05-21 15:52:11 +00:00
|
|
|
int i;
|
2010-05-04 09:48:51 +00:00
|
|
|
struct gsm48_sysinfo *s;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
print(priv, "ARFCN |MCC |MNC |LAC |cell ID|forb.LA|prio |"
|
2010-07-15 17:11:36 +00:00
|
|
|
"min-db |max-pwr|rx-lev\n");
|
2010-05-21 15:52:11 +00:00
|
|
|
print(priv, "-------+-------+-------+-------+-------+-------+-------+"
|
|
|
|
"-------+-------+-------\n");
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-05-04 09:48:51 +00:00
|
|
|
s = cs->list[i].sysinfo;
|
|
|
|
if (!s || !(cs->list[i].flags & flags))
|
2010-04-25 16:28:24 +00:00
|
|
|
continue;
|
2011-03-16 08:52:01 +00:00
|
|
|
if (i >= 1024)
|
|
|
|
print(priv, "%4dPCS|", i-1024+512);
|
|
|
|
else if (i >= 512 && i <= 885)
|
|
|
|
print(priv, "%4dDCS|", i);
|
|
|
|
else
|
|
|
|
print(priv, "%4d |", i);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
if (s->mcc) {
|
2010-06-20 11:19:06 +00:00
|
|
|
print(priv, "%s |%s%s |", gsm_print_mcc(s->mcc),
|
|
|
|
gsm_print_mnc(s->mnc),
|
|
|
|
((s->mnc & 0x00f) == 0x00f) ? " ":"");
|
2010-05-21 15:52:11 +00:00
|
|
|
print(priv, "0x%04x |0x%04x |", s->lac, s->cell_id);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
} else
|
|
|
|
print(priv, "n/a |n/a |n/a |n/a |");
|
|
|
|
if ((cs->list[i].flags & GSM322_CS_FLAG_SYSINFO)) {
|
2010-04-25 16:28:24 +00:00
|
|
|
if ((cs->list[i].flags & GSM322_CS_FLAG_FORBIDD))
|
2010-05-09 16:01:49 +00:00
|
|
|
print(priv, "yes |");
|
2010-04-25 16:28:24 +00:00
|
|
|
else
|
2010-05-09 16:01:49 +00:00
|
|
|
print(priv, "no |");
|
2010-04-25 16:28:24 +00:00
|
|
|
if ((cs->list[i].flags & GSM322_CS_FLAG_BARRED))
|
2010-05-21 15:52:11 +00:00
|
|
|
print(priv, "barred |");
|
2010-05-09 09:40:41 +00:00
|
|
|
else {
|
|
|
|
if (cs->list[i].sysinfo->cell_barr)
|
2010-05-21 15:52:11 +00:00
|
|
|
print(priv, "low |");
|
2010-04-25 16:28:24 +00:00
|
|
|
else
|
2010-05-21 15:52:11 +00:00
|
|
|
print(priv, "normal |");
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
} else
|
|
|
|
print(priv, "n/a |n/a |");
|
|
|
|
if (s->si3 || s->si4)
|
2010-07-15 17:11:36 +00:00
|
|
|
print(priv, "%4d |%4d |%s\n", s->rxlev_acc_min_db,
|
|
|
|
s->ms_txpwr_max_cch,
|
|
|
|
gsm_print_rxlev(cs->list[i].rxlev));
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
else
|
|
|
|
print(priv, "n/a |n/a |n/a\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
2010-05-09 16:01:49 +00:00
|
|
|
print(priv, "\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-13 13:51:30 +00:00
|
|
|
int gsm322_dump_forbidden_la(struct osmocom_ms *ms,
|
|
|
|
void (*print)(void *, const char *, ...), void *priv)
|
2010-04-25 16:28:24 +00:00
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_la_list *temp;
|
|
|
|
|
2010-06-13 13:51:30 +00:00
|
|
|
print(priv, "MCC |MNC |LAC |cause\n");
|
|
|
|
print(priv, "-------+-------+-------+-------\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
llist_for_each_entry(temp, &plmn->forbidden_la, entry)
|
2010-06-20 11:19:06 +00:00
|
|
|
print(priv, "%s |%s%s |0x%04x |#%d\n",
|
|
|
|
gsm_print_mcc(temp->mcc), gsm_print_mnc(temp->mnc),
|
|
|
|
((temp->mnc & 0x00f) == 0x00f) ? " ":"",
|
|
|
|
temp->lac, temp->cause);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-09 17:31:49 +00:00
|
|
|
int gsm322_dump_ba_list(struct gsm322_cellsel *cs, uint16_t mcc, uint16_t mnc,
|
|
|
|
void (*print)(void *, const char *, ...), void *priv)
|
|
|
|
{
|
|
|
|
struct gsm322_ba_list *ba;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
llist_for_each_entry(ba, &cs->ba_list, entry) {
|
|
|
|
if (mcc && mnc && (mcc != ba->mcc || mnc != ba->mnc))
|
|
|
|
continue;
|
2010-07-13 17:08:00 +00:00
|
|
|
print(priv, "Band Allocation of network: MCC %s MNC %s "
|
|
|
|
"(%s, %s)\n", gsm_print_mcc(ba->mcc),
|
|
|
|
gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
|
2010-05-09 17:31:49 +00:00
|
|
|
gsm_get_mnc(ba->mcc, ba->mnc));
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-05-09 17:31:49 +00:00
|
|
|
if ((ba->freq[i >> 3] & (1 << (i & 7))))
|
2011-03-16 08:52:01 +00:00
|
|
|
print(priv, " %s",
|
|
|
|
gsm_print_arfcn(index2arfcn(i)));
|
2010-05-09 17:31:49 +00:00
|
|
|
}
|
|
|
|
print(priv, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
int gsm322_dump_nb_list(struct gsm322_cellsel *cs,
|
|
|
|
void (*print)(void *, const char *, ...), void *priv)
|
|
|
|
{
|
|
|
|
struct gsm48_sysinfo *s;
|
|
|
|
struct gsm322_neighbour *nb;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if (!cs->selected) {
|
|
|
|
print(priv, "No serving cell selected (yet).\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
print(priv, "Serving cell:\n\n");
|
|
|
|
print(priv, "ARFCN=%s ", gsm_print_arfcn(cs->sel_arfcn));
|
|
|
|
print(priv, "RLA_C=%s ", gsm_print_rxlev(cs->rla_c_dbm + 110));
|
|
|
|
if (cs->c12_valid)
|
|
|
|
print(priv, "C1=%d C2=%d ", cs->c1, cs->c1);
|
|
|
|
else
|
|
|
|
print(priv, "C1 - C2 - ");
|
|
|
|
print(priv, "LAC=0x%04x\n\n", (cs->selected) ? cs->sel_si.lac : 0);
|
|
|
|
|
|
|
|
print(priv, "Neighbour cells:\n\n");
|
|
|
|
llist_for_each_entry(nb, &cs->nb_list, entry) {
|
|
|
|
if (i == 0) {
|
|
|
|
print(priv, "# |ARFCN |RLA_C |C1 |C2 |"
|
|
|
|
"CRH |prio |LAC |cell ID|usable |"
|
|
|
|
"state\n");
|
|
|
|
print(priv, "----------------------------------------"
|
|
|
|
"----------------------------------------"
|
|
|
|
"-------\n");
|
|
|
|
} else
|
|
|
|
if (i == GSM58_NB_NUMBER)
|
|
|
|
print(priv, "--- unmonitored cells: ---\n");
|
|
|
|
i++;
|
|
|
|
if (cs->last_serving_valid
|
|
|
|
&& cs->last_serving_arfcn == nb->arfcn)
|
|
|
|
print(priv, "%2d last|", i);
|
|
|
|
else
|
|
|
|
print(priv, "%2d |", i);
|
|
|
|
if ((nb->arfcn & ARFCN_PCS))
|
|
|
|
print(priv, "%4dPCS|", nb->arfcn & 1023);
|
|
|
|
else if (i >= 512 && i <= 885)
|
|
|
|
print(priv, "%4dDCS|", nb->arfcn & 1023);
|
|
|
|
else
|
|
|
|
print(priv, "%4d |", nb->arfcn);
|
|
|
|
if (nb->state == GSM322_NB_NOT_SUP) {
|
|
|
|
print(priv, " ARFCN not supported\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (nb->rla_c_dbm > -128)
|
|
|
|
print(priv, "%6s |",
|
|
|
|
gsm_print_rxlev(nb->rla_c_dbm + 110));
|
|
|
|
else
|
|
|
|
print(priv, "- |");
|
|
|
|
if (nb->state == GSM322_NB_SYSINFO && nb->c12_valid)
|
|
|
|
print(priv, "%4d |%4d |%4d |", nb->c1, nb->c1,
|
|
|
|
nb->crh);
|
|
|
|
else
|
|
|
|
print(priv, "- |- |- |");
|
|
|
|
s = cs->list[arfcn2index(nb->arfcn)].sysinfo;
|
|
|
|
if (nb->state == GSM322_NB_SYSINFO && s) {
|
|
|
|
print(priv, "%s |0x%04x |0x%04x |",
|
|
|
|
(nb->prio_low) ? "low ":"normal", s->lac,
|
|
|
|
s->cell_id);
|
|
|
|
} else
|
|
|
|
print(priv, "- |- |- |");
|
|
|
|
|
|
|
|
print(priv, "%s |",
|
|
|
|
(nb->suitable_allowable) ? "yes" : "no ");
|
|
|
|
print(priv, "%s\n", get_nb_state_name(nb->state));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
print(priv, "No neighbour cells available (yet).\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/*
|
|
|
|
* initialization
|
|
|
|
*/
|
|
|
|
|
|
|
|
int gsm322_init(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
2010-07-13 14:54:55 +00:00
|
|
|
FILE *fp;
|
2017-05-16 23:26:00 +00:00
|
|
|
char *ba_filename;
|
2010-04-29 18:46:11 +00:00
|
|
|
int i;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_ba_list *ba;
|
|
|
|
uint8_t buf[4];
|
2011-03-16 08:52:01 +00:00
|
|
|
char version[32];
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "init PLMN process\n");
|
|
|
|
LOGP(DCS, LOGL_INFO, "init Cell Selection process\n");
|
|
|
|
|
|
|
|
memset(plmn, 0, sizeof(*plmn));
|
|
|
|
memset(cs, 0, sizeof(*cs));
|
|
|
|
plmn->ms = ms;
|
|
|
|
cs->ms = ms;
|
|
|
|
|
|
|
|
/* set initial state */
|
|
|
|
plmn->state = 0;
|
|
|
|
cs->state = 0;
|
|
|
|
|
|
|
|
/* init lists */
|
|
|
|
INIT_LLIST_HEAD(&plmn->event_queue);
|
|
|
|
INIT_LLIST_HEAD(&cs->event_queue);
|
|
|
|
INIT_LLIST_HEAD(&plmn->sorted_plmn);
|
|
|
|
INIT_LLIST_HEAD(&plmn->forbidden_la);
|
|
|
|
INIT_LLIST_HEAD(&cs->ba_list);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
INIT_LLIST_HEAD(&cs->nb_list);
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
/* set supported frequencies in cell selection list */
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++)
|
|
|
|
if ((ms->settings.freq_map[i >> 3] & (1 << (i & 7))))
|
2010-04-25 16:28:24 +00:00
|
|
|
cs->list[i].flags |= GSM322_CS_FLAG_SUPPORT;
|
|
|
|
|
|
|
|
/* read BA list */
|
2017-05-16 23:26:00 +00:00
|
|
|
ba_filename = talloc_asprintf(ms, "%s/%s.ba", config_dir, ms->name);
|
|
|
|
fp = fopen(ba_filename, "r");
|
|
|
|
talloc_free(ba_filename);
|
2010-04-25 16:28:24 +00:00
|
|
|
if (fp) {
|
2010-04-29 18:46:11 +00:00
|
|
|
int rc;
|
2011-03-16 08:52:01 +00:00
|
|
|
char *s_rc;
|
2010-04-29 18:46:11 +00:00
|
|
|
|
2011-03-16 08:52:01 +00:00
|
|
|
s_rc = fgets(version, sizeof(version), fp);
|
|
|
|
version[sizeof(version) - 1] = '\0';
|
|
|
|
if (!s_rc || !!strcmp(ba_version, version)) {
|
2019-10-13 17:10:52 +00:00
|
|
|
LOGP(DCS, LOGL_NOTICE, "BA version mismatch, "
|
2011-03-16 08:52:01 +00:00
|
|
|
"stored BA list becomes obsolete.\n");
|
|
|
|
} else
|
2010-07-13 14:54:55 +00:00
|
|
|
while(!feof(fp)) {
|
2017-05-17 00:17:43 +00:00
|
|
|
ba = talloc_zero(ms, struct gsm322_ba_list);
|
2019-07-21 06:29:34 +00:00
|
|
|
if (!ba) {
|
|
|
|
fclose(fp);
|
2010-04-25 16:28:24 +00:00
|
|
|
return -ENOMEM;
|
2019-07-21 06:29:34 +00:00
|
|
|
}
|
2010-07-13 14:54:55 +00:00
|
|
|
rc = fread(buf, 4, 1, fp);
|
2010-04-29 18:46:11 +00:00
|
|
|
if (!rc) {
|
|
|
|
talloc_free(ba);
|
|
|
|
break;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
ba->mcc = (buf[0] << 8) | buf[1];
|
|
|
|
ba->mnc = (buf[2] << 8) | buf[3];
|
2010-07-13 14:54:55 +00:00
|
|
|
rc = fread(ba->freq, sizeof(ba->freq), 1, fp);
|
2010-04-29 18:46:11 +00:00
|
|
|
if (!rc) {
|
|
|
|
talloc_free(ba);
|
|
|
|
break;
|
|
|
|
}
|
2010-04-25 16:28:24 +00:00
|
|
|
llist_add_tail(&ba->entry, &cs->ba_list);
|
2010-06-20 11:19:06 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Read stored BA list (mcc=%s "
|
|
|
|
"mnc=%s %s, %s)\n", gsm_print_mcc(ba->mcc),
|
|
|
|
gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
|
2010-04-29 18:46:11 +00:00
|
|
|
gsm_get_mnc(ba->mcc, ba->mnc));
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
2010-07-13 14:54:55 +00:00
|
|
|
fclose(fp);
|
2010-04-25 16:28:24 +00:00
|
|
|
} else
|
2010-05-02 17:13:47 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "No stored BA list\n");
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int gsm322_exit(struct osmocom_ms *ms)
|
|
|
|
{
|
|
|
|
struct gsm322_plmn *plmn = &ms->plmn;
|
|
|
|
struct gsm322_cellsel *cs = &ms->cellsel;
|
|
|
|
struct llist_head *lh, *lh2;
|
|
|
|
struct msgb *msg;
|
2010-07-13 14:54:55 +00:00
|
|
|
FILE *fp;
|
2017-05-16 23:26:00 +00:00
|
|
|
char *ba_filename;
|
2010-04-25 16:28:24 +00:00
|
|
|
struct gsm322_ba_list *ba;
|
|
|
|
uint8_t buf[4];
|
2017-05-16 21:23:24 +00:00
|
|
|
int rc = 0;
|
2010-05-02 17:13:47 +00:00
|
|
|
int i;
|
2010-04-25 16:28:24 +00:00
|
|
|
|
|
|
|
LOGP(DPLMN, LOGL_INFO, "exit PLMN process\n");
|
|
|
|
LOGP(DCS, LOGL_INFO, "exit Cell Selection process\n");
|
|
|
|
|
|
|
|
/* stop cell selection process (if any) */
|
|
|
|
new_c_state(cs, GSM322_C0_NULL);
|
|
|
|
|
|
|
|
/* stop timers */
|
|
|
|
stop_cs_timer(cs);
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
stop_any_timer(cs);
|
2010-04-25 16:28:24 +00:00
|
|
|
stop_plmn_timer(plmn);
|
|
|
|
|
2010-05-02 17:13:47 +00:00
|
|
|
/* flush sysinfo */
|
2011-03-16 08:52:01 +00:00
|
|
|
for (i = 0; i <= 1023+299; i++) {
|
2010-05-02 17:13:47 +00:00
|
|
|
if (cs->list[i].sysinfo) {
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
LOGP(DCS, LOGL_DEBUG, "free sysinfo ARFCN=%s\n",
|
2011-03-16 08:52:01 +00:00
|
|
|
gsm_print_arfcn(index2arfcn(i)));
|
2010-05-02 17:13:47 +00:00
|
|
|
talloc_free(cs->list[i].sysinfo);
|
|
|
|
cs->list[i].sysinfo = NULL;
|
2020-02-29 17:39:05 +00:00
|
|
|
cs->si = NULL;
|
2010-05-02 17:13:47 +00:00
|
|
|
}
|
|
|
|
cs->list[i].flags = 0;
|
|
|
|
}
|
2017-11-30 08:51:58 +00:00
|
|
|
cs->si = NULL;
|
2010-05-02 17:13:47 +00:00
|
|
|
|
2010-04-25 16:28:24 +00:00
|
|
|
/* store BA list */
|
2017-05-16 23:26:00 +00:00
|
|
|
ba_filename = talloc_asprintf(ms, "%s/%s.ba", config_dir, ms->name);
|
|
|
|
if (ba_filename) {
|
|
|
|
fp = fopen(ba_filename, "w");
|
|
|
|
talloc_free(ba_filename);
|
|
|
|
if (fp) {
|
|
|
|
fputs(ba_version, fp);
|
|
|
|
llist_for_each_entry(ba, &cs->ba_list, entry) {
|
|
|
|
buf[0] = ba->mcc >> 8;
|
|
|
|
buf[1] = ba->mcc & 0xff;
|
|
|
|
buf[2] = ba->mnc >> 8;
|
|
|
|
buf[3] = ba->mnc & 0xff;
|
|
|
|
|
2019-02-02 08:48:07 +00:00
|
|
|
LOGP(DCS, LOGL_INFO, "Write stored BA list (mcc=%s "
|
|
|
|
"mnc=%s %s, %s)\n", gsm_print_mcc(ba->mcc),
|
|
|
|
gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
|
|
|
|
gsm_get_mnc(ba->mcc, ba->mnc));
|
|
|
|
|
2017-05-16 23:26:00 +00:00
|
|
|
rc += fwrite(buf, 4, 1, fp);
|
|
|
|
rc += fwrite(ba->freq, sizeof(ba->freq), 1, fp);
|
|
|
|
}
|
|
|
|
fclose(fp);
|
2010-04-25 16:28:24 +00:00
|
|
|
}
|
2017-05-16 21:23:24 +00:00
|
|
|
}
|
|
|
|
|
2019-02-02 08:48:07 +00:00
|
|
|
if (rc != 2)
|
2010-04-25 16:28:24 +00:00
|
|
|
LOGP(DCS, LOGL_ERROR, "Failed to write BA list\n");
|
|
|
|
|
|
|
|
/* free lists */
|
|
|
|
while ((msg = msgb_dequeue(&plmn->event_queue)))
|
|
|
|
msgb_free(msg);
|
|
|
|
while ((msg = msgb_dequeue(&cs->event_queue)))
|
|
|
|
msgb_free(msg);
|
|
|
|
llist_for_each_safe(lh, lh2, &plmn->sorted_plmn) {
|
|
|
|
llist_del(lh);
|
|
|
|
talloc_free(lh);
|
|
|
|
}
|
|
|
|
llist_for_each_safe(lh, lh2, &plmn->forbidden_la) {
|
|
|
|
llist_del(lh);
|
|
|
|
talloc_free(lh);
|
|
|
|
}
|
|
|
|
llist_for_each_safe(lh, lh2, &cs->ba_list) {
|
|
|
|
llist_del(lh);
|
|
|
|
talloc_free(lh);
|
|
|
|
}
|
[layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.
The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.
There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.
In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:
enable
monitor network 1 (where '1' is the instance of the MS)
In order to see the current state of the processes, enter:
show ms
2011-07-17 09:12:15 +00:00
|
|
|
llist_for_each_safe(lh, lh2, &cs->nb_list)
|
|
|
|
gsm322_nb_free(container_of(lh, struct gsm322_neighbour,
|
|
|
|
entry));
|
2010-04-25 16:28:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|