This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgHello fixeria, I'd like you to do a code review. Please visit https://gerrit.osmocom.org/c/osmo-bts/+/24310 to review the following change. Change subject: struct gsm_bts_trx: fix the PHY instance pointer ...................................................................... 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 --- M include/osmo-bts/bts_trx.h M include/osmo-bts/phy_link.h M src/common/main.c M src/common/phy_link.c M src/common/vty.c M src/osmo-bts-trx/l1_if.h M src/osmo-bts-trx/scheduler_trx.c M tests/sysmobts/sysmobts_test.c 8 files changed, 15 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/10/24310/1 diff --git a/include/osmo-bts/bts_trx.h b/include/osmo-bts/bts_trx.h index 4474903..24de77b 100644 --- a/include/osmo-bts/bts_trx.h +++ b/include/osmo-bts/bts_trx.h @@ -36,9 +36,8 @@ 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; union { struct { diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h index 0c693bb..467ad52 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -173,7 +173,7 @@ 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 2503352..73efc25 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -341,7 +341,7 @@ } 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 77d7aa6..411f870 100644 --- a/src/common/phy_link.c +++ b/src/common/phy_link.c @@ -118,7 +118,7 @@ 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 @@ 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 626cd60..01b3dcc 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -987,7 +987,7 @@ 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 112a6ab..491f7cd 100644 --- a/src/osmo-bts-trx/l1_if.h +++ b/src/osmo-bts-trx/l1_if.h @@ -138,8 +138,7 @@ 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 efd4954..c173f5b 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -73,13 +73,13 @@ /* 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 4b01ed7..d1e9e69 100644 --- a/tests/sysmobts/sysmobts_test.c +++ b/tests/sysmobts/sysmobts_test.c @@ -52,14 +52,17 @@ { 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 | -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/24310 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: 2021q1 Gerrit-Change-Id: I9bd6f0921e0c6bf824d38485486ad78864cbe17e Gerrit-Change-Number: 24310 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith at sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210520/14326041/attachment.htm>