From 9e6f8c3ad4b43ad46d125a379d9ec327d366991d Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 12 Apr 2021 09:12:22 +0200 Subject: wip Change-Id: I76b4744d610ad92671bfc676e21b41a8f1d7d2db --- include/osmo-bts/bts_trx.h | 6 ++++++ src/common/bts.c | 13 +++++++++++++ src/common/nm_bb_transc_fsm.c | 7 ++++++- src/common/oml.c | 4 ++++ src/osmo-bts-omldummy/main.c | 6 ++++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/include/osmo-bts/bts_trx.h b/include/osmo-bts/bts_trx.h index 39a9d37b..da72c9ec 100644 --- a/include/osmo-bts/bts_trx.h +++ b/include/osmo-bts/bts_trx.h @@ -14,6 +14,12 @@ * handles CCHAN and TRXMGMT, which is always done on the primary TRX's RSL link. */ #define TRX_PRIMARY(TRX) ((TRX)->vamos.primary_trx ? : (TRX)) +/* Return true if TRX is a plain primary TRX (with or without VAMOS operation). */ +#define TRX_IS_PRIMARY(TRX) ((TRX)->vamos.primary_trx == NULL) + +/* Return true if TRX is a VAMOS shadow TRX. */ +#define TRX_IS_SHADOW(TRX) ((TRX)->vamos.primary_trx != NULL) + struct gsm_bts_bb_trx { struct gsm_abis_mo mo; }; diff --git a/src/common/bts.c b/src/common/bts.c index 3a64aac3..ea0cdfa7 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -414,6 +414,7 @@ int bts_init(struct gsm_bts *bts) int bts_link_estab(struct gsm_bts *bts) { int i, j; + bool has_vamos = osmo_bts_has_feature(bts->features, BTS_FEAT_VAMOS); LOGP(DSUM, LOGL_INFO, "Main link established, sending NM Status.\n"); @@ -431,6 +432,18 @@ int bts_link_estab(struct gsm_bts *bts) for (i = 0; i < bts->num_trx; i++) { struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, i); + /* For VAMOS shadow TRXs, skip all initial status reports. The existence of shadow TRXes is indicated by + * BTS_FEAT_VAMOS. (If osmo-bts sent status reports for shadow TRXes, these would appear as full primary + * TRXes to non-Osmocom BSCs.) */ + if (has_vamos && TRX_IS_SHADOW(trx)) { + LOGP(DLGLOBAL, LOGL_ERROR, "Skipping TRX %d\n", trx->nr); + printf("Skipping TRX %d\n", trx->nr); + continue; + } else { + LOGP(DLGLOBAL, LOGL_ERROR, "NOT Skipping TRX %d\n", trx->nr); + printf("NOT Skipping TRX %d\n", trx->nr); + } + oml_tx_state_changed(&trx->mo); oml_tx_state_changed(&trx->bb_transc.mo); diff --git a/src/common/nm_bb_transc_fsm.c b/src/common/nm_bb_transc_fsm.c index 936451ff..75349063 100644 --- a/src/common/nm_bb_transc_fsm.c +++ b/src/common/nm_bb_transc_fsm.c @@ -60,7 +60,12 @@ static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event switch (event) { case NM_EV_SW_ACT: - oml_mo_tx_sw_act_rep(&bb_transc->mo); + /* For VAMOS shadow TRXs, do not send the initial Software Activated Report. The primary TRX's Software + * Activated Report implies the shadow TRX. (The main reason is to not confuse non-osmocom BSCs into + * thinking a shadow TRX were an independent primary TRX.) */ + if (!osmo_bts_has_feature(trx->bts->features, BTS_FEAT_VAMOS) + || TRX_PRIMARY(trx) == trx) + oml_mo_tx_sw_act_rep(&bb_transc->mo); nm_bb_transc_fsm_state_chg(fi, NM_BBTRANSC_ST_OP_DISABLED_OFFLINE); for (i = 0; i < TRX_NR_TS; i++) { struct gsm_bts_trx_ts *ts = &trx->ts[i]; diff --git a/src/common/oml.c b/src/common/oml.c index f836fd13..9fcb1d72 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -406,6 +406,10 @@ int oml_mo_statechg_ack(const struct gsm_abis_mo *mo) return rc; /* Emulate behaviour of ipaccess nanobts: Send a 'State Changed Event Report' as well. */ + LOGP(DLGLOBAL, LOGL_ERROR, "XXX oml_mo_statechg_ack() oml_tx_state_changed(%u %u %u)\n", + mo->obj_inst.bts_nr, + mo->obj_inst.trx_nr, + mo->obj_inst.ts_nr); return oml_tx_state_changed(mo); } diff --git a/src/osmo-bts-omldummy/main.c b/src/osmo-bts-omldummy/main.c index 92175a14..59899c64 100644 --- a/src/osmo-bts-omldummy/main.c +++ b/src/osmo-bts-omldummy/main.c @@ -116,6 +116,12 @@ int main(int argc, char **argv) msgb_talloc_ctx_init(tall_bts_ctx, 10*1024); osmo_init_logging2(tall_bts_ctx, &bts_log_info); + log_set_print_category(osmo_stderr_target, 1); + log_set_print_category_hex(osmo_stderr_target, 0); + log_set_print_level(osmo_stderr_target, 1); + log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_BASENAME); + log_set_print_filename_pos(osmo_stderr_target, LOG_FILENAME_POS_LINE_END); + log_set_print_extended_timestamp(osmo_stderr_target, 1); bts = gsm_bts_alloc(tall_bts_ctx, 0); if (!bts) -- cgit v1.2.3-59-g8ed1b