fixeria has uploaded this change for review.
abis_nm: parse feature flags in NM_ATT_IPACC_SUPP_FEATURES
Since change [1], among with the other attributes we started requesting
NM_ATT_IPACC_SUPP_FEATURES from the BTS. This patch adds the logic for
parsing the response (so far only printing supported features).
Change-Id: I64cffa0bdead3617cc169c83b0f6ddf74f0866a7
Related: [1] 43440e1fc5758c52e80a0d182afa7c9d16b21426
Depends: libosmocore.git Ia4208e10d61843dd6ae77398f6624c918dc81ea4
---
M include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h
M src/osmo-bsc/abis_nm.c
M src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
3 files changed, 89 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/23/34323/1
diff --git a/include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h b/include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h
index dd97a0a..23d5a2e 100644
--- a/include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h
+++ b/include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h
@@ -23,12 +23,15 @@
#include <stdint.h>
#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
struct gsm_bts_sm;
struct gsm_bts;
struct gsm_bts_trx;
struct gsm_gprs_nsvc;
+extern const struct tlv_definition ipacc_eie_tlv_def;
+
struct msgb *nanobts_gen_set_bts_attr(struct gsm_bts *bts);
struct msgb *nanobts_gen_set_nse_attr(struct gsm_bts_sm *bts_sm);
struct msgb *nanobts_gen_set_cell_attr(struct gsm_bts *bts);
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index 2f49424..1434e9c 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -52,6 +52,7 @@
#include <osmocom/bsc/nm_common_fsm.h>
#include <osmocom/gsm/bts_features.h>
#include <osmocom/bsc/ipaccess.h>
+#include <osmocom/bsc/bts_ipaccess_nanobts_omlattr.h>
#define OM_ALLOC_SIZE 1024
#define OM_HEADROOM_SIZE 128
@@ -600,6 +601,56 @@
}
}
+static inline uint32_t parse_ipacc_supp_flags(const struct abis_om_fom_hdr *foh,
+ const struct value_string *flags,
+ const struct tlv_p_entry *e,
+ const char *text)
+{
+ uint32_t u32 = 0;
+
+ for (unsigned int i = 0; i < OSMO_MAX(e->len, 4); i++)
+ u32 |= e->val[i] << (i * 8);
+ for (const struct value_string *vs = flags; vs->value && vs->str; vs++) {
+ if (u32 & vs->value)
+ LOGPFOH(DNM, LOGL_ERROR, foh, "%s '%s' is supported\n", text, vs->str);
+ }
+
+ return u32;
+}
+
+/* Parse ip.access Supported Features IE */
+static int parse_ipacc_supp_features(const struct gsm_bts *bts,
+ const struct abis_om_fom_hdr *foh,
+ const uint8_t *data, uint16_t data_len)
+{
+ const struct tlv_p_entry *e;
+ struct tlv_parsed tp;
+
+ if (tlv_parse(&tp, &ipacc_eie_tlv_def, data, data_len, 0, 0) < 0) {
+ LOGPFOH(DNM, LOGL_ERROR, foh, "%s(): tlv_parse failed\n", __func__);
+ return -EINVAL;
+ }
+
+ /* TODO: store the flags in the respective MO state */
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_FREQ_BANDS)) != NULL)
+ parse_ipacc_supp_flags(foh, abis_nm_ipacc_freq_band_desc, e, "Freq. band");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_CIPH_ALGOS)) != NULL)
+ parse_ipacc_supp_flags(foh, abis_nm_ipacc_freq_band_desc, e, "Ciphering algorithm");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_CHAN_TYPES)) != NULL)
+ parse_ipacc_supp_flags(foh, abis_nm_ipacc_chant_desc, e, "Channel type");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_CHAN_MODES)) != NULL)
+ parse_ipacc_supp_flags(foh, abis_nm_ipacc_chanm_desc, e, "Channel mode");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_GPRS_CODING)) != NULL)
+ parse_ipacc_supp_flags(foh, abis_nm_ipacc_gprs_coding_desc, e, "GPRS Coding Scheme");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_RTP_FEATURES)) != NULL)
+ parse_ipacc_supp_flags(foh, abis_nm_ipacc_rtp_feat_desc, e, "RTP Feature");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_RSL_FEATURES)) != NULL)
+ parse_ipacc_supp_flags(foh, abis_nm_ipacc_rsl_feat_desc, e, "RSL Feature");
+ /* TODO: parse NM_IPAC_EIE_MAX_TA */
+
+ return 0;
+}
+
/* Handle 3GPP TS 52.021 ยง8.11.3 Get Attribute Response (with nanoBTS specific attribute formatting) */
static int parse_attr_resp_info_attr(struct gsm_bts *bts, const struct gsm_bts_trx *trx, struct abis_om_fom_hdr *foh, struct tlv_parsed *tp)
{
@@ -618,6 +669,12 @@
parse_osmo_bts_features(bts, TLVP_VAL(tp, NM_ATT_MANUF_ID),
TLVP_LEN(tp, NM_ATT_MANUF_ID));
}
+ /* fall-through */
+ case GSM_BTS_TYPE_NANOBTS:
+ if (TLVP_PRESENT(tp, NM_ATT_IPACC_SUPP_FEATURES)) {
+ parse_ipacc_supp_features(bts, foh, TLVP_VAL(tp, NM_ATT_IPACC_SUPP_FEATURES),
+ TLVP_LEN(tp, NM_ATT_IPACC_SUPP_FEATURES));
+ }
break;
default:
break;
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
index d78f23b..167383d 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
@@ -26,6 +26,20 @@
#include <osmocom/bsc/bts.h>
#include <osmocom/gsm/bts_features.h>
+const struct tlv_definition ipacc_eie_tlv_def = {
+ .def = {
+ /* TODO: add more values from enum ipac_eie */
+ [NM_IPAC_EIE_FREQ_BANDS] = { TLV_TYPE_TL16V },
+ [NM_IPAC_EIE_MAX_TA] = { TLV_TYPE_TL16V },
+ [NM_IPAC_EIE_CIPH_ALGOS] = { TLV_TYPE_TL16V },
+ [NM_IPAC_EIE_CHAN_TYPES] = { TLV_TYPE_TL16V },
+ [NM_IPAC_EIE_CHAN_MODES] = { TLV_TYPE_TL16V },
+ [NM_IPAC_EIE_GPRS_CODING] = { TLV_TYPE_TL16V },
+ [NM_IPAC_EIE_RTP_FEATURES] = { TLV_TYPE_TL16V },
+ [NM_IPAC_EIE_RSL_FEATURES] = { TLV_TYPE_TL16V },
+ }
+};
+
/* 3GPP TS 52.021 section 8.6.1 Set BTS Attributes */
struct msgb *nanobts_gen_set_bts_attr(struct gsm_bts *bts)
{
To view, visit change 34323. To unsubscribe, or for help writing mail filters, visit settings.