diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-05-07 03:28:04 +0200 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-05-09 02:05:48 +0200 |
commit | b6d3e2c360cac5c73ad310f0049c22968f7b0385 (patch) | |
tree | 17fa3ebb6d1a05c809a4aa177e27314742255066 | |
parent | 2dda5d835afc1ece6ec0b4b728911ca375f0d308 (diff) |
[VAMOS] struct gsm_bts_trx: fix the PHY instance pointer
First of all, there is no reason to use a void pointer because
it's always 'struct phy_instance'. Also, no need to encapsulate
this pointer into 'role_bts' because there are no other roles in
osmo-bts (we used to have shared headers years ago).
This commit also fixes a bug in test_sysmobts_auto_band(), where a
pointer to 'struct femtol1_hdl' was directly assigned to trx.pinst.
Change-Id: I9bd6f0921e0c6bf824d38485486ad78864cbe17e
-rw-r--r-- | include/osmo-bts/bts_trx.h | 5 | ||||
-rw-r--r-- | include/osmo-bts/phy_link.h | 2 | ||||
-rw-r--r-- | src/common/main.c | 2 | ||||
-rw-r--r-- | src/common/phy_link.c | 6 | ||||
-rw-r--r-- | src/common/vty.c | 2 | ||||
-rw-r--r-- | src/osmo-bts-trx/l1_if.h | 3 | ||||
-rw-r--r-- | src/osmo-bts-trx/scheduler_trx.c | 4 | ||||
-rw-r--r-- | tests/sysmobts/sysmobts_test.c | 5 |
8 files changed, 15 insertions, 14 deletions
diff --git a/include/osmo-bts/bts_trx.h b/include/osmo-bts/bts_trx.h index 7d60a736..100eabac 100644 --- a/include/osmo-bts/bts_trx.h +++ b/include/osmo-bts/bts_trx.h @@ -36,9 +36,8 @@ struct gsm_bts_trx { struct gsm_power_ctrl_params *ms_dpc_params; /* MS Dynamic Power Control */ bool ms_pwr_ctl_soft; /* is power control loop done by osmocom software? */ - struct { - void *l1h; - } role_bts; + /* The associated PHY instance */ + struct phy_instance *pinst; struct gsm_bts_trx_ts ts[TRX_NR_TS]; }; diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h index 0c693bb8..467ad529 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -173,7 +173,7 @@ const char *phy_instance_name(struct phy_instance *pinst); static inline struct phy_instance *trx_phy_instance(const struct gsm_bts_trx *trx) { OSMO_ASSERT(trx); - return trx->role_bts.l1h; + return trx->pinst; } int bts_model_phy_link_open(struct phy_link *plink); diff --git a/src/common/main.c b/src/common/main.c index 25033525..73efc255 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -341,7 +341,7 @@ int bts_main(int argc, char **argv) } llist_for_each_entry(trx, &g_bts->trx_list, list) { - if (!trx->role_bts.l1h) { + if (!trx->pinst) { fprintf(stderr, "TRX %u has no associated PHY instance\n", trx->nr); exit(1); diff --git a/src/common/phy_link.c b/src/common/phy_link.c index 77d7aa62..411f8702 100644 --- a/src/common/phy_link.c +++ b/src/common/phy_link.c @@ -118,7 +118,7 @@ struct phy_instance *phy_instance_create(struct phy_link *plink, int num) void phy_instance_link_to_trx(struct phy_instance *pinst, struct gsm_bts_trx *trx) { - trx->role_bts.l1h = pinst; + trx->pinst = pinst; pinst->trx = trx; } @@ -128,8 +128,8 @@ void phy_instance_destroy(struct phy_instance *pinst) llist_del(&pinst->list); /* remove reverse link from TRX */ - OSMO_ASSERT(pinst->trx->role_bts.l1h == pinst); - pinst->trx->role_bts.l1h = NULL; + OSMO_ASSERT(pinst->trx->pinst == pinst); + pinst->trx->pinst = NULL; pinst->trx = NULL; talloc_free(pinst); diff --git a/src/common/vty.c b/src/common/vty.c index 9e428e7d..3b593168 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -987,7 +987,7 @@ DEFUN(cfg_trx_phy, cfg_trx_phy_cmd, return CMD_WARNING; } - trx->role_bts.l1h = pinst; + trx->pinst = pinst; pinst->trx = trx; return CMD_SUCCESS; diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h index 112a6abb..491f7cd7 100644 --- a/src/osmo-bts-trx/l1_if.h +++ b/src/osmo-bts-trx/l1_if.h @@ -138,8 +138,7 @@ enum gsm_phys_chan_config transceiver_chan_type_2_pchan(uint8_t type); static inline struct l1sched_trx *trx_l1sched_hdl(struct gsm_bts_trx *trx) { - struct phy_instance *pinst = trx->role_bts.l1h; - struct trx_l1h *l1h = pinst->u.osmotrx.hdl; + struct trx_l1h *l1h = trx->pinst->u.osmotrx.hdl; return &l1h->l1s; } diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index efd49543..c173f5b2 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -73,13 +73,13 @@ static struct phy_instance *dlfh_route_br(const struct trx_dl_burst_req *br, /* Check the "cache" first, so we eliminate frequent lookups */ idx = gsm0502_hop_seq_gen(&time, SCHED_FH_PARAMS_VALS(ts), NULL); if (ts->fh_trx_list[idx] != NULL) - return ts->fh_trx_list[idx]->role_bts.l1h; + return ts->fh_trx_list[idx]->pinst; /* The "cache" may not be filled yet, lookup the transceiver */ llist_for_each_entry(trx, &ts->trx->bts->trx_list, list) { if (trx->arfcn == ts->hopping.arfcn_list[idx]) { ts->fh_trx_list[idx] = trx; - return trx->role_bts.l1h; + return trx->pinst; } } diff --git a/tests/sysmobts/sysmobts_test.c b/tests/sysmobts/sysmobts_test.c index 4b01ed7a..d1e9e69f 100644 --- a/tests/sysmobts/sysmobts_test.c +++ b/tests/sysmobts/sysmobts_test.c @@ -52,14 +52,17 @@ static void test_sysmobts_auto_band(void) { struct gsm_bts bts; struct gsm_bts_trx trx; + struct phy_instance pinst; struct femtol1_hdl hdl; int i; memset(&bts, 0, sizeof(bts)); memset(&trx, 0, sizeof(trx)); + memset(&pinst, 0, sizeof(pinst)); memset(&hdl, 0, sizeof(hdl)); trx.bts = &bts; - trx.role_bts.l1h = &hdl; + trx.pinst = &pinst; + trx.pinst->u.sysmobts.hdl = &hdl; /* claim to support all hw_info's */ hdl.hw_info.band_support = GSM_BAND_850 | GSM_BAND_900 | |