This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/17588 ) Change subject: abis_nm: move fail report parsing to extra func ...................................................................... abis_nm: move fail report parsing to extra func Separate raw input parsing from handling the failure report. A follow-up patch will use the new parsing function to print saved failure reports to the VTY. Related: OS#1605 Change-Id: Ia51004faf620aa4d40435d58c70d758c9d0054d8 --- M include/osmocom/bsc/abis_nm.h M src/osmo-bsc/abis_nm.c 2 files changed, 59 insertions(+), 40 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/88/17588/1 diff --git a/include/osmocom/bsc/abis_nm.h b/include/osmocom/bsc/abis_nm.h index 45bbe2c..83bc2f8 100644 --- a/include/osmocom/bsc/abis_nm.h +++ b/include/osmocom/bsc/abis_nm.h @@ -27,6 +27,7 @@ #include <osmocom/gsm/protocol/gsm_12_21.h> #include <osmocom/bsc/gsm_data.h> +#include <osmocom/bsc/signal.h> /* max number of attributes represented as 3GPP TS 52.021 §9.4.62 SW Description array */ #define MAX_BTS_ATTR 5 @@ -170,6 +171,8 @@ int abis_nm_select_newest_sw(const struct abis_nm_sw_desc *sw, const size_t len); +struct nm_fail_rep_signal_data *abis_nm_fail_evt_rep_parse(struct msgb *mb, struct gsm_bts *bts); + /* Helper functions for updating attributes */ int abis_nm_update_max_power_red(struct gsm_bts_trx *trx); diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c index 2d181e8..01249b4 100644 --- a/src/osmo-bsc/abis_nm.c +++ b/src/osmo-bsc/abis_nm.c @@ -353,38 +353,72 @@ }; } -static int rx_fail_evt_rep(struct msgb *mb, struct gsm_bts *bts) +/* Parse into newly allocated struct abis_nm_fail_evt_rep, caller must free it. */ +struct nm_fail_rep_signal_data *abis_nm_fail_evt_rep_parse(struct msgb *mb, struct gsm_bts *bts) { 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 nm_fail_rep_signal_data sd; - struct tlv_parsed tp; - int rc = 0; + struct nm_fail_rep_signal_data *sd; + struct tlv_parsed *tp; const uint8_t *p_val = NULL; char *p_text = NULL; const char *e_type = NULL, *severity = NULL; - abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, - oh->length-sizeof(*foh)); + sd = talloc_zero(tall_bsc_ctx, struct nm_fail_rep_signal_data); + OSMO_ASSERT(sd); + tp = talloc(sd, struct tlv_parsed); + OSMO_ASSERT(tp); - if (TLVP_PRESENT(&tp, NM_ATT_ADD_TEXT)) { - const uint8_t *val = TLVP_VAL(&tp, NM_ATT_ADD_TEXT); - p_text = talloc_strndup(tall_bsc_ctx, (const char *) val, - TLVP_LEN(&tp, NM_ATT_ADD_TEXT)); + abis_nm_tlv_parse(tp, bts, foh->data, oh->length-sizeof(*foh)); + + if (TLVP_PRESENT(tp, NM_ATT_ADD_TEXT)) { + const uint8_t *val = TLVP_VAL(tp, NM_ATT_ADD_TEXT); + p_text = talloc_strndup(sd, (const char *) val, TLVP_LEN(tp, NM_ATT_ADD_TEXT)); } - if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE)) - e_type = abis_nm_event_type_name(*TLVP_VAL(&tp, - NM_ATT_EVENT_TYPE)); + if (TLVP_PRESENT(tp, NM_ATT_EVENT_TYPE)) + e_type = abis_nm_event_type_name(*TLVP_VAL(tp, NM_ATT_EVENT_TYPE)); - if (TLVP_PRESENT(&tp, NM_ATT_SEVERITY)) - severity = abis_nm_severity_name(*TLVP_VAL(&tp, - NM_ATT_SEVERITY)); + if (TLVP_PRESENT(tp, NM_ATT_SEVERITY)) + severity = abis_nm_severity_name(*TLVP_VAL(tp, NM_ATT_SEVERITY)); - if (TLVP_PRESENT(&tp, NM_ATT_PROB_CAUSE)) { - p_val = TLVP_VAL(&tp, NM_ATT_PROB_CAUSE); + if (TLVP_PRESENT(tp, NM_ATT_PROB_CAUSE)) + p_val = TLVP_VAL(tp, NM_ATT_PROB_CAUSE); + sd->bts = bts; + sd->msg = mb; + sd->tp = tp; + if (e_type) + sd->parsed.event_type = e_type; + else + sd->parsed.event_type = "<none>"; + if (severity) + sd->parsed.severity = severity; + else + sd->parsed.severity = "<none>"; + if (p_text) + sd->parsed.additional_text = p_text; + else + sd->parsed.additional_text = "<none>"; + sd->parsed.probable_cause = p_val; + + return sd; +} + +static int rx_fail_evt_rep(struct msgb *mb, struct gsm_bts *bts) +{ + struct nm_fail_rep_signal_data *sd; + int rc = 0; + const uint8_t *p_val; + const char *e_type, *severity, *p_text; + + sd = abis_nm_fail_evt_rep_parse(mb, bts); + e_type = sd->parsed.event_type; + severity = sd->parsed.severity; + p_text = sd->parsed.additional_text; + p_val = sd->parsed.probable_cause; + + if (p_val) { switch (p_val[0]) { case NM_PCAUSE_T_MANUF: handle_manufact_report(bts, p_val, e_type, severity, @@ -394,32 +428,14 @@ log_oml_fail_rep(bts, e_type, severity, p_val, p_text); }; } else { + struct abis_om_fom_hdr *foh = msgb_l3(mb); LOGPFOH(DNM, LOGL_ERROR, foh, "BTS%u: Failure Event Report without " "Probable Cause?!\n", bts->nr); rc = -EINVAL; } - sd.bts = bts; - sd.msg = mb; - sd.tp = &tp; - if (e_type) - sd.parsed.event_type = e_type; - else - sd.parsed.event_type = "<none>"; - if (severity) - sd.parsed.severity = severity; - else - sd.parsed.severity = "<none>"; - if (p_text) - sd.parsed.additional_text = p_text; - else - sd.parsed.additional_text = "<none>"; - sd.parsed.probable_cause = p_val; - osmo_signal_dispatch(SS_NM, S_NM_FAIL_REP, &sd); - - if (p_text) - talloc_free(p_text); - + osmo_signal_dispatch(SS_NM, S_NM_FAIL_REP, sd); + talloc_free(sd); return rc; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/17588 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ia51004faf620aa4d40435d58c70d758c9d0054d8 Gerrit-Change-Number: 17588 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200324/528f199b/attachment.htm>