2011-06-27 09:25:35 +00:00
|
|
|
#ifndef _GSM_DATA_H
|
|
|
|
#define _GSM_DATA_H
|
|
|
|
|
2020-06-17 15:48:16 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2011-06-27 09:25:35 +00:00
|
|
|
#include <osmocom/core/timer.h>
|
2020-06-17 15:48:16 +00:00
|
|
|
#include <osmocom/core/bitvec.h>
|
|
|
|
#include <osmocom/core/statistics.h>
|
|
|
|
#include <osmocom/core/utils.h>
|
2011-06-27 09:25:35 +00:00
|
|
|
#include <osmocom/core/linuxlist.h>
|
2021-08-16 17:04:48 +00:00
|
|
|
#include <osmocom/core/tdef.h>
|
2018-02-20 23:38:05 +00:00
|
|
|
#include <osmocom/gsm/gsm23003.h>
|
2020-06-16 22:08:54 +00:00
|
|
|
#include <osmocom/gsm/gsm0502.h>
|
2020-06-17 15:48:16 +00:00
|
|
|
#include <osmocom/gsm/gsm_utils.h>
|
|
|
|
#include <osmocom/gsm/tlv.h>
|
|
|
|
#include <osmocom/gsm/rxlev_stat.h>
|
|
|
|
#include <osmocom/gsm/sysinfo.h>
|
|
|
|
#include <osmocom/gsm/bts_features.h>
|
|
|
|
#include <osmocom/gsm/gsm48_rest_octets.h>
|
|
|
|
#include <osmocom/gsm/protocol/gsm_04_08.h>
|
|
|
|
#include <osmocom/gsm/protocol/gsm_08_58.h>
|
|
|
|
#include <osmocom/gsm/protocol/gsm_12_21.h>
|
|
|
|
|
|
|
|
#include <osmocom/abis/e1_input.h>
|
2011-06-27 09:25:35 +00:00
|
|
|
|
|
|
|
#include <osmo-bts/paging.h>
|
New generic transmit power handling
In order to support transmit power reduction by thermal management
as well as the variety of new internal / external PA configurations
of BTSs, we need a slightly more complex system.
Also, as at high power a single dB can be quite a big difference,
we are now doing all computations in milli-dB(m), i.e. 1/10000 bel.
Ramping is now used both for up and down ramping, as that is useful in
cases where you want to gracefully shut down a cell by shrinking its
radius, gradually handing over subscribers to neighboring cells.
Furthermore, this code is becoming part of the 'common' codebase, as it
is not really specific to how sysmobts is working.
The user can specify a single aggregate value for external system
gain/attenuation. Let's say you have 1dB loss of antenna cable, so you
can put that as 'user-gain -1' into the config, which means that a
'transmit power of 20dBm' will be compensatet for that and the TRX is
instructed to output 21dBm to compensate the cable loss. Similarly,
external PAs can be described by a positive user-gain.
One of the next steps will be to communicate those values and the
nominal power capability of the specific BTS to the BSC, so the BSC will
automatically show correct signal levels in the VTY and log files.
The code includes provisions for future extensions regarding
* an external and an internal PA with calibration tables
* a thermal attenuation setting to be controlled by the site manager
2014-08-22 00:46:15 +00:00
|
|
|
#include <osmo-bts/tx_power.h>
|
2020-07-03 14:22:44 +00:00
|
|
|
#include <osmo-bts/oml.h>
|
2021-10-06 15:59:57 +00:00
|
|
|
#include <osmo-bts/lchan.h>
|
2011-06-27 09:25:35 +00:00
|
|
|
|
2016-01-09 16:56:10 +00:00
|
|
|
#define GSM_FR_BITS 260
|
|
|
|
#define GSM_EFR_BITS 244
|
|
|
|
|
|
|
|
#define GSM_FR_BYTES 33 /* TS 101318 Chapter 5.1: 260 bits + 4bit sig */
|
|
|
|
#define GSM_HR_BYTES 14 /* TS 101318 Chapter 5.2: 112 bits, no sig */
|
|
|
|
#define GSM_EFR_BYTES 31 /* TS 101318 Chapter 5.3: 244 bits + 4bit sig */
|
|
|
|
|
2014-02-14 20:15:31 +00:00
|
|
|
#define GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT 41
|
|
|
|
#define GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DISABLE 999999
|
|
|
|
#define GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT 41
|
|
|
|
#define GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT 91
|
|
|
|
|
2011-06-27 09:25:35 +00:00
|
|
|
struct gsm_network {
|
2011-09-04 20:42:03 +00:00
|
|
|
struct llist_head bts_list;
|
|
|
|
unsigned int num_bts;
|
2018-02-20 23:38:05 +00:00
|
|
|
struct osmo_plmn_id plmn;
|
2012-07-08 18:50:02 +00:00
|
|
|
struct pcu_sock_state *pcu_state;
|
2011-06-27 09:25:35 +00:00
|
|
|
};
|
|
|
|
|
2020-06-17 15:48:16 +00:00
|
|
|
/* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018 Table 10.5.2.33b.1:
|
|
|
|
4-bit index is used (2#1111 = 10#15) */
|
|
|
|
#define SI2Q_MAX_NUM 16
|
|
|
|
/* length in bits (for single SI2quater message) */
|
|
|
|
#define SI2Q_MAX_LEN 160
|
|
|
|
#define SI2Q_MIN_LEN 18
|
|
|
|
|
|
|
|
/* lchans 0..3 are SDCCH in combined channel configuration,
|
|
|
|
use 4 as magic number for BCCH hack - see osmo-bts-../oml.c:opstart_compl() */
|
|
|
|
#define CCCH_LCHAN 4
|
|
|
|
|
|
|
|
#define TRX_NR_TS 8
|
|
|
|
#define TS_MAX_LCHAN 8
|
|
|
|
|
|
|
|
#define MAX_VERSION_LENGTH 64
|
|
|
|
|
|
|
|
enum gsm_bts_trx_ts_flags {
|
|
|
|
TS_F_PDCH_ACTIVE = 0x1000,
|
|
|
|
TS_F_PDCH_ACT_PENDING = 0x2000,
|
|
|
|
TS_F_PDCH_DEACT_PENDING = 0x4000,
|
|
|
|
TS_F_PDCH_PENDING_MASK = 0x6000 /*<
|
|
|
|
TS_F_PDCH_ACT_PENDING | TS_F_PDCH_DEACT_PENDING */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* One Timeslot in a TRX */
|
|
|
|
struct gsm_bts_trx_ts {
|
|
|
|
struct gsm_bts_trx *trx;
|
|
|
|
/* number of this timeslot at the TRX */
|
|
|
|
uint8_t nr;
|
|
|
|
|
|
|
|
enum gsm_phys_chan_config pchan;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
enum gsm_phys_chan_config pchan_is;
|
|
|
|
enum gsm_phys_chan_config pchan_want;
|
|
|
|
} dyn;
|
|
|
|
|
|
|
|
unsigned int flags;
|
|
|
|
struct gsm_abis_mo mo;
|
2021-05-22 01:33:13 +00:00
|
|
|
|
|
|
|
/* Training Sequence Code (range 0..7) */
|
|
|
|
uint8_t tsc_oml; /* configured via OML */
|
|
|
|
uint8_t tsc; /* currently in use */
|
|
|
|
/* Training Sequence Set (range 0..3) */
|
|
|
|
uint8_t tsc_set;
|
2020-06-17 15:48:16 +00:00
|
|
|
|
osmo-bts-trx: implement BCCH carrier power reduction mode
The BCCH carrier (sometimes called C0) of a BTS shall maintain
discontinuous Downlink transmission at full power in order to
stay 'visible' to the mobile stations. Because of that, early
versions of 3GPP TS 45.008 prohibited BS power reduction on C0.
However, in the recent 3GPP TS 45.008 there is a feature called
'BCCH carrier power reduction operation'. This is a special
mode of operation, where the variation of RF level for some
timeslots is relaxed for the purpose of energy saving.
In BCCH carrier power reduction operation, for timeslots on the
C0 carrier, except timeslots carrying BCCH/CCCH, the output power
may be lower than the output power used for timeslots carrying
BCCH/CCCH. In this case the maximum allowed difference in output
power actually transmitted by the BTS is 6 dB.
The power reduction operation can be controlled by the BSC by
sending BS POWER CONTROL on the A-bis/RSL with the Channel Number
IE set to 0x80 (RSL_CHAN_BCCH). This makes osmo-bts reduce the
transmission power on inactive timeslots of the BCCH carrier.
This is a non-standard, Osmocom specific extension, so indicate
support of this feature to the BSC in the feature vector. Also
add a VTY command to allow enabling/disabling the power reduction
locally. Add some signalling notes to the A-bis/RSL manual.
For more details, see 3GPP TS 45.008, section 7.1.
Change-Id: I3dcee6e910ccc61c5c63c728db9ea04327e2fc98
Depends: I69283b3f35988fc7a1a1dcf1a1ad3b67f08ec716
Related: SYS#4919
2021-06-25 17:16:06 +00:00
|
|
|
/* Actual BCCH carrier power reduction */
|
|
|
|
uint8_t c0_power_red_db;
|
|
|
|
|
2020-06-14 19:29:57 +00:00
|
|
|
/* Frequency hopping parameters (configured via OML) */
|
2020-06-17 15:48:16 +00:00
|
|
|
struct {
|
2020-06-14 19:29:57 +00:00
|
|
|
bool enabled;
|
2020-06-17 15:48:16 +00:00
|
|
|
uint8_t maio;
|
|
|
|
uint8_t hsn;
|
2020-09-13 17:24:15 +00:00
|
|
|
uint16_t arfcn_list[64];
|
|
|
|
uint8_t arfcn_num;
|
2020-06-17 15:48:16 +00:00
|
|
|
} hopping;
|
|
|
|
|
osmo-bts-trx/scheduler: implement baseband frequency hopping
The idea behind the baseband frequency hopping is quite simple: we
have several RF carriers (transceivers) transmitting and receiving
on fixed frequencies (just like in a regular multi-trx setup), and
an additional burst routing layer between the schedulear and the
transceiver interface (TRXD over UDP).
Speaking in terms of the proposed implementation:
- on Downlink, dlfh_route_br() calculates the ARFCN corresponding
to the current TDMA frame number according to the hopping sequence
parametets, and picks the transceiver with matching ARFCN;
- on Uplink, ulfh_route_bi() iterates over the transceiver list of
of the BTS, calculating hopping ARFCNs for equivalent timeslots,
and picks the one with ARFCN matching the received burst.
In order to avoid frequent transceiver lookups on the Downlink path,
dlfh_route_br() maintains a "cache" in the timeslot state structure.
Unfortunately, this "cache" seems to be useless on the Uplink path,
so ulfh_route_bi() always needs to lookup the matching transceiver
for each burst received over the TRXD interface.
It may also happen that the scheduler will be unable to route an
Uplink or Downlink burst, e.g. due to inconsistent / incorrect
hopping sequence parameters received from the BSC, or in case
if a transceiver gets RF-locked by the BTS operator.
Such events are logged as "FATAL" and aditionally signalled by the
following osmo-bts-trx specific rate counters:
- trx_sched:dl_fh_no_carrier (Downlink), and
- trx_sched:ul_fh_no_carrier (Uplink).
Change-Id: I68f4ae09fd0789ad0d8f1c1e17e17dfc4de8e462
Related: SYS#4868, OS#4546
2020-06-15 10:22:39 +00:00
|
|
|
/* Transceiver "cache" for frequency hopping */
|
|
|
|
const struct gsm_bts_trx *fh_trx_list[64];
|
|
|
|
|
[VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):
- struct l1sched_trx (struct gsm_bts_trx),
- struct l1sched_ts (struct gsm_bts_trx_ts),
- struct l1sched_chan_state (struct gsm_lchan).
These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead. Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ l1sched_trx --------------------> gsm_bts_trx (0..255)
| |
--+ l1sched_trx_ts --+ gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.
In this path I slightly change the architecture as follows:
+ gsm_network
|
--+ gsm_bts (0..255)
|
--+ gsm_bts_trx (0..255)
|
--+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
| |
--+ l1sched_chan_state --+ gsm_lchan (up to 8)
Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping. The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.
osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.
Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-07 13:47:57 +00:00
|
|
|
/* Implementation specific structure(s) */
|
|
|
|
void *priv;
|
|
|
|
|
2021-05-27 16:26:29 +00:00
|
|
|
/* VAMOS specific fields */
|
|
|
|
struct {
|
|
|
|
/* NULL if BTS_FEAT_VAMOS is not set */
|
|
|
|
struct gsm_bts_trx_ts *peer;
|
|
|
|
bool is_shadow;
|
|
|
|
} vamos;
|
|
|
|
|
2020-06-17 15:48:16 +00:00
|
|
|
struct gsm_lchan lchan[TS_MAX_LCHAN];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum gprs_rlc_par {
|
|
|
|
RLC_T3142,
|
|
|
|
RLC_T3169,
|
|
|
|
RLC_T3191,
|
|
|
|
RLC_T3193,
|
|
|
|
RLC_T3195,
|
|
|
|
RLC_N3101,
|
|
|
|
RLC_N3103,
|
|
|
|
RLC_N3105,
|
|
|
|
CV_COUNTDOWN,
|
|
|
|
T_DL_TBF_EXT, /* ms */
|
|
|
|
T_UL_TBF_EXT, /* ms */
|
|
|
|
_NUM_RLC_PAR
|
|
|
|
};
|
|
|
|
|
|
|
|
enum gprs_cs {
|
|
|
|
GPRS_CS1,
|
|
|
|
GPRS_CS2,
|
|
|
|
GPRS_CS3,
|
|
|
|
GPRS_CS4,
|
|
|
|
GPRS_MCS1,
|
|
|
|
GPRS_MCS2,
|
|
|
|
GPRS_MCS3,
|
|
|
|
GPRS_MCS4,
|
|
|
|
GPRS_MCS5,
|
|
|
|
GPRS_MCS6,
|
|
|
|
GPRS_MCS7,
|
|
|
|
GPRS_MCS8,
|
|
|
|
GPRS_MCS9,
|
|
|
|
_NUM_GRPS_CS
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The amount of time within which a sudden disconnect of a newly established
|
|
|
|
* OML connection will cause a special warning to be logged. */
|
|
|
|
#define OSMO_BTS_OML_CONN_EARLY_DISCONNECT 10 /* in seconds */
|
|
|
|
|
2021-08-16 17:04:48 +00:00
|
|
|
extern struct osmo_tdef_group bts_tdef_groups[];
|
|
|
|
extern struct osmo_tdef bts_T_defs[];
|
2021-08-16 17:05:06 +00:00
|
|
|
extern struct osmo_tdef abis_T_defs[];
|
2020-06-17 15:48:16 +00:00
|
|
|
|
|
|
|
extern const struct value_string gsm_pchant_names[13];
|
|
|
|
extern const struct value_string gsm_pchant_descs[13];
|
|
|
|
const char *gsm_pchan_name(enum gsm_phys_chan_config c);
|
|
|
|
const char *gsm_lchant_name(enum gsm_chan_t c);
|
|
|
|
char *gsm_ts_name(const struct gsm_bts_trx_ts *ts);
|
|
|
|
char *gsm_ts_and_pchan_name(const struct gsm_bts_trx_ts *ts);
|
|
|
|
|
2021-05-27 16:26:29 +00:00
|
|
|
#define GSM_TS_NAME_FMT \
|
|
|
|
"bts=%u,trx=%u,ts=%u" "%s"
|
|
|
|
#define GSM_TS_NAME_ARGS(ts) \
|
|
|
|
(ts)->trx->bts->nr, (ts)->trx->nr, (ts)->nr, \
|
|
|
|
(ts)->vamos.is_shadow ? ",shadow" : ""
|
|
|
|
|
2021-05-22 00:42:42 +00:00
|
|
|
#define BSIC2BCC(bsic) ((bsic) & 0x07)
|
2021-05-22 01:22:09 +00:00
|
|
|
#define BTS_TSC(bts) BSIC2BCC((bts)->bsic)
|
2020-06-17 15:48:16 +00:00
|
|
|
|
|
|
|
struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
|
|
|
|
int *rc);
|
|
|
|
|
2021-05-21 17:59:00 +00:00
|
|
|
enum gsm_phys_chan_config ts_pchan(const struct gsm_bts_trx_ts *ts);
|
|
|
|
uint8_t ts_subslots(const struct gsm_bts_trx_ts *ts);
|
|
|
|
bool ts_is_tch(const struct gsm_bts_trx_ts *ts);
|
2020-06-17 15:48:16 +00:00
|
|
|
|
2016-07-16 22:32:07 +00:00
|
|
|
int conf_lchans_as_pchan(struct gsm_bts_trx_ts *ts,
|
|
|
|
enum gsm_phys_chan_config pchan);
|
2012-04-16 18:07:56 +00:00
|
|
|
|
2012-12-26 17:55:54 +00:00
|
|
|
/* cipher code */
|
|
|
|
#define CIPHER_A5(x) (1 << (x-1))
|
|
|
|
|
2016-08-09 18:15:09 +00:00
|
|
|
bool ts_is_pdch(const struct gsm_bts_trx_ts *ts);
|
2012-12-26 17:55:54 +00:00
|
|
|
|
2021-10-06 16:51:01 +00:00
|
|
|
void gsm_ts_release(struct gsm_bts_trx_ts *ts);
|
|
|
|
|
2011-06-27 09:25:35 +00:00
|
|
|
#endif /* _GSM_DATA_H */
|