aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmo-bts/gsm_data.h101
-rw-r--r--include/osmo-bts/gsm_data_shared.h92
-rw-r--r--include/osmo-bts/paging.h4
-rw-r--r--src/common/abis.c6
-rw-r--r--src/common/bts.c111
-rw-r--r--src/common/cbch.c18
-rw-r--r--src/common/handover.c12
-rw-r--r--src/common/l1sap.c50
-rw-r--r--src/common/load_indication.c47
-rw-r--r--src/common/main.c8
-rw-r--r--src/common/oml.c60
-rw-r--r--src/common/paging.c23
-rw-r--r--src/common/pcu_sock.c10
-rw-r--r--src/common/power_control.c3
-rw-r--r--src/common/rsl.c15
-rw-r--r--src/common/sysinfo.c7
-rw-r--r--src/common/vty.c113
-rw-r--r--src/osmo-bts-litecell15/l1_if.c3
-rw-r--r--src/osmo-bts-litecell15/main.c4
-rw-r--r--src/osmo-bts-litecell15/oml.c3
-rw-r--r--src/osmo-bts-litecell15/utils.c3
-rw-r--r--src/osmo-bts-octphy/l1_if.c6
-rw-r--r--src/osmo-bts-sysmo/l1_if.c3
-rw-r--r--src/osmo-bts-sysmo/main.c4
-rw-r--r--src/osmo-bts-sysmo/oml.c3
-rw-r--r--src/osmo-bts-sysmo/sysmobts_vty.c3
-rw-r--r--src/osmo-bts-sysmo/utils.c3
-rw-r--r--src/osmo-bts-trx/main.c4
-rw-r--r--src/osmo-bts-virtual/main.c5
-rw-r--r--src/osmo-bts-virtual/scheduler_virtbts.c21
-rw-r--r--tests/agch/agch_test.c26
-rw-r--r--tests/cipher/cipher_test.c32
-rw-r--r--tests/handover/handover_test.c5
-rw-r--r--tests/paging/paging_test.c24
-rw-r--r--tests/power/power_test.c5
-rw-r--r--tests/sysmobts/sysmobts_test.c11
36 files changed, 371 insertions, 477 deletions
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 31879b9b..9e62cdf0 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -24,9 +24,6 @@
#define GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT 41
#define GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT 91
-struct pcu_sock_state;
-struct smscb_msg;
-
struct gsm_network {
struct llist_head bts_list;
unsigned int num_bts;
@@ -34,99 +31,6 @@ struct gsm_network {
struct pcu_sock_state *pcu_state;
};
-/* data structure for BTS related data specific to the BTS role */
-struct gsm_bts_role_bts {
- struct gsm_bts *bts;
- struct {
- /* Interference Boundaries for OML */
- int16_t boundary[6];
- uint8_t intave;
- } interference;
- unsigned int t200_ms[7];
- unsigned int t3105_ms;
- struct {
- uint8_t overload_period;
- struct {
- /* Input parameters from OML */
- uint8_t load_ind_thresh; /* percent */
- uint8_t load_ind_period; /* seconds */
- /* Internal data */
- struct osmo_timer_list timer;
- unsigned int pch_total;
- unsigned int pch_used;
- } ccch;
- struct {
- /* Input parameters from OML */
- int16_t busy_thresh; /* in dBm */
- uint16_t averaging_slots;
- /* Internal data */
- unsigned int total; /* total nr */
- unsigned int busy; /* above busy_thresh */
- unsigned int access; /* access bursts */
- } rach;
- } load;
- uint8_t ny1;
- uint8_t max_ta;
-
- /* AGCH queuing */
- struct {
- struct llist_head queue;
- int length;
- int max_length;
-
- int thresh_level; /* Cleanup threshold in percent of max len */
- int low_level; /* Low water mark in percent of max len */
- int high_level; /* High water mark in percent of max len */
-
- /* TODO: Use a rate counter group instead */
- uint64_t dropped_msgs;
- uint64_t merged_msgs;
- uint64_t rejected_msgs;
- uint64_t agch_msgs;
- uint64_t pch_msgs;
- } agch_queue;
-
- struct paging_state *paging_state;
- char *bsc_oml_host;
- struct llist_head oml_queue;
- unsigned int rtp_jitter_buf_ms;
- bool rtp_jitter_adaptive;
- struct {
- uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */
- } support;
- struct {
- uint8_t tc4_ctr;
- } si;
- struct gsm_time gsm_time;
- /* Radio Link Timeout counter. -1 disables timeout for
- * lab/measurement purpose */
- int radio_link_timeout;
-
- int ul_power_target; /* Uplink Rx power target */
-
- /* used by the sysmoBTS to adjust band */
- uint8_t auto_band;
-
- struct {
- struct llist_head queue; /* list of struct smscb_msg */
- struct smscb_msg *cur_msg; /* current SMS-CB */
- } smscb_state;
-
- float min_qual_rach; /* minimum quality for RACH bursts */
- float min_qual_norm; /* minimum quality for normal daata */
- uint16_t max_ber10k_rach; /* Maximum permitted RACH BER in 0.01% */
-
- struct {
- char *sock_path;
- } pcu;
-
- struct {
- uint32_t last_fn;
- struct timeval tv_clock;
- struct osmo_timer_list fn_timer;
- } vbts;
-};
-
enum lchan_ciph_state {
LCHAN_CIPH_NONE,
LCHAN_CIPH_RX_REQ,
@@ -136,9 +40,6 @@ enum lchan_ciph_state {
LCHAN_CIPH_RXTX_CONF,
};
-#define bts_role_bts(x) ((struct gsm_bts_role_bts *)(x)->role)
-#define btsb_bts(x) (x)->bts
-
#include <osmo-bts/gsm_data_shared.h>
void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state);
@@ -148,7 +49,7 @@ int conf_lchans_as_pchan(struct gsm_bts_trx_ts *ts,
/* cipher code */
#define CIPHER_A5(x) (1 << (x-1))
-int bts_supports_cipher(struct gsm_bts_role_bts *bts, int rsl_cipher);
+int bts_supports_cipher(struct gsm_bts *bts, int rsl_cipher);
bool ts_is_pdch(const struct gsm_bts_trx_ts *ts);
diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h
index e4ac9b0b..b19bc903 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -78,6 +78,8 @@ enum bts_gprs_mode {
struct gsm_lchan;
struct osmo_rtp_socket;
+struct pcu_sock_state;
+struct smscb_msg;
/* Network Management State */
struct gsm_nm_state {
@@ -626,7 +628,95 @@ struct gsm_bts {
struct rate_ctr_group *ctrs;
bool supp_meas_toa256;
- void *role;
+ struct {
+ /* Interference Boundaries for OML */
+ int16_t boundary[6];
+ uint8_t intave;
+ } interference;
+ unsigned int t200_ms[7];
+ unsigned int t3105_ms;
+ struct {
+ uint8_t overload_period;
+ struct {
+ /* Input parameters from OML */
+ uint8_t load_ind_thresh; /* percent */
+ uint8_t load_ind_period; /* seconds */
+ /* Internal data */
+ struct osmo_timer_list timer;
+ unsigned int pch_total;
+ unsigned int pch_used;
+ } ccch;
+ struct {
+ /* Input parameters from OML */
+ int16_t busy_thresh; /* in dBm */
+ uint16_t averaging_slots;
+ /* Internal data */
+ unsigned int total; /* total nr */
+ unsigned int busy; /* above busy_thresh */
+ unsigned int access; /* access bursts */
+ } rach;
+ } load;
+ uint8_t ny1;
+ uint8_t max_ta;
+
+ /* AGCH queuing */
+ struct {
+ struct llist_head queue;
+ int length;
+ int max_length;
+
+ int thresh_level; /* Cleanup threshold in percent of max len */
+ int low_level; /* Low water mark in percent of max len */
+ int high_level; /* High water mark in percent of max len */
+
+ /* TODO: Use a rate counter group instead */
+ uint64_t dropped_msgs;
+ uint64_t merged_msgs;
+ uint64_t rejected_msgs;
+ uint64_t agch_msgs;
+ uint64_t pch_msgs;
+ } agch_queue;
+
+ struct paging_state *paging_state;
+ char *bsc_oml_host;
+ struct llist_head oml_queue;
+ unsigned int rtp_jitter_buf_ms;
+ bool rtp_jitter_adaptive;
+ struct {
+ uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */
+ } support;
+ struct {
+ uint8_t tc4_ctr;
+ } si;
+ struct gsm_time gsm_time;
+ /* Radio Link Timeout counter. -1 disables timeout for
+ * lab/measurement purpose */
+ int radio_link_timeout;
+
+ int ul_power_target; /* Uplink Rx power target */
+
+ /* used by the sysmoBTS to adjust band */
+ uint8_t auto_band;
+
+ struct {
+ struct llist_head queue; /* list of struct smscb_msg */
+ struct smscb_msg *cur_msg; /* current SMS-CB */
+ } smscb_state;
+
+ float min_qual_rach; /* minimum quality for RACH bursts */
+ float min_qual_norm; /* minimum quality for normal daata */
+ uint16_t max_ber10k_rach; /* Maximum permitted RACH BER in 0.01% */
+
+ struct {
+ char *sock_path;
+ } pcu;
+
+ struct {
+ uint32_t last_fn;
+ struct timeval tv_clock;
+ struct osmo_timer_list fn_timer;
+ } vbts;
+
};
diff --git a/include/osmo-bts/paging.h b/include/osmo-bts/paging.h
index 38accd72..7fc0bf05 100644
--- a/include/osmo-bts/paging.h
+++ b/include/osmo-bts/paging.h
@@ -6,10 +6,10 @@
#include <osmocom/gsm/protocol/gsm_04_08.h>
struct paging_state;
-struct gsm_bts_role_bts;
+struct gsm_bts;
/* initialize paging code */
-struct paging_state *paging_init(struct gsm_bts_role_bts *btsb,
+struct paging_state *paging_init(struct gsm_bts *bts,
unsigned int num_paging_max,
unsigned int paging_lifetime);
diff --git a/src/common/abis.c b/src/common/abis.c
index 768d261c..6402bdb2 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -54,10 +54,9 @@ static struct gsm_bts *g_bts;
int abis_oml_sendmsg(struct msgb *msg)
{
struct gsm_bts *bts = msg->trx->bts;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
if (!bts->oml_link) {
- llist_add_tail(&msg->list, &btsb->oml_queue);
+ llist_add_tail(&msg->list, &bts->oml_queue);
return 0;
} else {
/* osmo-bts uses msg->trx internally, but libosmo-abis uses
@@ -69,10 +68,9 @@ int abis_oml_sendmsg(struct msgb *msg)
static void drain_oml_queue(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct msgb *msg, *msg2;
- llist_for_each_entry_safe(msg, msg2, &btsb->oml_queue, list) {
+ llist_for_each_entry_safe(msg, msg2, &bts->oml_queue, list) {
/* osmo-bts uses msg->trx internally, but libosmo-abis uses
* the signalling link at msg->dst */
llist_del(&msg->list);
diff --git a/src/common/bts.c b/src/common/bts.c
index 3ab6e872..74630cc3 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -108,7 +108,6 @@ static const struct rate_ctr_group_desc bts_ctrg_desc = {
* file reading */
int bts_init(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb;
struct gsm_bts_trx *trx;
int rc, i;
static int initialized = 0;
@@ -119,11 +118,8 @@ int bts_init(struct gsm_bts *bts)
bts->band = GSM_BAND_1800;
- bts->role = btsb = talloc_zero(bts, struct gsm_bts_role_bts);
- btsb->bts = bts;
-
- INIT_LLIST_HEAD(&btsb->agch_queue.queue);
- btsb->agch_queue.length = 0;
+ INIT_LLIST_HEAD(&bts->agch_queue.queue);
+ bts->agch_queue.length = 0;
bts->ctrs = rate_ctr_group_alloc(bts, &bts_ctrg_desc, bts->nr);
@@ -131,31 +127,31 @@ int bts_init(struct gsm_bts *bts)
* raise threshold to GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DISABLE to
* disable this feature.
*/
- btsb->agch_queue.low_level = GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT;
- btsb->agch_queue.high_level = GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT;
- btsb->agch_queue.thresh_level = GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT;
+ bts->agch_queue.low_level = GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT;
+ bts->agch_queue.high_level = GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT;
+ bts->agch_queue.thresh_level = GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT;
/* configurable via VTY */
- btsb->paging_state = paging_init(btsb, 200, 0);
- btsb->ul_power_target = -75; /* dBm default */
- btsb->rtp_jitter_adaptive = false;
+ bts->paging_state = paging_init(bts, 200, 0);
+ bts->ul_power_target = -75; /* dBm default */
+ bts->rtp_jitter_adaptive = false;
/* configurable via OML */
- btsb->load.ccch.load_ind_period = 112;
+ bts->load.ccch.load_ind_period = 112;
load_timer_start(bts);
- btsb->rtp_jitter_buf_ms = 100;
- btsb->max_ta = 63;
- btsb->ny1 = 4;
- btsb->t3105_ms = 300;
- btsb->min_qual_rach = MIN_QUAL_RACH;
- btsb->min_qual_norm = MIN_QUAL_NORM;
- btsb->max_ber10k_rach = 1707; /* 7 of 41 bits is Eb/N0 of 0 dB = 0.1707 */
- btsb->pcu.sock_path = talloc_strdup(btsb, PCU_SOCK_DEFAULT);
- for (i = 0; i < ARRAY_SIZE(btsb->t200_ms); i++)
- btsb->t200_ms[i] = oml_default_t200_ms[i];
+ bts->rtp_jitter_buf_ms = 100;
+ bts->max_ta = 63;
+ bts->ny1 = 4;
+ bts->t3105_ms = 300;
+ bts->min_qual_rach = MIN_QUAL_RACH;
+ bts->min_qual_norm = MIN_QUAL_NORM;
+ bts->max_ber10k_rach = 1707; /* 7 of 41 bits is Eb/N0 of 0 dB = 0.1707 */
+ bts->pcu.sock_path = talloc_strdup(bts, PCU_SOCK_DEFAULT);
+ for (i = 0; i < ARRAY_SIZE(bts->t200_ms); i++)
+ bts->t200_ms[i] = oml_default_t200_ms[i];
/* default RADIO_LINK_TIMEOUT */
- btsb->radio_link_timeout = 32;
+ bts->radio_link_timeout = 32;
/* Start with the site manager */
oml_mo_state_init(&bts->site_mgr.mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
@@ -205,8 +201,8 @@ int bts_init(struct gsm_bts *bts)
initialized = 1;
}
- INIT_LLIST_HEAD(&btsb->smscb_state.queue);
- INIT_LLIST_HEAD(&btsb->oml_queue);
+ INIT_LLIST_HEAD(&bts->smscb_state.queue);
+ INIT_LLIST_HEAD(&bts->oml_queue);
/* register DTX DL FSM */
rc = osmo_fsm_register(&dtx_dl_amr_fsm);
@@ -387,22 +383,21 @@ int bts_agch_max_queue_length(int T, int bcch_conf)
static void bts_update_agch_max_queue_length(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct gsm48_system_information_type_3 *si3;
- int old_max_length = btsb->agch_queue.max_length;
+ int old_max_length = bts->agch_queue.max_length;
if (!(bts->si_valid & (1<<SYSINFO_TYPE_3)))
return;
si3 = GSM_BTS_SI(bts, SYSINFO_TYPE_3);
- btsb->agch_queue.max_length =
+ bts->agch_queue.max_length =
bts_agch_max_queue_length(si3->rach_control.tx_integer,
si3->control_channel_desc.ccch_conf);
- if (btsb->agch_queue.max_length != old_max_length)
+ if (bts->agch_queue.max_length != old_max_length)
LOGP(DRSL, LOGL_INFO, "Updated AGCH max queue length to %d\n",
- btsb->agch_queue.max_length);
+ bts->agch_queue.max_length);
}
#define REQ_REFS_PER_IMM_ASS_REJ 4
@@ -534,47 +529,45 @@ static int try_merge_imm_ass_rej(struct gsm48_imm_ass_rej *old_rej,
int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
int hard_limit = 1000;
struct gsm48_imm_ass_rej *imm_ass_cmd = msgb_l3(msg);
- if (btsb->agch_queue.length > hard_limit) {
+ if (bts->agch_queue.length > hard_limit) {
LOGP(DSUM, LOGL_ERROR,
"AGCH: too many messages in queue, "
"refusing message type 0x%02x, length = %d/%d\n",
((struct gsm48_imm_ass *)msgb_l3(msg))->msg_type,
- btsb->agch_queue.length, btsb->agch_queue.max_length);
+ bts->agch_queue.length, bts->agch_queue.max_length);
- btsb->agch_queue.rejected_msgs++;
+ bts->agch_queue.rejected_msgs++;
return -ENOMEM;
}
- if (btsb->agch_queue.length > 0) {
+ if (bts->agch_queue.length > 0) {
struct msgb *last_msg =
- llist_entry(btsb->agch_queue.queue.prev, struct msgb, list);
+ llist_entry(bts->agch_queue.queue.prev, struct msgb, list);
struct gsm48_imm_ass_rej *last_imm_ass_rej = msgb_l3(last_msg);
if (try_merge_imm_ass_rej(last_imm_ass_rej, imm_ass_cmd)) {
- btsb->agch_queue.merged_msgs++;
+ bts->agch_queue.merged_msgs++;
msgb_free(msg);
return 0;
}
}
- msgb_enqueue(&btsb->agch_queue.queue, msg);
- btsb->agch_queue.length++;
+ msgb_enqueue(&bts->agch_queue.queue, msg);
+ bts->agch_queue.length++;
return 0;
}
struct msgb *bts_agch_dequeue(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- struct msgb *msg = msgb_dequeue(&btsb->agch_queue.queue);
+ struct msgb *msg = msgb_dequeue(&bts->agch_queue.queue);
if (!msg)
return NULL;
- btsb->agch_queue.length--;
+ bts->agch_queue.length--;
return msg;
}
@@ -586,19 +579,18 @@ struct msgb *bts_agch_dequeue(struct gsm_bts *bts)
*/
static void compact_agch_queue(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct msgb *msg, *msg2;
int max_len, slope, offs;
- int level_low = btsb->agch_queue.low_level;
- int level_high = btsb->agch_queue.high_level;
- int level_thres = btsb->agch_queue.thresh_level;
+ int level_low = bts->agch_queue.low_level;
+ int level_high = bts->agch_queue.high_level;
+ int level_thres = bts->agch_queue.thresh_level;
- max_len = btsb->agch_queue.max_length;
+ max_len = bts->agch_queue.max_length;
if (max_len == 0)
max_len = 1;
- if (btsb->agch_queue.length < max_len * level_thres / 100)
+ if (bts->agch_queue.length < max_len * level_thres / 100)
return;
/* p^
@@ -615,7 +607,7 @@ static void compact_agch_queue(struct gsm_bts *bts)
else
slope = 0x10000 * max_len; /* p_drop >= 1 if len > offs */
- llist_for_each_entry_safe(msg, msg2, &btsb->agch_queue.queue, list) {
+ llist_for_each_entry_safe(msg, msg2, &bts->agch_queue.queue, list) {
struct gsm48_imm_ass *imm_ass_cmd = msgb_l3(msg);
int p_drop;
@@ -624,16 +616,16 @@ static void compact_agch_queue(struct gsm_bts *bts)
/* IMMEDIATE ASSIGN REJECT */
- p_drop = (btsb->agch_queue.length - offs) * slope / max_len;
+ p_drop = (bts->agch_queue.length - offs) * slope / max_len;
if ((random() & 0xffff) >= p_drop)
return;
llist_del(&msg->list);
- btsb->agch_queue.length--;
+ bts->agch_queue.length--;
msgb_free(msg);
- btsb->agch_queue.dropped_msgs++;
+ bts->agch_queue.dropped_msgs++;
}
return;
}
@@ -642,7 +634,6 @@ int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt
int is_ag_res)
{
struct msgb *msg = NULL;
- struct gsm_bts_role_bts *btsb = bts->role;
int rc = 0;
int is_empty = 1;
@@ -655,7 +646,7 @@ int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt
/* Check for paging messages first if this is PCH */
if (!is_ag_res)
- rc = paging_gen_msg(btsb->paging_state, out_buf, gt, &is_empty);
+ rc = paging_gen_msg(bts->paging_state, out_buf, gt, &is_empty);
/* Check whether the block may be overwritten */
if (!is_empty)
@@ -673,14 +664,14 @@ int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt
msgb_free(msg);
if (is_ag_res)
- btsb->agch_queue.agch_msgs++;
+ bts->agch_queue.agch_msgs++;
else
- btsb->agch_queue.pch_msgs++;
+ bts->agch_queue.pch_msgs++;
return rc;
}
-int bts_supports_cipher(struct gsm_bts_role_bts *bts, int rsl_cipher)
+int bts_supports_cipher(struct gsm_bts *bts, int rsl_cipher)
{
int sup;
@@ -702,9 +693,7 @@ int trx_ms_pwr_ctrl_is_osmo(struct gsm_bts_trx *trx)
struct gsm_time *get_time(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts->role;
-
- return &btsb->gsm_time;
+ return &bts->gsm_time;
}
int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
diff --git a/src/common/cbch.c b/src/common/cbch.c
index e511c674..b8f69c62 100644
--- a/src/common/cbch.c
+++ b/src/common/cbch.c
@@ -52,9 +52,8 @@ static int get_smscb_null_block(uint8_t *out)
static int get_smscb_block(struct gsm_bts *bts, uint8_t *out)
{
int to_copy;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct gsm412_block_type *block_type;
- struct smscb_msg *msg = btsb->smscb_state.cur_msg;
+ struct smscb_msg *msg = bts->smscb_state.cur_msg;
if (!msg) {
/* No message: Send NULL mesage */
@@ -86,8 +85,8 @@ static int get_smscb_block(struct gsm_bts *bts, uint8_t *out)
if (block_type->lb == 1) {
/* remove/release the message memory */
- talloc_free(btsb->smscb_state.cur_msg);
- btsb->smscb_state.cur_msg = NULL;
+ talloc_free(bts->smscb_state.cur_msg);
+ bts->smscb_state.cur_msg = NULL;
}
return block_type->lb;
@@ -106,7 +105,6 @@ int bts_process_smscb_cmd(struct gsm_bts *bts,
struct rsl_ie_cb_cmd_type cmd_type,
uint8_t msg_len, const uint8_t *msg)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct smscb_msg *scm;
if (msg_len > sizeof(scm->msg)) {
@@ -137,7 +135,7 @@ int bts_process_smscb_cmd(struct gsm_bts *bts,
break;
}
- llist_add_tail(&scm->list, &btsb->smscb_state.queue);
+ llist_add_tail(&scm->list, &bts->smscb_state.queue);
return 0;
}
@@ -145,12 +143,11 @@ int bts_process_smscb_cmd(struct gsm_bts *bts,
static struct smscb_msg *select_next_smscb(struct gsm_bts *bts)
{
struct smscb_msg *msg;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- if (llist_empty(&btsb->smscb_state.queue))
+ if (llist_empty(&bts->smscb_state.queue))
return NULL;
- msg = llist_entry(btsb->smscb_state.queue.next,
+ msg = llist_entry(bts->smscb_state.queue.next,
struct smscb_msg, list);
llist_del(&msg->list);
@@ -162,7 +159,6 @@ static struct smscb_msg *select_next_smscb(struct gsm_bts *bts)
* block for a given gsm_time. outbuf must have 23 bytes of space. */
int bts_cbch_get(struct gsm_bts *bts, uint8_t *outbuf, struct gsm_time *g_time)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
uint32_t fn = gsm_gsmtime2fn(g_time);
/* According to 05.02 Section 6.5.4 */
uint32_t tb = (fn / 51) % 8;
@@ -180,7 +176,7 @@ int bts_cbch_get(struct gsm_bts *bts, uint8_t *outbuf, struct gsm_time *g_time)
switch (tb) {
case 0:
/* select a new SMSCB message */
- btsb->smscb_state.cur_msg = select_next_smscb(bts);
+ bts->smscb_state.cur_msg = select_next_smscb(bts);
rc = get_smscb_block(bts, outbuf);
break;
case 1: case 2: case 3:
diff --git a/src/common/handover.c b/src/common/handover.c
index 45ed0406..54b131ff 100644
--- a/src/common/handover.c
+++ b/src/common/handover.c
@@ -67,10 +67,9 @@ static void ho_t3105_cb(void *data)
{
struct gsm_lchan *lchan = data;
struct gsm_bts *bts = lchan->ts->trx->bts;
- struct gsm_bts_role_bts *btsb = bts->role;
LOGP(DHO, LOGL_INFO, "%s T3105 timeout (%d resends left)\n",
- gsm_lchan_name(lchan), btsb->ny1 - lchan->ho.phys_info_count);
+ gsm_lchan_name(lchan), bts->ny1 - lchan->ho.phys_info_count);
if (lchan->state != LCHAN_S_ACTIVE) {
LOGP(DHO, LOGL_NOTICE,
@@ -79,7 +78,7 @@ static void ho_t3105_cb(void *data)
return;
}
- if (lchan->ho.phys_info_count >= btsb->ny1) {
+ if (lchan->ho.phys_info_count >= bts->ny1) {
/* HO Abort */
LOGP(DHO, LOGL_NOTICE, "%s NY1 reached, sending CONNection "
"FAILure to BSC.\n", gsm_lchan_name(lchan));
@@ -89,14 +88,13 @@ static void ho_t3105_cb(void *data)
ho_tx_phys_info(lchan);
lchan->ho.phys_info_count++;
- osmo_timer_schedule(&lchan->ho.t3105, 0, btsb->t3105_ms * 1000);
+ osmo_timer_schedule(&lchan->ho.t3105, 0, bts->t3105_ms * 1000);
}
/* received random access on dedicated channel */
void handover_rach(struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay)
{
struct gsm_bts *bts = lchan->ts->trx->bts;
- struct gsm_bts_role_bts *btsb = bts->role;
/* Ignore invalid handover ref */
if (lchan->ho.ref != ra) {
@@ -141,10 +139,10 @@ void handover_rach(struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay)
/* Start T3105 */
LOGP(DHO, LOGL_DEBUG,
"%s Starting T3105 with %u ms\n",
- gsm_lchan_name(lchan), btsb->t3105_ms);
+ gsm_lchan_name(lchan), bts->t3105_ms);
lchan->ho.t3105.cb = ho_t3105_cb;
lchan->ho.t3105.data = lchan;
- osmo_timer_schedule(&lchan->ho.t3105, 0, btsb->t3105_ms * 1000);
+ osmo_timer_schedule(&lchan->ho.t3105, 0, bts->t3105_ms * 1000);
}
/* received frist valid data frame on dedicated channel */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 83801756..0a229e1b 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -448,29 +448,28 @@ static int l1sap_info_time_ind(struct gsm_bts *bts,
struct osmo_phsap_prim *l1sap,
struct info_time_ind_param *info_time_ind)
{
- struct gsm_bts_role_bts *btsb = bts->role;
int frames_expired;
DEBUGPFN(DL1P, info_time_ind->fn, "Rx MPH_INFO time ind\n");
/* Calculate and check frame difference */
- frames_expired = info_time_ind->fn - btsb->gsm_time.fn;
+ frames_expired = info_time_ind->fn - bts->gsm_time.fn;
if (frames_expired > 1) {
- if (btsb->gsm_time.fn)
+ if (bts->gsm_time.fn)
LOGPFN(DL1P, LOGL_ERROR, info_time_ind->fn,
"Invalid condition detected: Frame difference is %"PRIu32"-%"PRIu32"=%d > 1!\n",
- info_time_ind->fn, btsb->gsm_time.fn, frames_expired);
+ info_time_ind->fn, bts->gsm_time.fn, frames_expired);
}
/* Update our data structures with the current GSM time */
- gsm_fn2gsmtime(&btsb->gsm_time, info_time_ind->fn);
+ gsm_fn2gsmtime(&bts->gsm_time, info_time_ind->fn);
/* Update time on PCU interface */
pcu_tx_time_ind(info_time_ind->fn);
/* increment number of RACH slots that have passed by since the
* last time indication */
- btsb->load.rach.total +=
+ bts->load.rach.total +=
calc_exprd_rach_frames(bts, info_time_ind->fn) * frames_expired;
return 0;
@@ -921,10 +920,10 @@ static int l1sap_tch_rts_ind(struct gsm_bts_trx *trx,
* network operator." */
static void radio_link_timeout(struct gsm_lchan *lchan, int bad_frame)
{
- struct gsm_bts_role_bts *btsb = lchan->ts->trx->bts->role;
+ struct gsm_bts *bts = lchan->ts->trx->bts;
/* Bypass radio link timeout if set to -1 */
- if (btsb->radio_link_timeout < 0)
+ if (bts->radio_link_timeout < 0)
return;
/* if link loss criterion already reached */
@@ -944,11 +943,11 @@ static void radio_link_timeout(struct gsm_lchan *lchan, int bad_frame)
return;
}
- if (lchan->s < btsb->radio_link_timeout) {
+ if (lchan->s < bts->radio_link_timeout) {
/* count up radio link counter S */
lchan->s += 2;
- if (lchan->s > btsb->radio_link_timeout)
- lchan->s = btsb->radio_link_timeout;
+ if (lchan->s > bts->radio_link_timeout)
+ lchan->s = bts->radio_link_timeout;
DEBUGP(DMEAS, "%s counting up radio link counter S=%d\n",
gsm_lchan_name(lchan), lchan->s);
}
@@ -1105,12 +1104,12 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx,
static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
struct ph_tch_param *tch_ind)
{
+ struct gsm_bts *bts = trx->bts;
struct msgb *msg = l1sap->oph.msg;
struct gsm_time g_time;
struct gsm_lchan *lchan;
uint8_t chan_nr;
uint32_t fn;
- struct gsm_bts_role_bts *btsb = bts_role_bts(trx->bts);
chan_nr = tch_ind->chan_nr;
fn = tch_ind->fn;
@@ -1131,7 +1130,7 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
* the content is not available due to decoding issues. Content not
* available is expected as empty payload. We also check if quality is
* good enough. */
- if (msg->len && tch_ind->lqual_cb / 10 >= btsb->min_qual_norm) {
+ if (msg->len && tch_ind->lqual_cb / 10 >= bts->min_qual_norm) {
/* hand msg to RTP code for transmission */
if (lchan->abis_ip.rtp_socket)
osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
@@ -1161,16 +1160,15 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
#define RACH_MIN_TOA256 -2 * 256
-static bool rach_pass_filter(struct ph_rach_ind_param *rach_ind,
- struct gsm_bts_role_bts *btsb)
+static bool rach_pass_filter(struct ph_rach_ind_param *rach_ind, struct gsm_bts *bts)
{
int16_t toa256 = rach_ind->acc_delay_256bits;
/* Check for RACH exceeding BER threshold (ghost RACH) */
- if (rach_ind->ber10k > btsb->max_ber10k_rach) {
+ if (rach_ind->ber10k > bts->max_ber10k_rach) {
LOGPFN(DL1C, LOGL_INFO, rach_ind->fn, "Ignoring RACH request: "
"BER10k(%u) > BER10k_MAX(%u)\n",
- rach_ind->ber10k, btsb->max_ber10k_rach);
+ rach_ind->ber10k, bts->max_ber10k_rach);
return false;
}
@@ -1179,10 +1177,10 @@ static bool rach_pass_filter(struct ph_rach_ind_param *rach_ind,
* We allow early arrival up to 2 symbols, and delay
* according to maximal allowed Timing Advance value.
*/
- if (toa256 < RACH_MIN_TOA256 || toa256 > btsb->max_ta * 256) {
+ if (toa256 < RACH_MIN_TOA256 || toa256 > bts->max_ta * 256) {
LOGPFN(DL1C, LOGL_INFO, rach_ind->fn, "Ignoring RACH request: "
"ToA(%d) exceeds the allowed range (%d..%d)\n",
- toa256, RACH_MIN_TOA256, btsb->max_ta * 256);
+ toa256, RACH_MIN_TOA256, bts->max_ta * 256);
return false;
}
@@ -1194,7 +1192,7 @@ static int l1sap_handover_rach(struct gsm_bts_trx *trx,
struct osmo_phsap_prim *l1sap, struct ph_rach_ind_param *rach_ind)
{
/* Filter out noise / interference / ghosts */
- if (!rach_pass_filter(rach_ind, trx->bts->role)) {
+ if (!rach_pass_filter(rach_ind, trx->bts)) {
rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_DROP);
return 0;
}
@@ -1211,7 +1209,6 @@ static int l1sap_ph_rach_ind(struct gsm_bts_trx *trx,
struct osmo_phsap_prim *l1sap, struct ph_rach_ind_param *rach_ind)
{
struct gsm_bts *bts = trx->bts;
- struct gsm_bts_role_bts *btsb = bts->role;
struct lapdm_channel *lc;
DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind");
@@ -1225,17 +1222,17 @@ static int l1sap_ph_rach_ind(struct gsm_bts_trx *trx,
rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_RCVD);
/* increment number of busy RACH slots, if required */
- if (rach_ind->rssi >= btsb->load.rach.busy_thresh)
- btsb->load.rach.busy++;
+ if (rach_ind->rssi >= bts->load.rach.busy_thresh)
+ bts->load.rach.busy++;
/* Filter out noise / interference / ghosts */
- if (!rach_pass_filter(rach_ind, btsb)) {
+ if (!rach_pass_filter(rach_ind, bts)) {
rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_DROP);
return 0;
}
/* increment number of RACH slots with valid non-handover RACH burst */
- btsb->load.rach.access++;
+ bts->load.rach.access++;
lc = &trx->ts[0].lchan[CCCH_LCHAN].lapdm_ch;
@@ -1397,7 +1394,6 @@ static int l1sap_chan_act_dact_modify(struct gsm_bts_trx *trx, uint8_t chan_nr,
int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed *tp)
{
- struct gsm_bts_role_bts *btsb = trx->bts->role;
struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, chan_nr);
struct gsm48_chan_desc *cd;
int rc;
@@ -1423,7 +1419,7 @@ int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed *
}
lchan->sacch_deact = 0;
- lchan->s = btsb->radio_link_timeout;
+ lchan->s = lchan->ts->trx->bts->radio_link_timeout;
rc = l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_ACTIVATE, 0);
if (rc)
diff --git a/src/common/load_indication.c b/src/common/load_indication.c
index 4756d5ad..e91f6d49 100644
--- a/src/common/load_indication.c
+++ b/src/common/load_indication.c
@@ -30,28 +30,25 @@
static void reset_load_counters(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
-
/* re-set the counters */
- btsb->load.ccch.pch_used = btsb->load.ccch.pch_total = 0;
+ bts->load.ccch.pch_used = bts->load.ccch.pch_total = 0;
}
static void load_timer_cb(void *data)
{
struct gsm_bts *bts = data;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
unsigned int pch_percent, rach_percent;
/* compute percentages */
- if (btsb->load.ccch.pch_total == 0)
+ if (bts->load.ccch.pch_total == 0)
pch_percent = 0;
else
- pch_percent = (btsb->load.ccch.pch_used * 100) /
- btsb->load.ccch.pch_total;
+ pch_percent = (bts->load.ccch.pch_used * 100) /
+ bts->load.ccch.pch_total;
- if (pch_percent >= btsb->load.ccch.load_ind_thresh) {
+ if (pch_percent >= bts->load.ccch.load_ind_thresh) {
/* send RSL load indication message to BSC */
- uint16_t buffer_space = paging_buffer_space(btsb->paging_state);
+ uint16_t buffer_space = paging_buffer_space(bts->paging_state);
rsl_tx_ccch_load_ind_pch(bts, buffer_space);
} else {
/* This is an extenstion of TS 08.58. We don't only
@@ -61,41 +58,37 @@ static void load_timer_cb(void *data)
rsl_tx_ccch_load_ind_pch(bts, 0xffff);
}
- if (btsb->load.rach.total == 0)
+ if (bts->load.rach.total == 0)
rach_percent = 0;
else
- rach_percent = (btsb->load.rach.busy * 100) /
- btsb->load.rach.total;
+ rach_percent = (bts->load.rach.busy * 100) /
+ bts->load.rach.total;
- if (rach_percent >= btsb->load.ccch.load_ind_thresh) {
+ if (rach_percent >= bts->load.ccch.load_ind_thresh) {
/* send RSL load indication message to BSC */
- rsl_tx_ccch_load_ind_rach(bts, btsb->load.rach.total,
- btsb->load.rach.busy,
- btsb->load.rach.access);
+ rsl_tx_ccch_load_ind_rach(bts, bts->load.rach.total,
+ bts->load.rach.busy,
+ bts->load.rach.access);
}
reset_load_counters(bts);
/* re-schedule the timer */
- osmo_timer_schedule(&btsb->load.ccch.timer,
- btsb->load.ccch.load_ind_period, 0);
+ osmo_timer_schedule(&bts->load.ccch.timer,
+ bts->load.ccch.load_ind_period, 0);
}
void load_timer_start(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
-
- if (!btsb->load.ccch.timer.data) {
- btsb->load.ccch.timer.data = bts;
- btsb->load.ccch.timer.cb = load_timer_cb;
+ if (!bts->load.ccch.timer.data) {
+ bts->load.ccch.timer.data = bts;
+ bts->load.ccch.timer.cb = load_timer_cb;
reset_load_counters(bts);
}
- osmo_timer_schedule(&btsb->load.ccch.timer, btsb->load.ccch.load_ind_period, 0);
+ osmo_timer_schedule(&bts->load.ccch.timer, bts->load.ccch.load_ind_period, 0);
}
void load_timer_stop(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
-
- osmo_timer_del(&btsb->load.ccch.timer);
+ osmo_timer_del(&bts->load.ccch.timer);
}
diff --git a/src/common/main.c b/src/common/main.c
index d5dc4ea0..0f6f5295 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -226,7 +226,6 @@ static int write_pid_file(char *procname)
int bts_main(int argc, char **argv)
{
- struct gsm_bts_role_bts *btsb;
struct gsm_bts_trx *trx;
struct e1inp_line *line;
int rc, i;
@@ -289,7 +288,6 @@ int bts_main(int argc, char **argv)
fprintf(stderr, "unable to open bts\n");
exit(1);
}
- btsb = bts_role_bts(bts);
abis_init(bts);
@@ -324,7 +322,7 @@ int bts_main(int argc, char **argv)
exit(1);
}
- if (pcu_sock_init(btsb->pcu.sock_path)) {
+ if (pcu_sock_init(bts->pcu.sock_path)) {
fprintf(stderr, "PCU L1 socket failed\n");
exit(1);
}
@@ -336,12 +334,12 @@ int bts_main(int argc, char **argv)
signal(SIGUSR2, &signal_handler);
osmo_init_ignore_signals();
- if (!btsb->bsc_oml_host) {
+ if (!bts->bsc_oml_host) {
fprintf(stderr, "Cannot start BTS without knowing BSC OML IP\n");
exit(1);
}
- line = abis_open(bts, btsb->bsc_oml_host, "sysmoBTS");
+ line = abis_open(bts, bts->bsc_oml_host, "sysmoBTS");
if (!line) {
fprintf(stderr, "unable to connect to BSC\n");
exit(2);
diff --git a/src/common/oml.c b/src/common/oml.c
index 295d66f6..139210ed 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -486,29 +486,28 @@ static void dl_set_t200(struct lapdm_datalink *dl, unsigned int t200_msec)
int oml_set_lchan_t200(struct gsm_lchan *lchan)
{
struct gsm_bts *bts = lchan->ts->trx->bts;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct lapdm_channel *lc = &lchan->lapdm_ch;
unsigned int t200_dcch, t200_dcch_sapi3, t200_acch, t200_acch_sapi3;
/* set T200 for main and associated channel */
switch (lchan->type) {
case GSM_LCHAN_SDCCH:
- t200_dcch = btsb->t200_ms[T200_SDCCH];
- t200_dcch_sapi3 = btsb->t200_ms[T200_SDCCH_SAPI3];
- t200_acch = btsb->t200_ms[T200_SACCH_SDCCH];
- t200_acch_sapi3 = btsb->t200_ms[T200_SACCH_SDCCH];
+ t200_dcch = bts->t200_ms[T200_SDCCH];
+ t200_dcch_sapi3 = bts->t200_ms[T200_SDCCH_SAPI3];
+ t200_acch = bts->t200_ms[T200_SACCH_SDCCH];
+ t200_acch_sapi3 = bts->t200_ms[T200_SACCH_SDCCH];
break;
case GSM_LCHAN_TCH_F:
- t200_dcch = btsb->t200_ms[T200_FACCH_F];
- t200_dcch_sapi3 = btsb->t200_ms[T200_FACCH_F];
- t200_acch = btsb->t200_ms[T200_SACCH_TCH_SAPI0];
- t200_acch_sapi3 = btsb->t200_ms[T200_SACCH_TCH_SAPI3];
+ t200_dcch = bts->t200_ms[T200_FACCH_F];
+ t200_dcch_sapi3 = bts->t200_ms[T200_FACCH_F];
+ t200_acch = bts->t200_ms[T200_SACCH_TCH_SAPI0];
+ t200_acch_sapi3 = bts->t200_ms[T200_SACCH_TCH_SAPI3];
break;
case GSM_LCHAN_TCH_H:
- t200_dcch = btsb->t200_ms[T200_FACCH_H];
- t200_dcch_sapi3 = btsb->t200_ms[T200_FACCH_H];
- t200_acch = btsb->t200_ms[T200_SACCH_TCH_SAPI0];
- t200_acch_sapi3 = btsb->t200_ms[T200_SACCH_TCH_SAPI3];
+ t200_dcch = bts->t200_ms[T200_FACCH_H];
+ t200_dcch_sapi3 = bts->t200_ms[T200_FACCH_H];
+ t200_acch = bts->t200_ms[T200_SACCH_TCH_SAPI0];
+ t200_acch_sapi3 = bts->t200_ms[T200_SACCH_TCH_SAPI3];
break;
default:
return -1;
@@ -572,7 +571,6 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
struct tlv_parsed tp, *tp_merged;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
int rc, i;
const uint8_t *payload;
@@ -627,12 +625,12 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
payload = TLVP_VAL(&tp, NM_ATT_INTERF_BOUND);
for (i = 0; i < 6; i++) {
int16_t boundary = *payload;
- btsb->interference.boundary[i] = -1 * boundary;
+ bts->interference.boundary[i] = -1 * boundary;
}
}
/* 9.4.24 Intave Parameter */
if (TLVP_PRES_LEN(&tp, NM_ATT_INTAVE_PARAM, 1))
- btsb->interference.intave = *TLVP_VAL(&tp, NM_ATT_INTAVE_PARAM);
+ bts->interference.intave = *TLVP_VAL(&tp, NM_ATT_INTAVE_PARAM);
/* 9.4.14 Connection Failure Criterion */
if (TLVP_PRES_LEN(&tp, NM_ATT_CONN_FAIL_CRIT, 1)) {
@@ -642,12 +640,12 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
case 0xFF: /* Osmocom specific Extension of TS 12.21 */
LOGP(DOML, LOGL_NOTICE, "WARNING: Radio Link Timeout "
"explicitly disabled, only use this for lab testing!\n");
- btsb->radio_link_timeout = -1;
+ bts->radio_link_timeout = -1;
break;
case 0x01: /* Based on uplink SACCH (radio link timeout) */
if (TLVP_LEN(&tp, NM_ATT_CONN_FAIL_CRIT) >= 2 &&
val[1] >= 4 && val[1] <= 64) {
- btsb->radio_link_timeout = val[1];
+ bts->radio_link_timeout = val[1];
break;
}
/* fall-through */
@@ -661,15 +659,15 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
}
/* 9.4.53 T200 */
- if (TLVP_PRES_LEN(&tp, NM_ATT_T200, ARRAY_SIZE(btsb->t200_ms))) {
+ if (TLVP_PRES_LEN(&tp, NM_ATT_T200, ARRAY_SIZE(bts->t200_ms))) {
payload = TLVP_VAL(&tp, NM_ATT_T200);
- for (i = 0; i < ARRAY_SIZE(btsb->t200_ms); i++) {
+ for (i = 0; i < ARRAY_SIZE(bts->t200_ms); i++) {
uint32_t t200_ms = payload[i] * abis_nm_t200_ms[i];
#if 0
- btsb->t200_ms[i] = t200_ms;
+ bts->t200_ms[i] = t200_ms;
DEBUGP(DOML, "T200[%u]: OML=%u, mult=%u => %u ms\n",
i, payload[i], abis_nm_t200_mult[i],
- btsb->t200_ms[i]);
+ bts->t200_ms[i]);
#else
/* we'd rather use the 1s/2s (long) defaults by
* libosmocore, as we appear to have some bug(s)
@@ -684,31 +682,31 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
/* 9.4.31 Maximum Timing Advance */
if (TLVP_PRES_LEN(&tp, NM_ATT_MAX_TA, 1))
- btsb->max_ta = *TLVP_VAL(&tp, NM_ATT_MAX_TA);
+ bts->max_ta = *TLVP_VAL(&tp, NM_ATT_MAX_TA);
/* 9.4.39 Overload Period */
if (TLVP_PRES_LEN(&tp, NM_ATT_OVERL_PERIOD, 1))
- btsb->load.overload_period = *TLVP_VAL(&tp, NM_ATT_OVERL_PERIOD);
+ bts->load.overload_period = *TLVP_VAL(&tp, NM_ATT_OVERL_PERIOD);
/* 9.4.12 CCCH Load Threshold */
if (TLVP_PRES_LEN(&tp, NM_ATT_CCCH_L_T, 1))
- btsb->load.ccch.load_ind_thresh = *TLVP_VAL(&tp, NM_ATT_CCCH_L_T);
+ bts->load.ccch.load_ind_thresh = *TLVP_VAL(&tp, NM_ATT_CCCH_L_T);
/* 9.4.11 CCCH Load Indication Period */
if (TLVP_PRES_LEN(&tp, NM_ATT_CCCH_L_I_P, 1)) {
- btsb->load.ccch.load_ind_period = *TLVP_VAL(&tp, NM_ATT_CCCH_L_I_P);
+ bts->load.ccch.load_ind_period = *TLVP_VAL(&tp, NM_ATT_CCCH_L_I_P);
load_timer_start(bts);
}
/* 9.4.44 RACH Busy Threshold */
if (TLVP_PRES_LEN(&tp, NM_ATT_RACH_B_THRESH, 1)) {
int16_t thresh = *TLVP_VAL(&tp, NM_ATT_RACH_B_THRESH);
- btsb->load.rach.busy_thresh = -1 * thresh;
+ bts->load.rach.busy_thresh = -1 * thresh;
}
/* 9.4.45 RACH Load Averaging Slots */
if (TLVP_PRES_LEN(&tp, NM_ATT_LDAVG_SLOTS, 2)) {
- btsb->load.rach.averaging_slots =
+ bts->load.rach.averaging_slots =
ntohs(tlvp_val16_unal(&tp, NM_ATT_LDAVG_SLOTS));
}
@@ -720,13 +718,13 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
"T3105 must have a value != 0.\n");
return oml_fom_ack_nack(msg, NM_NACK_PARAM_RANGE);
}
- btsb->t3105_ms = t3105 * 10;
+ bts->t3105_ms = t3105 * 10;
}
/* 9.4.37 NY1 */
if (TLVP_PRES_LEN(&tp, NM_ATT_NY1, 1))
- btsb->ny1 = *TLVP_VAL(&tp, NM_ATT_NY1);
-
+ bts->ny1 = *TLVP_VAL(&tp, NM_ATT_NY1);
+
/* 9.4.8 BCCH ARFCN */
if (TLVP_PRES_LEN(&tp, NM_ATT_BCCH_ARFCN, 2))
bts->c0->arfcn = ntohs(tlvp_val16_unal(&tp, NM_ATT_BCCH_ARFCN));
diff --git a/src/common/paging.c b/src/common/paging.c
index d2acd70a..aa604e72 100644
--- a/src/common/paging.c
+++ b/src/common/paging.c
@@ -68,7 +68,7 @@ struct paging_record {
};
struct paging_state {
- struct gsm_bts_role_bts *btsb;
+ struct gsm_bts *bts;
/* parameters taken / interpreted from BCCH/CCCH configuration */
struct gsm48_control_channel_descr chan_desc;
@@ -181,19 +181,19 @@ int paging_add_identity(struct paging_state *ps, uint8_t paging_group,
int blocks = gsm48_number_of_paging_subchannels(&ps->chan_desc);
struct paging_record *pr;
- rate_ctr_inc2(ps->btsb->bts->ctrs, BTS_CTR_PAGING_RCVD);
+ rate_ctr_inc2(ps->bts->ctrs, BTS_CTR_PAGING_RCVD);
if (paging_group >= blocks) {
LOGP(DPAG, LOGL_ERROR, "BSC Send PAGING for group %u, but number of paging "
"sub-channels is only %u\n", paging_group, blocks);
- rate_ctr_inc2(ps->btsb->bts->ctrs, BTS_CTR_PAGING_DROP);
+ rate_ctr_inc2(ps->bts->ctrs, BTS_CTR_PAGING_DROP);
return -EINVAL;
}
if (ps->num_paging >= ps->num_paging_max) {
LOGP(DPAG, LOGL_NOTICE, "Dropping paging, queue full (%u)\n",
ps->num_paging);
- rate_ctr_inc2(ps->btsb->bts->ctrs, BTS_CTR_PAGING_DROP);
+ rate_ctr_inc2(ps->bts->ctrs, BTS_CTR_PAGING_DROP);
return -ENOSPC;
}
@@ -399,7 +399,7 @@ int paging_gen_msg(struct paging_state *ps, uint8_t *out_buf, struct gsm_time *g
int len;
*is_empty = 0;
- ps->btsb->load.ccch.pch_total += 1;
+ ps->bts->load.ccch.pch_total += 1;
group = get_pag_subch_nr(ps, gt);
if (group < 0) {
@@ -423,7 +423,7 @@ int paging_gen_msg(struct paging_state *ps, uint8_t *out_buf, struct gsm_time *g
time_t now = time(NULL);
unsigned int i, num_imsi = 0;
- ps->btsb->load.ccch.pch_used += 1;
+ ps->bts->load.ccch.pch_used += 1;
/* get (if we have) up to four paging records */
for (i = 0; i < ARRAY_SIZE(pr); i++) {
@@ -519,7 +519,7 @@ int paging_gen_msg(struct paging_state *ps, uint8_t *out_buf, struct gsm_time *g
/* skip those that we might have re-added above */
if (pr[i] == NULL)
continue;
- rate_ctr_inc2(ps->btsb->bts->ctrs, BTS_CTR_PAGING_SENT);
+ rate_ctr_inc2(ps->bts->ctrs, BTS_CTR_PAGING_SENT);
/* check if we can expire the paging record,
* or if we need to re-queue it */
if (pr[i]->u.paging.expiration_time <= now) {
@@ -551,8 +551,7 @@ static int paging_signal_cbfn(unsigned int subsys, unsigned int signal, void *hd
{
if (subsys == SS_GLOBAL && signal == S_NEW_SYSINFO) {
struct gsm_bts *bts = signal_data;
- struct gsm_bts_role_bts *btsb = bts->role;
- struct paging_state *ps = btsb->paging_state;
+ struct paging_state *ps = bts->paging_state;
struct gsm48_system_information_type_3 *si3 = (void *) bts->si_buf[SYSINFO_TYPE_3];
paging_si_update(ps, &si3->control_channel_desc);
@@ -562,18 +561,18 @@ static int paging_signal_cbfn(unsigned int subsys, unsigned int signal, void *hd
static int initialized = 0;
-struct paging_state *paging_init(struct gsm_bts_role_bts *btsb,
+struct paging_state *paging_init(struct gsm_bts *bts,
unsigned int num_paging_max,
unsigned int paging_lifetime)
{
struct paging_state *ps;
unsigned int i;
- ps = talloc_zero(btsb, struct paging_state);
+ ps = talloc_zero(bts, struct paging_state);
if (!ps)
return NULL;
- ps->btsb = btsb;
+ ps->bts = bts;
ps->paging_lifetime = paging_lifetime;
ps->num_paging_max = num_paging_max;
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 949a5faa..5f94050a 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -325,14 +325,13 @@ int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t sapi, uint32_t fn,
struct gsm_pcu_if *pcu_prim;
struct gsm_pcu_if_data *data_ind;
struct gsm_bts *bts = ts->trx->bts;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
LOGP(DPCU, LOGL_DEBUG, "Sending data indication: sapi=%s arfcn=%d block=%d data=%s\n",
sapi_string[sapi], arfcn, block_nr, osmo_hexdump(data, len));
- if (lqual / 10 < btsb->min_qual_norm) {
+ if (lqual / 10 < bts->min_qual_norm) {
LOGP(DPCU, LOGL_DEBUG, "Link quality %"PRId16" is below threshold %f, dropping packet\n",
- lqual, btsb->min_qual_norm);
+ lqual, bts->min_qual_norm);
return 0;
}
@@ -487,10 +486,7 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
* This might not be required, if PCU_IF_MSG_DATA_REQ
* is used instead. */
} else {
- struct gsm_bts_role_bts *btsb = bts->role;
-
- paging_add_imm_ass(btsb->paging_state, data_req->data,
- data_req->len);
+ paging_add_imm_ass(bts->paging_state, data_req->data, data_req->len);
}
break;
case PCU_IF_SAPI_AGCH:
diff --git a/src/common/power_control.c b/src/common/power_control.c
index e040ee4c..b1728705 100644
--- a/src/common/power_control.c
+++ b/src/common/power_control.c
@@ -44,7 +44,6 @@ int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan,
int rx;
int cur_dBm, new_dBm, new_pwr;
struct gsm_bts *bts = lchan->ts->trx->bts;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
const enum gsm_band band = bts->band;
if (!trx_ms_pwr_ctrl_is_osmo(lchan->ts->trx))
@@ -57,7 +56,7 @@ int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan,
return 0;
/* What is the difference between what we want and received? */
- rx = btsb->ul_power_target - rxLevel;
+ rx = bts->ul_power_target - rxLevel;
cur_dBm = ms_pwr_dbm(band, ms_power);
new_dBm = cur_dBm + rx;
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 669a39b4..5f3c17e5 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -444,8 +444,8 @@ static int rsl_tx_delete_ind(struct gsm_bts *bts, const uint8_t *ia, uint8_t ia_
/* 8.5.5 PAGING COMMAND */
static int rsl_rx_paging_cmd(struct gsm_bts_trx *trx, struct msgb *msg)
{
- struct gsm_bts_role_bts *btsb = trx->bts->role;
struct tlv_parsed tp;
+ struct gsm_bts *bts = trx->bts;
uint8_t chan_needed = 0, paging_group;
const uint8_t *identity_lv;
int rc;
@@ -462,8 +462,7 @@ static int rsl_rx_paging_cmd(struct gsm_bts_trx *trx, struct msgb *msg)
if (TLVP_PRES_LEN(&tp, RSL_IE_CHAN_NEEDED, 1))
chan_needed = *TLVP_VAL(&tp, RSL_IE_CHAN_NEEDED);
- rc = paging_add_identity(btsb->paging_state, paging_group,
- identity_lv, chan_needed);
+ rc = paging_add_identity(bts->paging_state, paging_group, identity_lv, chan_needed);
if (rc < 0) {
/* FIXME: notfiy the BSC on other errors? */
if (rc == -ENOSPC)
@@ -818,10 +817,10 @@ static int encr_info2lchan(struct gsm_lchan *lchan,
const uint8_t *val, uint8_t len)
{
int rc;
- struct gsm_bts_role_bts *btsb = bts_role_bts(lchan->ts->trx->bts);
+ struct gsm_bts *bts = lchan->ts->trx->bts;
/* check if the encryption algorithm sent by BSC is supported! */
- rc = bts_supports_cipher(btsb, *val);
+ rc = bts_supports_cipher(bts, *val);
if (rc != 1)
return rc;
@@ -1696,7 +1695,7 @@ static int rsl_rx_ipac_XXcx(struct msgb *msg)
struct abis_rsl_dchan_hdr *dch = msgb_l2(msg);
struct tlv_parsed tp;
struct gsm_lchan *lchan = msg->lchan;
- struct gsm_bts_role_bts *btsb = bts_role_bts(msg->lchan->ts->trx->bts);
+ struct gsm_bts *bts = lchan->ts->trx->bts;
const uint8_t *payload_type, *speech_mode, *payload_type2;
uint32_t connect_ip = 0;
uint16_t connect_port = 0;
@@ -1782,10 +1781,10 @@ static int rsl_rx_ipac_XXcx(struct msgb *msg)
inc_ip_port, dch->c.msg_type);
}
rc = osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket,
- btsb->rtp_jitter_adaptive ?
+ bts->rtp_jitter_adaptive ?
OSMO_RTP_P_JIT_ADAP :
OSMO_RTP_P_JITBUF,
- btsb->rtp_jitter_buf_ms);
+ bts->rtp_jitter_buf_ms);
if (rc < 0)
LOGP(DRTP, LOGL_ERROR,
"%s IPAC Failed to set RTP socket parameters: %s\n",
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index b5fd061d..f5f9c7ec 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -38,7 +38,6 @@ static inline uint8_t *get_si2q_inc_index(struct gsm_bts *bts)
/* Apply the rules from 05.02 6.3.1.3 Mapping of BCCH Data */
uint8_t *bts_sysinfo_get(struct gsm_bts *bts, const struct gsm_time *g_time)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
unsigned int tc4_cnt = 0;
unsigned int tc4_sub[4];
@@ -110,12 +109,12 @@ uint8_t *bts_sysinfo_get(struct gsm_bts *bts, const struct gsm_time *g_time)
return GSM_BTS_SI(bts, SYSINFO_TYPE_2);
else {
/* increment static counter by one, modulo count */
- btsb->si.tc4_ctr = (btsb->si.tc4_ctr + 1) % tc4_cnt;
+ bts->si.tc4_ctr = (bts->si.tc4_ctr + 1) % tc4_cnt;
- if (tc4_sub[btsb->si.tc4_ctr] == SYSINFO_TYPE_2quater)
+ if (tc4_sub[bts->si.tc4_ctr] == SYSINFO_TYPE_2quater)
return get_si2q_inc_index(bts);
- return GSM_BTS_SI(bts, tc4_sub[btsb->si.tc4_ctr]);
+ return GSM_BTS_SI(bts, tc4_sub[bts->si.tc4_ctr]);
}
case 5:
/* 2bis, 2ter, 2quater */
diff --git a/src/common/vty.c b/src/common/vty.c
index ca5ca7c4..2716a7a7 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -203,9 +203,8 @@ gDEFUN(cfg_bts_auto_band, cfg_bts_auto_band_cmd,
"Automatically select band for ARFCN based on configured band\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->auto_band = 1;
+ bts->auto_band = 1;
return CMD_SUCCESS;
}
@@ -214,9 +213,8 @@ gDEFUN(cfg_bts_no_auto_band, cfg_bts_no_auto_band_cmd,
NO_STR "Automatically select band for ARFCN based on configured band\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->auto_band = 0;
+ bts->auto_band = 0;
return CMD_SUCCESS;
}
@@ -247,7 +245,6 @@ DEFUN(cfg_bts_trx, cfg_bts_trx_cmd,
static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct gsm_bts_trx *trx;
char buf_casecnvt[256];
int i;
@@ -256,26 +253,26 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
if (bts->description)
vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
- if (btsb->auto_band)
+ if (bts->auto_band)
vty_out(vty, " auto-band%s", VTY_NEWLINE);
vty_out(vty, " ipa unit-id %u %u%s",
bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
- vty_out(vty, " oml remote-ip %s%s", btsb->bsc_oml_host, VTY_NEWLINE);
- vty_out(vty, " rtp jitter-buffer %u", btsb->rtp_jitter_buf_ms);
- if (btsb->rtp_jitter_adaptive)
+ vty_out(vty, " oml remote-ip %s%s", bts->bsc_oml_host, VTY_NEWLINE);
+ vty_out(vty, " rtp jitter-buffer %u", bts->rtp_jitter_buf_ms);
+ if (bts->rtp_jitter_adaptive)
vty_out(vty, " adaptive");
vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, " paging queue-size %u%s", paging_get_queue_max(btsb->paging_state),
+ vty_out(vty, " paging queue-size %u%s", paging_get_queue_max(bts->paging_state),
VTY_NEWLINE);
- vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(btsb->paging_state),
+ vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(bts->paging_state),
VTY_NEWLINE);
- vty_out(vty, " uplink-power-target %d%s", btsb->ul_power_target, VTY_NEWLINE);
- if (btsb->agch_queue.thresh_level != GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT
- || btsb->agch_queue.low_level != GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT
- || btsb->agch_queue.high_level != GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT)
+ vty_out(vty, " uplink-power-target %d%s", bts->ul_power_target, VTY_NEWLINE);
+ if (bts->agch_queue.thresh_level != GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT
+ || bts->agch_queue.low_level != GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT
+ || bts->agch_queue.high_level != GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT)
vty_out(vty, " agch-queue-mgmt threshold %d low %d high %d%s",
- btsb->agch_queue.thresh_level, btsb->agch_queue.low_level,
- btsb->agch_queue.high_level, VTY_NEWLINE);
+ bts->agch_queue.thresh_level, bts->agch_queue.low_level,
+ bts->agch_queue.high_level, VTY_NEWLINE);
for (i = 0; i < 32; i++) {
if (gsmtap_sapi_mask & (1 << i)) {
@@ -287,14 +284,14 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
osmo_str2lower(buf_casecnvt, get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH));
vty_out(vty, " gsmtap-sapi %s%s", buf_casecnvt, VTY_NEWLINE);
}
- vty_out(vty, " min-qual-rach %.0f%s", btsb->min_qual_rach * 10.0f,
+ vty_out(vty, " min-qual-rach %.0f%s", bts->min_qual_rach * 10.0f,
VTY_NEWLINE);
- vty_out(vty, " min-qual-norm %.0f%s", btsb->min_qual_norm * 10.0f,
+ vty_out(vty, " min-qual-norm %.0f%s", bts->min_qual_norm * 10.0f,
VTY_NEWLINE);
- vty_out(vty, " max-ber10k-rach %u%s", btsb->max_ber10k_rach,
+ vty_out(vty, " max-ber10k-rach %u%s", bts->max_ber10k_rach,
VTY_NEWLINE);
- if (strcmp(btsb->pcu.sock_path, PCU_SOCK_DEFAULT))
- vty_out(vty, " pcu-socket %s%s", btsb->pcu.sock_path, VTY_NEWLINE);
+ if (strcmp(bts->pcu.sock_path, PCU_SOCK_DEFAULT))
+ vty_out(vty, " pcu-socket %s%s", bts->pcu.sock_path, VTY_NEWLINE);
if (bts->supp_meas_toa256)
vty_out(vty, " supp-meas-info toa256%s", VTY_NEWLINE);
@@ -454,12 +451,11 @@ DEFUN(cfg_bts_oml_ip,
"OML Parameters\n" "OML IP Address\n" "OML IP Address\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- if (btsb->bsc_oml_host)
- talloc_free(btsb->bsc_oml_host);
+ if (bts->bsc_oml_host)
+ talloc_free(bts->bsc_oml_host);
- btsb->bsc_oml_host = talloc_strdup(btsb, argv[0]);
+ bts->bsc_oml_host = talloc_strdup(bts, argv[0]);
return CMD_SUCCESS;
}
@@ -482,11 +478,10 @@ DEFUN(cfg_bts_rtp_jitbuf,
RTP_STR "RTP jitter buffer\n" "jitter buffer in ms\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->rtp_jitter_buf_ms = atoi(argv[0]);
+ bts->rtp_jitter_buf_ms = atoi(argv[0]);
if (argc > 1)
- btsb->rtp_jitter_adaptive = true;
+ bts->rtp_jitter_adaptive = true;
return CMD_SUCCESS;
}
@@ -500,9 +495,8 @@ DEFUN(cfg_bts_paging_queue_size,
"Maximum length of BTS-internal paging queue\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- paging_set_queue_max(btsb->paging_state, atoi(argv[0]));
+ paging_set_queue_max(bts->paging_state, atoi(argv[0]));
return CMD_SUCCESS;
}
@@ -514,9 +508,8 @@ DEFUN(cfg_bts_paging_lifetime,
"Maximum lifetime of a paging record (secods)\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- paging_set_lifetime(btsb->paging_state, atoi(argv[0]));
+ paging_set_lifetime(bts->paging_state, atoi(argv[0]));
return CMD_SUCCESS;
}
@@ -532,11 +525,10 @@ DEFUN(cfg_bts_agch_queue_mgmt_params,
"High water mark for cleanup\nin %% of the maximum queue length\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->agch_queue.thresh_level = atoi(argv[0]);
- btsb->agch_queue.low_level = atoi(argv[1]);
- btsb->agch_queue.high_level = atoi(argv[2]);
+ bts->agch_queue.thresh_level = atoi(argv[0]);
+ bts->agch_queue.low_level = atoi(argv[1]);
+ bts->agch_queue.high_level = atoi(argv[2]);
return CMD_SUCCESS;
}
@@ -548,11 +540,10 @@ DEFUN(cfg_bts_agch_queue_mgmt_default,
"Reset clean parameters to default values\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->agch_queue.thresh_level = GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT;
- btsb->agch_queue.low_level = GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT;
- btsb->agch_queue.high_level = GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT;
+ bts->agch_queue.thresh_level = GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT;
+ bts->agch_queue.low_level = GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT;
+ bts->agch_queue.high_level = GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT;
return CMD_SUCCESS;
}
@@ -563,9 +554,8 @@ DEFUN(cfg_bts_ul_power_target, cfg_bts_ul_power_target_cmd,
"Target uplink Rx level in dBm\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->ul_power_target = atoi(argv[0]);
+ bts->ul_power_target = atoi(argv[0]);
return CMD_SUCCESS;
}
@@ -576,9 +566,8 @@ DEFUN(cfg_bts_min_qual_rach, cfg_bts_min_qual_rach_cmd,
"C/I level in tenth of dB\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->min_qual_rach = strtof(argv[0], NULL) / 10.0f;
+ bts->min_qual_rach = strtof(argv[0], NULL) / 10.0f;
return CMD_SUCCESS;
}
@@ -589,9 +578,8 @@ DEFUN(cfg_bts_min_qual_norm, cfg_bts_min_qual_norm_cmd,
"C/I level in tenth of dB\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->min_qual_norm = strtof(argv[0], NULL) / 10.0f;
+ bts->min_qual_norm = strtof(argv[0], NULL) / 10.0f;
return CMD_SUCCESS;
}
@@ -602,9 +590,8 @@ DEFUN(cfg_bts_max_ber_rach, cfg_bts_max_ber_rach_cmd,
"BER in 1/10000 units (0=no BER; 100=1% BER)\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- btsb->max_ber10k_rach = strtoul(argv[0], NULL, 10);
+ bts->max_ber10k_rach = strtoul(argv[0], NULL, 10);
return CMD_SUCCESS;
}
@@ -614,13 +601,12 @@ DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd,
"Configure the PCU socket file/path name\n")
{
struct gsm_bts *bts = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- if (btsb->pcu.sock_path) {
+ if (bts->pcu.sock_path) {
/* FIXME: close the interface? */
- talloc_free(btsb->pcu.sock_path);
+ talloc_free(bts->pcu.sock_path);
}
- btsb->pcu.sock_path = talloc_strdup(btsb, argv[0]);
+ bts->pcu.sock_path = talloc_strdup(bts, argv[0]);
/* FIXME: re-open the interface? */
return CMD_SUCCESS;
@@ -795,7 +781,6 @@ static void bts_dump_vty_features(struct vty *vty, struct gsm_bts *bts)
static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts->role;
struct gsm_bts_trx *trx;
vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
@@ -817,20 +802,20 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
vty_out(vty, " PCU version %s connected%s",
bts->pcu_version, VTY_NEWLINE);
vty_out(vty, " Paging: Queue size %u, occupied %u, lifetime %us%s",
- paging_get_queue_max(btsb->paging_state), paging_queue_length(btsb->paging_state),
- paging_get_lifetime(btsb->paging_state), VTY_NEWLINE);
+ paging_get_queue_max(bts->paging_state), paging_queue_length(bts->paging_state),
+ paging_get_lifetime(bts->paging_state), VTY_NEWLINE);
vty_out(vty, " AGCH: Queue limit %u, occupied %d, "
"dropped %"PRIu64", merged %"PRIu64", rejected %"PRIu64", "
"ag-res %"PRIu64", non-res %"PRIu64"%s",
- btsb->agch_queue.max_length, btsb->agch_queue.length,
- btsb->agch_queue.dropped_msgs, btsb->agch_queue.merged_msgs,
- btsb->agch_queue.rejected_msgs, btsb->agch_queue.agch_msgs,
- btsb->agch_queue.pch_msgs,
+ bts->agch_queue.max_length, bts->agch_queue.length,
+ bts->agch_queue.dropped_msgs, bts->agch_queue.merged_msgs,
+ bts->agch_queue.rejected_msgs, bts->agch_queue.agch_msgs,
+ bts->agch_queue.pch_msgs,
VTY_NEWLINE);
vty_out(vty, " CBCH backlog queue length: %u%s",
- llist_length(&btsb->smscb_state.queue), VTY_NEWLINE);
+ llist_length(&bts->smscb_state.queue), VTY_NEWLINE);
vty_out(vty, " Paging: queue length %d, buffer space %d%s",
- paging_queue_length(btsb->paging_state), paging_buffer_space(btsb->paging_state),
+ paging_queue_length(bts->paging_state), paging_buffer_space(bts->paging_state),
VTY_NEWLINE);
vty_out(vty, " OML Link state: %s.%s",
bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
@@ -1476,7 +1461,6 @@ DEFUN(bts_t_t_l_jitter_buf,
{
struct gsm_network *net = gsmnet_from_vty(vty);
struct gsm_lchan *lchan;
- struct gsm_bts_role_bts *btsb;
int jitbuf_ms = atoi(argv[4]), rc;
lchan = resolve_lchan(net, argv, 0);
@@ -1489,9 +1473,8 @@ DEFUN(bts_t_t_l_jitter_buf,
VTY_NEWLINE);
return CMD_WARNING;
}
- btsb = bts_role_bts(lchan->ts->trx->bts);
rc = osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket,
- btsb->rtp_jitter_adaptive ?
+ lchan->ts->trx->bts->rtp_jitter_adaptive ?
OSMO_RTP_P_JIT_ADAP : OSMO_RTP_P_JITBUF,
jitbuf_ms);
if (rc < 0)
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index ea652a15..e6cdfd4b 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -994,14 +994,13 @@ static int handle_ph_ra_ind(struct lc15l1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
{
struct gsm_bts_trx *trx = lc15l1_hdl_trx(fl1);
struct gsm_bts *bts = trx->bts;
- struct gsm_bts_role_bts *btsb = bts->role;
struct gsm_lchan *lchan;
struct osmo_phsap_prim *l1sap;
int rc;
struct ph_rach_ind_param rach_ind_param;
/* FIXME: this should be deprecated/obsoleted as it bypasses rach.busy counting */
- if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) {
+ if (ra_ind->measParam.fLinkQuality < bts->min_qual_rach) {
msgb_free(l1p_msg);
return 0;
}
diff --git a/src/osmo-bts-litecell15/main.c b/src/osmo-bts-litecell15/main.c
index dcbd9f56..030c3efd 100644
--- a/src/osmo-bts-litecell15/main.c
+++ b/src/osmo-bts-litecell15/main.c
@@ -65,14 +65,12 @@ unsigned int dsp_trace = 0x00000000;
int bts_model_init(struct gsm_bts *bts)
{
struct gsm_bts_trx *trx;
- struct gsm_bts_role_bts *btsb;
struct stat st;
static struct osmo_fd accept_fd, read_fd;
int rc;
bts->variant = BTS_OSMO_LITECELL15;
- btsb = bts_role_bts(bts);
- btsb->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
+ bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
rc = oml_router_init(bts, OML_ROUTER_PATH, &accept_fd, &read_fd);
if (rc < 0) {
diff --git a/src/osmo-bts-litecell15/oml.c b/src/osmo-bts-litecell15/oml.c
index 7b728f9d..2c3002bf 100644
--- a/src/osmo-bts-litecell15/oml.c
+++ b/src/osmo-bts-litecell15/oml.c
@@ -381,7 +381,6 @@ static const uint8_t trx_rqd_attr[] = { NM_ATT_RF_MAXPOWR_R };
static int trx_init(struct gsm_bts_trx *trx)
{
struct lc15l1_hdl *fl1h = trx_lc15l1_hdl(trx);
- struct gsm_bts_role_bts *btsb = bts_role_bts(trx->bts);
struct msgb *msg;
GsmL1_MphInitReq_t *mi_req;
GsmL1_DeviceParam_t *dev_par;
@@ -411,7 +410,7 @@ static int trx_init(struct gsm_bts_trx *trx)
dev_par->u16BcchArfcn = trx->bts->c0->arfcn;
dev_par->u8NbTsc = trx->bts->bsic & 7;
dev_par->fRxPowerLevel = trx_ms_pwr_ctrl_is_osmo(trx)
- ? 0.0 : btsb->ul_power_target;
+ ? 0.0 : trx->bts->ul_power_target;
dev_par->fTxPowerLevel = 0.0;
LOGP(DL1C, LOGL_NOTICE, "Init TRX (Band %d, ARFCN %u, TSC %u, RxPower % 2f dBm, "
diff --git a/src/osmo-bts-litecell15/utils.c b/src/osmo-bts-litecell15/utils.c
index 59a621b3..8c3eb5a8 100644
--- a/src/osmo-bts-litecell15/utils.c
+++ b/src/osmo-bts-litecell15/utils.c
@@ -82,9 +82,8 @@ int lc15bts_select_lc15_band(struct gsm_bts_trx *trx, uint16_t arfcn)
{
enum gsm_band band;
struct gsm_bts *bts = trx->bts;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- if (!btsb->auto_band)
+ if (!bts->auto_band)
return band_osmo2lc15(trx, bts->band);
/*
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 32b86a0a..0d63d517 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -767,13 +767,10 @@ int bts_model_phy_link_open(struct phy_link *plink)
int bts_model_init(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb;
-
LOGP(DL1C, LOGL_NOTICE, "model_init()\n");
bts->variant = BTS_OSMO_OCTPHY;
- btsb = bts_role_bts(bts);
- btsb->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
+ bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
/* FIXME: what is the nominal transmit power of the PHY/board? */
bts->c0->nominal_power = 15;
@@ -1166,7 +1163,6 @@ static int handle_ph_rach_ind(struct octphy_hdl *fl1,
{
struct gsm_bts_trx *trx = trx_by_l1h(fl1, ra_ind->TrxId.byTrxId);
struct gsm_bts *bts = trx->bts;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct osmo_phsap_prim *l1sap;
int rc;
struct ph_rach_ind_param rach_ind_param;
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 9aa5477a..57e2d5c5 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -984,14 +984,13 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
{
struct gsm_bts_trx *trx = femtol1_hdl_trx(fl1);
struct gsm_bts *bts = trx->bts;
- struct gsm_bts_role_bts *btsb = bts->role;
struct gsm_lchan *lchan;
struct osmo_phsap_prim *l1sap;
int rc;
struct ph_rach_ind_param rach_ind_param;
/* FIXME: this should be deprecated/obsoleted as it bypasses rach.busy counting */
- if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) {
+ if (ra_ind->measParam.fLinkQuality < bts->min_qual_rach) {
msgb_free(l1p_msg);
return 0;
}
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index efcf4a8d..b63d07ef 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -57,14 +57,12 @@
int bts_model_init(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb;
struct stat st;
static struct osmo_fd accept_fd, read_fd;
int rc;
bts->variant = BTS_OSMO_SYSMO;
- btsb = bts_role_bts(bts);
- btsb->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
+ bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
rc = oml_router_init(bts, OML_ROUTER_PATH, &accept_fd, &read_fd);
if (rc < 0) {
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 505a457c..ce85a8b9 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -384,7 +384,6 @@ static const uint8_t trx_rqd_attr[] = { NM_ATT_RF_MAXPOWR_R };
static int trx_init(struct gsm_bts_trx *trx)
{
struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx);
- struct gsm_bts_role_bts *btsb = bts_role_bts(trx->bts);
struct msgb *msg;
GsmL1_MphInitReq_t *mi_req;
GsmL1_DeviceParam_t *dev_par;
@@ -415,7 +414,7 @@ static int trx_init(struct gsm_bts_trx *trx)
dev_par->u16BcchArfcn = trx->bts->c0->arfcn;
dev_par->u8NbTsc = trx->bts->bsic & 7;
dev_par->fRxPowerLevel = trx_ms_pwr_ctrl_is_osmo(trx)
- ? 0.0 : btsb->ul_power_target;
+ ? 0.0 : trx->bts->ul_power_target;
dev_par->fTxPowerLevel = ((float) initial_mdBm) / 1000;
LOGP(DL1C, LOGL_NOTICE, "Init TRX (ARFCN %u, TSC %u, RxPower % 2f dBm, "
diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c
index b5940dcf..039236f5 100644
--- a/src/osmo-bts-sysmo/sysmobts_vty.c
+++ b/src/osmo-bts-sysmo/sysmobts_vty.c
@@ -153,9 +153,8 @@ DEFUN_DEPRECATED(cfg_trx_ul_power_target, cfg_trx_ul_power_target_cmd,
"Target uplink Rx level in dBm\n")
{
struct gsm_bts_trx *trx = vty->index;
- struct gsm_bts_role_bts *btsb = bts_role_bts(trx->bts);
- btsb->ul_power_target = atoi(argv[0]);
+ trx->bts->ul_power_target = atoi(argv[0]);
return CMD_SUCCESS;
}
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index be6051a8..7d1aca70 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -80,9 +80,8 @@ int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn)
{
enum gsm_band band;
struct gsm_bts *bts = trx->bts;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- if (!btsb->auto_band)
+ if (!bts->auto_band)
return band_osmo2femto(trx, bts->band);
/*
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index 5a5c97ec..6e5a4cad 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -97,10 +97,8 @@ int bts_model_handle_options(int argc, char **argv)
int bts_model_init(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
-
bts->variant = BTS_OSMO_TRX;
- btsb->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2);
+ bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2);
/* FIXME: this needs to be overridden with the real hardrware
* value */
diff --git a/src/osmo-bts-virtual/main.c b/src/osmo-bts-virtual/main.c
index 7815a343..62376a74 100644
--- a/src/osmo-bts-virtual/main.c
+++ b/src/osmo-bts-virtual/main.c
@@ -56,10 +56,7 @@ uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx)
int bts_model_init(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb;
-
- btsb = bts_role_bts(bts);
- btsb->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
+ bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);
gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_V1);
diff --git a/src/osmo-bts-virtual/scheduler_virtbts.c b/src/osmo-bts-virtual/scheduler_virtbts.c
index 5782c0a5..de995e6f 100644
--- a/src/osmo-bts-virtual/scheduler_virtbts.c
+++ b/src/osmo-bts-virtual/scheduler_virtbts.c
@@ -566,9 +566,8 @@ static int vbts_sched_fn(struct gsm_bts *bts, uint32_t fn)
static void vbts_fn_timer_cb(void *data)
{
struct gsm_bts *bts = data;
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
struct timeval tv_now;
- struct timeval *tv_clock = &btsb->vbts.tv_clock;
+ struct timeval *tv_clock = &bts->vbts.tv_clock;
int32_t elapsed_us;
gettimeofday(&tv_now, NULL);
@@ -592,30 +591,28 @@ static void vbts_fn_timer_cb(void *data)
};
timeradd(tv_clock, &tv_frame, tv_clock);
/* increment the frame number in the BTS model instance */
- btsb->vbts.last_fn = (btsb->vbts.last_fn + 1) % GSM_HYPERFRAME;
- vbts_sched_fn(bts, btsb->vbts.last_fn);
+ bts->vbts.last_fn = (bts->vbts.last_fn + 1) % GSM_HYPERFRAME;
+ vbts_sched_fn(bts, bts->vbts.last_fn);
elapsed_us -= FRAME_DURATION_uS;
}
/* re-schedule the timer */
/* timer is set to frame duration - elapsed time to guarantee that this cb method will be
* periodically executed every 4.615ms */
- osmo_timer_schedule(&btsb->vbts.fn_timer, 0, FRAME_DURATION_uS - elapsed_us);
+ osmo_timer_schedule(&bts->vbts.fn_timer, 0, FRAME_DURATION_uS - elapsed_us);
}
int vbts_sched_start(struct gsm_bts *bts)
{
- struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
-
LOGP(DL1P, LOGL_NOTICE, "starting VBTS scheduler\n");
- memset(&btsb->vbts.fn_timer, 0, sizeof(btsb->vbts.fn_timer));
- btsb->vbts.fn_timer.cb = vbts_fn_timer_cb;
- btsb->vbts.fn_timer.data = bts;
+ memset(&bts->vbts.fn_timer, 0, sizeof(bts->vbts.fn_timer));
+ bts->vbts.fn_timer.cb = vbts_fn_timer_cb;
+ bts->vbts.fn_timer.data = bts;
- gettimeofday(&btsb->vbts.tv_clock, NULL);
+ gettimeofday(&bts->vbts.tv_clock, NULL);
/* trigger the first timer after 4615us (a frame duration) */
- osmo_timer_schedule(&btsb->vbts.fn_timer, 0, FRAME_DURATION_uS);
+ osmo_timer_schedule(&bts->vbts.fn_timer, 0, FRAME_DURATION_uS);
return 0;
}
diff --git a/tests/agch/agch_test.c b/tests/agch/agch_test.c
index 89f113ab..6efbc248 100644
--- a/tests/agch/agch_test.c
+++ b/tests/agch/agch_test.c
@@ -29,7 +29,6 @@
#include <unistd.h>
static struct gsm_bts *bts;
-static struct gsm_bts_role_bts *btsb;
static int count_imm_ass_rej_refs(struct gsm48_imm_ass_rej *rej)
{
@@ -116,11 +115,11 @@ static void test_agch_queue(void)
g_time.t3 = 6;
printf("Testing AGCH messages queue handling.\n");
- btsb->agch_queue.max_length = 32;
+ bts->agch_queue.max_length = 32;
- btsb->agch_queue.low_level = 30;
- btsb->agch_queue.high_level = 30;
- btsb->agch_queue.thresh_level = 60;
+ bts->agch_queue.low_level = 30;
+ bts->agch_queue.high_level = 30;
+ bts->agch_queue.thresh_level = 60;
for (round = 1; round <= num_rounds; round++) {
for (idx = 0; idx < num_ima_per_round; idx++) {
@@ -143,10 +142,10 @@ static void test_agch_queue(void)
"dropped %"PRIu64", merged %"PRIu64", rejected %"PRIu64", "
"ag-res %"PRIu64", non-res %"PRIu64"\n",
count, imm_ass_count, imm_ass_rej_count, imm_ass_rej_ref_count,
- btsb->agch_queue.max_length, btsb->agch_queue.length,
- btsb->agch_queue.dropped_msgs, btsb->agch_queue.merged_msgs,
- btsb->agch_queue.rejected_msgs, btsb->agch_queue.agch_msgs,
- btsb->agch_queue.pch_msgs);
+ bts->agch_queue.max_length, bts->agch_queue.length,
+ bts->agch_queue.dropped_msgs, bts->agch_queue.merged_msgs,
+ bts->agch_queue.rejected_msgs, bts->agch_queue.agch_msgs,
+ bts->agch_queue.pch_msgs);
imm_ass_count = 0;
imm_ass_rej_count = 0;
@@ -182,10 +181,10 @@ static void test_agch_queue(void)
"dropped %"PRIu64", merged %"PRIu64", rejected %"PRIu64", "
"ag-res %"PRIu64", non-res %"PRIu64"\n",
multiframes, imm_ass_count, imm_ass_rej_count, imm_ass_rej_ref_count,
- btsb->agch_queue.max_length, btsb->agch_queue.length,
- btsb->agch_queue.dropped_msgs, btsb->agch_queue.merged_msgs,
- btsb->agch_queue.rejected_msgs, btsb->agch_queue.agch_msgs,
- btsb->agch_queue.pch_msgs);
+ bts->agch_queue.max_length, bts->agch_queue.length,
+ bts->agch_queue.dropped_msgs, bts->agch_queue.merged_msgs,
+ bts->agch_queue.rejected_msgs, bts->agch_queue.agch_msgs,
+ bts->agch_queue.pch_msgs);
}
static void test_agch_queue_length_computation(void)
@@ -231,7 +230,6 @@ int main(int argc, char **argv)
exit(1);
}
- btsb = bts_role_bts(bts);
test_agch_queue_length_computation();
test_agch_queue();
printf("Success\n");
diff --git a/tests/cipher/cipher_test.c b/tests/cipher/cipher_test.c
index 07d9fdee..5e2bdc02 100644
--- a/tests/cipher/cipher_test.c
+++ b/tests/cipher/cipher_test.c
@@ -28,7 +28,6 @@
#include <unistd.h>
static struct gsm_bts *bts;
-static struct gsm_bts_role_bts *btsb;
#define ASSERT_TRUE(rc) \
if (!(rc)) { \
@@ -41,27 +40,27 @@ static void test_cipher_parsing(void)
{
int i;
- btsb->support.ciphers = 0;
+ bts->support.ciphers = 0;
/* always support A5/0 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x0) == -ENOTSUP);
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x1) == 1); /* A5/0 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x0) == -ENOTSUP);
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x1) == 1); /* A5/0 */
for (i = 2; i <= 8; ++i) {
- ASSERT_TRUE(bts_supports_cipher(btsb, i) == 0);
+ ASSERT_TRUE(bts_supports_cipher(bts, i) == 0);
}
/* checking default A5/1 to A5/3 support */
- btsb->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x0) == -ENOTSUP);
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x1) == 1); /* A5/0 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x2) == 1); /* A5/1 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x3) == 1); /* A5/2 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x4) == 1); /* A5/3 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x5) == 0); /* A5/4 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x6) == 0); /* A5/5 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x7) == 0); /* A5/6 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x8) == 0); /* A5/7 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x9) == -ENOTSUP);
+ bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x0) == -ENOTSUP);
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x1) == 1); /* A5/0 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x2) == 1); /* A5/1 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x3) == 1); /* A5/2 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x4) == 1); /* A5/3 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x5) == 0); /* A5/4 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x6) == 0); /* A5/5 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x7) == 0); /* A5/6 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x8) == 0); /* A5/7 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x9) == -ENOTSUP);
}
int main(int argc, char **argv)
@@ -77,7 +76,6 @@ int main(int argc, char **argv)
exit(1);
}
- btsb = bts_role_bts(bts);
test_cipher_parsing();
printf("Success\n");
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index adc4d65b..1c0a4da7 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -56,7 +56,6 @@ static void expect_phys_info(struct lapdm_entity *le)
int main(int argc, char **argv)
{
- struct gsm_bts_role_bts *btsb;
void *tall_bts_ctx;
struct e1inp_line *line;
struct gsm_lchan *lchan;
@@ -87,8 +86,6 @@ int main(int argc, char **argv)
exit(1);
}
- btsb = bts_role_bts(bts);
-
libosmo_abis_init(NULL);
line = e1inp_line_create(0, "ipa");
@@ -170,7 +167,7 @@ int main(int argc, char **argv)
OSMO_ASSERT(rslh->c.msg_type == RSL_MT_HANDO_DET);
OSMO_ASSERT(!msgb_dequeue(&trx->rsl_link->tx_list));
- for (i = 0; i < btsb->ny1 - 1; i++) {
+ for (i = 0; i < bts->ny1 - 1; i++) {
/* expect T3105 running */
OSMO_ASSERT(osmo_timer_pending(&trx->ts[2].lchan[0].ho.t3105))
diff --git a/tests/paging/paging_test.c b/tests/paging/paging_test.c
index 2573b3fb..f4f0934e 100644
--- a/tests/paging/paging_test.c
+++ b/tests/paging/paging_test.c
@@ -28,7 +28,6 @@
#include <unistd.h>
static struct gsm_bts *bts;
-static struct gsm_bts_role_bts *btsb;
static const uint8_t static_ilv[] = {
0x08, 0x59, 0x51, 0x30, 0x99, 0x00, 0x00, 0x00, 0x19
@@ -50,28 +49,28 @@ static void test_paging_smoke(void)
printf("Testing that paging messages expire.\n");
/* add paging entry */
- rc = paging_add_identity(btsb->paging_state, 0, static_ilv, 0);
+ rc = paging_add_identity(bts->paging_state, 0, static_ilv, 0);
ASSERT_TRUE(rc == 0);
- ASSERT_TRUE(paging_queue_length(btsb->paging_state) == 1);
+ ASSERT_TRUE(paging_queue_length(bts->paging_state) == 1);
/* generate messages */
g_time.fn = 0;
g_time.t1 = 0;
g_time.t2 = 0;
g_time.t3 = 6;
- rc = paging_gen_msg(btsb->paging_state, out_buf, &g_time, &is_empty);
+ rc = paging_gen_msg(bts->paging_state, out_buf, &g_time, &is_empty);
ASSERT_TRUE(rc == 13);
ASSERT_TRUE(is_empty == 0);
- ASSERT_TRUE(paging_group_queue_empty(btsb->paging_state, 0));
- ASSERT_TRUE(paging_queue_length(btsb->paging_state) == 0);
+ ASSERT_TRUE(paging_group_queue_empty(bts->paging_state, 0));
+ ASSERT_TRUE(paging_queue_length(bts->paging_state) == 0);
/* now test the empty queue */
g_time.fn = 0;
g_time.t1 = 0;
g_time.t2 = 0;
g_time.t3 = 6;
- rc = paging_gen_msg(btsb->paging_state, out_buf, &g_time, &is_empty);
+ rc = paging_gen_msg(bts->paging_state, out_buf, &g_time, &is_empty);
ASSERT_TRUE(rc == 6);
ASSERT_TRUE(is_empty == 1);
@@ -90,9 +89,9 @@ static void test_paging_sleep(void)
printf("Testing that paging messages expire with sleep.\n");
/* add paging entry */
- rc = paging_add_identity(btsb->paging_state, 0, static_ilv, 0);
+ rc = paging_add_identity(bts->paging_state, 0, static_ilv, 0);
ASSERT_TRUE(rc == 0);
- ASSERT_TRUE(paging_queue_length(btsb->paging_state) == 1);
+ ASSERT_TRUE(paging_queue_length(bts->paging_state) == 1);
/* sleep */
sleep(1);
@@ -102,12 +101,12 @@ static void test_paging_sleep(void)
g_time.t1 = 0;
g_time.t2 = 0;
g_time.t3 = 6;
- rc = paging_gen_msg(btsb->paging_state, out_buf, &g_time, &is_empty);
+ rc = paging_gen_msg(bts->paging_state, out_buf, &g_time, &is_empty);
ASSERT_TRUE(rc == 13);
ASSERT_TRUE(is_empty == 0);
- ASSERT_TRUE(paging_group_queue_empty(btsb->paging_state, 0));
- ASSERT_TRUE(paging_queue_length(btsb->paging_state) == 0);
+ ASSERT_TRUE(paging_group_queue_empty(bts->paging_state, 0));
+ ASSERT_TRUE(paging_queue_length(bts->paging_state) == 0);
}
int main(int argc, char **argv)
@@ -123,7 +122,6 @@ int main(int argc, char **argv)
exit(1);
}
- btsb = bts_role_bts(bts);
test_paging_smoke();
test_paging_sleep();
printf("Success\n");
diff --git a/tests/power/power_test.c b/tests/power/power_test.c
index 295f6380..a46a430c 100644
--- a/tests/power/power_test.c
+++ b/tests/power/power_test.c
@@ -35,13 +35,11 @@ static inline void apply_power_test(struct gsm_lchan *lchan, int rxlev, int exp_
static void test_power_loop(void)
{
struct gsm_bts bts;
- struct gsm_bts_role_bts btsb;
struct gsm_bts_trx trx;
struct gsm_bts_trx_ts ts;
struct gsm_lchan *lchan;
memset(&bts, 0, sizeof(bts));
- memset(&btsb, 0, sizeof(btsb));
memset(&trx, 0, sizeof(trx));
memset(&ts, 0, sizeof(ts));
@@ -49,10 +47,9 @@ static void test_power_loop(void)
lchan->ts = &ts;
ts.trx = &trx;
trx.bts = &bts;
- bts.role = &btsb;
bts.band = GSM_BAND_1800;
trx.ms_power_control = 1;
- btsb.ul_power_target = -75;
+ bts.ul_power_target = -75;
lchan->state = LCHAN_S_NONE;
lchan->ms_power_ctrl.current = ms_pwr_ctl_lvl(GSM_BAND_1800, 0);
diff --git a/tests/sysmobts/sysmobts_test.c b/tests/sysmobts/sysmobts_test.c
index 32d6e958..02490bef 100644
--- a/tests/sysmobts/sysmobts_test.c
+++ b/tests/sysmobts/sysmobts_test.c
@@ -51,16 +51,13 @@ static int pcs_to_pcs[][3] = {
static void test_sysmobts_auto_band(void)
{
struct gsm_bts bts;
- struct gsm_bts_role_bts btsb;
struct gsm_bts_trx trx;
struct femtol1_hdl hdl;
int i;
memset(&bts, 0, sizeof(bts));
- memset(&btsb, 0, sizeof(btsb));
memset(&trx, 0, sizeof(trx));
memset(&hdl, 0, sizeof(hdl));
- bts.role = &btsb;
trx.bts = &bts;
trx.role_bts.l1h = &hdl;
@@ -74,7 +71,7 @@ static void test_sysmobts_auto_band(void)
uint16_t arfcn;
int res;
- btsb.auto_band = 0;
+ bts.auto_band = 0;
bts.band = direct_map[i][0];
arfcn = direct_map[i][2];
res = sysmobts_select_femto_band(&trx, arfcn);
@@ -89,7 +86,7 @@ static void test_sysmobts_auto_band(void)
uint16_t arfcn;
int res;
- btsb.auto_band = 1;
+ bts.auto_band = 1;
bts.band = direct_map[i][0];
arfcn = direct_map[i][2];
res = sysmobts_select_femto_band(&trx, arfcn);
@@ -104,7 +101,7 @@ static void test_sysmobts_auto_band(void)
uint16_t arfcn;
int res;
- btsb.auto_band = 1;
+ bts.auto_band = 1;
bts.band = dcs_to_dcs[i][0];
arfcn = dcs_to_dcs[i][2];
res = sysmobts_select_femto_band(&trx, arfcn);
@@ -119,7 +116,7 @@ static void test_sysmobts_auto_band(void)
uint16_t arfcn;
int res;
- btsb.auto_band = 1;
+ bts.auto_band = 1;
bts.band = pcs_to_pcs[i][0];
arfcn = pcs_to_pcs[i][2];
res = sysmobts_select_femto_band(&trx, arfcn);