Review at https://gerrit.osmocom.org/2783
Get TRX attributes Request per-TRX attributes in addition to BTS attributes. Change-Id: I2b61131b9930afd03357c0b66947ee856d58cc46 Related: OS#1614 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/abis_nm.c M openbsc/src/libbsc/bsc_init.c M openbsc/src/libcommon/gsm_data_shared.c 4 files changed, 29 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/83/2783/1 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 3371fb9..4661830 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -512,6 +512,7 @@ enum bts_attribute { BTS_TYPE_VARIANT, BTS_SUB_MODEL, + TRX_PHY_VERSION, }; struct vty; diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index ec1e478..abacc1d 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -455,15 +455,15 @@ } /* Handle 3GPP TS 52.021 §9.4.64 Get Attribute Response Info */ -static int abis_nm_rx_get_attr_resp(struct msgb *mb, struct gsm_bts *bts) +static int abis_nm_rx_get_attr_resp(struct msgb *mb, struct gsm_bts *bts, uint8_t trx_num) { struct abis_om_hdr *oh = msgb_l2(mb); struct abis_om_fom_hdr *foh = msgb_l3(mb); struct e1inp_sign_link *sign_link = mb->dst; struct tlv_parsed tp; - const uint8_t *ari; - uint8_t unreported, i; - uint16_t ari_len; + const uint8_t *ari, *power; + uint8_t unreported, i, adjust = 0; + uint16_t ari_len, sw_len; int rc; struct abis_nm_sw_desc sw_descr[MAX_BTS_ATTR]; @@ -480,6 +480,7 @@ ari = TLVP_VAL(&tp, NM_ATT_GET_ARI); ari_len = TLVP_LEN(&tp, NM_ATT_GET_ARI); + /* Attributes Response Info has peculiar structure - first the number of unreported attributes */ unreported = ari[0]; DEBUGP(DNM, "Found Get Attributes Response Info: %u bytes total with %u unreported attributes\n", @@ -490,9 +491,20 @@ LOGP(DNM, LOGL_ERROR, "Attribute %s is unreported\n", /* +1 because we have to account for number of */ get_value_string(abis_nm_att_names, ari[i + 1])); /* unreported attributes, prefixing the list. */ - /* after that there's finally list of replies in form of sw-conf structure: - it starts right after the list of unreported attributes + space for length of that list */ - rc = abis_nm_get_sw_conf(ari + unreported + 1, ari_len - (unreported + 2), &sw_descr[0], ARRAY_SIZE(sw_descr)); + /* the data starts right after the list of unreported attributes + space for length of that list */ + sw_len = ari_len - (unreported + 2); + /* let's try to parse it again to check for 3GPP TS 52.021 §9.4.28 Manufacturer Dependent State presence */ + abis_nm_tlv_parse(&tp, sign_link->trx->bts, ari + unreported + 1, sw_len); + if (TLVP_PRESENT(&tp, NM_ATT_MANUF_STATE)) { + power = TLVP_VAL(&tp, NM_ATT_MANUF_STATE); + LOGP(DNM, LOGL_INFO, "Get Attributes Response: BTS%u/TRX%u nominal power is %u\n", + bts->nr, trx_num, *power); + adjust = 2; /* adjust for already parsed TV struct */ + sw_len -= adjust; + } + + /* after that there's finally list of replies in form of sw-conf structure */ + rc = abis_nm_get_sw_conf(ari + unreported + 1 + adjust, sw_len, &sw_descr[0], ARRAY_SIZE(sw_descr)); if (rc > 0) { for (i = 0; i < rc; i++) { if (!handle_attr(bts, str2btsattr((const char *)sw_descr[i].file_id), sw_descr[i].file_version, @@ -720,7 +732,7 @@ case NM_MT_SET_BTS_ATTR_ACK: break; case NM_MT_GET_ATTR_RESP: - ret = abis_nm_rx_get_attr_resp(mb, bts); + ret = abis_nm_rx_get_attr_resp(mb, bts, (foh)->obj_inst.trx_nr); break; default: abis_nm_debugp_foh(DNM, foh); diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 520b2e2..78c00ef 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -316,7 +316,7 @@ struct input_signal_data *isd = signal_data; struct gsm_bts_trx *trx = isd->trx; int ts_no, lchan_no; - const uint8_t attr[] = { NM_ATT_SW_CONFIG, }; + const uint8_t attr[] = { NM_ATT_SW_CONFIG, NM_ATT_MANUF_STATE, }; /* we should not request more attributes than we're ready to handle */ OSMO_ASSERT(sizeof(attr) < MAX_BTS_ATTR); @@ -339,14 +339,17 @@ set bts->si_common.cell_alloc */ generate_cell_chan_list(ca, trx->bts); + /* Request generic BTS-level attributes: note the -1 to skip the last attribute in the list */ + abis_nm_get_attr(trx->bts, NM_OC_BTS, trx->bts->nr, trx->nr, 0xFF, attr, sizeof(attr) - 1); + llist_for_each_entry(cur_trx, &trx->bts->trx_list, list) { int i; - + /* Request TRX-level attributes */ + abis_nm_get_attr(cur_trx->bts, NM_OC_BASEB_TRANSC, cur_trx->bts->nr, cur_trx->nr, 0xFF, + attr, sizeof(attr)); for (i = 0; i < ARRAY_SIZE(cur_trx->ts); i++) generate_ma_for_ts(&cur_trx->ts[i]); } - - abis_nm_get_attr(trx->bts, NM_OC_BTS, trx->bts->nr, trx->nr, 0xFF, attr, sizeof(attr)); } if (isd->link_type == E1INP_SIGN_RSL) bootstrap_rsl(trx); diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index f404363..ab64d05 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -54,6 +54,7 @@ const struct value_string bts_attribute_names[] = { OSMO_VALUE_STRING(BTS_TYPE_VARIANT), OSMO_VALUE_STRING(BTS_SUB_MODEL), + OSMO_VALUE_STRING(TRX_PHY_VERSION), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/2783 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2b61131b9930afd03357c0b66947ee856d58cc46 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max <msur...@sysmocom.de>