dexter has uploaded this change for review. ( https://gerrit.osmocom.org/13269


Change subject: oml: Use oml_tx_failure_event_rep() instead of signals to 
SS_FAIL
......................................................................

oml: Use oml_tx_failure_event_rep() instead of signals to SS_FAIL

At some locations in the code a signal to SS_FAIL is dispatched in order
to trigger the sending of an OML failure event report in oml.c. This is
a bit overcomplicated for the task. Lets use oml_tx_failure_event_rep()
to send the failure event reports and lets remove the signal handler for
SS_FAIL.

Change-Id: Ie4fce1273a19cc14f37ff6fc7582b2945c7e7c47
Related: OS#3843
---
M include/osmo-bts/signal.h
M src/common/bts_ctrl_commands.c
M src/common/oml.c
M src/common/pcu_sock.c
4 files changed, 10 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/69/13269/1

diff --git a/include/osmo-bts/signal.h b/include/osmo-bts/signal.h
index 01d4099..c8168a2 100644
--- a/include/osmo-bts/signal.h
+++ b/include/osmo-bts/signal.h
@@ -5,7 +5,6 @@

 enum sig_subsys {
        SS_GLOBAL,
-       SS_FAIL,
 };

 enum signals_global {
diff --git a/src/common/bts_ctrl_commands.c b/src/common/bts_ctrl_commands.c
index 4efb4ee..47d8a5d 100644
--- a/src/common/bts_ctrl_commands.c
+++ b/src/common/bts_ctrl_commands.c
@@ -34,6 +34,8 @@
 #include <osmo-bts/oml.h>
 #include <osmo-bts/bts.h>

+static struct gsm_bts *g_bts;
+
 CTRL_CMD_DEFINE(therm_att, "thermal-attenuation");
 static int get_therm_att(struct ctrl_cmd *cmd, void *data)
 {
@@ -75,7 +77,7 @@
 static int set_oml_alert(struct ctrl_cmd *cmd, void *data)
 {
        /* Note: we expect signal dispatch to be synchronous */
-       osmo_signal_dispatch(SS_FAIL, OSMO_EVT_EXT_ALARM, cmd->value);
+       oml_tx_failure_event_rep(&g_bts->mo, OSMO_EVT_EXT_ALARM, cmd->value);

        cmd->reply = "OK";

@@ -88,6 +90,7 @@

        rc |= ctrl_cmd_install(CTRL_NODE_TRX, &cmd_therm_att);
        rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_oml_alert);
+       g_bts = bts;

        return rc;
 }
diff --git a/src/common/oml.c b/src/common/oml.c
index 7ff5967..c96a893 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1493,23 +1493,11 @@
        return ret;
 }

-static int handle_fail_sig(unsigned int subsys, unsigned int signal, void 
*handle,
-                          void *signal_data)
-{
-       if (signal_data)
-               oml_tx_failure_event_rep(handle, signal, "%s", signal_data);
-       else
-               oml_tx_failure_event_rep(handle, signal, "");
-
-       return 0;
-}
-
 int oml_init(struct gsm_abis_mo *mo)
 {
        DEBUGP(DOML, "Initializing OML attribute definitions\n");
        tlv_def_patch(&abis_nm_att_tlvdef_ipa_local, &abis_nm_att_tlvdef_ipa);
        tlv_def_patch(&abis_nm_att_tlvdef_ipa_local, &abis_nm_att_tlvdef);
-       osmo_signal_register_handler(SS_FAIL, handle_fail_sig, mo);

        return 0;
 }
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 64ec714..1414874 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -43,6 +43,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);

@@ -577,7 +578,7 @@
        case PCU_VERSION:
                LOGP(DPCU, LOGL_INFO, "OsmoPCU version %s connected\n",
                     txt->text);
-               osmo_signal_dispatch(SS_FAIL, OSMO_EVT_PCU_VERS, txt->text);
+               oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_PCU_VERS, 
txt->text);
                osmo_strlcpy(bts->pcu_version, txt->text, MAX_VERSION_LENGTH);

                if (GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_13))
@@ -586,7 +587,7 @@
                LOGP(DPCU, LOGL_INFO, "SI13 is not available on PCU 
connection\n");
                break;
        case PCU_OML_ALERT:
-               osmo_signal_dispatch(SS_FAIL, OSMO_EVT_EXT_ALARM, txt->text);
+               oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_EXT_ALARM, 
txt->text);
                break;
        default:
                LOGP(DPCU, LOGL_ERROR, "Unknown TXT_IND type %u received\n",
@@ -713,7 +714,9 @@
        bts = llist_entry(state->net->bts_list.next, struct gsm_bts, list);

        LOGP(DPCU, LOGL_NOTICE, "PCU socket has LOST connection\n");
-       osmo_signal_dispatch(SS_FAIL, OSMO_EVT_PCU_VERS, NULL);
+       oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_PCU_VERS,
+                                "PCU socket has LOST connection");
+
        bts->pcu_version[0] = '\0';

        close(bfd->fd);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4fce1273a19cc14f37ff6fc7582b2945c7e7c47
Gerrit-Change-Number: 13269
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>

Reply via email to