aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/bsc_ctrl_commands.c4
-rw-r--r--src/osmo-bsc/bsc_init.c22
-rw-r--r--src/osmo-bsc/bsc_rf_ctrl.c18
-rw-r--r--src/osmo-bsc/bsc_vty.c8
-rw-r--r--src/osmo-bsc/cbsp_link.c4
-rw-r--r--src/osmo-bsc/gsm_08_08.c14
-rw-r--r--src/osmo-bsc/osmo_bsc_bssap.c2
-rw-r--r--src/osmo-bsc/osmo_bsc_ctrl.c4
-rw-r--r--src/osmo-bsc/osmo_bsc_grace.c2
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c18
-rw-r--r--src/osmo-bsc/osmo_bsc_msc.c4
-rw-r--r--src/osmo-bsc/osmo_bsc_vty.c37
12 files changed, 55 insertions, 82 deletions
diff --git a/src/osmo-bsc/bsc_ctrl_commands.c b/src/osmo-bsc/bsc_ctrl_commands.c
index ca182d7d1..774ded21b 100644
--- a/src/osmo-bsc/bsc_ctrl_commands.c
+++ b/src/osmo-bsc/bsc_ctrl_commands.c
@@ -349,7 +349,7 @@ static int get_net_rf_lock(struct ctrl_cmd *cmd, void *data)
struct gsm_bts *bts;
const char *policy_name;
- policy_name = osmo_bsc_rf_get_policy_name(net->bsc_data->rf_ctrl->policy);
+ policy_name = osmo_bsc_rf_get_policy_name(net->rf_ctrl->policy);
llist_for_each_entry(bts, &net->bts_list, list) {
struct gsm_bts_trx *trx;
@@ -389,7 +389,7 @@ static int set_net_rf_lock(struct ctrl_cmd *cmd, void *data)
return CTRL_CMD_ERROR;
}
- rf = net->bsc_data->rf_ctrl;
+ rf = net->rf_ctrl;
if (!rf) {
cmd->reply = "RF Ctrl is not enabled in the BSC Configuration";
diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c
index d08e9c861..7f145efb1 100644
--- a/src/osmo-bsc/bsc_init.c
+++ b/src/osmo-bsc/bsc_init.c
@@ -254,21 +254,15 @@ static struct gsm_network *bsc_network_init(void *ctx)
{
struct gsm_network *net = gsm_network_init(ctx);
- net->bsc_data = talloc_zero(net, struct osmo_bsc_data);
- if (!net->bsc_data) {
- talloc_free(net);
- return NULL;
- }
- net->bsc_data->cbc = talloc_zero(net->bsc_data, struct bsc_cbc_link);
- if (!net->bsc_data->cbc) {
+ net->cbc = talloc_zero(net, struct bsc_cbc_link);
+ if (!net->cbc) {
talloc_free(net);
return NULL;
}
/* Init back pointer */
- net->bsc_data->auto_off_timeout = -1;
- net->bsc_data->network = net;
- INIT_LLIST_HEAD(&net->bsc_data->mscs);
+ net->auto_off_timeout = -1;
+ INIT_LLIST_HEAD(&net->mscs);
net->ho = ho_cfg_init(net, NULL);
net->hodec2.congestion_check_interval_s = HO_CFG_CONGESTION_CHECK_DEFAULT;
@@ -298,12 +292,12 @@ static struct gsm_network *bsc_network_init(void *ctx)
osmo_timer_setup(&net->t3122_chan_load_timer, update_t3122_chan_load_timer, net);
osmo_timer_schedule(&net->t3122_chan_load_timer, T3122_CHAN_LOAD_SAMPLE_INTERVAL, 0);
- net->bsc_data->cbc->net = net;
+ net->cbc->net = net;
/* no cbc_hostname: client not started by default */
- net->bsc_data->cbc->config.cbc_port = CBSP_TCP_PORT;
+ net->cbc->config.cbc_port = CBSP_TCP_PORT;
/* listen_port == -1: server not started by default */
- net->bsc_data->cbc->config.listen_port = -1;
- net->bsc_data->cbc->config.listen_hostname = talloc_strdup(net->bsc_data->cbc, "127.0.0.1");
+ net->cbc->config.listen_port = -1;
+ net->cbc->config.listen_hostname = talloc_strdup(net->cbc, "127.0.0.1");
return net;
}
diff --git a/src/osmo-bsc/bsc_rf_ctrl.c b/src/osmo-bsc/bsc_rf_ctrl.c
index 73156e6dc..11cd22404 100644
--- a/src/osmo-bsc/bsc_rf_ctrl.c
+++ b/src/osmo-bsc/bsc_rf_ctrl.c
@@ -106,12 +106,12 @@ enum osmo_bsc_rf_adminstate osmo_bsc_rf_get_adminstate_by_bts(struct gsm_bts *bt
enum osmo_bsc_rf_policy osmo_bsc_rf_get_policy_by_bts(struct gsm_bts *bts)
{
- struct osmo_bsc_data *bsc_data = bts->network->bsc_data;
+ struct gsm_network *net = bts->network;
- if (!bsc_data)
+ if (!net || !net->rf_ctrl)
return OSMO_BSC_RF_POLICY_UNKNOWN;
- switch (bsc_data->rf_ctrl->policy) {
+ switch (net->rf_ctrl->policy) {
case S_RF_ON:
return OSMO_BSC_RF_POLICY_ON;
case S_RF_OFF:
@@ -267,9 +267,9 @@ static int enter_grace(struct osmo_bsc_rf *rf)
}
osmo_timer_setup(&rf->grace_timeout, grace_timeout, rf);
- osmo_timer_schedule(&rf->grace_timeout, rf->gsm_network->bsc_data->mid_call_timeout, 0);
+ osmo_timer_schedule(&rf->grace_timeout, rf->gsm_network->mid_call_timeout, 0);
LOGP(DLINP, LOGL_NOTICE, "Going to switch RF off in %d seconds.\n",
- rf->gsm_network->bsc_data->mid_call_timeout);
+ rf->gsm_network->mid_call_timeout);
send_signal(rf, S_RF_GRACE);
return 0;
@@ -409,18 +409,18 @@ static int msc_signal_handler(unsigned int subsys, unsigned int signal,
net = handler_data;
/* check if we have the needed information */
- if (!net->bsc_data)
+ if (!net)
return 0;
- rf = net->bsc_data->rf_ctrl;
+ rf = net->rf_ctrl;
switch (signal) {
case S_MSC_LOST:
- if (net->bsc_data->auto_off_timeout < 0)
+ if (net->auto_off_timeout < 0)
return 0;
if (osmo_timer_pending(&rf->auto_off_timer))
return 0;
osmo_timer_schedule(&rf->auto_off_timer,
- net->bsc_data->auto_off_timeout, 0);
+ net->auto_off_timeout, 0);
break;
case S_MSC_CONNECTED:
osmo_timer_del(&rf->auto_off_timer);
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index c380a3060..80658ece8 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -253,13 +253,13 @@ static void net_dump_vty(struct vty *vty, struct gsm_network *net)
dump_pchan_load_vty(vty, " ", &pl);
/* show rf */
- if (net->bsc_data)
+ if (net->rf_ctrl)
vty_out(vty, " Last RF Command: %s%s",
- net->bsc_data->rf_ctrl->last_state_command,
+ net->rf_ctrl->last_state_command,
VTY_NEWLINE);
- if (net->bsc_data)
+ if (net->rf_ctrl)
vty_out(vty, " Last RF Lock Command: %s%s",
- net->bsc_data->rf_ctrl->last_rf_lock_ctrl_command,
+ net->rf_ctrl->last_rf_lock_ctrl_command,
VTY_NEWLINE);
}
diff --git a/src/osmo-bsc/cbsp_link.c b/src/osmo-bsc/cbsp_link.c
index 8840afa52..91217ad41 100644
--- a/src/osmo-bsc/cbsp_link.c
+++ b/src/osmo-bsc/cbsp_link.c
@@ -192,7 +192,7 @@ static int cbsp_client_read_cb(struct osmo_stream_cli *cli)
int bsc_cbc_link_restart(void)
{
- struct bsc_cbc_link *cbc = bsc_gsmnet->bsc_data->cbc;
+ struct bsc_cbc_link *cbc = bsc_gsmnet->cbc;
/* shut down client, if no longer configured */
if (cbc->client.cli && !cbc->config.cbc_hostname) {
@@ -280,7 +280,7 @@ int cbsp_tx_decoded(struct bsc_cbc_link *cbc, struct osmo_cbsp_decoded *cbsp)
static struct bsc_cbc_link *vty_cbc_data(struct vty *vty)
{
- return bsc_gsmnet->bsc_data->cbc;
+ return bsc_gsmnet->cbc;
}
/*********************************************************************************
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index 9ccdb3b24..7789d490b 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -162,16 +162,14 @@ static struct bsc_subscr *extract_sub(struct gsm_subscriber_connection *conn,
static struct bsc_msc_data *bsc_find_msc(struct gsm_subscriber_connection *conn,
struct msgb *msg)
{
+ struct gsm_network *net = conn->network;
struct gsm48_hdr *gh;
int8_t pdisc;
uint8_t mtype;
- struct osmo_bsc_data *bsc;
struct bsc_msc_data *msc, *pag_msc;
struct bsc_subscr *subscr;
int is_emerg = 0;
- bsc = conn->network->bsc_data;
-
if (msgb_l3len(msg) < sizeof(*gh)) {
LOGP(DMSC, LOGL_ERROR, "There is no GSM48 header here.\n");
return NULL;
@@ -196,12 +194,12 @@ static struct bsc_msc_data *bsc_find_msc(struct gsm_subscriber_connection *conn,
goto round_robin;
round_robin:
- llist_for_each_entry(msc, &bsc->mscs, entry) {
+ llist_for_each_entry(msc, &net->mscs, entry) {
if (is_emerg && !msc->allow_emerg)
continue;
/* force round robin by moving it to the end */
- llist_move_tail(&msc->entry, &bsc->mscs);
+ llist_move_tail(&msc->entry, &net->mscs);
return msc;
}
@@ -218,7 +216,7 @@ paging:
pag_msc = paging_get_msc(conn_get_bts(conn), subscr);
bsc_subscr_put(subscr);
- llist_for_each_entry(msc, &bsc->mscs, entry) {
+ llist_for_each_entry(msc, &net->mscs, entry) {
if (msc != pag_msc)
continue;
@@ -228,7 +226,7 @@ paging:
*/
/* force round robin by moving it to the end */
- llist_move_tail(&msc->entry, &bsc->mscs);
+ llist_move_tail(&msc->entry, &net->mscs);
return msc;
}
@@ -242,7 +240,7 @@ blind:
* know the MSC which is in charge. The only meaningful option we have
* is to deliver the paging response to the first configured MSC
* blindly. */
- msc = llist_first_entry_or_null(&bsc->mscs, struct bsc_msc_data, entry);
+ msc = llist_first_entry_or_null(&net->mscs, struct bsc_msc_data, entry);
if (msc)
return msc;
LOGP(DMSC, LOGL_ERROR, "Unable to find any suitable MSC to deliver paging response!\n");
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index e65d0cf91..864d96d18 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -137,7 +137,7 @@ page_subscriber(struct bsc_msc_data *msc, struct gsm_bts *bts,
subscr->lac = lac;
subscr->tmsi = tmsi;
- ret = bsc_grace_paging_request(msc->network->bsc_data->rf_ctrl->policy, subscr, chan_needed, msc, bts);
+ ret = bsc_grace_paging_request(msc->network->rf_ctrl->policy, subscr, chan_needed, msc, bts);
if (ret == 0)
LOGP(DMSC, LOGL_INFO, "Paging request failed or repeated paging: BTS: %d IMSI: '%s' TMSI: '0x%x/%u' LAC: 0x%x\n",
bts->nr, mi_string, tmsi, tmsi, lac);
diff --git a/src/osmo-bsc/osmo_bsc_ctrl.c b/src/osmo-bsc/osmo_bsc_ctrl.c
index eb82a7c90..12b2f4db6 100644
--- a/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -348,7 +348,7 @@ void bsc_gen_location_state_trap(struct gsm_bts *bts)
{
struct bsc_msc_data *msc;
- llist_for_each_entry(msc, &bts->network->bsc_data->mscs, entry)
+ llist_for_each_entry(msc, &bts->network->mscs, entry)
generate_location_state_trap(bts, msc);
}
@@ -651,7 +651,7 @@ static int set_net_inform_msc(struct ctrl_cmd *cmd, void *data)
struct bsc_msc_data *msc;
net = cmd->node;
- llist_for_each_entry(msc, &net->bsc_data->mscs, entry) {
+ llist_for_each_entry(msc, &net->mscs, entry) {
struct ctrl_cmd *trap;
trap = ctrl_cmd_create(tall_bsc_ctx, CTRL_TYPE_TRAP);
diff --git a/src/osmo-bsc/osmo_bsc_grace.c b/src/osmo-bsc/osmo_bsc_grace.c
index 9ee84d4cf..56edee569 100644
--- a/src/osmo-bsc/osmo_bsc_grace.c
+++ b/src/osmo-bsc/osmo_bsc_grace.c
@@ -30,7 +30,7 @@ int bsc_grace_allow_new_connection(struct gsm_network *network, struct gsm_bts *
{
if (bts->excl_from_rf_lock)
return 1;
- return network->bsc_data->rf_ctrl->policy == S_RF_ON;
+ return network->rf_ctrl->policy == S_RF_ON;
}
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 42d05b1a2..9ddbe3577 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -651,10 +651,6 @@ static void signal_handler(int signal)
talloc_report(tall_vty_ctx, stderr);
talloc_report_full(tall_bsc_ctx, stderr);
break;
- case SIGUSR2:
- if (!bsc_gsmnet->bsc_data)
- return;
- break;
default:
break;
}
@@ -797,7 +793,6 @@ extern void *tall_ctr_ctx;
int main(int argc, char **argv)
{
struct bsc_msc_data *msc;
- struct osmo_bsc_data *data;
int rc;
tall_bsc_ctx = talloc_named_const(NULL, 1, "osmo-bsc");
@@ -880,17 +875,16 @@ int main(int argc, char **argv)
exit(1);
}
- data = bsc_gsmnet->bsc_data;
if (rf_ctrl)
- osmo_talloc_replace_string(data, &data->rf_ctrl_name, rf_ctrl);
+ osmo_talloc_replace_string(bsc_gsmnet, &bsc_gsmnet->rf_ctrl_name, rf_ctrl);
- data->rf_ctrl = osmo_bsc_rf_create(data->rf_ctrl_name, bsc_gsmnet);
- if (!data->rf_ctrl) {
+ bsc_gsmnet->rf_ctrl = osmo_bsc_rf_create(bsc_gsmnet->rf_ctrl_name, bsc_gsmnet);
+ if (!bsc_gsmnet->rf_ctrl) {
fprintf(stderr, "Failed to create the RF service.\n");
exit(1);
}
- rc = check_codec_pref(&bsc_gsmnet->bsc_data->mscs);
+ rc = check_codec_pref(&bsc_gsmnet->mscs);
if (rc < 0) {
LOGP(DMSC, LOGL_ERROR, "Configuration contains mutually exclusive codec settings -- check"
" configuration!\n");
@@ -902,7 +896,7 @@ int main(int argc, char **argv)
}
}
- llist_for_each_entry(msc, &bsc_gsmnet->bsc_data->mscs, entry) {
+ llist_for_each_entry(msc, &bsc_gsmnet->mscs, entry) {
if (osmo_bsc_msc_init(msc) != 0) {
LOGP(DMSC, LOGL_ERROR, "Failed to start up. Exiting.\n");
exit(1);
@@ -918,7 +912,7 @@ int main(int argc, char **argv)
exit(1);
}
- if (osmo_bsc_sigtran_init(&bsc_gsmnet->bsc_data->mscs) != 0) {
+ if (osmo_bsc_sigtran_init(&bsc_gsmnet->mscs) != 0) {
LOGP(DNM, LOGL_ERROR, "Failed to initialize sigtran backhaul.\n");
exit(1);
}
diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c
index f766f75d6..30b54f3d5 100644
--- a/src/osmo-bsc/osmo_bsc_msc.c
+++ b/src/osmo-bsc/osmo_bsc_msc.c
@@ -150,7 +150,7 @@ struct bsc_msc_data *osmo_msc_data_find(struct gsm_network *net, int nr)
{
struct bsc_msc_data *msc_data;
- llist_for_each_entry(msc_data, &net->bsc_data->mscs, entry)
+ llist_for_each_entry(msc_data, &net->mscs, entry)
if (msc_data->nr == nr)
return msc_data;
return NULL;
@@ -183,7 +183,7 @@ struct bsc_msc_data *osmo_msc_data_alloc(struct gsm_network *net, int nr)
return NULL;
}
- llist_add_tail(&msc_data->entry, &net->bsc_data->mscs);
+ llist_add_tail(&msc_data->entry, &net->mscs);
/* Init back pointer */
msc_data->network = net;
diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index 51a660b63..34a56dedb 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -35,11 +35,6 @@
#include <time.h>
-static struct osmo_bsc_data *osmo_bsc_data(struct vty *vty)
-{
- return bsc_gsmnet->bsc_data;
-}
-
static struct bsc_msc_data *bsc_msc_data(struct vty *vty)
{
return vty->index;
@@ -180,9 +175,8 @@ static void write_msc(struct vty *vty, struct bsc_msc_data *msc)
static int config_write_msc(struct vty *vty)
{
struct bsc_msc_data *msc;
- struct osmo_bsc_data *bsc = osmo_bsc_data(vty);
- llist_for_each_entry(msc, &bsc->mscs, entry)
+ llist_for_each_entry(msc, &bsc_gsmnet->mscs, entry)
write_msc(vty, msc);
return CMD_SUCCESS;
@@ -190,17 +184,15 @@ static int config_write_msc(struct vty *vty)
static int config_write_bsc(struct vty *vty)
{
- struct osmo_bsc_data *bsc = osmo_bsc_data(vty);
-
vty_out(vty, "bsc%s", VTY_NEWLINE);
- vty_out(vty, " mid-call-timeout %d%s", bsc->mid_call_timeout, VTY_NEWLINE);
- if (bsc->rf_ctrl_name)
+ vty_out(vty, " mid-call-timeout %d%s", bsc_gsmnet->mid_call_timeout, VTY_NEWLINE);
+ if (bsc_gsmnet->rf_ctrl_name)
vty_out(vty, " bsc-rf-socket %s%s",
- bsc->rf_ctrl_name, VTY_NEWLINE);
+ bsc_gsmnet->rf_ctrl_name, VTY_NEWLINE);
- if (bsc->auto_off_timeout != -1)
+ if (bsc_gsmnet->auto_off_timeout != -1)
vty_out(vty, " bsc-auto-rf-off %d%s",
- bsc->auto_off_timeout, VTY_NEWLINE);
+ bsc_gsmnet->auto_off_timeout, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -285,7 +277,7 @@ DEFUN(cfg_net_bsc_codec_list,
/* create a new array */
data->audio_support =
- talloc_zero_array(osmo_bsc_data(vty), struct gsm_audio_support *, argc);
+ talloc_zero_array(bsc_gsmnet, struct gsm_audio_support *, argc);
data->audio_length = argc;
for (i = 0; i < argc; ++i) {
@@ -581,8 +573,7 @@ DEFUN(cfg_net_bsc_mid_call_timeout,
"mid-call-timeout NR",
"Switch from Grace to Off in NR seconds.\n" "Timeout in seconds\n")
{
- struct osmo_bsc_data *data = osmo_bsc_data(vty);
- data->mid_call_timeout = atoi(argv[0]);
+ bsc_gsmnet->mid_call_timeout = atoi(argv[0]);
return CMD_SUCCESS;
}
@@ -591,9 +582,7 @@ DEFUN(cfg_net_rf_socket,
"bsc-rf-socket PATH",
"Set the filename for the RF control interface.\n" "RF Control path\n")
{
- struct osmo_bsc_data *data = osmo_bsc_data(vty);
-
- osmo_talloc_replace_string(data, &data->rf_ctrl_name, argv[0]);
+ osmo_talloc_replace_string(bsc_gsmnet, &bsc_gsmnet->rf_ctrl_name, argv[0]);
return CMD_SUCCESS;
}
@@ -602,8 +591,7 @@ DEFUN(cfg_net_rf_off_time,
"bsc-auto-rf-off <1-65000>",
"Disable RF on MSC Connection\n" "Timeout\n")
{
- struct osmo_bsc_data *data = osmo_bsc_data(vty);
- data->auto_off_timeout = atoi(argv[0]);
+ bsc_gsmnet->auto_off_timeout = atoi(argv[0]);
return CMD_SUCCESS;
}
@@ -612,8 +600,7 @@ DEFUN(cfg_net_no_rf_off_time,
"no bsc-auto-rf-off",
NO_STR "Disable RF on MSC Connection\n")
{
- struct osmo_bsc_data *data = osmo_bsc_data(vty);
- data->auto_off_timeout = -1;
+ bsc_gsmnet->auto_off_timeout = -1;
return CMD_SUCCESS;
}
@@ -632,7 +619,7 @@ DEFUN(show_mscs,
SHOW_STR "MSC Connections and State\n")
{
struct bsc_msc_data *msc;
- llist_for_each_entry(msc, &bsc_gsmnet->bsc_data->mscs, entry) {
+ llist_for_each_entry(msc, &bsc_gsmnet->mscs, entry) {
vty_out(vty, "%d %s %s ",
msc->a.cs7_instance,
osmo_ss7_asp_protocol_name(msc->a.asp_proto),