aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMinh-Quang Nguyen <minh-quang.nguyen@nutaq.com>2016-06-10 11:07:16 -0400
committerMinh-Quang Nguyen <minh-quang.nguyen@nutaq.com>2016-06-10 11:07:16 -0400
commit5ec217da048344f54c0aef911939e2356bec3fee (patch)
treee5ec59291d953163c5c91b882214e5f793fba87c
parent58a4e449f749afdcbe2accb0e9bf0987e7eee052 (diff)
LC15: Introduce TS 12.21 8.8.2 Abis/OML failure event report
-rw-r--r--include/osmo-bts/oml.h30
-rw-r--r--include/osmo-bts/pcuif_proto.h12
-rw-r--r--src/common/main.c23
-rw-r--r--src/common/oml.c34
-rw-r--r--src/common/pcu_sock.c39
5 files changed, 135 insertions, 3 deletions
diff --git a/include/osmo-bts/oml.h b/include/osmo-bts/oml.h
index 9f494447..11824373 100644
--- a/include/osmo-bts/oml.h
+++ b/include/osmo-bts/oml.h
@@ -1,11 +1,38 @@
#ifndef _OML_H
#define _OML_H
+#include <osmo-bts/pcuif_proto.h>
struct gsm_bts;
struct gsm_abis_mo;
struct msgb;
struct gsm_lchan;
+struct gsm_failure_evt_rep {
+ uint8_t event_type;
+ uint8_t event_serverity;
+ uint8_t cause_type;
+ uint16_t event_cause;
+ char *add_text;
+};
+
+/* FIXME: can move to libosmocore */
+enum abis_mm_event_causes {
+ /* Critical causes */
+ NM_MM_EVT_CRIT_SW_FATAL = 0x0000,
+ NM_MM_EVT_CRIT_PROC_STOP = 0x0002,
+ NM_MM_EVT_CRIT_RTP_TOUT = 0x032c,
+ NM_MM_EVT_CRIT_BOOT_FAIL = 0x0401,
+ /* Major causes */
+ NM_MM_EVT_MAJ_UKWN_MSG = 0x0002,
+ NM_MM_EVT_MAJ_RSL_FAIL = 0x0309,
+ NM_MM_EVT_MAJ_UNSUP_ATTR = 0x0318,
+ NM_MM_EVT_MAJ_NET_CONGEST = 0x032b,
+ /* Minor causes */
+ NM_MM_EVT_MIN_PAG_TAB_FULL = 0x0401,
+ /* Warning causes */
+ NM_MM_EVT_WARN_SW_WARN = 0x0001,
+
+};
int oml_init(void);
int down_oml(struct gsm_bts *bts, struct msgb *msg);
@@ -42,4 +69,7 @@ int oml_mo_fom_ack_nack(struct gsm_abis_mo *mo, uint8_t orig_msg_type,
int oml_set_lchan_t200(struct gsm_lchan *lchan);
extern const unsigned int oml_default_t200_ms[7];
+/* Transmit failure event report */
+int oml_tx_failure_event_rep(struct gsm_abis_mo *mo, struct gsm_failure_evt_rep failure_evt_rep);
+
#endif // _OML_H */
diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h
index 9d740ac1..75e911b8 100644
--- a/include/osmo-bts/pcuif_proto.h
+++ b/include/osmo-bts/pcuif_proto.h
@@ -14,6 +14,9 @@
#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
+/*alarms & performance counters */
+#define PCU_IF_MSG_FAILURE_EVT_IND 0x67 /* PCU failure event report indication*/
+
/* sapi */
#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
@@ -131,6 +134,14 @@ struct gsm_pcu_if_pag_req {
uint8_t identity_lv[9];
} __attribute__ ((packed));
+struct gsm_pcu_if_fail_evt_ind {
+ uint8_t event_type;
+ uint8_t event_serverity;
+ uint8_t cause_type;
+ uint16_t event_cause;
+ char add_text[100];
+}__attribute__ ((packed));
+
struct gsm_pcu_if {
/* context based information */
uint8_t msg_type; /* message type */
@@ -147,6 +158,7 @@ struct gsm_pcu_if {
struct gsm_pcu_if_act_req act_req;
struct gsm_pcu_if_time_ind time_ind;
struct gsm_pcu_if_pag_req pag_req;
+ struct gsm_pcu_if_fail_evt_ind failure_evt_ind;
} u;
} __attribute__ ((packed));
diff --git a/src/common/main.c b/src/common/main.c
index d19c2840..a0edbff9 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -50,6 +50,7 @@
#include <osmo-bts/bts_model.h>
#include <osmo-bts/pcu_if.h>
#include <osmo-bts/control_if.h>
+#include <osmo-bts/oml.h>
int quit = 0;
static const char *config_file = "osmo-bts.cfg";
@@ -176,18 +177,38 @@ static struct gsm_bts *bts;
static void signal_handler(int signal)
{
+ char log_msg[100];
+ struct gsm_failure_evt_rep failure_rep;
+
fprintf(stderr, "signal %u received\n", signal);
switch (signal) {
case SIGINT:
//osmo_signal_dispatch(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
- if (!quit)
+ if (!quit) {
+ snprintf(log_msg, 100, "BTS: signal SIGINT received -> shutdown\n");
+ failure_rep.event_type = NM_EVT_PROC_FAIL;
+ failure_rep.event_serverity = NM_SEVER_CRITICAL;
+ failure_rep.cause_type = NM_PCAUSE_T_MANUF;
+ failure_rep.event_cause = NM_MM_EVT_CRIT_PROC_STOP;
+ failure_rep.add_text = (char *)&log_msg;
+ oml_tx_failure_event_rep(&bts->mo, failure_rep);
+
bts_shutdown(bts, "SIGINT");
+ }
quit++;
break;
case SIGABRT:
case SIGUSR1:
case SIGUSR2:
+ snprintf(log_msg, 100, "BTS: signal %d received\n", signal);
+ failure_rep.event_type = NM_EVT_PROC_FAIL;
+ failure_rep.event_serverity = NM_SEVER_CRITICAL;
+ failure_rep.cause_type = NM_PCAUSE_T_MANUF;
+ failure_rep.event_cause = NM_MM_EVT_CRIT_PROC_STOP;
+ failure_rep.add_text = (char *)&log_msg;
+ oml_tx_failure_event_rep(&bts->mo, failure_rep);
+
talloc_report_full(tall_bts_ctx, stderr);
break;
default:
diff --git a/src/common/oml.c b/src/common/oml.c
index e7953c9e..2277c377 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -41,6 +41,8 @@
#include <osmo-bts/bts_model.h>
#include <osmo-bts/bts.h>
#include <osmo-bts/signal.h>
+#include <osmo-bts/pcu_if.h>
+#include <osmo-bts/pcuif_proto.h>
/* FIXME: move this to libosmocore */
static struct tlv_definition abis_nm_att_tlvdef_ipa = {
@@ -369,6 +371,38 @@ int oml_mo_tx_sw_act_rep(struct gsm_abis_mo *mo)
return oml_mo_send_msg(mo, nmsg, NM_MT_SW_ACTIVATED_REP);
}
+/* TS 12.21 8.8.2 */
+int oml_tx_failure_event_rep(struct gsm_abis_mo *mo, struct gsm_failure_evt_rep failure_evt_rep)
+{
+ struct msgb *nmsg;
+ uint8_t cause[3];
+ int i, len;
+
+ LOGP(DOML, LOGL_INFO, "%s Tx FAILure EVT REP\n", gsm_abis_mo_name(mo));
+
+ nmsg = oml_msgb_alloc();
+ if (!nmsg)
+ return -ENOMEM;
+
+ msgb_tv_put(nmsg, NM_ATT_EVENT_TYPE, failure_evt_rep.event_type);
+ msgb_tv_put(nmsg, NM_ATT_SEVERITY, failure_evt_rep.event_serverity);
+
+ cause[0] = failure_evt_rep.cause_type;
+ for (i = 0; i < 2 ; i++)
+ cause[i + 1] = ((uint8_t*)&failure_evt_rep.event_cause)[1 - i];
+
+ msgb_tv_fixed_put(nmsg, NM_ATT_PROB_CAUSE, 3, cause);
+
+ len = strlen(failure_evt_rep.add_text);
+ if(len){
+ LOGP(DOML, LOGL_DEBUG, "%s Tx FAILure EVT REP Additional Text = %s (%d)\n", gsm_abis_mo_name(mo), failure_evt_rep.add_text, len);
+ msgb_tl16v_put(nmsg, NM_ATT_ADD_TEXT, len, failure_evt_rep.add_text);
+ }
+
+ return oml_mo_send_msg(mo, nmsg, NM_MT_FAILURE_EVENT_REP);
+
+}
+
/* TS 12.21 9.4.53 */
enum abis_nm_t200_idx {
T200_SDCCH = 0,
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 7c835fb9..77186c0a 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -40,6 +40,7 @@
#include <osmo-bts/rsl.h>
#include <osmo-bts/signal.h>
#include <osmo-bts/l1sap.h>
+#include <osmo-bts/oml.h>
uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx);
@@ -550,11 +551,35 @@ static int pcu_rx_act_req(struct gsm_bts *bts,
return 0;
}
+static int pcu_rx_failure_event_rep(struct gsm_bts *bts, struct gsm_pcu_if_fail_evt_ind *fail_ind)
+{
+ struct gsm_failure_evt_rep failure_rep;
+ int rc;
+
+ LOGP(DPCU, LOGL_DEBUG, "[PCU] Failure EVT REP detailed: evt_type=%02x, evt_serv=%02x, cause_type=%02x, cause_id=%04x, text=%s\n",
+ fail_ind->event_type,
+ fail_ind->event_serverity,
+ fail_ind->cause_type,
+ fail_ind->event_cause,
+ fail_ind->add_text);
+
+ failure_rep.event_type = fail_ind->event_type;
+ failure_rep.event_serverity = fail_ind->event_serverity;
+ failure_rep.cause_type = fail_ind->cause_type;
+ failure_rep.event_cause = fail_ind->event_cause;
+ failure_rep.add_text = &fail_ind->add_text[0];
+
+ rc = oml_tx_failure_event_rep(&bts->gprs.cell.mo, failure_rep);
+ return rc;
+}
+
static int pcu_rx(struct gsm_network *net, uint8_t msg_type,
struct gsm_pcu_if *pcu_prim)
{
int rc = 0;
struct gsm_bts *bts;
+ char log_msg[100];
+ struct gsm_failure_evt_rep failure_rep;
/* FIXME: allow multiple BTS */
bts = llist_entry(net->bts_list.next, struct gsm_bts, list);
@@ -567,9 +592,19 @@ static int pcu_rx(struct gsm_network *net, uint8_t msg_type,
case PCU_IF_MSG_ACT_REQ:
rc = pcu_rx_act_req(bts, &pcu_prim->u.act_req);
break;
+ case PCU_IF_MSG_FAILURE_EVT_IND:
+ rc = pcu_rx_failure_event_rep(bts, &pcu_prim->u.failure_evt_ind);
+ break;
default:
- LOGP(DPCU, LOGL_ERROR, "Received unknwon PCU msg type %d\n",
- msg_type);
+ snprintf(log_msg, 100, "Received unknown PCU msg type %d\n", msg_type);
+ LOGP(DPCU, LOGL_ERROR,"%s", log_msg);
+
+ failure_rep.event_type = NM_EVT_COMM_FAIL;
+ failure_rep.event_serverity = NM_SEVER_MAJOR;
+ failure_rep.cause_type = NM_PCAUSE_T_MANUF;
+ failure_rep.event_cause = NM_MM_EVT_MAJ_UKWN_MSG;
+ failure_rep.add_text = (char *)&log_msg;
+ oml_tx_failure_event_rep(&bts->mo, failure_rep);
rc = -EINVAL;
}