aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-09-08 02:25:29 +0700
committerfixeria <vyanitskiy@sysmocom.de>2023-09-13 10:40:45 +0000
commit9e1b54254c505f8ce54e623d06ce2da900b16494 (patch)
treede8b42f820b43cff6ab5f007ce2cb95bd14ed360
parent9ac3459a000e5c2ce9b56786bec5c7748a371462 (diff)
nm_{bb_transc,bts}_fsm: rework sending of Get Attributes
* Make it easier to append the attributes conditionally. * Remove irrelevant comments about the order of attributes. * Request NM_ATT_IPACC_SUPP_FEATURES from Abis/IP models only. Change-Id: Ice5bddd51481a3ef9fcffd77a4c292ea211bf179 Related: OS#4505
-rw-r--r--src/osmo-bsc/nm_bb_transc_fsm.c17
-rw-r--r--src/osmo-bsc/nm_bts_fsm.c17
2 files changed, 22 insertions, 12 deletions
diff --git a/src/osmo-bsc/nm_bb_transc_fsm.c b/src/osmo-bsc/nm_bb_transc_fsm.c
index c70904ba1..4b5e2b24d 100644
--- a/src/osmo-bsc/nm_bb_transc_fsm.c
+++ b/src/osmo-bsc/nm_bb_transc_fsm.c
@@ -111,13 +111,18 @@ static void configure_loop(struct gsm_bts_bb_trx *bb_transc, const struct gsm_nm
/* Request TRX-level attributes */
if (!bb_transc->mo.get_attr_sent && !bb_transc->mo.get_attr_rep_received) {
- bb_transc->mo.get_attr_sent = true;
- /* N. B: we rely on attribute order when parsing response in abis_nm_rx_get_attr_resp() */
- const uint8_t trx_attr[] = { NM_ATT_MANUF_STATE, NM_ATT_SW_CONFIG, NM_ATT_IPACC_SUPP_FEATURES };
- /* we should not request more attributes than we're ready to handle */
- OSMO_ASSERT(sizeof(trx_attr) < MAX_BTS_ATTR);
+ uint8_t attr_buf[MAX_BTS_ATTR];
+ uint8_t *ptr = &attr_buf[0];
+
+ *(ptr++) = NM_ATT_MANUF_STATE;
+ *(ptr++) = NM_ATT_SW_CONFIG;
+ if (is_ipa_abisip_bts(trx->bts))
+ *(ptr++) = NM_ATT_IPACC_SUPP_FEATURES;
+
+ OSMO_ASSERT((ptr - attr_buf) <= sizeof(attr_buf));
abis_nm_get_attr(trx->bts, NM_OC_BASEB_TRANSC, 0, trx->nr, 0xff,
- trx_attr, sizeof(trx_attr));
+ &attr_buf[0], (ptr - attr_buf));
+ bb_transc->mo.get_attr_sent = true;
}
if (bb_transc->mo.get_attr_rep_received &&
diff --git a/src/osmo-bsc/nm_bts_fsm.c b/src/osmo-bsc/nm_bts_fsm.c
index e601e1841..a9b6604b5 100644
--- a/src/osmo-bsc/nm_bts_fsm.c
+++ b/src/osmo-bsc/nm_bts_fsm.c
@@ -98,13 +98,18 @@ static void configure_loop(struct gsm_bts *bts, const struct gsm_nm_state *state
/* Request generic BTS-level attributes */
if (!bts->mo.get_attr_sent && !bts->mo.get_attr_rep_received) {
- bts->mo.get_attr_sent = true;
- /* N. B: we rely on attribute order when parsing response in abis_nm_rx_get_attr_resp() */
- const uint8_t bts_attr[] = { NM_ATT_MANUF_ID, NM_ATT_SW_CONFIG, NM_ATT_IPACC_SUPP_FEATURES};
- /* we should not request more attributes than we're ready to handle */
- OSMO_ASSERT(sizeof(bts_attr) < MAX_BTS_ATTR);
+ uint8_t attr_buf[MAX_BTS_ATTR];
+ uint8_t *ptr = &attr_buf[0];
+
+ *(ptr++) = NM_ATT_MANUF_ID;
+ *(ptr++) = NM_ATT_SW_CONFIG;
+ if (is_ipa_abisip_bts(bts))
+ *(ptr++) = NM_ATT_IPACC_SUPP_FEATURES;
+
+ OSMO_ASSERT((ptr - attr_buf) <= sizeof(attr_buf));
abis_nm_get_attr(bts, NM_OC_BTS, 0, 0xff, 0xff,
- bts_attr, sizeof(bts_attr));
+ &attr_buf[0], (ptr - attr_buf));
+ bts->mo.get_attr_sent = true;
}
if (bts->mo.get_attr_rep_received &&