Change in osmo-bts[master]: pcu_sock: separate trx / ts filling from pcu_tx_info_ind()
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/19511 ) Change subject: pcu_sock: separate trx / ts filling from pcu_tx_info_ind() .. pcu_sock: separate trx / ts filling from pcu_tx_info_ind() This would allow to avoid further nasting in 'for' loops. Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b --- M src/common/pcu_sock.c 1 file changed, 35 insertions(+), 26 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index ca8dd15..392900a 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -112,6 +112,39 @@ } } +static void info_ind_fill_trx(struct gsm_pcu_if_info_trx *trx_info, + const struct gsm_bts_trx *trx) +{ + unsigned int tn; + + trx_info->pdch_mask = 0; + trx_info->arfcn = trx->arfcn; + trx_info->hlayer1 = trx_get_hlayer1(trx); + + if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED || + trx->mo.nm_state.administrative != NM_STATE_UNLOCKED) { + LOGPTRX(trx, DPCU, LOGL_INFO, "unavailable for PCU (op=%s adm=%s)\n", + abis_nm_opstate_name(trx->mo.nm_state.operational), + abis_nm_admin_name(trx->mo.nm_state.administrative)); + return; + } + + for (tn = 0; tn < 8; tn++) { + const struct gsm_bts_trx_ts *ts = >ts[tn]; + + if (ts->mo.nm_state.operational != NM_OPSTATE_ENABLED) + continue; + if (!ts_should_be_pdch(ts)) + continue; + + trx_info->pdch_mask |= (1 << tn); + trx_info->tsc[tn] = gsm_ts_tsc(ts); + + LOGP(DPCU, LOGL_INFO, "(trx=%u,ts=%u) PDCH available (tsc=%u arfcn=%u)\n", + trx->nr, ts->nr, trx_info->tsc[tn], trx->arfcn); + } +} + int pcu_tx_info_ind(void) { struct gsm_network *net = _gsmnet; @@ -122,8 +155,7 @@ struct gprs_rlc_cfg *rlcc; struct gsm_bts_gprs_nsvc *nsvc; struct gsm_bts_trx *trx; - struct gsm_bts_trx_ts *ts; - int i, j; + int i; LOGP(DPCU, LOGL_INFO, "Sending info\n"); @@ -223,30 +255,7 @@ continue; } - info_ind->trx[trx->nr].pdch_mask = 0; - info_ind->trx[trx->nr].arfcn = trx->arfcn; - info_ind->trx[trx->nr].hlayer1 = trx_get_hlayer1(trx); - if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED || - trx->mo.nm_state.administrative != NM_STATE_UNLOCKED) { - LOGPTRX(trx, DPCU, LOGL_INFO, "unavailable for PCU (op=%s adm=%s)\n", - abis_nm_opstate_name(trx->mo.nm_state.operational), - abis_nm_admin_name(trx->mo.nm_state.administrative)); - continue; - } - for (j = 0; j < 8; j++) { - ts = >ts[j]; - if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED - && ts_should_be_pdch(ts)) { - info_ind->trx[trx->nr].pdch_mask |= (1 << j); - info_ind->trx[trx->nr].tsc[j] = gsm_ts_tsc(ts); - - LOGP(DPCU, LOGL_INFO, "trx=%d ts=%d: " - "available (tsc=%d arfcn=%d)\n", - trx->nr, ts->nr, - info_ind->trx[trx->nr].tsc[j], - info_ind->trx[trx->nr].arfcn); - } - } + info_ind_fill_trx(_ind->trx[trx->nr], trx); } return pcu_sock_send(net, msg); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/19511 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b Gerrit-Change-Number: 19511 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-MessageType: merged
Change in osmo-bts[master]: pcu_sock: separate trx / ts filling from pcu_tx_info_ind()
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/19511 ) Change subject: pcu_sock: separate trx / ts filling from pcu_tx_info_ind() .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/19511 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b Gerrit-Change-Number: 19511 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Comment-Date: Thu, 06 Aug 2020 16:44:18 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-bts[master]: pcu_sock: separate trx / ts filling from pcu_tx_info_ind()
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/19511 ) Change subject: pcu_sock: separate trx / ts filling from pcu_tx_info_ind() .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/19511 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b Gerrit-Change-Number: 19511 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-Reviewer: laforge Gerrit-Comment-Date: Sun, 02 Aug 2020 20:18:07 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-bts[master]: pcu_sock: separate trx / ts filling from pcu_tx_info_ind()
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/19511 ) Change subject: pcu_sock: separate trx / ts filling from pcu_tx_info_ind() .. pcu_sock: separate trx / ts filling from pcu_tx_info_ind() This would allow to avoid further nasting in 'for' loops. Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b --- M src/common/pcu_sock.c 1 file changed, 35 insertions(+), 26 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/11/19511/1 diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index ca8dd15..392900a 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -112,6 +112,39 @@ } } +static void info_ind_fill_trx(struct gsm_pcu_if_info_trx *trx_info, + const struct gsm_bts_trx *trx) +{ + unsigned int tn; + + trx_info->pdch_mask = 0; + trx_info->arfcn = trx->arfcn; + trx_info->hlayer1 = trx_get_hlayer1(trx); + + if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED || + trx->mo.nm_state.administrative != NM_STATE_UNLOCKED) { + LOGPTRX(trx, DPCU, LOGL_INFO, "unavailable for PCU (op=%s adm=%s)\n", + abis_nm_opstate_name(trx->mo.nm_state.operational), + abis_nm_admin_name(trx->mo.nm_state.administrative)); + return; + } + + for (tn = 0; tn < 8; tn++) { + const struct gsm_bts_trx_ts *ts = >ts[tn]; + + if (ts->mo.nm_state.operational != NM_OPSTATE_ENABLED) + continue; + if (!ts_should_be_pdch(ts)) + continue; + + trx_info->pdch_mask |= (1 << tn); + trx_info->tsc[tn] = gsm_ts_tsc(ts); + + LOGP(DPCU, LOGL_INFO, "(trx=%u,ts=%u) PDCH available (tsc=%u arfcn=%u)\n", + trx->nr, ts->nr, trx_info->tsc[tn], trx->arfcn); + } +} + int pcu_tx_info_ind(void) { struct gsm_network *net = _gsmnet; @@ -122,8 +155,7 @@ struct gprs_rlc_cfg *rlcc; struct gsm_bts_gprs_nsvc *nsvc; struct gsm_bts_trx *trx; - struct gsm_bts_trx_ts *ts; - int i, j; + int i; LOGP(DPCU, LOGL_INFO, "Sending info\n"); @@ -223,30 +255,7 @@ continue; } - info_ind->trx[trx->nr].pdch_mask = 0; - info_ind->trx[trx->nr].arfcn = trx->arfcn; - info_ind->trx[trx->nr].hlayer1 = trx_get_hlayer1(trx); - if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED || - trx->mo.nm_state.administrative != NM_STATE_UNLOCKED) { - LOGPTRX(trx, DPCU, LOGL_INFO, "unavailable for PCU (op=%s adm=%s)\n", - abis_nm_opstate_name(trx->mo.nm_state.operational), - abis_nm_admin_name(trx->mo.nm_state.administrative)); - continue; - } - for (j = 0; j < 8; j++) { - ts = >ts[j]; - if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED - && ts_should_be_pdch(ts)) { - info_ind->trx[trx->nr].pdch_mask |= (1 << j); - info_ind->trx[trx->nr].tsc[j] = gsm_ts_tsc(ts); - - LOGP(DPCU, LOGL_INFO, "trx=%d ts=%d: " - "available (tsc=%d arfcn=%d)\n", - trx->nr, ts->nr, - info_ind->trx[trx->nr].tsc[j], - info_ind->trx[trx->nr].arfcn); - } - } + info_ind_fill_trx(_ind->trx[trx->nr], trx); } return pcu_sock_send(net, msg); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/19511 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b Gerrit-Change-Number: 19511 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-MessageType: newchange