aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-04-10 14:25:20 +0000
committerNeels Hofmeyr <neels@hofmeyr.de>2021-04-10 14:25:20 +0000
commitbcabd936f3c6edd8a91da4493d1a1ff538b81c5d (patch)
tree89d79166f231a4acbe32ebdd1ebb94235fefcc45
parent5212daebca50f6353bdcff1bc1ec7f0a30a3b588 (diff)
add VAMOS shadow TRX structures
-rw-r--r--include/osmo-bts/bts_trx.h19
-rw-r--r--src/common/bts.c2
-rw-r--r--src/common/bts_trx.c24
-rw-r--r--src/common/vty.c2
-rw-r--r--src/osmo-bts-omldummy/main.c2
-rw-r--r--tests/handover/handover_test.c2
-rw-r--r--tests/meas/meas_test.c2
-rw-r--r--tests/power/bs_power_loop_test.c2
-rw-r--r--tests/power/ms_power_loop_test.c2
-rw-r--r--tests/tx_power/tx_power_test.c2
10 files changed, 43 insertions, 16 deletions
diff --git a/include/osmo-bts/bts_trx.h b/include/osmo-bts/bts_trx.h
index 44749035..dd6d3130 100644
--- a/include/osmo-bts/bts_trx.h
+++ b/include/osmo-bts/bts_trx.h
@@ -2,6 +2,15 @@
#include <osmo-bts/gsm_data.h>
+/* For VAMOS, there is a "shadow TRX" for each normal TRX, to handle multiple MS on the same timeslot. The shadow TRX is
+ * visible on OML and RSL, but there is only a single struct gsm_bts_trx for the TRX and the shadow TRX. Also, there is
+ * only a single timeslot FSM handling both the "normal" and the secondary VAMOS lchans. */
+#define TRX_SHADOW_NR(NR) (0x80 + (NR))
+
+/* For any gsm_bts_trx (VAMOS shadow or primary trx), return the primary gsm_bts_trx pointer. Useful for all code that
+ * handles CCHAN and TRXMGMT, which is always done on the primary TRX's RSL link. */
+#define TRX_PRIMARY(TRX) ((TRX)->vamos.primary_trx ? : (TRX))
+
struct gsm_bts_bb_trx {
struct gsm_abis_mo mo;
};
@@ -48,13 +57,21 @@ struct gsm_bts_trx {
} ipaccess;
};
struct gsm_bts_trx_ts ts[TRX_NR_TS];
+
+ struct {
+ /* If this is a primary TRX that has a shadow TRX, this points at the shadow TRX.
+ * NULL when this TRX is a shadow TRX itself, or when there is no shadow TRX set up. */
+ struct gsm_bts_trx *shadow_trx;
+ /* If this is a shadow TRX, this points at the primary TRX. NULL if this is a primary TRX. */
+ struct gsm_bts_trx *primary_trx;
+ } vamos;
};
static inline struct gsm_bts_trx *gsm_bts_bb_trx_get_trx(struct gsm_bts_bb_trx *bb_transc) {
return (struct gsm_bts_trx *)container_of(bb_transc, struct gsm_bts_trx, bb_transc);
}
-struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
+struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts, struct gsm_bts_trx *shadow_for_primary_trx);
int bts_trx_init(struct gsm_bts_trx *trx);
struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
char *gsm_trx_name(const struct gsm_bts_trx *trx);
diff --git a/src/common/bts.c b/src/common/bts.c
index 06a5ccb2..3a64aac3 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -264,7 +264,7 @@ struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
sizeof(bts->gprs.cell.rlc_cfg));
/* create our primary TRX. It will be initialized during bts_init() */
- bts->c0 = gsm_bts_trx_alloc(bts);
+ bts->c0 = gsm_bts_trx_alloc(bts, NULL);
if (!bts->c0) {
talloc_free(bts);
return NULL;
diff --git a/src/common/bts_trx.c b/src/common/bts_trx.c
index 9fc18e46..28b9d9d5 100644
--- a/src/common/bts_trx.c
+++ b/src/common/bts_trx.c
@@ -52,7 +52,7 @@ static int gsm_bts_trx_talloc_destructor(struct gsm_bts_trx *trx)
return 0;
}
-struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
+struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts, struct gsm_bts_trx *shadow_for_primary_trx)
{
struct gsm_bts_trx *trx = talloc_zero(bts, struct gsm_bts_trx);
int k;
@@ -63,13 +63,23 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
talloc_set_destructor(trx, gsm_bts_trx_talloc_destructor);
trx->bts = bts;
- trx->nr = bts->num_trx++;
- trx->mo.fi = osmo_fsm_inst_alloc(&nm_rcarrier_fsm, trx, trx,
- LOGL_INFO, NULL);
- osmo_fsm_inst_update_id_f(trx->mo.fi, "bts%d-trx%d", bts->nr, trx->nr);
- gsm_mo_init(&trx->mo, bts, NM_OC_RADIO_CARRIER,
- bts->nr, trx->nr, 0xff);
+ if (!shadow_for_primary_trx) {
+ trx->nr = bts->num_trx++;
+ } else {
+ trx->nr = TRX_SHADOW_NR(shadow_for_primary_trx->nr);
+ shadow_for_primary_trx->vamos.shadow_trx = trx;
+ trx->vamos.primary_trx = shadow_for_primary_trx;
+ }
+
+ /* Skip Radio Carrier FSM for shadow TRXes */
+ if (!shadow_for_primary_trx) {
+ trx->mo.fi = osmo_fsm_inst_alloc(&nm_rcarrier_fsm, trx, trx,
+ LOGL_INFO, NULL);
+ osmo_fsm_inst_update_id_f(trx->mo.fi, "bts%d-trx%d", bts->nr, trx->nr);
+ gsm_mo_init(&trx->mo, bts, NM_OC_RADIO_CARRIER,
+ bts->nr, trx->nr, 0xff);
+ }
trx->bb_transc.mo.fi = osmo_fsm_inst_alloc(&nm_bb_transc_fsm, trx, &trx->bb_transc,
LOGL_INFO, NULL);
diff --git a/src/common/vty.c b/src/common/vty.c
index 45ee32c5..6ad4ce87 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -227,7 +227,7 @@ DEFUN_ATTR(cfg_bts_trx, cfg_bts_trx_cmd,
* Remark: TRX0 was already created during gsm_bts_alloc() and
* initialized in bts_init(), not here.
*/
- trx = gsm_bts_trx_alloc(bts);
+ trx = gsm_bts_trx_alloc(bts, NULL);
if (trx)
bts_trx_init(trx);
} else
diff --git a/src/osmo-bts-omldummy/main.c b/src/osmo-bts-omldummy/main.c
index 9ab23c58..3f10987b 100644
--- a/src/osmo-bts-omldummy/main.c
+++ b/src/osmo-bts-omldummy/main.c
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
/* Additional TRXs */
for (i = 1; i < cmdline.trx_num; i++) {
- trx = gsm_bts_trx_alloc(bts);
+ trx = gsm_bts_trx_alloc(bts, NULL);
if (!trx)
exit(1);
}
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 72d8dc8e..bf0637f7 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
exit(1);
}
- trx = gsm_bts_trx_alloc(bts);
+ trx = gsm_bts_trx_alloc(bts, NULL);
if (!trx) {
fprintf(stderr, "Failed to alloc TRX structure\n");
exit(1);
diff --git a/tests/meas/meas_test.c b/tests/meas/meas_test.c
index d1293365..1e4a1a43 100644
--- a/tests/meas/meas_test.c
+++ b/tests/meas/meas_test.c
@@ -525,7 +525,7 @@ int main(int argc, char **argv)
exit(1);
}
- trx = gsm_bts_trx_alloc(bts);
+ trx = gsm_bts_trx_alloc(bts, NULL);
if (!trx) {
fprintf(stderr, "Failed to alloc TRX structure\n");
exit(1);
diff --git a/tests/power/bs_power_loop_test.c b/tests/power/bs_power_loop_test.c
index 53fdbba6..6c32c1b9 100644
--- a/tests/power/bs_power_loop_test.c
+++ b/tests/power/bs_power_loop_test.c
@@ -106,7 +106,7 @@ static void init_test(const char *name)
OSMO_ASSERT(g_bts != NULL);
INIT_LLIST_HEAD(&g_bts->trx_list);
- g_trx = gsm_bts_trx_alloc(g_bts);
+ g_trx = gsm_bts_trx_alloc(g_bts, NULL);
OSMO_ASSERT(g_trx != NULL);
g_bts->band = GSM_BAND_900;
diff --git a/tests/power/ms_power_loop_test.c b/tests/power/ms_power_loop_test.c
index 0d863108..3fd4abd5 100644
--- a/tests/power/ms_power_loop_test.c
+++ b/tests/power/ms_power_loop_test.c
@@ -46,7 +46,7 @@ static void init_test(const char *name)
OSMO_ASSERT(g_bts != NULL);
INIT_LLIST_HEAD(&g_bts->trx_list);
- g_trx = gsm_bts_trx_alloc(g_bts);
+ g_trx = gsm_bts_trx_alloc(g_bts, NULL);
OSMO_ASSERT(g_trx != NULL);
g_trx->ms_pwr_ctl_soft = true;
diff --git a/tests/tx_power/tx_power_test.c b/tests/tx_power/tx_power_test.c
index 3724f564..c33b35f4 100644
--- a/tests/tx_power/tx_power_test.c
+++ b/tests/tx_power/tx_power_test.c
@@ -257,7 +257,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Failed to create BTS structure\n");
exit(1);
}
- trx = gsm_bts_trx_alloc(bts);
+ trx = gsm_bts_trx_alloc(bts, NULL);
if (!trx) {
fprintf(stderr, "Failed to TRX structure\n");
exit(1);