From a43f789a0a124c322146280ab00935b75f505617 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 1 Dec 2009 18:04:30 +0530 Subject: Replace template-based SYSTEM INFORMATION with real implementation Before this commit, OpenBSC used templates for the SYSTEM INFO 1, 2, 3, 4, 5 and 6 messages. Those templates were patched in various places to reflect the network config like ARFCN. Now, we actually generate those SI messages ourselves, using values from the configuration file, and even calculating neighbor cell lists. All bts'es that you have configured in OpenBSC will end up in the neighbor cell list - which should be more than sufficient for the current small-single-site networks. --- openbsc/src/bsc_init.c | 329 ++++++++----------------------------------------- 1 file changed, 52 insertions(+), 277 deletions(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 153e024e4..d21f71a0c 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,6 @@ extern struct gsm_network *bsc_gsmnet; extern int ipacc_rtp_direct; static void patch_nm_tables(struct gsm_bts *bts); -static void patch_si_tables(struct gsm_bts *bts); /* The following definitions are for OM and NM packets that we cannot yet * generate by code but we just pass on */ @@ -667,219 +667,42 @@ int bsc_shutdown_net(struct gsm_network *net) return 0; } -struct bcch_info { - u_int8_t type; - u_int8_t len; - const u_int8_t *data; -}; - -/* -SYSTEM INFORMATION TYPE 1 - Cell channel description - Format-ID bit map 0 - CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 - RACH Control Parameters - maximum 7 retransmissions - 8 slots used to spread transmission - cell not barred for access - call reestablishment not allowed - Access Control Class = 0000 -*/ -static u_int8_t si1[] = { - /* header */0x55, 0x06, 0x19, - /* ccdesc */0x04 /*0x00*/, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*0x01*/, - /* rach */0xD5, 0x04, 0x00, - /* s1 reset*/0x2B -}; - -/* - SYSTEM INFORMATION TYPE 2 - Neighbour Cells Description - EXT-IND: Carries the complete BA - BA-IND = 0 - Format-ID bit map 0 - CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - NCC permitted (NCC) = FF - RACH Control Parameters - maximum 7 retransmissions - 8 slots used to spread transmission - cell not barred for access - call reestablishment not allowed - Access Control Class = 0000 -*/ -static u_int8_t si2[] = { - /* header */0x59, 0x06, 0x1A, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* ncc */0xFF, - /* rach*/0xD5, 0x04, 0x00 -}; - -/* -SYSTEM INFORMATION TYPE 3 - Cell identity = 00001 (1h) - Location area identification - Mobile Country Code (MCC): 001 - Mobile Network Code (MNC): 01 - Location Area Code (LAC): 00001 (1h) - Control Channel Description - Attach-detach: MSs in the cell are not allowed to apply IMSI attach /detach - 0 blocks reserved for access grant - 1 channel used for CCCH, with SDCCH - 5 multiframes period for PAGING REQUEST - Time-out T3212 = 0 - Cell Options BCCH - Power control indicator: not set - MSs shall not use uplink DTX - Radio link timeout = 36 - Cell Selection Parameters - Cell reselect hysteresis = 6 dB RXLEV hysteresis for LA re-selection - max.TX power level MS may use for CCH = 2 <- according to GSM05.05 39dBm (max) - Additional Reselect Parameter Indication (ACS) = only SYSTEM INFO 4: The SI rest octets, if present, shall be used to derive the value of PI and possibly C2 parameters - Half rate support (NECI): New establishment causes are not supported - min.RX signal level for MS = 0 - RACH Control Parameters - maximum 7 retransmissions - 8 slots used to spread transmission - cell not barred for access - call reestablishment not allowed - Access Control Class = 0000 - SI 3 Rest Octets (not present) -*/ -static u_int8_t si3[] = { - /* header */0x49, 0x06, 0x1B, - /* cell */0x00, 0x01, - /* lai */0x00, 0xF1, 0x10, 0x00, 0x01, - /* desc */0x01, 0x03, 0x00, - /* option*/0x28, - /* selection*/0x62, 0x00, - /* rach */0xD5, 0x04, 0x00, - /* rest */ 0x2B, 0x2B, 0x2B, 0x2B -}; - -/* -SYSTEM INFORMATION TYPE 4 - Location area identification - Mobile Country Code (MCC): 001 - Mobile Network Code (MNC): 01 - Location Area Code (LAC): 00001 (1h) - Cell Selection Parameters - Cell reselect hysteresis = 6 dB RXLEV hysteresis for LA re-selection - max.TX power level MS may use for CCH = 2 - Additional Reselect Parameter Indication (ACS) = only SYSTEM INFO 4: The SI rest octets, if present, shall be used to derive the value of PI and possibly C2 parameters - Half rate support (NECI): New establishment causes are not supported - min.RX signal level for MS = 0 - RACH Control Parameters - maximum 7 retransmissions - 8 slots used to spread transmission - cell not barred for access - call reestablishment not allowed - Access Control Class = 0000 - CBCH Channel Description - Type = SDCCH/4[2] - Timeslot Number: 0 - Training Sequence Code: 7h - ARFCN: 1 - SI Rest Octets (not present) -*/ -static u_int8_t si4[] = { - /* header */0x41, 0x06, 0x1C, - /* lai */0x00, 0xF1, 0x10, 0x00, 0x01, - /* sel */0x62, 0x00, - /* rach*/0xD5, 0x04, 0x00, - /* cbch chan desc */ 0x64, 0x30, 0xE0, HARDCODED_ARFCN/*0x01*/, - /* rest octets */ 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B -}; - -/* - SYSTEM INFORMATION TYPE 5 - Neighbour Cells Description - EXT-IND: Carries the complete BA - BA-IND = 0 - Format-ID bit map 0 - CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -*/ - -static u_int8_t si5[] = { - /* header without l2 len*/0x06, 0x1D, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -// SYSTEM INFORMATION TYPE 6 - -/* -SACCH FILLING - System Info Type: SYSTEM INFORMATION 6 - L3 Information (Hex): 06 1E 00 01 xx xx 10 00 01 28 FF - -SYSTEM INFORMATION TYPE 6 - Cell identity = 00001 (1h) - Location area identification - Mobile Country Code (MCC): 001 - Mobile Network Code (MNC): 01 - Location Area Code (LAC): 00001 (1h) - Cell Options SACCH - Power control indicator: not set - MSs shall not use uplink DTX on a TCH-F. MS shall not use uplink DTX on TCH-H. - Radio link timeout = 36 - NCC permitted (NCC) = FF -*/ - -static u_int8_t si6[] = { - /* header */0x06, 0x1E, - /* cell id*/ 0x00, 0x01, - /* lai */ 0x00, 0xF1, 0x10, 0x00, 0x01, - /* options */ 0x28, - /* ncc */ 0xFF, -}; - - - -static const struct bcch_info bcch_infos[] = { - { - .type = RSL_SYSTEM_INFO_1, - .len = sizeof(si1), - .data = si1, - }, { - .type = RSL_SYSTEM_INFO_2, - .len = sizeof(si2), - .data = si2, - }, { - .type = RSL_SYSTEM_INFO_3, - .len = sizeof(si3), - .data = si3, - }, { - .type = RSL_SYSTEM_INFO_4, - .len = sizeof(si4), - .data = si4, - }, -}; - -static_assert(sizeof(si1) == sizeof(struct gsm48_system_information_type_1), type1) -static_assert(sizeof(si2) == sizeof(struct gsm48_system_information_type_2), type2) -static_assert(sizeof(si3) == sizeof(struct gsm48_system_information_type_3), type3) -static_assert(sizeof(si4) >= sizeof(struct gsm48_system_information_type_4), type4) -static_assert(sizeof(si5) == sizeof(struct gsm48_system_information_type_5), type5) -static_assert(sizeof(si6) >= sizeof(struct gsm48_system_information_type_6), type6) - /* set all system information types */ static int set_system_infos(struct gsm_bts_trx *trx) { - int i; + int i, rc; + u_int8_t si_tmp[23]; if (trx == trx->bts->c0) { - for (i = 0; i < ARRAY_SIZE(bcch_infos); i++) { - rsl_bcch_info(trx, bcch_infos[i].type, - bcch_infos[i].data, - bcch_infos[i].len); + for (i = 1; i <= 4; i++) { + rc = gsm_generate_si(si_tmp, trx->bts, i); + if (rc < 0) + goto err_out; + rsl_bcch_info(trx, i, si_tmp, sizeof(si_tmp)); } } - rsl_sacch_filling(trx, RSL_SYSTEM_INFO_5, si5, sizeof(si5)); - rsl_sacch_filling(trx, RSL_SYSTEM_INFO_6, si6, sizeof(si6)); +#ifdef GPRS + rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_13); + if (rc < 0) + goto err_out; + rsl_bcch_info(trx, RSL_SYSTEM_INFO_13, si_tmp, rc); +#endif + rc = gsm_generate_si(si_tmp, trx->bts, 5); + if (rc < 0) + goto err_out; + rsl_sacch_filling(trx, RSL_SYSTEM_INFO_5, si_tmp, rc); + + rc = gsm_generate_si(si_tmp, trx->bts, 6); + if (rc < 0) + goto err_out; + rsl_sacch_filling(trx, RSL_SYSTEM_INFO_6, si_tmp, rc); return 0; +err_out: + fprintf(stderr, "Cannot generate SI for BTS %u, most likely " + "a problem with neighbor cell list generation\n", + trx->bts->nr); + return rc; } /* @@ -913,81 +736,12 @@ static void patch_nm_tables(struct gsm_bts *bts) nanobts_attr_radio[1] = bts->c0->max_power_red / 2; } -/* - * Patch the various SYSTEM INFORMATION tables to update - * the LAI - */ -static void patch_si_tables(struct gsm_bts *bts) -{ - u_int8_t arfcn_low = bts->c0->arfcn & 0xff; - u_int8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f; - - /* covert the raw packet to the struct */ - struct gsm48_system_information_type_1 *type_1 = - (struct gsm48_system_information_type_1*)&si1; - struct gsm48_system_information_type_2 *type_2 = - (struct gsm48_system_information_type_2*)&si2; - struct gsm48_system_information_type_3 *type_3 = - (struct gsm48_system_information_type_3*)&si3; - struct gsm48_system_information_type_4 *type_4 = - (struct gsm48_system_information_type_4*)&si4; - struct gsm48_system_information_type_6 *type_6 = - (struct gsm48_system_information_type_6*)&si6; - struct gsm48_loc_area_id lai; - - gsm0408_generate_lai(&lai, bts->network->country_code, - bts->network->network_code, - bts->location_area_code); - - /* assign the MCC and MNC */ - type_3->lai = lai; - type_4->lai = lai; - type_6->lai = lai; - - /* set the CI */ - type_3->cell_identity = htons(bts->cell_identity); - type_6->cell_identity = htons(bts->cell_identity); - - type_4->data[2] &= 0xf0; - type_4->data[2] |= arfcn_high; - type_4->data[3] = arfcn_low; - - /* patch Control Channel Description 10.5.2.11 */ - type_3->control_channel_desc = bts->chan_desc; - - /* patch TSC */ - si4[15] &= ~0xe0; - si4[15] |= (bts->tsc & 7) << 5; - - /* patch MS max power for CCH */ - 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; - type_3->rach_control.cell_bar = 1; - type_4->rach_control.cell_bar = 1; - } else { - type_1->rach_control.cell_bar = 0; - type_2->rach_control.cell_bar = 0; - type_3->rach_control.cell_bar = 0; - type_4->rach_control.cell_bar = 0; - } -} - - static void bootstrap_rsl(struct gsm_bts_trx *trx) { fprintf(stdout, "bootstrapping RSL for BTS/TRX (%u/%u) " "using MCC=%u MNC=%u BSIC=%u TSC=%u\n", trx->bts->nr, trx->nr, bsc_gsmnet->country_code, bsc_gsmnet->network_code, trx->bts->bsic, trx->bts->tsc); - patch_si_tables(trx->bts); set_system_infos(trx); } @@ -1042,11 +796,32 @@ static int bootstrap_bts(struct gsm_bts *bts) } /* Control Channel Description */ - bts->chan_desc.att = 1; - bts->chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C; - bts->chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5; + bts->si_common.chan_desc.att = 1; + bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C; + bts->si_common.chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5; + if (bts->cell_barred) + bts->si_common.rach_control.cell_bar = 1; /* T3212 is set from vty/config */ + /* some defaults for our system information */ + bts->si_common.rach_control.re = 1; /* no re-establishment */ + bts->si_common.rach_control.tx_integer = 5; /* 8 slots spread */ + bts->si_common.rach_control.max_trans = 3; /* 7 retransmissions */ + bts->si_common.rach_control.t2 = 4; /* no emergency calls */ + + bts->si_common.cell_options.radio_link_timeout = 2; /* 12 */ + bts->si_common.cell_options.dtx = 2; /* MS shall not use upplink DTX */ + bts->si_common.cell_options.pwrc = 0; /* PWRC not set */ + + bts->si_common.cell_sel_par.ms_txpwr_max_ccch = + ms_pwr_ctl_lvl(bts->band, bts->ms_max_power); + bts->si_common.cell_sel_par.cell_resel_hyst = 2; /* 4 dB */ + bts->si_common.cell_sel_par.rxlev_acc_min = 0; + bts->si_common.cell_sel_par.acs = 0; + bts->si_common.cell_sel_par.neci = bts->network->neci; + + bts->si_common.ncc_permitted = 0xff; + paging_init(bts); return 0; -- cgit v1.2.3 From d6aa52488a19674fb142e9619b579f600b2fec9a Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 12 Dec 2009 13:44:19 +0100 Subject: add warning about accept-all network on non-barred cells --- openbsc/src/bsc_init.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index d21f71a0c..c46fb2cdc 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -795,6 +795,14 @@ static int bootstrap_bts(struct gsm_bts *bts) return -EINVAL; } + if (bts->network->auth_policy == GSM_AUTH_POLICY_ACCEPT_ALL && + !bts->cell_barred) + fprintf(stderr, "\nWARNING: You are running an 'accept-all' " + "network on a BTS that is not barred. This " + "configuration is likely to interfere with production " + "GSM networks and should only be used in a RF " + "shielded environment such as a faraday cage!\n\n"); + /* Control Channel Description */ bts->si_common.chan_desc.att = 1; bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C; -- cgit v1.2.3 From 7322528ca1a331dc8cf404aae23aa8c2984a9190 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 12 Dec 2009 18:17:25 +0100 Subject: [VTY] add more cell reselection parameters to VTY allow setting of 'cell reselection hysteresis' and 'rxlev access min' from VTY for experiments with cell reselection. --- openbsc/src/bsc_init.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index c46fb2cdc..54aeb28cb 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -823,8 +823,6 @@ static int bootstrap_bts(struct gsm_bts *bts) bts->si_common.cell_sel_par.ms_txpwr_max_ccch = ms_pwr_ctl_lvl(bts->band, bts->ms_max_power); - bts->si_common.cell_sel_par.cell_resel_hyst = 2; /* 4 dB */ - bts->si_common.cell_sel_par.rxlev_acc_min = 0; bts->si_common.cell_sel_par.acs = 0; bts->si_common.cell_sel_par.neci = bts->network->neci; -- cgit v1.2.3 From ade7a14e750116ebe6a9de431772ff84df845fbe Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 14 Dec 2009 17:49:52 +0100 Subject: make sure BSIC is patched into NM tables before initializing BS11 --- openbsc/src/bsc_init.c | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 54aeb28cb..ef68ef936 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -575,6 +575,7 @@ static void nm_reconfig_bts(struct gsm_bts *bts) switch (bts->type) { case GSM_BTS_TYPE_BS11: + patch_nm_tables(bts); abis_nm_raw_msg(bts, sizeof(msg_1), msg_1); /* set BTS SiteMgr attr*/ abis_nm_set_bts_attr(bts, bs11_attr_bts, sizeof(bs11_attr_bts)); abis_nm_raw_msg(bts, sizeof(msg_3), msg_3); /* set BTS handover attr */ -- cgit v1.2.3 From 152b6261f88ac085cd96b63374ad5847ac7b3ce2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 16 Dec 2009 11:57:48 +0100 Subject: [system_information] Print more debugging about what's going on --- openbsc/src/bsc_init.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index ef68ef936..aed0dad42 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -684,25 +684,31 @@ static int set_system_infos(struct gsm_bts_trx *trx) } #ifdef GPRS rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_13); - if (rc < 0) + if (rc < 0) { + i = 13; goto err_out; + } rsl_bcch_info(trx, RSL_SYSTEM_INFO_13, si_tmp, rc); #endif rc = gsm_generate_si(si_tmp, trx->bts, 5); - if (rc < 0) + if (rc < 0) { + i = 5; goto err_out; + } rsl_sacch_filling(trx, RSL_SYSTEM_INFO_5, si_tmp, rc); rc = gsm_generate_si(si_tmp, trx->bts, 6); - if (rc < 0) + if (rc < 0) { + i = 6; goto err_out; + } rsl_sacch_filling(trx, RSL_SYSTEM_INFO_6, si_tmp, rc); return 0; err_out: - fprintf(stderr, "Cannot generate SI for BTS %u, most likely " + fprintf(stderr, "Cannot generate SI %u for BTS %u, most likely " "a problem with neighbor cell list generation\n", - trx->bts->nr); + i, trx->bts->nr); return rc; } -- cgit v1.2.3 From 8d77b9540a907fb36afbb324df549c9261e1ca02 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 17 Dec 2009 00:31:10 +0100 Subject: [handover] first functional handover implementation With this commit, we can successfully hand over a channel from one cell to another cell. We implement asynchronous intra-BSC (but inter-BTS) handover. Changes: * introduce new DHO log category * extend rsl_chan_activate_lchan() with argument for HO reference * introduce actual minimal handover decision making in handover_decision.c * various fixes to bsc_handover_start() in handover_logic.c --- openbsc/src/bsc_init.c | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index aed0dad42..ce3d0b4f8 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -679,6 +679,7 @@ static int set_system_infos(struct gsm_bts_trx *trx) rc = gsm_generate_si(si_tmp, trx->bts, i); if (rc < 0) goto err_out; + DEBUGP(DRR, "SI%u: %s\n", i, hexdump(si_tmp, rc)); rsl_bcch_info(trx, i, si_tmp, sizeof(si_tmp)); } } -- cgit v1.2.3 From b1d4c8ed9d2b4ecb76355d71a152c22934c48504 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 17 Dec 2009 23:10:46 +0100 Subject: logging: introduce log levels at caller site This introduces a new LOGP() macro together with LOGL_* definition to support multiple log levels (severities) throughout the codebase. Please note that the actual logging system does not use them yet, in this patch we simply introduce the new macros at the caller site. --- openbsc/src/bsc_init.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index ce3d0b4f8..744eacb24 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -453,7 +453,7 @@ static int sw_activ_rep(struct msgb *mb) static int oml_msg_nack(u_int8_t mt) { if (mt == NM_MT_SET_BTS_ATTR_NACK) { - fprintf(stderr, "Failed to set BTS attributes. That is fatal. " + LOGP(DNM, LOGL_FATAL, "Failed to set BTS attributes. That is fatal. " "Was the bts type and frequency properly specified?\n"); exit(-1); } @@ -556,7 +556,7 @@ static void nm_reconfig_trx(struct gsm_bts_trx *trx) trx->nominal_power = 23; break; default: - fprintf(stderr, "Unsupported nanoBTS GSM band %s\n", + LOGP(DNM, LOGL_ERROR, "Unsupported nanoBTS GSM band %s\n", gsm_band_name(trx->bts->band)); break; } @@ -621,7 +621,7 @@ static void bootstrap_om_bs11(struct gsm_bts *bts) static void bootstrap_om(struct gsm_bts *bts) { - fprintf(stdout, "bootstrapping OML for BTS %u\n", bts->nr); + LOGP(DNM, LOGL_NOTICE, "bootstrapping OML for BTS %u\n", bts->nr); switch (bts->type) { case GSM_BTS_TYPE_BS11: @@ -631,13 +631,13 @@ static void bootstrap_om(struct gsm_bts *bts) bootstrap_om_nanobts(bts); break; default: - fprintf(stderr, "Unable to bootstrap OML: Unknown BTS type %d\n", bts->type); + LOGP(DNM, LOGL_ERROR, "Unable to bootstrap OML: Unknown BTS type %d\n", bts->type); } } static int shutdown_om(struct gsm_bts *bts) { - fprintf(stdout, "shutting down OML for BTS %u\n", bts->nr); + LOGP(DNM, LOGL_NOTICE, "shutting down OML for BTS %u\n", bts->nr); /* stop sending event reports */ abis_nm_event_reports(bts, 0); @@ -707,7 +707,7 @@ static int set_system_infos(struct gsm_bts_trx *trx) return 0; err_out: - fprintf(stderr, "Cannot generate SI %u for BTS %u, most likely " + LOGP(DRR, LOGL_ERROR, "Cannot generate SI %u for BTS %u, most likely " "a problem with neighbor cell list generation\n", i, trx->bts->nr); return rc; @@ -746,7 +746,7 @@ static void patch_nm_tables(struct gsm_bts *bts) static void bootstrap_rsl(struct gsm_bts_trx *trx) { - fprintf(stdout, "bootstrapping RSL for BTS/TRX (%u/%u) " + LOGP(DRSL, LOGL_NOTICE, "bootstrapping RSL for BTS/TRX (%u/%u) " "using MCC=%u MNC=%u BSIC=%u TSC=%u\n", trx->bts->nr, trx->nr, bsc_gsmnet->country_code, bsc_gsmnet->network_code, trx->bts->bsic, trx->bts->tsc); @@ -769,7 +769,7 @@ void input_event(int event, enum e1inp_sign_type type, struct gsm_bts_trx *trx) } break; case EVT_E1_TEI_DN: - fprintf(stderr, "Lost some E1 TEI link\n"); + LOGP(DMI, LOGL_NOTICE, "Lost some E1 TEI link\n"); /* FIXME: deal with TEI or L1 link loss */ break; default: @@ -782,30 +782,30 @@ static int bootstrap_bts(struct gsm_bts *bts) switch (bts->band) { case GSM_BAND_1800: if (bts->c0->arfcn < 512 || bts->c0->arfcn > 885) { - fprintf(stderr, "GSM1800 channel must be between 512-885.\n"); + LOGP(DNM, LOGL_ERROR, "GSM1800 channel must be between 512-885.\n"); return -EINVAL; } break; case GSM_BAND_1900: if (bts->c0->arfcn < 512 || bts->c0->arfcn > 810) { - fprintf(stderr, "GSM1900 channel must be between 512-810.\n"); + LOGP(DNM, LOGL_ERROR, "GSM1900 channel must be between 512-810.\n"); return -EINVAL; } break; case GSM_BAND_900: if (bts->c0->arfcn < 1 || bts->c0->arfcn > 124) { - fprintf(stderr, "GSM900 channel must be between 1-124.\n"); + LOGP(DNM, LOGL_ERROR, "GSM900 channel must be between 1-124.\n"); return -EINVAL; } break; default: - fprintf(stderr, "Unsupported frequency band.\n"); + LOGP(DNM, LOGL_ERROR, "Unsupported frequency band.\n"); return -EINVAL; } if (bts->network->auth_policy == GSM_AUTH_POLICY_ACCEPT_ALL && !bts->cell_barred) - fprintf(stderr, "\nWARNING: You are running an 'accept-all' " + LOGP(DNM, LOG_ERROR, "\nWARNING: You are running an 'accept-all' " "network on a BTS that is not barred. This " "configuration is likely to interfere with production " "GSM networks and should only be used in a RF " @@ -858,7 +858,7 @@ int bsc_bootstrap_network(int (*mncc_recv)(struct gsm_network *, int, void *), telnet_init(bsc_gsmnet, 4242); rc = vty_read_config_file(config_file); if (rc < 0) { - fprintf(stderr, "Failed to parse the config file: '%s'\n", config_file); + LOGP(DNM, LOGL_FATAL, "Failed to parse the config file: '%s'\n", config_file); return rc; } -- cgit v1.2.3 From 50e7fec9b892c32655ce74431e45437669bffac6 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 19 Dec 2009 21:29:00 +0100 Subject: system_information: DEBUGP() SI13/5/6 during startup --- openbsc/src/bsc_init.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 744eacb24..7065833bf 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -679,30 +679,30 @@ static int set_system_infos(struct gsm_bts_trx *trx) rc = gsm_generate_si(si_tmp, trx->bts, i); if (rc < 0) goto err_out; - DEBUGP(DRR, "SI%u: %s\n", i, hexdump(si_tmp, rc)); + DEBUGP(DRR, "SI%2u: %s\n", i, hexdump(si_tmp, rc)); rsl_bcch_info(trx, i, si_tmp, sizeof(si_tmp)); } } #ifdef GPRS + i = 13 rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_13); - if (rc < 0) { - i = 13; + if (rc < 0) goto err_out; - } + DEBUGP(DRR, "SI%2u: %s\n", i, hexdump(si_tmp, rc)); rsl_bcch_info(trx, RSL_SYSTEM_INFO_13, si_tmp, rc); #endif - rc = gsm_generate_si(si_tmp, trx->bts, 5); - if (rc < 0) { - i = 5; + i = 5; + rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_5); + if (rc < 0) goto err_out; - } + DEBUGP(DRR, "SI%2u: %s\n", i, hexdump(si_tmp, rc)); rsl_sacch_filling(trx, RSL_SYSTEM_INFO_5, si_tmp, rc); - rc = gsm_generate_si(si_tmp, trx->bts, 6); - if (rc < 0) { - i = 6; + i = 6; + rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_6); + if (rc < 0) goto err_out; - } + DEBUGP(DRR, "SI%2u: %s\n", i, hexdump(si_tmp, rc)); rsl_sacch_filling(trx, RSL_SYSTEM_INFO_6, si_tmp, rc); return 0; -- cgit v1.2.3 From f88c8a02fc35fbcc8b85e3b51733f1a20ceadf13 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 20 Dec 2009 13:48:15 +0100 Subject: remove hand full of 'extern ipacc_rtp_direct' definitions and instead declare it in gsm_data.h --- openbsc/src/bsc_init.c | 1 - 1 file changed, 1 deletion(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 7065833bf..8450af6d0 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -35,7 +35,6 @@ /* global pointer to the gsm network data structure */ extern struct gsm_network *bsc_gsmnet; -extern int ipacc_rtp_direct; static void patch_nm_tables(struct gsm_bts *bts); -- cgit v1.2.3 From 6a22c0135a6ac49d716d38a92c9d9c9a329da980 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2009 17:02:32 +0100 Subject: [gprs] SI 13 should only be generated on C0 (BCCH-carrying TRX) --- openbsc/src/bsc_init.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 8450af6d0..48d90d700 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -681,15 +681,16 @@ static int set_system_infos(struct gsm_bts_trx *trx) DEBUGP(DRR, "SI%2u: %s\n", i, hexdump(si_tmp, rc)); rsl_bcch_info(trx, i, si_tmp, sizeof(si_tmp)); } - } #ifdef GPRS - i = 13 - rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_13); - if (rc < 0) - goto err_out; - DEBUGP(DRR, "SI%2u: %s\n", i, hexdump(si_tmp, rc)); - rsl_bcch_info(trx, RSL_SYSTEM_INFO_13, si_tmp, rc); + i = 13 + rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_13); + if (rc < 0) + goto err_out; + DEBUGP(DRR, "SI%2u: %s\n", i, hexdump(si_tmp, rc)); + rsl_bcch_info(trx, RSL_SYSTEM_INFO_13, si_tmp, rc); #endif + } + i = 5; rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_5); if (rc < 0) -- cgit v1.2.3 From 713550120cb9231de49090c01abb6e867a93137d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2009 23:08:18 +0100 Subject: remove duplicate flag for cell barring it's sufficient if we keep the state of cell barring in one place --- openbsc/src/bsc_init.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 48d90d700..86a93a1a9 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -804,7 +804,7 @@ static int bootstrap_bts(struct gsm_bts *bts) } if (bts->network->auth_policy == GSM_AUTH_POLICY_ACCEPT_ALL && - !bts->cell_barred) + !bts->si_common.rach_control.cell_bar) LOGP(DNM, LOG_ERROR, "\nWARNING: You are running an 'accept-all' " "network on a BTS that is not barred. This " "configuration is likely to interfere with production " @@ -815,8 +815,6 @@ static int bootstrap_bts(struct gsm_bts *bts) bts->si_common.chan_desc.att = 1; bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C; bts->si_common.chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5; - if (bts->cell_barred) - bts->si_common.rach_control.cell_bar = 1; /* T3212 is set from vty/config */ /* some defaults for our system information */ -- cgit v1.2.3 From 73d4fce151b587ae28692448ea7094212e7eab7b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2009 23:12:19 +0100 Subject: make sure bootstrap_bts() only contains static initialization values that might change at runtime are moved to set_system_infos() which we might now also call at runtime to update the BTS with changes in the SI --- openbsc/src/bsc_init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 86a93a1a9..61510435b 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -672,6 +672,11 @@ static int set_system_infos(struct gsm_bts_trx *trx) { int i, rc; u_int8_t si_tmp[23]; + struct gsm_bts *bts = trx->bts; + + bts->si_common.cell_sel_par.ms_txpwr_max_ccch = + ms_pwr_ctl_lvl(bts->band, bts->ms_max_power); + bts->si_common.cell_sel_par.neci = bts->network->neci; if (trx == trx->bts->c0) { for (i = 1; i <= 4; i++) { @@ -827,10 +832,7 @@ static int bootstrap_bts(struct gsm_bts *bts) bts->si_common.cell_options.dtx = 2; /* MS shall not use upplink DTX */ bts->si_common.cell_options.pwrc = 0; /* PWRC not set */ - bts->si_common.cell_sel_par.ms_txpwr_max_ccch = - ms_pwr_ctl_lvl(bts->band, bts->ms_max_power); bts->si_common.cell_sel_par.acs = 0; - bts->si_common.cell_sel_par.neci = bts->network->neci; bts->si_common.ncc_permitted = 0xff; -- cgit v1.2.3 From a992a36d5f9e7a2d1bb7948784c69ea2e342b7d3 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2009 23:36:45 +0100 Subject: it's LOGL_ERROR, not LOG_ERROR --- openbsc/src/bsc_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/src/bsc_init.c') diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 61510435b..a8a202e93 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -810,7 +810,7 @@ static int bootstrap_bts(struct gsm_bts *bts) if (bts->network->auth_policy == GSM_AUTH_POLICY_ACCEPT_ALL && !bts->si_common.rach_control.cell_bar) - LOGP(DNM, LOG_ERROR, "\nWARNING: You are running an 'accept-all' " + LOGP(DNM, LOGL_ERROR, "\nWARNING: You are running an 'accept-all' " "network on a BTS that is not barred. This " "configuration is likely to interfere with production " "GSM networks and should only be used in a RF " -- cgit v1.2.3