diff options
Diffstat (limited to 'include/osmo-bts/bts.h')
-rw-r--r-- | include/osmo-bts/bts.h | 155 |
1 files changed, 101 insertions, 54 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index 6a61d015..8a5fb820 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -5,6 +5,7 @@ #include <osmocom/core/socket.h> #include <osmo-bts/gsm_data.h> #include <osmo-bts/bts_trx.h> +#include <osmo-bts/osmux.h> struct gsm_bts_trx; @@ -24,11 +25,21 @@ enum { BTS_CTR_RACH_RCVD, BTS_CTR_RACH_DROP, BTS_CTR_RACH_HO, + BTS_CTR_RACH_VGCS, BTS_CTR_RACH_CS, BTS_CTR_RACH_PS, BTS_CTR_AGCH_RCVD, BTS_CTR_AGCH_SENT, BTS_CTR_AGCH_DELETED, + + BTS_CTR_RTP_RX_TOTAL, + BTS_CTR_RTP_RX_MARKER, + BTS_CTR_RTP_RX_DROP_PREEN, + BTS_CTR_RTP_RX_DROP_LOOPBACK, + BTS_CTR_RTP_RX_DROP_OVERFLOW, + BTS_CTR_RTP_RX_DROP_V110_DEC, + BTS_CTR_RTP_TX_TOTAL, + BTS_CTR_RTP_TX_MARKER, }; /* Used by OML layer for BTS Attribute reporting */ @@ -52,34 +63,28 @@ enum gsm_bts_type_variant { }; const char *btsvariant2str(enum gsm_bts_type_variant v); -/* TODO: add a brief description of this flag */ -#define BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP (1 << 0) -/* When this flag is set then the measurement data is included in - * (PRIM_PH_DATA) and struct ph_tch_param (PRIM_TCH). Otherwise the - * measurement data is passed using a separate MPH INFO MEAS IND. - * (See also ticket: OS#2977) */ -#define BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB (1 << 1) -/* Whether the BTS model requires RadioCarrier MO to be in Enabled state - * (OPSTARTed) before OPSTARTing the RadioChannel MOs. See OS#5157 */ -#define BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER (1 << 2) +enum bts_impl_flag { + /* TODO: add a brief description of this flag */ + BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP, + /* When this flag is set then the measurement data is included in + * (PRIM_PH_DATA) and struct ph_tch_param (PRIM_TCH). Otherwise the + * measurement data is passed using a separate MPH INFO MEAS IND. + * (See also ticket: OS#2977) */ + BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB, + /* Whether the BTS model requires RadioCarrier MO to be in Enabled state + * (OPSTARTed) before OPSTARTing the RadioChannel MOs. See OS#5157 */ + BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER, + /* Whether the BTS model reports interference measurements to L1SAP. */ + BTS_INTERNAL_FLAG_INTERF_MEAS, + + _BTS_INTERNAL_FLAG_NUM, /* must be at the end */ +}; /* BTS implementation flags (internal use, not exposed via OML) */ #define bts_internal_flag_get(bts, flag) \ - ((bts->flags & (typeof(bts->flags)) flag) != 0) + ((bts->flags & (typeof(bts->flags))(1 << flag)) != 0) #define bts_internal_flag_set(bts, flag) \ - bts->flags |= (typeof(bts->flags)) flag - -struct gsm_bts_gprs_nsvc { - struct gsm_bts *bts; - /* data read via VTY config file, to configure the BTS - * via OML from BSC */ - int id; - uint16_t nsvci; - struct osmo_sockaddr local; /* on the BTS */ - struct osmo_sockaddr remote; /* on the SGSN */ - - struct gsm_abis_mo mo; -}; + bts->flags |= (typeof(bts->flags))(1 << flag) struct gprs_rlc_cfg { uint16_t parameter[_NUM_RLC_PAR]; @@ -128,14 +133,28 @@ struct bts_power_ctrl_params { } pf; }; -/* BTS Site Manager */ -struct gsm_bts_sm { +/* GPRS CELL; ip.access specific NM Object */ +struct gsm_gprs_cell { struct gsm_abis_mo mo; + uint16_t bvci; + uint8_t timer[11]; + struct gprs_rlc_cfg rlc_cfg; + struct { + uint32_t gprs_codings; /* see NM_IPAC_F_GPRS_CODING_* flags */ + } support; +}; + +/* Struct that holds one OML-Address (Address of the BSC) */ +struct bsc_oml_host { + struct llist_head list; + char *addr; }; +#define BTS_PCU_SOCK_WQUEUE_LEN_DEFAULT 100 + /* One BTS */ struct gsm_bts { - /* list header in net->bts_list */ + /* list header in g_bts_sm->bts_list */ struct llist_head list; /* number of the BTS in network */ @@ -149,6 +168,7 @@ struct gsm_bts { /* Base Station Identification Code (BSIC), lower 3 bits is BCC, * which is used as TSC for the CCCH */ uint8_t bsic; + bool bsic_configured; /* type of BTS */ enum gsm_bts_type_variant variant; enum gsm_band band; @@ -184,7 +204,7 @@ struct gsm_bts { /* CCCH is on C0 */ struct gsm_bts_trx *c0; - struct gsm_bts_sm site_mgr; + struct gsm_bts_sm *site_mgr; /* bitmask of all SI that are present/valid in si_buf */ uint32_t si_valid; @@ -214,18 +234,7 @@ struct gsm_bts { /* 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]; + struct gsm_gprs_cell cell; uint8_t rac; } gprs; @@ -241,8 +250,9 @@ struct gsm_bts { int16_t boundary[6]; uint8_t intave; } interference; - unsigned int t200_ms[7]; + uint32_t t200_fn[7]; unsigned int t3105_ms; + unsigned int t3115_ms; /* VGCS UPLINK GRANT repeat timer */ struct { uint8_t overload_period; struct { @@ -265,6 +275,7 @@ struct gsm_bts { } rach; } load; uint8_t ny1; + uint8_t ny2; /* maximum number of repetitions for the VGCS UPLINK GRANT */ uint8_t max_ta; /* AGCH queuing */ @@ -294,9 +305,17 @@ struct gsm_bts { bool pni; /* Primary Notification Identifier */ } etws; + /* Advanced Speech Call Items (VBS/VGCS) + NCH related bits */ + struct { + int pos_nch; /* position of the NCH or < 0, if not available */ + uint8_t nln, nln_status; /* current notification list number and status */ + struct llist_head notifications; + int notification_entries; /* current number of entries in the list */ + int notification_count; /* counter to count all entries */ + } asci; + struct paging_state *paging_state; - char *bsc_oml_host; - struct llist_head oml_queue; + struct llist_head bsc_oml_hosts; unsigned int rtp_jitter_buf_ms; bool rtp_jitter_adaptive; @@ -306,8 +325,13 @@ struct gsm_bts { int rtp_ip_dscp; int rtp_priority; + bool rtp_nogaps_mode; /* emit RTP stream without any gaps */ + bool use_ul_ecu; /* "rtp internal-uplink-ecu" option */ + bool emit_hr_rfc5993; + struct { uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */ + uint8_t max_ta; /* maximum timing advance */ } support; struct { uint8_t tc4_ctr; @@ -352,17 +376,26 @@ struct gsm_bts { struct { char *sock_path; + unsigned int sock_wqueue_len_max; } pcu; /* GSMTAP Um logging (disabled by default) */ struct { struct gsmtap_inst *inst; char *remote_host; + char *local_host; uint32_t sapi_mask; uint8_t sapi_acch; + bool rlp; + bool rlp_skip_null; } gsmtap; + struct osmux_state osmux; + struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */ + bool shutdown_fi_exit_proc; /* exit process when shutdown_fsm is finished? */ + bool shutdown_fi_skip_power_ramp; /* Skip power ramping and change power in one step? */ + struct osmo_fsm_inst *abis_link_fi; /* FSM instance to manage abis connection during process startup and link failure */ struct osmo_tdef *T_defs; /* Timer defines */ void *model_priv; /* Allocated by bts_model, contains model specific data pointer */ @@ -375,40 +408,47 @@ extern void *tall_bts_ctx; #define GSM_BTS_HAS_SI(bts, i) ((bts)->si_valid & (1 << i)) #define GSM_BTS_SI(bts, i) (void *)((bts)->si_buf[i][0]) -static inline struct gsm_bts *gsm_bts_sm_get_bts(struct gsm_bts_sm *site_mgr) { - return (struct gsm_bts *)container_of(site_mgr, struct gsm_bts, site_mgr); +static inline struct gsm_bts *gsm_gprs_cell_get_bts(struct gsm_gprs_cell *cell) +{ + return (struct gsm_bts *)container_of(cell, struct gsm_bts, gprs.cell); } -struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num); -struct gsm_bts *gsm_bts_num(const struct gsm_network *net, int num); +struct gsm_bts *gsm_bts_alloc(struct gsm_bts_sm *bts_sm, uint8_t bts_num); +struct gsm_bts *gsm_bts_num(const struct gsm_bts_sm *bts_sm, int num); int bts_init(struct gsm_bts *bts); void bts_shutdown(struct gsm_bts *bts, const char *reason); +void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc, bool skip_power_ramp); int bts_link_estab(struct gsm_bts *bts); int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg); -struct msgb *bts_agch_dequeue(struct gsm_bts *bts); int bts_agch_max_queue_length(int T, int bcch_conf); -int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt, - int is_ag_res); + +enum ccch_msgt { + CCCH_MSGT_AGCH, + CCCH_MSGT_PCH, + CCCH_MSGT_NCH, +}; + +int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt, enum ccch_msgt ccch); int bts_supports_cipher(struct gsm_bts *bts, int rsl_cipher); uint8_t *bts_sysinfo_get(struct gsm_bts *bts, const struct gsm_time *g_time); void regenerate_si3_restoctets(struct gsm_bts *bts); void regenerate_si4_restoctets(struct gsm_bts *bts); int get_si4_ro_offset(const uint8_t *si4_buf); -uint8_t *lchan_sacch_get(struct gsm_lchan *lchan); -int lchan_init_lapdm(struct gsm_lchan *lchan); void load_timer_start(struct gsm_bts *bts); +void load_timer_stop(struct gsm_bts *bts); +bool load_timer_is_running(const struct gsm_bts *bts); void bts_update_status(enum bts_global_status which, int on); struct gsm_time *get_time(struct gsm_bts *bts); int bts_main(int argc, char **argv); -int bts_supports_cm(const struct gsm_bts *bts, - const struct rsl_ie_chan_mode *cm); +bool bts_supports_cm(const struct gsm_bts *bts, + const struct rsl_ie_chan_mode *cm); int32_t bts_get_avg_fn_advance(const struct gsm_bts *bts); @@ -417,4 +457,11 @@ struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts); int bts_set_c0_pwr_red(struct gsm_bts *bts, const uint8_t red); +/* Context information to be put in the control buffer (db) of the AGCH msg + * buffer */ +struct bts_agch_msg_cb { + uint32_t msg_id; + bool confirm; +} __attribute__ ((packed)); + #endif /* _BTS_H */ |