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/.
dexter gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/906 octphy: Fixed OML ADM state handling bts_model_chg_adm_state() is accepting all state changes blindly, this patch adds a proper state handling Change-Id: I034114beca95210169429d8ac1eb8648df12fc6c --- M src/osmo-bts-octphy/l1_oml.c 1 file changed, 79 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/06/906/1 diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index 7735261..f8c5ac9 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -50,6 +50,8 @@ #include <octphy/octvc1/gsm/octvc1_gsm_id.h> #include <octphy/octvc1/main/octvc1_main_default.h> +int trx_locked = 0; + /* Map OSMOCOM logical channel type to OctPHY Logical channel type */ static tOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM pchan_to_logChComb[_GSM_PCHAN_MAX] = { @@ -1349,7 +1351,14 @@ oc->Config.usBcchArfcn = trx->bts->c0->arfcn; oc->RfConfig.ulRxGainDb = plink->u.octphy.rx_gain_db; /* FIXME: compute this based on nominal transmit power, etc. */ - oc->RfConfig.ulTxAttndB = plink->u.octphy.tx_atten_db; + if(plink->u.octphy.tx_atten_flag == 1) { + oc->RfConfig.ulTxAttndB = plink->u.octphy.tx_atten_db; + } + else { + /* Take the Tx Attn received in set radio attribures + * x4 is for the value in db */ + oc->RfConfig.ulTxAttndB = (trx->max_power_red) << 2; + } LOGP(DL1C, LOGL_INFO, "Tx TRX-OPEN.req(trx=%u, rf_port=%u, arfcn=%u, " "tsc=%u, rx_gain=%u, tx_atten=%u)\n", @@ -1502,10 +1511,75 @@ int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj, uint8_t adm_state) { - /* TODO: implement this properly */ - /* blindly accept all state changes */ - mo->nm_state.administrative = adm_state; - return oml_mo_statechg_ack(mo); + int rc; + int granted = 0; + + struct gsm_bts_trx *trx; + struct phy_instance *pinst; + struct octphy_hdl *fl1h; + + switch (mo->obj_class) { + case NM_OC_RADIO_CARRIER: + + trx = ((struct gsm_bts_trx *)obj); + pinst = trx_phy_instance(trx); + fl1h = pinst->phy_link->u.octphy.hdl; + + if (mo->procedure_pending) { + LOGP(DL1C, LOGL_ERROR, "Discarding adm change command: " + "pending procedure on RC %d\n", trx->nr); + return 0; + } + mo->procedure_pending = 1; + switch (adm_state) { + case NM_STATE_LOCKED: + + trx_locked = 1; + + /* Stop heartbeat check */ + osmo_timer_del(&fl1h->alive_timer); + + bts_model_trx_deact_rf(trx); + + /* Close TRX */ + rc = bts_model_trx_close(trx); + if (rc != 0) { + LOGP(DL1C, LOGL_ERROR, + "TRX already closed..!\n\n"); + } + granted = 1; + break; + + case NM_STATE_UNLOCKED: + + if (trx_locked) { + trx_locked = 0; + l1if_activate_rf(trx, 1); + } + + granted = 1; + break; + + default: + granted = 1; + break; + } + + mo->procedure_pending = 0; + break; + + default: + /* blindly accept all state changes */ + granted = 1; + break; + } + + if (granted) { + mo->nm_state.administrative = adm_state; + return oml_mo_statechg_ack(mo); + } else + return oml_mo_statechg_nack(mo, NM_NACK_REQ_NOT_GRANT); + } int bts_model_trx_deact_rf(struct gsm_bts_trx *trx) -- To view, visit https://gerrit.osmocom.org/906 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I034114beca95210169429d8ac1eb8648df12fc6c Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter <pmaier at sysmocom.de>