aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-11-16 17:12:38 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-11-17 09:46:33 +0100
commitf7d752f7acc0ccee32959ad0586cbbb54b1efaf8 (patch)
tree08acaefa8086ef65ef59d6abde331c2c56d2c257
parent0fef39a8ac17484f42840a898e06923c4989db38 (diff)
[si] Make it possible to set the NECI value...
Allow to configure the NECI value... and change code that is relying on the NECI value.
-rw-r--r--openbsc/include/openbsc/gsm_04_08.h4
-rw-r--r--openbsc/include/openbsc/gsm_data.h1
-rw-r--r--openbsc/src/abis_rsl.c4
-rw-r--r--openbsc/src/bsc_init.c4
-rw-r--r--openbsc/src/gsm_04_08_utils.c8
-rw-r--r--openbsc/src/vty_interface.c12
6 files changed, 25 insertions, 8 deletions
diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h
index 186a53f97..4a3bdc187 100644
--- a/openbsc/include/openbsc/gsm_04_08.h
+++ b/openbsc/include/openbsc/gsm_04_08.h
@@ -724,8 +724,8 @@ void gsm0408_set_reject_cause(int cause);
int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id);
void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc,
u_int16_t mnc, u_int16_t lac);
-enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra);
-enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra);
+enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci);
+enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci);
int gsm48_tx_mm_info(struct gsm_lchan *lchan);
int gsm48_tx_mm_auth_req(struct gsm_lchan *lchan, u_int8_t *rand);
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 3040525c2..c1b7b05ac 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -410,6 +410,7 @@ struct gsm_network {
char *name_short;
enum gsm_auth_policy auth_policy;
int a5_encryption;
+ int neci;
/* layer 4 */
int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg);
diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c
index de0f4845b..2d006030f 100644
--- a/openbsc/src/abis_rsl.c
+++ b/openbsc/src/abis_rsl.c
@@ -1133,8 +1133,8 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
/* determine channel type (SDCCH/TCH_F/TCH_H) based on
* request reference RA */
- lctype = get_ctype_by_chreq(bts, rqd_ref->ra);
- chreq_reason = get_reason_by_chreq(bts, rqd_ref->ra);
+ lctype = get_ctype_by_chreq(bts, rqd_ref->ra, bts->network->neci);
+ chreq_reason = get_reason_by_chreq(bts, rqd_ref->ra, bts->network->neci);
/* check availability / allocate channel */
lchan = lchan_alloc(bts, lctype);
diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c
index bb1e382f0..d11cde578 100644
--- a/openbsc/src/bsc_init.c
+++ b/openbsc/src/bsc_init.c
@@ -956,6 +956,10 @@ static void patch_si_tables(struct gsm_bts *bts)
type_4->cell_sel_par.ms_txpwr_max_ccch =
ms_pwr_ctl_lvl(bts->band, bts->ms_max_power);
+ /* Set NECI to influence channel request */
+ type_3->cell_sel_par.neci = bts->network->neci;
+ type_4->cell_sel_par.neci = bts->network->neci;
+
if (bts->cell_barred) {
type_1->rach_control.cell_bar = 1;
type_2->rach_control.cell_bar = 1;
diff --git a/openbsc/src/gsm_04_08_utils.c b/openbsc/src/gsm_04_08_utils.c
index 2545f33a6..0e242b778 100644
--- a/openbsc/src/gsm_04_08_utils.c
+++ b/openbsc/src/gsm_04_08_utils.c
@@ -302,13 +302,13 @@ static const enum gsm_chreq_reason_t reason_by_chreq[] = {
[CHREQ_T_PAG_R_TCH_FH] = GSM_CHREQ_REASON_PAG,
};
-enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra)
+enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci)
{
int i;
/* FIXME: determine if we set NECI = 0 in the BTS SI4 */
for (i = 0; i < ARRAY_SIZE(chreq_type_neci0); i++) {
- const struct chreq *chr = &chreq_type_neci0[i];
+ const struct chreq *chr = neci ? &chreq_type_neci1[i] : &chreq_type_neci0[i];
if ((ra & chr->mask) == chr->val)
return ctype_by_chreq[chr->type];
}
@@ -316,13 +316,13 @@ enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra)
return GSM_LCHAN_SDCCH;
}
-enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra)
+enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci)
{
int i;
/* FIXME: determine if we set NECI = 0 in the BTS SI4 */
for (i = 0; i < ARRAY_SIZE(chreq_type_neci0); i++) {
- const struct chreq *chr = &chreq_type_neci0[i];
+ const struct chreq *chr = neci ? &chreq_type_neci1[i] : &chreq_type_neci0[i];
if ((ra & chr->mask) == chr->val)
return reason_by_chreq[chr->type];
}
diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c
index 894146b6f..54c9d5c68 100644
--- a/openbsc/src/vty_interface.c
+++ b/openbsc/src/vty_interface.c
@@ -87,6 +87,8 @@ static void net_dump_vty(struct vty *vty, struct gsm_network *net)
gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
VTY_NEWLINE);
+ vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
+ VTY_NEWLINE);
}
DEFUN(show_net, show_net_cmd, "show network",
@@ -789,6 +791,15 @@ DEFUN(cfg_net_encryption,
return CMD_SUCCESS;
}
+DEFUN(cfg_net_neci,
+ cfg_net_neci_cmd,
+ "neci (0|1)",
+ "Set if NECI of cell selection is to be set")
+{
+ gsmnet->neci = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
/* per-BTS configuration */
DEFUN(cfg_bts,
cfg_bts_cmd,
@@ -1228,6 +1239,7 @@ int bsc_vty_init(struct gsm_network *net)
install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
+ install_element(GSMNET_NODE, &cfg_net_neci_cmd);
install_element(GSMNET_NODE, &cfg_bts_cmd);
install_node(&bts_node, config_write_bts);