This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/19299 ) Change subject: Move gsm_bts_{trx_}set_system_infos APIs to bts{_trx}.* ...................................................................... Move gsm_bts_{trx_}set_system_infos APIs to bts{_trx}.* Change-Id: I2aa83b499d6e5d06a0fa1001fee3111f7e639c94 --- M include/osmocom/bsc/bts.h M include/osmocom/bsc/bts_trx.h M include/osmocom/bsc/gsm_data.h M src/ipaccess/ipaccess-config.c M src/ipaccess/ipaccess-proxy.c M src/osmo-bsc/bsc_init.c M src/osmo-bsc/bts.c M src/osmo-bsc/bts_trx.c M src/utils/bs11_config.c M src/utils/meas_json.c M tests/abis/abis_test.c M tests/bsc/bsc_test.c M tests/gsm0408/gsm0408_test.c M tests/nanobts_omlattr/nanobts_omlattr_test.c 14 files changed, 200 insertions(+), 170 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index 9b89f4f..730dee9 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -622,6 +622,8 @@ int bts_count_free_ts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan); +int gsm_bts_set_system_infos(struct gsm_bts *bts); + int gsm_bts_model_register(struct gsm_bts_model *model); struct gsm_bts_model *bts_model_find(enum gsm_bts_type type); diff --git a/include/osmocom/bsc/bts_trx.h b/include/osmocom/bsc/bts_trx.h index 7e64439..3a635ba 100644 --- a/include/osmocom/bsc/bts_trx.h +++ b/include/osmocom/bsc/bts_trx.h @@ -90,3 +90,5 @@ void gsm_trx_all_ts_dispatch(struct gsm_bts_trx *trx, uint32_t ts_ev, void *data); int trx_count_free_ts(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan); bool trx_has_valid_pchan_config(const struct gsm_bts_trx *trx); + +int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx); diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index e85be70..a8b495f 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1189,9 +1189,6 @@ void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr, uint8_t e1_ts, uint8_t e1_ts_ss); -int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx); -int gsm_bts_set_system_infos(struct gsm_bts *bts); - /* generic E1 line operations for all ISDN-based BTS. */ extern struct e1inp_line_ops bts_isdn_e1inp_line_ops; diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c index 34ad57f..c9264d7 100644 --- a/src/ipaccess/ipaccess-config.c +++ b/src/ipaccess/ipaccess-config.c @@ -1133,18 +1133,12 @@ /* Stub */ int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg) -{ - return 0; -} - -/* Stub */ +{ return 0; } int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg) -{ - return 0; -} - -/* Stub */ -int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) -{ - return 0; -} +{ return 0; } +int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; } +void pcu_info_update(struct gsm_bts *bts) {}; +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; } +int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len) +{ return 0; } +int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) { return 0; } diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c index 05a6f63..d5dd8d4 100644 --- a/src/ipaccess/ipaccess-proxy.c +++ b/src/ipaccess/ipaccess-proxy.c @@ -1254,7 +1254,9 @@ } /* Stub */ -int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) -{ - return 0; -} +int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; } +void pcu_info_update(struct gsm_bts *bts) {}; +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; } +int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len) +{ return 0; } +int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) { return 0; } diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c index 4fc0ab1..e45b5e8 100644 --- a/src/osmo-bsc/bsc_init.c +++ b/src/osmo-bsc/bsc_init.c @@ -69,155 +69,6 @@ return 0; } -static int rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i, int si_len) -{ - struct gsm_bts *bts = trx->bts; - int rc, j; - - if (si_len) { - DEBUGP(DRR, "SI%s: %s\n", get_value_string(osmo_sitype_strs, i), - osmo_hexdump(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN)); - } else - DEBUGP(DRR, "SI%s: OFF\n", get_value_string(osmo_sitype_strs, i)); - - switch (i) { - case SYSINFO_TYPE_5: - case SYSINFO_TYPE_5bis: - case SYSINFO_TYPE_5ter: - case SYSINFO_TYPE_6: - rc = rsl_sacch_filling(trx, osmo_sitype2rsl(i), - si_len ? GSM_BTS_SI(bts, i) : NULL, si_len); - break; - case SYSINFO_TYPE_2quater: - if (si_len == 0) { - rc = rsl_bcch_info(trx, i, NULL, 0); - break; - } - rc = 0; - for (j = 0; j <= bts->si2q_count; j++) - rc = rsl_bcch_info(trx, i, (const uint8_t *)GSM_BTS_SI2Q(bts, j), GSM_MACBLOCK_LEN); - break; - default: - rc = rsl_bcch_info(trx, i, si_len ? GSM_BTS_SI(bts, i) : NULL, si_len); - break; - } - - return rc; -} - -/* set all system information types for a TRX */ -int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx) -{ - int i, rc; - struct gsm_bts *bts = trx->bts; - uint8_t gen_si[_MAX_SYSINFO_TYPE], n_si = 0, n; - int si_len[_MAX_SYSINFO_TYPE]; - - 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; - - /* Zero/forget the state of the dynamically computed SIs, leeping the static ones */ - bts->si_valid = bts->si_mode_static; - - /* First, we determine which of the SI messages we actually need */ - - if (trx == bts->c0) { - /* 1...4 are always present on a C0 TRX */ - gen_si[n_si++] = SYSINFO_TYPE_1; - gen_si[n_si++] = SYSINFO_TYPE_2; - gen_si[n_si++] = SYSINFO_TYPE_2bis; - gen_si[n_si++] = SYSINFO_TYPE_2ter; - gen_si[n_si++] = SYSINFO_TYPE_2quater; - gen_si[n_si++] = SYSINFO_TYPE_3; - gen_si[n_si++] = SYSINFO_TYPE_4; - - /* 13 is always present on a C0 TRX of a GPRS BTS */ - if (bts->gprs.mode != BTS_GPRS_NONE) - gen_si[n_si++] = SYSINFO_TYPE_13; - } - - /* 5 and 6 are always present on every TRX */ - gen_si[n_si++] = SYSINFO_TYPE_5; - gen_si[n_si++] = SYSINFO_TYPE_5bis; - gen_si[n_si++] = SYSINFO_TYPE_5ter; - gen_si[n_si++] = SYSINFO_TYPE_6; - - /* Second, we generate the selected SI via RSL */ - - for (n = 0; n < n_si; n++) { - i = gen_si[n]; - /* Only generate SI if this SI is not in "static" (user-defined) mode */ - if (!(bts->si_mode_static & (1 << i))) { - /* Set SI as being valid. gsm_generate_si() might unset - * it, if SI is not required. */ - bts->si_valid |= (1 << i); - rc = gsm_generate_si(bts, i); - if (rc < 0) - goto err_out; - si_len[i] = rc; - } else { - if (i == SYSINFO_TYPE_5 || i == SYSINFO_TYPE_5bis - || i == SYSINFO_TYPE_5ter) - si_len[i] = 18; - else if (i == SYSINFO_TYPE_6) - si_len[i] = 11; - else - si_len[i] = 23; - } - } - - /* Third, we send the selected SI via RSL */ - - for (n = 0; n < n_si; n++) { - i = gen_si[n]; - /* 3GPP TS 08.58 §8.5.1 BCCH INFORMATION. If we don't currently - * have this SI, we send a zero-length RSL BCCH FILLING / - * SACCH FILLING in order to deactivate the SI, in case it - * might have previously been active */ - if (!GSM_BTS_HAS_SI(bts, i)) { - if (bts->si_unused_send_empty) - rc = rsl_si(trx, i, 0); - else - rc = 0; /* some nanoBTS fw don't like receiving empty unsupported SI */ - } else - rc = rsl_si(trx, i, si_len[i]); - if (rc < 0) - return rc; - } - - /* Make sure the PCU is aware (in case anything GPRS related has - * changed in SI */ - pcu_info_update(bts); - - return 0; -err_out: - LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>, " - "most likely a problem with neighbor cell list generation\n", - get_value_string(osmo_sitype_strs, i), bts->nr, strerror(-rc)); - return rc; -} - -/* set all system information types for a BTS */ -int gsm_bts_set_system_infos(struct gsm_bts *bts) -{ - struct gsm_bts_trx *trx; - - /* Generate a new ID */ - bts->bcch_change_mark += 1; - bts->bcch_change_mark %= 0x7; - - llist_for_each_entry(trx, &bts->trx_list, list) { - int rc; - - rc = gsm_bts_trx_set_system_infos(trx); - if (rc != 0) - return rc; - } - - return 0; -} - /* XXX hard-coded for now */ #define T3122_CHAN_LOAD_SAMPLE_INTERVAL 1 /* in seconds */ diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index c943684..055cc47 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -750,3 +750,23 @@ return count; } + +/* set all system information types for a BTS */ +int gsm_bts_set_system_infos(struct gsm_bts *bts) +{ + struct gsm_bts_trx *trx; + + /* Generate a new ID */ + bts->bcch_change_mark += 1; + bts->bcch_change_mark %= 0x7; + + llist_for_each_entry(trx, &bts->trx_list, list) { + int rc; + + rc = gsm_bts_trx_set_system_infos(trx); + if (rc != 0) + return rc; + } + + return 0; +} diff --git a/src/osmo-bsc/bts_trx.c b/src/osmo-bsc/bts_trx.c index 15d5b59..25a3fc7 100644 --- a/src/osmo-bsc/bts_trx.c +++ b/src/osmo-bsc/bts_trx.c @@ -25,7 +25,10 @@ #include <osmocom/bsc/bts_trx.h> #include <osmocom/bsc/timeslot_fsm.h> #include <osmocom/bsc/abis_nm.h> +#include <osmocom/bsc/abis_rsl.h> #include <osmocom/bsc/lchan_fsm.h> +#include <osmocom/bsc/system_information.h> +#include <osmocom/bsc/pcu_if.h> #include <osmocom/bsc/debug.h> struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts) @@ -286,3 +289,132 @@ return result; } + +static int rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i, int si_len) +{ + struct gsm_bts *bts = trx->bts; + int rc, j; + + if (si_len) { + DEBUGP(DRR, "SI%s: %s\n", get_value_string(osmo_sitype_strs, i), + osmo_hexdump(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN)); + } else + DEBUGP(DRR, "SI%s: OFF\n", get_value_string(osmo_sitype_strs, i)); + + switch (i) { + case SYSINFO_TYPE_5: + case SYSINFO_TYPE_5bis: + case SYSINFO_TYPE_5ter: + case SYSINFO_TYPE_6: + rc = rsl_sacch_filling(trx, osmo_sitype2rsl(i), + si_len ? GSM_BTS_SI(bts, i) : NULL, si_len); + break; + case SYSINFO_TYPE_2quater: + if (si_len == 0) { + rc = rsl_bcch_info(trx, i, NULL, 0); + break; + } + rc = 0; + for (j = 0; j <= bts->si2q_count; j++) + rc = rsl_bcch_info(trx, i, (const uint8_t *)GSM_BTS_SI2Q(bts, j), GSM_MACBLOCK_LEN); + break; + default: + rc = rsl_bcch_info(trx, i, si_len ? GSM_BTS_SI(bts, i) : NULL, si_len); + break; + } + + return rc; +} + +/* set all system information types for a TRX */ +int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx) +{ + int i, rc; + struct gsm_bts *bts = trx->bts; + uint8_t gen_si[_MAX_SYSINFO_TYPE], n_si = 0, n; + int si_len[_MAX_SYSINFO_TYPE]; + + 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; + + /* Zero/forget the state of the dynamically computed SIs, leeping the static ones */ + bts->si_valid = bts->si_mode_static; + + /* First, we determine which of the SI messages we actually need */ + + if (trx == bts->c0) { + /* 1...4 are always present on a C0 TRX */ + gen_si[n_si++] = SYSINFO_TYPE_1; + gen_si[n_si++] = SYSINFO_TYPE_2; + gen_si[n_si++] = SYSINFO_TYPE_2bis; + gen_si[n_si++] = SYSINFO_TYPE_2ter; + gen_si[n_si++] = SYSINFO_TYPE_2quater; + gen_si[n_si++] = SYSINFO_TYPE_3; + gen_si[n_si++] = SYSINFO_TYPE_4; + + /* 13 is always present on a C0 TRX of a GPRS BTS */ + if (bts->gprs.mode != BTS_GPRS_NONE) + gen_si[n_si++] = SYSINFO_TYPE_13; + } + + /* 5 and 6 are always present on every TRX */ + gen_si[n_si++] = SYSINFO_TYPE_5; + gen_si[n_si++] = SYSINFO_TYPE_5bis; + gen_si[n_si++] = SYSINFO_TYPE_5ter; + gen_si[n_si++] = SYSINFO_TYPE_6; + + /* Second, we generate the selected SI via RSL */ + + for (n = 0; n < n_si; n++) { + i = gen_si[n]; + /* Only generate SI if this SI is not in "static" (user-defined) mode */ + if (!(bts->si_mode_static & (1 << i))) { + /* Set SI as being valid. gsm_generate_si() might unset + * it, if SI is not required. */ + bts->si_valid |= (1 << i); + rc = gsm_generate_si(bts, i); + if (rc < 0) + goto err_out; + si_len[i] = rc; + } else { + if (i == SYSINFO_TYPE_5 || i == SYSINFO_TYPE_5bis + || i == SYSINFO_TYPE_5ter) + si_len[i] = 18; + else if (i == SYSINFO_TYPE_6) + si_len[i] = 11; + else + si_len[i] = 23; + } + } + + /* Third, we send the selected SI via RSL */ + + for (n = 0; n < n_si; n++) { + i = gen_si[n]; + /* 3GPP TS 08.58 §8.5.1 BCCH INFORMATION. If we don't currently + * have this SI, we send a zero-length RSL BCCH FILLING / + * SACCH FILLING in order to deactivate the SI, in case it + * might have previously been active */ + if (!GSM_BTS_HAS_SI(bts, i)) { + if (bts->si_unused_send_empty) + rc = rsl_si(trx, i, 0); + else + rc = 0; /* some nanoBTS fw don't like receiving empty unsupported SI */ + } else + rc = rsl_si(trx, i, si_len[i]); + if (rc < 0) + return rc; + } + + /* Make sure the PCU is aware (in case anything GPRS related has + * changed in SI */ + pcu_info_update(bts); + + return 0; +err_out: + LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>, " + "most likely a problem with neighbor cell list generation\n", + get_value_string(osmo_sitype_strs, i), bts->nr, strerror(-rc)); + return rc; +} diff --git a/src/utils/bs11_config.c b/src/utils/bs11_config.c index c43c008..c279179 100644 --- a/src/utils/bs11_config.c +++ b/src/utils/bs11_config.c @@ -990,3 +990,8 @@ void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {} int abis_rsl_rcvmsg(struct msgb *msg) { return 0; } int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; } +void pcu_info_update(struct gsm_bts *bts) {}; +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; } +int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len) +{ return 0; } +int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) { return 0; } diff --git a/src/utils/meas_json.c b/src/utils/meas_json.c index 0fd99c0..b44a300 100644 --- a/src/utils/meas_json.c +++ b/src/utils/meas_json.c @@ -205,3 +205,8 @@ void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {} int abis_rsl_rcvmsg(struct msgb *msg) { return 0; } int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; } +void pcu_info_update(struct gsm_bts *bts) {}; +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; } +int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len) +{ return 0; } +int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) { return 0; } diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c index 767a9fb..9d26edd 100644 --- a/tests/abis/abis_test.c +++ b/tests/abis/abis_test.c @@ -191,3 +191,8 @@ bool on_gsm_ts_init(struct gsm_bts_trx_ts *ts) { return true; } void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {} int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; } +void pcu_info_update(struct gsm_bts *bts) {}; +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; } +int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len) +{ return 0; } +int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) { return 0; } diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c index 164f78f..dd2b1bb 100644 --- a/tests/bsc/bsc_test.c +++ b/tests/bsc/bsc_test.c @@ -240,3 +240,8 @@ bool neighbor_ident_bts_entry_exists(uint8_t from_bts) { return false; } const char *handover_status(struct gsm_subscriber_connection *conn) { return "x"; } int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; } +void pcu_info_update(struct gsm_bts *bts) {}; +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; } +int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len) +{ return 0; } +int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) { return 0; } diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c index b3e8b11..e53b83a 100644 --- a/tests/gsm0408/gsm0408_test.c +++ b/tests/gsm0408/gsm0408_test.c @@ -969,3 +969,8 @@ int rsl_encryption_cmd(struct msgb *msg) { return 0; } int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; } + +void pcu_info_update(struct gsm_bts *bts) {}; +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; } +int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len) +{ return 0; } diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c index 4180f4a..ea98409 100644 --- a/tests/nanobts_omlattr/nanobts_omlattr_test.c +++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c @@ -320,3 +320,8 @@ void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {} int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; } +void pcu_info_update(struct gsm_bts *bts) {}; +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; } +int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len) +{ return 0; } +int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) { return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/19299 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I2aa83b499d6e5d06a0fa1001fee3111f7e639c94 Gerrit-Change-Number: 19299 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200718/86507b51/attachment.htm>