fixeria submitted this change.
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
Related: OS#4505
---
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, 97 insertions(+), 1 deletion(-)
diff --git a/include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h b/include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h
index dd97a0a..9f51efd 100644
--- a/include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h
+++ b/include/osmocom/bsc/bts_ipaccess_nanobts_omlattr.h
@@ -23,12 +23,19 @@
#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;
+
+int ipacc_parse_supp_features(const struct gsm_bts *bts,
+ const struct abis_om_fom_hdr *foh,
+ const uint8_t *data, uint16_t data_len);
+
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 aa6a3a5..1b544fe 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
@@ -560,7 +561,6 @@
return ari + num_unreported + 1; /* we have to account for 1st byte with number of unreported attributes */
}
-
/* Parse Attribute Response Info content for 3GPP TS 52.021 ยง9.4.30 Manufacturer Id */
static void parse_osmo_bts_features(struct gsm_bts *bts,
const uint8_t *data, uint16_t data_len)
@@ -618,6 +618,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)) {
+ ipacc_parse_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..c65b701 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
@@ -26,6 +26,73 @@
#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 },
+ }
+};
+
+static inline uint32_t ipacc_parse_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_DEBUG, foh, "%s '%s' is supported\n", text, vs->str);
+ }
+
+ return u32;
+}
+
+/* Parse ip.access Supported Features IE */
+int ipacc_parse_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)
+ ipacc_parse_supp_flags(foh, abis_nm_ipacc_freq_band_desc, e, "Freq. band");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_CIPH_ALGOS)) != NULL)
+ ipacc_parse_supp_flags(foh, abis_nm_ipacc_ciph_algo_desc, e, "Ciphering algorithm");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_CHAN_TYPES)) != NULL)
+ ipacc_parse_supp_flags(foh, abis_nm_ipacc_chant_desc, e, "Channel type");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_CHAN_MODES)) != NULL)
+ ipacc_parse_supp_flags(foh, abis_nm_ipacc_chanm_desc, e, "Channel mode");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_GPRS_CODING)) != NULL)
+ ipacc_parse_supp_flags(foh, abis_nm_ipacc_gprs_coding_desc, e, "GPRS Coding Scheme");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_RTP_FEATURES)) != NULL)
+ ipacc_parse_supp_flags(foh, abis_nm_ipacc_rtp_feat_desc, e, "RTP Feature");
+ if ((e = TLVP_GET(&tp, NM_IPAC_EIE_RSL_FEATURES)) != NULL)
+ ipacc_parse_supp_flags(foh, abis_nm_ipacc_rsl_feat_desc, e, "RSL Feature");
+ if (TLVP_PRES_LEN(&tp, NM_IPAC_EIE_MAX_TA, 1)) {
+ uint8_t u8 = *TLVP_VAL(&tp, NM_IPAC_EIE_MAX_TA);
+ LOGPFOH(DNM, LOGL_DEBUG, foh, "Max Timing Advance %u\n", u8);
+ }
+
+ return 0;
+}
+
/* 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.