diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-05-07 15:47:57 +0200 |
---|---|---|
committer | fixeria <vyanitskiy@sysmocom.de> | 2021-05-18 19:11:06 +0000 |
commit | 462bf0952a5b9e16ff0cf81e793f62e9ca777a27 (patch) | |
tree | 85d9c6d587289b9e165d4c0817f34049591d1875 /include | |
parent | b4c0e43c6050a23cb18f3cf41744be6e25fffe15 (diff) |
[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
Diffstat (limited to 'include')
-rw-r--r-- | include/osmo-bts/gsm_data.h | 3 | ||||
-rw-r--r-- | include/osmo-bts/phy_link.h | 3 | ||||
-rw-r--r-- | include/osmo-bts/scheduler.h | 31 | ||||
-rw-r--r-- | include/osmo-bts/scheduler_backend.h | 54 |
4 files changed, 40 insertions, 51 deletions
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index ff0c89cb..be180075 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -455,6 +455,9 @@ struct gsm_bts_trx_ts { /* Transceiver "cache" for frequency hopping */ const struct gsm_bts_trx *fh_trx_list[64]; + /* Implementation specific structure(s) */ + void *priv; + struct gsm_lchan lchan[TS_MAX_LCHAN]; }; diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h index 467ad529..c4b60f36 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -115,9 +115,6 @@ struct phy_instance { bool sw_act_reported; } osmotrx; struct { - struct l1sched_trx sched; - } virt; - struct { /* logical transceiver number within one PHY */ uint32_t trx_id; /* trx lock state variable */ diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h index 4b1731a7..3ea08d9e 100644 --- a/include/osmo-bts/scheduler.h +++ b/include/osmo-bts/scheduler.h @@ -136,6 +136,8 @@ struct l1sched_chan_state { }; struct l1sched_ts { + struct gsm_bts_trx_ts *ts; /* timeslot we belong to */ + uint8_t mf_index; /* selected multiframe index */ uint8_t mf_period; /* period of multiframe */ const struct trx_sched_frame *mf_frames; /* pointer to frame layout */ @@ -148,25 +150,18 @@ struct l1sched_ts { struct l1sched_chan_state chan_state[_TRX_CHAN_MAX]; }; -struct l1sched_trx { - struct gsm_bts_trx *trx; - struct l1sched_ts ts[TRX_NR_TS]; -}; - -struct l1sched_ts *l1sched_trx_get_ts(struct l1sched_trx *l1t, uint8_t tn); - /*! \brief Initialize the scheduler data structures */ -int trx_sched_init(struct l1sched_trx *l1t, struct gsm_bts_trx *trx); +void trx_sched_init(struct gsm_bts_trx *trx); /*! \brief De-initialize the scheduler data structures */ -void trx_sched_exit(struct l1sched_trx *l1t); +void trx_sched_clean(struct gsm_bts_trx *trx); /*! \brief Handle a PH-DATA.req from L2 down to L1 */ -int trx_sched_ph_data_req(struct l1sched_trx *l1t, struct osmo_phsap_prim *l1sap); +int trx_sched_ph_data_req(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap); /*! \brief Handle a PH-TCH.req from L2 down to L1 */ -int trx_sched_tch_req(struct l1sched_trx *l1t, struct osmo_phsap_prim *l1sap); +int trx_sched_tch_req(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap); /*! \brief PHY informs us of new (current) GSM frame number */ int trx_sched_clock(struct gsm_bts *bts, uint32_t fn); @@ -178,21 +173,19 @@ int trx_sched_clock_started(struct gsm_bts *bts); int trx_sched_clock_stopped(struct gsm_bts *bts); /*! \brief set multiframe scheduler to given physical channel config */ -int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn, - enum gsm_phys_chan_config pchan); +int trx_sched_set_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config pchan); /*! \brief set all matching logical channels active/inactive */ -int trx_sched_set_lchan(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t link_id, bool active); +int trx_sched_set_lchan(struct gsm_lchan *lchan, uint8_t chan_nr, uint8_t link_id, bool active); /*! \brief set mode of all matching logical channels to given mode(s) */ -int trx_sched_set_mode(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t rsl_cmode, +int trx_sched_set_mode(struct gsm_bts_trx_ts *ts, uint8_t chan_nr, uint8_t rsl_cmode, uint8_t tch_mode, int codecs, uint8_t codec0, uint8_t codec1, uint8_t codec2, uint8_t codec3, uint8_t initial_codec, uint8_t handover); /*! \brief set ciphering on given logical channels */ -int trx_sched_set_cipher(struct l1sched_trx *l1t, uint8_t chan_nr, int downlink, - int algo, uint8_t *key, int key_len); +int trx_sched_set_cipher(struct gsm_lchan *lchan, uint8_t chan_nr, bool downlink); /* frame structures */ struct trx_sched_frame { @@ -287,8 +280,8 @@ struct trx_dl_burst_req { }; /*! Handle an UL burst received by PHY */ -int trx_sched_route_burst_ind(struct trx_ul_burst_ind *bi, struct l1sched_trx *l1t); -int trx_sched_ul_burst(struct l1sched_trx *l1t, struct trx_ul_burst_ind *bi); +int trx_sched_route_burst_ind(const struct gsm_bts_trx *trx, struct trx_ul_burst_ind *bi); +int trx_sched_ul_burst(struct l1sched_ts *l1ts, struct trx_ul_burst_ind *bi); /* Averaging mode for trx_sched_meas_avg() */ enum sched_meas_avg_mode { diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h index 13ca71b4..2a0dd111 100644 --- a/include/osmo-bts/scheduler_backend.h +++ b/include/osmo-bts/scheduler_backend.h @@ -1,21 +1,18 @@ #pragma once -#define LOGL1S(subsys, level, l1t, tn, chan, fn, fmt, args ...) \ +#define LOGL1S(subsys, level, l1ts, chan, fn, fmt, args ...) \ LOGP(subsys, level, "%s %s %s: " fmt, \ gsm_fn_as_gsmtime_str(fn), \ - gsm_ts_name(&(l1t)->trx->ts[tn]), \ + gsm_ts_name((l1ts)->ts), \ chan >=0 ? trx_chan_desc[chan].name : "", ## args) /* Logging helper adding context from trx_{ul,dl}_burst_{ind,req} */ -#define LOGL1SB(subsys, level, l1t, b, fmt, args ...) \ - LOGL1S(subsys, level, l1t, (b)->tn, (b)->chan, (b)->fn, fmt, ## args) +#define LOGL1SB(subsys, level, l1ts, b, fmt, args ...) \ + LOGL1S(subsys, level, l1ts, (b)->chan, (b)->fn, fmt, ## args) -typedef int trx_sched_rts_func(struct l1sched_trx *l1t, uint8_t tn, - uint32_t fn, enum trx_chan_type chan); - -typedef int trx_sched_dl_func(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); - -typedef int trx_sched_ul_func(struct l1sched_trx *l1t, const struct trx_ul_burst_ind *bi); +typedef int trx_sched_rts_func(const struct l1sched_ts *l1ts, const struct trx_dl_burst_req *br); +typedef int trx_sched_dl_func(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); +typedef int trx_sched_ul_func(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi); struct trx_chan_desc { /*! \brief Human-readable name */ @@ -42,35 +39,34 @@ extern const ubit_t _sched_tsc[8][26]; extern const ubit_t _sched_egprs_tsc[8][78]; extern const ubit_t _sched_sch_train[64]; -struct msgb *_sched_dequeue_prim(struct l1sched_trx *l1t, - const struct trx_dl_burst_req *br); +struct msgb *_sched_dequeue_prim(struct l1sched_ts *l1ts, const struct trx_dl_burst_req *br); -int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, +int _sched_compose_ph_data_ind(struct l1sched_ts *l1ts, uint32_t fn, enum trx_chan_type chan, uint8_t *l2, uint8_t l2_len, float rssi, int16_t ta_offs_256bits, int16_t link_qual_cb, uint16_t ber10k, enum osmo_ph_pres_info_type presence_info); -int _sched_compose_tch_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, +int _sched_compose_tch_ind(struct l1sched_ts *l1ts, uint32_t fn, enum trx_chan_type chan, uint8_t *tch, uint8_t tch_len, int16_t ta_offs_256bits, uint16_t ber10k, float rssi, uint8_t is_sub); -int tx_idle_fn(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); -int tx_fcch_fn(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); -int tx_sch_fn(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); -int tx_data_fn(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); -int tx_pdtch_fn(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); -int tx_tchf_fn(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); -int tx_tchh_fn(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); +int tx_idle_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); +int tx_fcch_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); +int tx_sch_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); +int tx_data_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); +int tx_pdtch_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); +int tx_tchf_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); +int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); -int rx_rach_fn(struct l1sched_trx *l1t, const struct trx_ul_burst_ind *bi); -int rx_data_fn(struct l1sched_trx *l1t, const struct trx_ul_burst_ind *bi); -int rx_pdtch_fn(struct l1sched_trx *l1t, const struct trx_ul_burst_ind *bi); -int rx_tchf_fn(struct l1sched_trx *l1t, const struct trx_ul_burst_ind *bi); -int rx_tchh_fn(struct l1sched_trx *l1t, const struct trx_ul_burst_ind *bi); +int rx_rach_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi); +int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi); +int rx_pdtch_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi); +int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi); +int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi); -void _sched_dl_burst(struct l1sched_trx *l1t, struct trx_dl_burst_req *br); -int _sched_rts(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn); -void _sched_act_rach_det(struct l1sched_trx *l1t, uint8_t tn, uint8_t ss, int activate); +void _sched_dl_burst(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br); +int _sched_rts(const struct l1sched_ts *l1ts, uint32_t fn); +void _sched_act_rach_det(struct gsm_bts_trx *trx, uint8_t tn, uint8_t ss, int activate); |