Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11680


Change subject: abis_nm: Allow sending and receiving Get Attributes (Response) 
against nanoBTS
......................................................................

abis_nm: Allow sending and receiving Get Attributes (Response) against nanoBTS

* Allow sending Get Attributes message in abis_nm_get_attr.
* Move code handling Get Attribute Response Info part to its own
function.
* Don't try to decode Get Attribute Response Info for nanoBTS, since it
uses a different formatting.

Related: OS#3624
Change-Id: I53d01e73791cf5450aa34b1ac8f051730e3a70f9
---
M src/osmo-bsc/abis_nm.c
1 file changed, 24 insertions(+), 12 deletions(-)



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

diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index f75470d..eb4bb3f 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -528,29 +528,21 @@
 }

 /* Handle 3GPP TS 52.021 §9.4.64 Get Attribute Response Info */
-static int abis_nm_rx_get_attr_resp(struct msgb *mb, const struct gsm_bts_trx 
*trx)
+static int parse_attr_resp_info(struct gsm_bts *bts, const struct gsm_bts_trx 
*trx, struct abis_om_fom_hdr *foh, struct tlv_parsed *tp)
 {
-       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 gsm_bts *bts = trx ? trx->bts : sign_link->trx->bts;
-       struct tlv_parsed tp;
        const uint8_t *data;
        int i;
        uint16_t data_len;
        int rc;
        struct abis_nm_sw_desc sw_descr[MAX_BTS_ATTR];

-       DEBUGPFOH(DNM, foh, "Get Attributes Response for BTS%u\n", bts->nr);
-
-       abis_nm_tlv_parse(&tp, bts, foh->data, oh->length-sizeof(*foh));
-       if (!TLVP_PRES_LEN(&tp, NM_ATT_GET_ARI, 1)) {
+       if (!TLVP_PRES_LEN(tp, NM_ATT_GET_ARI, 1)) {
                LOGPFOH(DNM, LOGL_ERROR, foh, "BTS%u: Get Attr Response without 
Response Info?!\n",
                        bts->nr);
                return -EINVAL;
        }

-       data = parse_attr_resp_info_unreported(bts->nr, TLVP_VAL(&tp, 
NM_ATT_GET_ARI), TLVP_LEN(&tp, NM_ATT_GET_ARI),
+       data = parse_attr_resp_info_unreported(bts->nr, TLVP_VAL(tp, 
NM_ATT_GET_ARI), TLVP_LEN(tp, NM_ATT_GET_ARI),
                                               &data_len);

        data = parse_attr_resp_info_manuf_state(trx, data, &data_len);
@@ -570,6 +562,26 @@
                LOGPFOH(DNM, LOGL_ERROR, foh, "BTS%u: failed to parse SW-Config 
part of "
                        "Get Attribute Response Info: %s\n", bts->nr, 
strerror(-rc));
        }
+       return 0;
+}
+
+/* Handle 3GPP TS 52.021 §8.11.3 Get Attribute Response */
+static int abis_nm_rx_get_attr_resp(struct msgb *mb, const struct gsm_bts_trx 
*trx)
+{
+       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 gsm_bts *bts = trx ? trx->bts : sign_link->trx->bts;
+       struct tlv_parsed tp;
+
+       DEBUGPFOH(DNM, foh, "Get Attributes Response for BTS%u\n", bts->nr);
+
+       abis_nm_tlv_parse(&tp, bts, foh->data, oh->length-sizeof(*foh));
+
+       /* nanoBTS doesn't send Get Attribute Response Info, uses its own 
format */
+       if (bts->type != GSM_BTS_TYPE_NANOBTS)
+               parse_attr_resp_info(bts, trx, foh, &tp);
+

        return 0;
 }
@@ -1646,7 +1658,7 @@
        struct abis_om_hdr *oh;
        struct msgb *msg;

-       if (bts->type != GSM_BTS_TYPE_OSMOBTS) {
+       if (bts->type != GSM_BTS_TYPE_OSMOBTS && bts->type != 
GSM_BTS_TYPE_NANOBTS) {
                LOGPC(DNM, LOGL_NOTICE, "Getting attributes from BTS%d type %s 
is not supported.\n",
                      bts->nr, btstype2str(bts->type));
                return -EINVAL;

--
To view, visit https://gerrit.osmocom.org/11680
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I53d01e73791cf5450aa34b1ac8f051730e3a70f9
Gerrit-Change-Number: 11680
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <[email protected]>

Reply via email to