fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/34354?usp=email )


Change subject: nm_{bb_transc,bts}_fsm: rework sending of Get Attributes
......................................................................

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
---
M src/osmo-bsc/nm_bb_transc_fsm.c
M src/osmo-bsc/nm_bts_fsm.c
2 files changed, 36 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/54/34354/1

diff --git a/src/osmo-bsc/nm_bb_transc_fsm.c b/src/osmo-bsc/nm_bb_transc_fsm.c
index c70904b..4b5e2b2 100644
--- a/src/osmo-bsc/nm_bb_transc_fsm.c
+++ b/src/osmo-bsc/nm_bb_transc_fsm.c
@@ -111,13 +111,18 @@

        /* 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 e601e18..a9b6604 100644
--- a/src/osmo-bsc/nm_bts_fsm.c
+++ b/src/osmo-bsc/nm_bts_fsm.c
@@ -98,13 +98,18 @@

        /* 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 &&

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/34354?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ice5bddd51481a3ef9fcffd77a4c292ea211bf179
Gerrit-Change-Number: 34354
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to