summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-12-11 16:13:28 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2016-09-25 08:11:43 +0200
commit1f102e49d91974760e6603858d193cd37d85cef2 (patch)
tree25b389a56ceaa4ebea50b8041509d0466f63b2e1
parent6188bdc5481a936a66b7c03e29e53c78a3ba62e7 (diff)
[WIP] HO: VTY test option to fake a better neighbor cell to force handover
The handover is forced by reporting perfect measurement results of a given neighbor cell. All other neighbor cells and the serving cell is reported as poor. The falke report will sustain until the connection is released or a new 'better' cell is specified.
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h3
-rw-r--r--src/host/layer23/src/mobile/gsm48_rr.c46
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c38
3 files changed, 86 insertions, 1 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h b/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
index d0227c6..14b7dc6 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
@@ -193,6 +193,8 @@ struct gsm48_rrlayer {
/* counter for access bursts */
uint16_t hando_new_cell_arfcn;
uint8_t hando_new_cell_bsic;
+ int hando_fake_report; /* perform fake reporting */
+ uint16_t hando_fake_report_arfcn; /* good cell */
/* BA range */
uint8_t ba_ranges;
@@ -231,5 +233,6 @@ int gsm48_rr_tx_voice(struct osmocom_ms *ms, struct msgb *msg);
int gsm48_rr_audio_mode(struct osmocom_ms *ms, uint8_t mode);
int gsm48_rr_meas_ind(struct osmocom_ms *ms, uint16_t band_arfcn,
uint8_t rx_lev, uint8_t bsic);
+const char *gsm48_rr_force_handover(struct osmocom_ms *ms, uint16_t arfcn);
#endif /* _GSM48_RR_H */
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c
index c600d86..2f32d9a 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -363,6 +363,8 @@ static void new_rr_state(struct gsm48_rrlayer *rr, int state)
stop_rr_t_starting(rr);
/* stop handover timer */
stop_rr_t3124(rr);
+ /* stop faking measurement report */
+ rr->hando_fake_report = 0;
}
rr->state = state;
@@ -2830,6 +2832,17 @@ static int gsm48_rr_tx_meas_rep(struct osmocom_ms *ms)
serv_rxqual_full = serv_rxqual_sub = 0; // FIXME
}
+ /* fake serving cell, if wanted */
+ if (rr->hando_fake_report) {
+ struct gsm322_cellsel *cs = &ms->cellsel;
+
+ if (rr->hando_fake_report_arfcn == cs->sel_arfcn)
+ serv_rxlev_full = serv_rxlev_sub = 63; /* -47 dBm */
+ else
+ serv_rxlev_full = serv_rxlev_sub = 10; /* -100 dBm */
+ serv_rxqual_full = serv_rxqual_sub = 0; // quality is ok
+ }
+
memset(&rxlev_nc, 0, sizeof(rxlev_nc));
memset(&bsic_nc, 0, sizeof(bsic_nc));
memset(&bcch_f_nc, 0, sizeof(bcch_f_nc));
@@ -2870,6 +2883,15 @@ static int gsm48_rr_tx_meas_rep(struct osmocom_ms *ms)
rxlev_nc[n] = rrmeas->nc_rxlev_dbm[index] + 110;
bsic_nc[n] = rrmeas->nc_bsic[index];
bcch_f_nc[n] = index;
+
+ /* fake neighbor cell, if wanted */
+ if (rr->hando_fake_report) {
+ if (rr->hando_fake_report_arfcn
+ == rrmeas->nc_arfcn[index])
+ rxlev_nc[n] = 63; /* -47 dBm */
+ else
+ rxlev_nc[n] = 10; /* -100 dBm */
+ }
}
}
@@ -4730,6 +4752,30 @@ static int gsm48_rr_rx_phys_info(struct osmocom_ms *ms, struct msgb *msg)
return gsm48_rr_resume_after_handover(ms);
}
+/* force handover to given ARFCN, by faking measurement report */
+const char *gsm48_rr_force_handover(struct osmocom_ms *ms, uint16_t arfcn)
+{
+ struct gsm48_rrlayer *rr = &ms->rrlayer;
+ struct gsm48_rr_meas *rrmeas = &rr->meas;
+ int i;
+
+ if (rr->state != GSM48_RR_ST_DEDICATED)
+ return "No dedicated connection";
+
+ if (rrmeas->nc_num == 0)
+ return "No Neighbor cells given by BTS";
+
+ for (i = 0; i < rrmeas->nc_num; i++) {
+ if (rrmeas->nc_arfcn[i] == arfcn) {
+ rr->hando_fake_report = 1;
+ rr->hando_fake_report_arfcn = arfcn;
+ return 0;
+ }
+ }
+
+ return "Given ARFCN is not a neighbor cell";
+}
+
/*
* radio ressource requests
*/
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index eda181a..1b6f3a5 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -967,8 +967,11 @@ DEFUN(service, service_cmd, "service MS_NAME (*#06#|*#21#|*#67#|*#61#|*#62#"
return CMD_SUCCESS;
}
+#define TEST_STR "Test functions\n"
+
DEFUN(test_reselection, test_reselection_cmd, "test re-selection NAME",
- "Manually trigger cell re-selection\nName of MS (see \"show ms\")")
+ TEST_STR "Manually trigger cell re-selection\n"
+ "Name of MS (see \"show ms\")")
{
struct osmocom_ms *ms;
struct gsm_settings *set;
@@ -994,6 +997,38 @@ DEFUN(test_reselection, test_reselection_cmd, "test re-selection NAME",
return CMD_SUCCESS;
}
+DEFUN(test_handover, test_handover_cmd, "test handover NAME <0-1024> [pcs]",
+ TEST_STR "Force handover by faking measurement report\n"
+ "Name of MS (see \"show ms\")\nARFCN to be reported best cell\n"
+ "Given frequency is PCS band (1900) rather than DCS band.")
+{
+ struct osmocom_ms *ms;
+ uint16_t arfcn = atoi(argv[1]);
+ const char *err_msg;
+
+ ms = get_ms(argv[0], vty);
+ if (!ms)
+ return CMD_WARNING;
+
+ if (argc > 2) {
+ if (arfcn < 512 || arfcn > 810) {
+ vty_out(vty, "Given ARFCN not in PCS band%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ arfcn |= ARFCN_PCS;
+ }
+
+ err_msg = gsm48_rr_force_handover(ms, arfcn);
+ if (err_msg) {
+ vty_out(vty, "Cannot force handover: %s%s", err_msg,
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN(delete_forbidden_plmn, delete_forbidden_plmn_cmd,
"delete forbidden plmn NAME MCC MNC",
"Delete\nForbidden\nplmn\nName of MS (see \"show ms\")\n"
@@ -2852,6 +2887,7 @@ int ms_vty_init(void)
install_element(ENABLE_NODE, &sms_cmd);
install_element(ENABLE_NODE, &service_cmd);
install_element(ENABLE_NODE, &test_reselection_cmd);
+ install_element(ENABLE_NODE, &test_handover_cmd);
install_element(ENABLE_NODE, &delete_forbidden_plmn_cmd);
#ifdef _HAVE_GPSD