This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/19123 )
Change subject: Move gsm_bts code gsm-data.* => bts.*
......................................................................
Move gsm_bts code gsm-data.* => bts.*
bts.h refers to struct gsm_bts object, but we still had a bunch of stuff
in bulky gsm_data.* from old days. Let's move stuff where it belongs to
start clean up of gsm_data.
Change-Id: I0a4219e3f64f625ee8b364bf408b8d2bcc8085c5
---
M include/osmo-bts/bts.h
M include/osmo-bts/gsm_data.h
M src/common/bts.c
M src/common/bts_shutdown_fsm.c
M src/common/gsm_data.c
M src/common/load_indication.c
M src/common/msg_utils.c
M src/common/scheduler.c
M src/common/sysinfo.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/sysmobts_vty.c
M src/osmo-bts-trx/trx_vty.c
12 files changed, 350 insertions(+), 341 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/23/19123/1
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 63412f9..8fb8062 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -24,8 +24,227 @@
BTS_CTR_AGCH_DELETED,
};
+/* One BTS */
+struct gsm_bts {
+ /* list header in net->bts_list */
+ struct llist_head list;
+
+ /* number of the BTS in network */
+ uint8_t nr;
+ /* human readable name / description */
+ char *description;
+ /* Cell Identity */
+ uint16_t cell_identity;
+ /* location area code of this BTS */
+ uint16_t location_area_code;
+ /* Base Station Identification Code (BSIC), lower 3 bits is BCC,
+ * which is used as TSC for the CCCH */
+ uint8_t bsic;
+ /* type of BTS */
+ enum gsm_bts_type_variant variant;
+ enum gsm_band band;
+ char version[MAX_VERSION_LENGTH];
+ char sub_model[MAX_VERSION_LENGTH];
+
+ /* public features of a given BTS (set/reported via OML) */
+ struct bitvec *features;
+ /* implementation flags of a given BTS (not exposed via OML) */
+ uint16_t flags;
+
+ /* Connected PCU version (if any) */
+ char pcu_version[MAX_VERSION_LENGTH];
+
+ /* maximum Tx power that the MS is permitted to use in this cell */
+ int ms_max_power;
+
+ /* how do we talk OML with this TRX? */
+ struct e1inp_sign_link *oml_link;
+ struct timespec oml_conn_established_timestamp;
+
+ /* Abis network management O&M handle */
+ struct gsm_abis_mo mo;
+
+ /* number of this BTS on given E1 link */
+ uint8_t bts_nr;
+
+ /* DTX features of this BTS */
+ bool dtxd;
+
+ /* CCCH is on C0 */
+ struct gsm_bts_trx *c0;
+
+ struct {
+ struct gsm_abis_mo mo;
+ } site_mgr;
+
+ /* bitmask of all SI that are present/valid in si_buf */
+ uint32_t si_valid;
+ /* 3GPP TS 44.018 Table 10.5.2.33b.1 INDEX and COUNT for SI2quater */
+ uint8_t si2q_index; /* distinguish individual SI2quater messages */
+ uint8_t si2q_count; /* si2q_index for the last (highest indexed) individual SI2quater message */
+ /* buffers where we put the pre-computed SI */
+ sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE][SI2Q_MAX_NUM];
+ /* offsets used while generating SI2quater */
+ size_t e_offset;
+ size_t u_offset;
+ /* decoded SI3 rest octets - *unmodified* as received from BSC */
+ struct osmo_gsm48_si_ro_info si3_ro_decoded;
+ /* is SI3 GPRS Indicator currently disabled due to lack of PCU connection? */
+ bool si3_gprs_ind_disabled;
+
+ /* ip.access Unit ID's have Site/BTS/TRX layout */
+ union {
+ struct {
+ uint16_t site_id;
+ uint16_t bts_id;
+ uint32_t flags;
+ uint32_t rsl_ip;
+ } ip_access;
+ };
+
+ /* Not entirely sure how ip.access specific this is */
+ struct {
+ struct {
+ struct gsm_abis_mo mo;
+ uint16_t nsei;
+ uint8_t timer[7];
+ } nse;
+ struct {
+ struct gsm_abis_mo mo;
+ uint16_t bvci;
+ uint8_t timer[11];
+ struct gprs_rlc_cfg rlc_cfg;
+ } cell;
+ struct gsm_bts_gprs_nsvc nsvc[2];
+ uint8_t rac;
+ } gprs;
+
+ /* transceivers */
+ int num_trx;
+ struct llist_head trx_list;
+
+ struct rate_ctr_group *ctrs;
+ bool supp_meas_toa256;
+
+ 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 {
+ uint8_t *prim_notif; /* ETWS primary notification (NULL if none) */
+ ssize_t prim_notif_len; /* Length of prim_notif; expected 56 bytes */
+ uint8_t page_size;
+ uint8_t num_pages; /* total number of pages */
+ uint8_t next_page; /* next page number to be sent */
+ bool pni; /* Primary Notification Identifier */
+ } etws;
+
+ struct paging_state *paging_state;
+ char *bsc_oml_host;
+ struct llist_head oml_queue;
+ unsigned int rtp_jitter_buf_ms;
+ bool rtp_jitter_adaptive;
+
+ uint16_t rtp_port_range_start;
+ uint16_t rtp_port_range_end;
+ uint16_t rtp_port_range_next;
+ int rtp_ip_dscp;
+
+ 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;
+ /* frame number statistics (FN in PH-RTS.ind vs. PH-DATA.ind */
+ struct {
+ int32_t min; /* minimum observed */
+ int32_t max; /* maximum observed */
+ int32_t avg256; /* accumulator */
+ uint32_t avg_count; /* number of samples accumulated in avg256 */
+ uint32_t avg_window; /* number of averages in avg_count */
+ } fn_stats;
+ /* 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;
+
+ /* State for SMSCB (Cell Broadcast) for BASIC and EXTENDED channel */
+ struct bts_smscb_state smscb_basic;
+ struct bts_smscb_state smscb_extended;
+ int smscb_queue_tgt_len; /* ideal/target queue length */
+ int smscb_queue_max_len; /* maximum queue length */
+ int smscb_queue_hyst; /* hysteresis for CBCH load indications */
+
+ int16_t min_qual_rach; /* minimum link quality (in centiBels) for Access Bursts */
+ int16_t min_qual_norm; /* minimum link quality (in centiBels) for Normal Bursts */
+ uint16_t max_ber10k_rach; /* Maximum permitted RACH BER in 0.01% */
+
+ struct {
+ char *sock_path;
+ } pcu;
+
+ struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */
+ struct osmo_tdef *T_defs; /* Timer defines */
+
+ void *model_priv; /* Allocated by bts_model, contains model specific data pointer */
+};
+
extern void *tall_bts_ctx;
+struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num);
+struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
+
int bts_init(struct gsm_bts *bts);
int bts_trx_init(struct gsm_bts_trx *trx);
void bts_shutdown(struct gsm_bts *bts, const char *reason);
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 2e8ff46..7847eb8 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -494,226 +494,6 @@
* OML connection will cause a special warning to be logged. */
#define OSMO_BTS_OML_CONN_EARLY_DISCONNECT 10 /* in seconds */
-/* One BTS */
-struct gsm_bts {
- /* list header in net->bts_list */
- struct llist_head list;
-
- /* number of the BTS in network */
- uint8_t nr;
- /* human readable name / description */
- char *description;
- /* Cell Identity */
- uint16_t cell_identity;
- /* location area code of this BTS */
- uint16_t location_area_code;
- /* Base Station Identification Code (BSIC), lower 3 bits is BCC,
- * which is used as TSC for the CCCH */
- uint8_t bsic;
- /* type of BTS */
- enum gsm_bts_type_variant variant;
- enum gsm_band band;
- char version[MAX_VERSION_LENGTH];
- char sub_model[MAX_VERSION_LENGTH];
-
- /* public features of a given BTS (set/reported via OML) */
- struct bitvec *features;
- /* implementation flags of a given BTS (not exposed via OML) */
- uint16_t flags;
-
- /* Connected PCU version (if any) */
- char pcu_version[MAX_VERSION_LENGTH];
-
- /* maximum Tx power that the MS is permitted to use in this cell */
- int ms_max_power;
-
- /* how do we talk OML with this TRX? */
- struct e1inp_sign_link *oml_link;
- struct timespec oml_conn_established_timestamp;
-
- /* Abis network management O&M handle */
- struct gsm_abis_mo mo;
-
- /* number of this BTS on given E1 link */
- uint8_t bts_nr;
-
- /* DTX features of this BTS */
- bool dtxd;
-
- /* CCCH is on C0 */
- struct gsm_bts_trx *c0;
-
- struct {
- struct gsm_abis_mo mo;
- } site_mgr;
-
- /* bitmask of all SI that are present/valid in si_buf */
- uint32_t si_valid;
- /* 3GPP TS 44.018 Table 10.5.2.33b.1 INDEX and COUNT for SI2quater */
- uint8_t si2q_index; /* distinguish individual SI2quater messages */
- uint8_t si2q_count; /* si2q_index for the last (highest indexed) individual SI2quater message */
- /* buffers where we put the pre-computed SI */
- sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE][SI2Q_MAX_NUM];
- /* offsets used while generating SI2quater */
- size_t e_offset;
- size_t u_offset;
- /* decoded SI3 rest octets - *unmodified* as received from BSC */
- struct osmo_gsm48_si_ro_info si3_ro_decoded;
- /* is SI3 GPRS Indicator currently disabled due to lack of PCU connection? */
- bool si3_gprs_ind_disabled;
-
- /* ip.access Unit ID's have Site/BTS/TRX layout */
- union {
- struct {
- uint16_t site_id;
- uint16_t bts_id;
- uint32_t flags;
- uint32_t rsl_ip;
- } ip_access;
- };
-
- /* Not entirely sure how ip.access specific this is */
- struct {
- struct {
- struct gsm_abis_mo mo;
- uint16_t nsei;
- uint8_t timer[7];
- } nse;
- struct {
- struct gsm_abis_mo mo;
- uint16_t bvci;
- uint8_t timer[11];
- struct gprs_rlc_cfg rlc_cfg;
- } cell;
- struct gsm_bts_gprs_nsvc nsvc[2];
- uint8_t rac;
- } gprs;
-
- /* transceivers */
- int num_trx;
- struct llist_head trx_list;
-
- struct rate_ctr_group *ctrs;
- bool supp_meas_toa256;
-
- 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 {
- uint8_t *prim_notif; /* ETWS primary notification (NULL if none) */
- ssize_t prim_notif_len; /* Length of prim_notif; expected 56 bytes */
- uint8_t page_size;
- uint8_t num_pages; /* total number of pages */
- uint8_t next_page; /* next page number to be sent */
- bool pni; /* Primary Notification Identifier */
- } etws;
-
- struct paging_state *paging_state;
- char *bsc_oml_host;
- struct llist_head oml_queue;
- unsigned int rtp_jitter_buf_ms;
- bool rtp_jitter_adaptive;
-
- uint16_t rtp_port_range_start;
- uint16_t rtp_port_range_end;
- uint16_t rtp_port_range_next;
- int rtp_ip_dscp;
-
- 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;
- /* frame number statistics (FN in PH-RTS.ind vs. PH-DATA.ind */
- struct {
- int32_t min; /* minimum observed */
- int32_t max; /* maximum observed */
- int32_t avg256; /* accumulator */
- uint32_t avg_count; /* number of samples accumulated in avg256 */
- uint32_t avg_window; /* number of averages in avg_count */
- } fn_stats;
- /* 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;
-
- /* State for SMSCB (Cell Broadcast) for BASIC and EXTENDED channel */
- struct bts_smscb_state smscb_basic;
- struct bts_smscb_state smscb_extended;
- int smscb_queue_tgt_len; /* ideal/target queue length */
- int smscb_queue_max_len; /* maximum queue length */
- int smscb_queue_hyst; /* hysteresis for CBCH load indications */
-
- int16_t min_qual_rach; /* minimum link quality (in centiBels) for Access Bursts */
- int16_t min_qual_norm; /* minimum link quality (in centiBels) for Normal Bursts */
- uint16_t max_ber10k_rach; /* Maximum permitted RACH BER in 0.01% */
-
- struct {
- char *sock_path;
- } pcu;
-
- struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */
- struct osmo_tdef *T_defs; /* Timer defines */
-
- void *model_priv; /* Allocated by bts_model, contains model specific data pointer */
-};
-
-
-struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num);
-struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
-
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
@@ -748,13 +528,7 @@
#define BSIC2BCC(bsic) ((bsic) & 0x3)
-static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts)
-{
- if (ts->tsc != -1)
- return ts->tsc;
- else
- return ts->trx->bts->bsic & 7;
-}
+uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts);
struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
int *rc);
diff --git a/src/common/bts.c b/src/common/bts.c
index dccb098..9243983 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -32,6 +32,7 @@
#include <osmocom/core/timer.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/tdef.h>
#include <osmocom/core/stats.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
@@ -50,6 +51,7 @@
#include <osmo-bts/signal.h>
#include <osmo-bts/dtx_dl_amr_fsm.h>
#include <osmo-bts/cbch.h>
+#include <osmo-bts/bts_shutdown_fsm.h>
#define MIN_QUAL_RACH 50 /* minimum link quality (in centiBels) for Access Bursts */
#define MIN_QUAL_NORM -5 /* minimum link quality (in centiBels) for Normal Bursts */
@@ -122,6 +124,117 @@
cbch_ctr_desc
};
+static struct osmo_tdef bts_T_defs[] = {
+ /* T-1: FIXME: Ideally should be dynamically calculated per trx at
+ * shutdown start based on params below, and highest trx value taken:
+ * + VTY's power-ramp step-interval.
+ * + Amount of steps needed (taking into account how many dB each step moves).
+ * + Extra time to get response back for each step.
+ * For now we simply give 5 mins, which should be enough for any
+ * acceptable setup, while still ensuring will timeout at some point if
+ * something fails in the ramp down procedure.
+ */
+ { .T=-1, .default_val=300, .desc="Time after which osmo-bts exits if regular ramp down during shut down process does not finish (s)" },
+ { .T=-2, .default_val=3, .desc="Time after which osmo-bts exits if requesting transceivers to stop during shut down process does not finish (s)" },
+ {}
+};
+
+static const uint8_t bts_nse_timer_default[] = { 3, 3, 3, 3, 30, 3, 10 };
+static const uint8_t bts_cell_timer_default[] =
+ { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 };
+static const struct gprs_rlc_cfg rlc_cfg_default = {
+ .parameter = {
+ [RLC_T3142] = 20,
+ [RLC_T3169] = 5,
+ [RLC_T3191] = 5,
+ [RLC_T3193] = 160, /* 10ms */
+ [RLC_T3195] = 5,
+ [RLC_N3101] = 10,
+ [RLC_N3103] = 4,
+ [RLC_N3105] = 8,
+ [CV_COUNTDOWN] = 15,
+ [T_DL_TBF_EXT] = 250 * 10, /* ms */
+ [T_UL_TBF_EXT] = 250 * 10, /* ms */
+ },
+ .paging = {
+ .repeat_time = 5 * 50, /* ms */
+ .repeat_count = 3,
+ },
+ .cs_mask = 0x1fff,
+ .initial_cs = 2,
+ .initial_mcs = 6,
+};
+
+struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
+{
+ struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts);
+ int i;
+
+ if (!bts)
+ return NULL;
+
+ bts->nr = bts_num;
+ bts->num_trx = 0;
+ INIT_LLIST_HEAD(&bts->trx_list);
+ bts->ms_max_power = 15; /* dBm */
+
+ bts->T_defs = bts_T_defs;
+ osmo_tdefs_reset(bts->T_defs);
+ bts->shutdown_fi = osmo_fsm_inst_alloc(&bts_shutdown_fsm, bts, bts,
+ LOGL_INFO, NULL);
+ osmo_fsm_inst_update_id_f(bts->shutdown_fi, "bts%d", bts->nr);
+
+ gsm_mo_init(&bts->mo, bts, NM_OC_BTS,
+ bts->nr, 0xff, 0xff);
+ gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER,
+ 0xff, 0xff, 0xff);
+
+ for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
+ bts->gprs.nsvc[i].bts = bts;
+ bts->gprs.nsvc[i].id = i;
+ gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
+ bts->nr, i, 0xff);
+ }
+ memcpy(&bts->gprs.nse.timer, bts_nse_timer_default,
+ sizeof(bts->gprs.nse.timer));
+ gsm_mo_init(&bts->gprs.nse.mo, bts, NM_OC_GPRS_NSE,
+ bts->nr, 0xff, 0xff);
+ memcpy(&bts->gprs.cell.timer, bts_cell_timer_default,
+ sizeof(bts->gprs.cell.timer));
+ gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL,
+ bts->nr, 0xff, 0xff);
+ memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default,
+ sizeof(bts->gprs.cell.rlc_cfg));
+
+ /* create our primary TRX. It will be initialized during bts_init() */
+ bts->c0 = gsm_bts_trx_alloc(bts);
+ if (!bts->c0) {
+ talloc_free(bts);
+ return NULL;
+ }
+ bts->c0->ts[0].pchan = GSM_PCHAN_CCCH_SDCCH4;
+
+ bts->features = bitvec_alloc(MAX_BTS_FEATURES / 8, bts);
+ OSMO_ASSERT(bts->features != NULL);
+
+ return bts;
+}
+
+struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num)
+{
+ struct gsm_bts *bts;
+
+ if (num >= net->num_bts)
+ return NULL;
+
+ llist_for_each_entry(bts, &net->bts_list, list) {
+ if (bts->nr == num)
+ return bts;
+ }
+
+ return NULL;
+}
+
/* Initialize the BTS data structures, called before config
* file reading */
int bts_init(struct gsm_bts *bts)
diff --git a/src/common/bts_shutdown_fsm.c b/src/common/bts_shutdown_fsm.c
index d55b1cd..c81a4ab 100644
--- a/src/common/bts_shutdown_fsm.c
+++ b/src/common/bts_shutdown_fsm.c
@@ -28,6 +28,7 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/bts_model.h>
+#include <osmo-bts/bts.h>
#define X(s) (1 << (s))
diff --git a/src/common/gsm_data.c b/src/common/gsm_data.c
index 57f33ae..caeb19b 100644
--- a/src/common/gsm_data.c
+++ b/src/common/gsm_data.c
@@ -30,29 +30,13 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/statistics.h>
#include <osmocom/core/fsm.h>
-#include <osmocom/core/tdef.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/abis_nm.h>
#include <osmocom/codec/ecu.h>
#include <osmo-bts/gsm_data.h>
-#include <osmo-bts/bts_shutdown_fsm.h>
-
-static struct osmo_tdef bts_T_defs[] = {
- /* T-1: FIXME: Ideally should be dynamically calculated per trx at
- * shutdown start based on params below, and highest trx value taken:
- * + VTY's power-ramp step-interval.
- * + Amount of steps needed (taking into account how many dB each step moves).
- * + Extra time to get response back for each step.
- * For now we simply give 5 mins, which should be enough for any
- * acceptable setup, while still ensuring will timeout at some point if
- * something fails in the ramp down procedure.
- */
- { .T=-1, .default_val=300, .desc="Time after which osmo-bts exits if regular ramp down during shut down process does not finish (s)" },
- { .T=-2, .default_val=3, .desc="Time after which osmo-bts exits if requesting transceivers to stop during shut down process does not finish (s)" },
- {}
-};
+#include <osmo-bts/bts.h>
const struct value_string bts_attribute_names[] = {
OSMO_VALUE_STRING(BTS_TYPE_VARIANT),
@@ -164,21 +148,6 @@
return get_value_string(lchan_s_names, s);
}
-struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num)
-{
- struct gsm_bts *bts;
-
- if (num >= net->num_bts)
- return NULL;
-
- llist_for_each_entry(bts, &net->bts_list, list) {
- if (bts->nr == num)
- return bts;
- }
-
- return NULL;
-}
-
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
{
struct gsm_bts_trx *trx = talloc_zero(bts, struct gsm_bts_trx);
@@ -233,88 +202,6 @@
return trx;
}
-
-static const uint8_t bts_nse_timer_default[] = { 3, 3, 3, 3, 30, 3, 10 };
-static const uint8_t bts_cell_timer_default[] =
- { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 };
-static const struct gprs_rlc_cfg rlc_cfg_default = {
- .parameter = {
- [RLC_T3142] = 20,
- [RLC_T3169] = 5,
- [RLC_T3191] = 5,
- [RLC_T3193] = 160, /* 10ms */
- [RLC_T3195] = 5,
- [RLC_N3101] = 10,
- [RLC_N3103] = 4,
- [RLC_N3105] = 8,
- [CV_COUNTDOWN] = 15,
- [T_DL_TBF_EXT] = 250 * 10, /* ms */
- [T_UL_TBF_EXT] = 250 * 10, /* ms */
- },
- .paging = {
- .repeat_time = 5 * 50, /* ms */
- .repeat_count = 3,
- },
- .cs_mask = 0x1fff,
- .initial_cs = 2,
- .initial_mcs = 6,
-};
-
-struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
-{
- struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts);
- int i;
-
- if (!bts)
- return NULL;
-
- bts->nr = bts_num;
- bts->num_trx = 0;
- INIT_LLIST_HEAD(&bts->trx_list);
- bts->ms_max_power = 15; /* dBm */
-
- bts->T_defs = bts_T_defs;
- osmo_tdefs_reset(bts->T_defs);
- bts->shutdown_fi = osmo_fsm_inst_alloc(&bts_shutdown_fsm, bts, bts,
- LOGL_INFO, NULL);
- osmo_fsm_inst_update_id_f(bts->shutdown_fi, "bts%d", bts->nr);
-
- gsm_mo_init(&bts->mo, bts, NM_OC_BTS,
- bts->nr, 0xff, 0xff);
- gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER,
- 0xff, 0xff, 0xff);
-
- for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
- bts->gprs.nsvc[i].bts = bts;
- bts->gprs.nsvc[i].id = i;
- gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
- bts->nr, i, 0xff);
- }
- memcpy(&bts->gprs.nse.timer, bts_nse_timer_default,
- sizeof(bts->gprs.nse.timer));
- gsm_mo_init(&bts->gprs.nse.mo, bts, NM_OC_GPRS_NSE,
- bts->nr, 0xff, 0xff);
- memcpy(&bts->gprs.cell.timer, bts_cell_timer_default,
- sizeof(bts->gprs.cell.timer));
- gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL,
- bts->nr, 0xff, 0xff);
- memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default,
- sizeof(bts->gprs.cell.rlc_cfg));
-
- /* create our primary TRX. It will be initialized during bts_init() */
- bts->c0 = gsm_bts_trx_alloc(bts);
- if (!bts->c0) {
- talloc_free(bts);
- return NULL;
- }
- bts->c0->ts[0].pchan = GSM_PCHAN_CCCH_SDCCH4;
-
- bts->features = bitvec_alloc(MAX_BTS_FEATURES / 8, bts);
- OSMO_ASSERT(bts->features != NULL);
-
- return bts;
-}
-
struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num)
{
struct gsm_bts_trx *trx;
@@ -520,6 +407,14 @@
return lchan;
}
+uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts)
+{
+ if (ts->tsc != -1)
+ return ts->tsc;
+ else
+ return ts->trx->bts->bsic & 7;
+}
+
/* determine logical channel based on TRX and channel number IE */
struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
int *rc)
diff --git a/src/common/load_indication.c b/src/common/load_indication.c
index 8d9b56f..c9b2645 100644
--- a/src/common/load_indication.c
+++ b/src/common/load_indication.c
@@ -27,6 +27,7 @@
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/rsl.h>
#include <osmo-bts/paging.h>
+#include <osmo-bts/bts.h>
static void reset_load_counters(struct gsm_bts *bts)
{
diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index 52b0566..1817849 100644
--- a/src/common/msg_utils.c
+++ b/src/common/msg_utils.c
@@ -23,6 +23,7 @@
#include <osmo-bts/oml.h>
#include <osmo-bts/amr.h>
#include <osmo-bts/rsl.h>
+#include <osmo-bts/bts.h>
#include <osmocom/gsm/protocol/ipaccess.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 3068918..7375a1a 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -42,6 +42,7 @@
#include <osmo-bts/l1sap.h>
#include <osmo-bts/scheduler.h>
#include <osmo-bts/scheduler_backend.h>
+#include <osmo-bts/bts.h>
extern void *tall_bts_ctx;
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index f5bc3c8..4a86c4e 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -25,6 +25,7 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/pcu_if.h>
+#include <osmo-bts/bts.h>
/* properly increment SI2q index and return SI2q data for scheduling */
static inline uint8_t *get_si2q_inc_index(struct gsm_bts *bts)
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 0adc8fe..c03b411 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -43,6 +43,7 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/l1sap.h>
#include <osmo-bts/handover.h>
+#include <osmo-bts/bts.h>
#include "l1_if.h"
#include "l1_oml.h"
diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c
index 0653f01..7876612 100644
--- a/src/osmo-bts-sysmo/sysmobts_vty.c
+++ b/src/osmo-bts-sysmo/sysmobts_vty.c
@@ -45,6 +45,7 @@
#include <osmo-bts/bts_model.h>
#include <osmo-bts/vty.h>
#include <osmo-bts/rsl.h>
+#include <osmo-bts/bts.h>
#include "femtobts.h"
#include "l1_if.h"
diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c
index 2e52958..fb75a4e 100644
--- a/src/osmo-bts-trx/trx_vty.c
+++ b/src/osmo-bts-trx/trx_vty.c
@@ -42,6 +42,7 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/vty.h>
#include <osmo-bts/scheduler.h>
+#include <osmo-bts/bts.h>
#include "l1_if.h"
#include "trx_if.h"
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/19123
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I0a4219e3f64f625ee8b364bf408b8d2bcc8085c5
Gerrit-Change-Number: 19123
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200703/e88e8919/attachment.htm>