[PATCH] osmo-bts[master]: let osmo-bts log a special notice if OML connection is close...

2018-05-08 Thread Stefan Sperling
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/8056

to look at the new patch set (#2).

let osmo-bts log a special notice if OML connection is closed early

A frequent configuration file error is that the unit_id settings of
osmo-bts and osmo-bsc don't match. The BSC already prints an error
in this case. Let the BTS print an error as well.

We use a heuristic for this purpose: If the OML link is dropped within
10 seconds after being established, log a special warning which alerts
the user and recommend a manual configuration file check.

Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47
Related: OS#3143
---
M include/osmo-bts/gsm_data_shared.h
M src/common/abis.c
2 files changed, 23 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/56/8056/2

diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 812d086..81cac3e 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -514,6 +514,10 @@
uint8_t initial_mcs;
 };
 
+/* The amount of time within which a sudden disconnect of a newly established
+ * OML connection will cause a special warning to be logged. */
+#define OSMO_BTS_OML_CONN_EARLY_DISCONNECT 10   /* in seconds */
+
 /* One BTS */
 struct gsm_bts {
/* list header in net->bts_list */
@@ -552,6 +556,7 @@
/* how do we talk OML with this TRX? */
uint8_t oml_tei;
struct e1inp_sign_link *oml_link;
+   struct timespec oml_conn_established_timestamp;
 
/* Abis network management O handle */
struct abis_nm_h *nmh;
diff --git a/src/common/abis.c b/src/common/abis.c
index 6aa2f1d..301be53 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -108,6 +109,9 @@
sign_link = g_bts->oml_link =
e1inp_sign_link_create(>ts[E1INP_SIGN_OML-1],
E1INP_SIGN_OML, NULL, 255, 0);
+   if (clock_gettime(CLOCK_MONOTONIC, 
_bts->oml_conn_established_timestamp) != 0)
+   memset(_bts->oml_conn_established_timestamp, 0,
+  sizeof(g_bts->oml_conn_established_timestamp));
drain_oml_queue(g_bts);
sign_link->trx = g_bts->c0;
bts_link_estab(g_bts);
@@ -140,9 +144,22 @@
LOGP(DABIS, LOGL_ERROR, "Signalling link down\n");
 
/* First remove the OML signalling link */
-   if (g_bts->oml_link)
+   if (g_bts->oml_link) {
+   struct timespec now;
+
e1inp_sign_link_destroy(g_bts->oml_link);
+
+   /* Log a special notice if the OML connection was dropped 
relatively quickly. */
+   if (g_bts->oml_conn_established_timestamp.tv_sec != 0 && 
clock_gettime(CLOCK_MONOTONIC, ) == 0 &&
+   g_bts->oml_conn_established_timestamp.tv_sec + 
OSMO_BTS_OML_CONN_EARLY_DISCONNECT >= now.tv_sec) {
+   LOGP(DABIS, LOGL_NOTICE, "OML link was closed early 
within %" PRIu64 " seconds. "
+   "If this situation persists, please check your BTS and 
BSC configuration files for errors. "
+   "A common error is a mismatch between unit_id 
configuration parameters of BTS and BSC.\n",
+   (uint64_t)(now.tv_sec - 
g_bts->oml_conn_established_timestamp.tv_sec));
+   }
+   }
g_bts->oml_link = NULL;
+   memset(_bts->oml_conn_established_timestamp, 0, 
sizeof(g_bts->oml_conn_established_timestamp));
 
/* Then iterate over the RSL signalling links */
llist_for_each_entry(trx, _bts->trx_list, list) {

-- 
To view, visit https://gerrit.osmocom.org/8056
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 


[PATCH] osmo-bts[master]: let osmo-bts log a special notice if OML connection is close...

2018-05-07 Thread Stefan Sperling

Review at  https://gerrit.osmocom.org/8056

let osmo-bts log a special notice if OML connection is closed early

A frequent configuration file error is that the unit_id settings of
osmo-bts and osmo-bsc don't match. The BSC already prints an error
in this case. Let the BTS print an error as well.

We use a heuristic for this purpose: If the OML link is dropped within
10 seconds after being established, log a special warning which alerts
the user and recommend a manual configuration file check.

Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47
Related: OS#3143
---
M include/osmo-bts/gsm_data_shared.h
M src/common/abis.c
2 files changed, 23 insertions(+), 1 deletion(-)


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

diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 812d086..6a1613b 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -514,6 +514,10 @@
uint8_t initial_mcs;
 };
 
+/* The amount of time within which a sudden disconnect of a newly established
+ * OML connection will cause a special warning to be logged. */
+#define OSMO_BTS_OML_CONN_EARLY_DISCONNECT 10   /* in seconds */
+
 /* One BTS */
 struct gsm_bts {
/* list header in net->bts_list */
@@ -552,6 +556,7 @@
/* how do we talk OML with this TRX? */
uint8_t oml_tei;
struct e1inp_sign_link *oml_link;
+   struct timeval oml_conn_established_timestamp;
 
/* Abis network management O handle */
struct abis_nm_h *nmh;
diff --git a/src/common/abis.c b/src/common/abis.c
index 6aa2f1d..6c303b9 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -108,6 +109,9 @@
sign_link = g_bts->oml_link =
e1inp_sign_link_create(>ts[E1INP_SIGN_OML-1],
E1INP_SIGN_OML, NULL, 255, 0);
+   if (osmo_gettimeofday(_bts->oml_conn_established_timestamp, 
NULL) != 0)
+   memset(_bts->oml_conn_established_timestamp, 0,
+  sizeof(g_bts->oml_conn_established_timestamp));
drain_oml_queue(g_bts);
sign_link->trx = g_bts->c0;
bts_link_estab(g_bts);
@@ -140,9 +144,22 @@
LOGP(DABIS, LOGL_ERROR, "Signalling link down\n");
 
/* First remove the OML signalling link */
-   if (g_bts->oml_link)
+   if (g_bts->oml_link) {
+   struct timeval now;
+
e1inp_sign_link_destroy(g_bts->oml_link);
+
+   /* Log a special notice if the OML connection was dropped 
relatively quickly. */
+   if (g_bts->oml_conn_established_timestamp.tv_sec != 0 && 
osmo_gettimeofday(, NULL) == 0 &&
+   g_bts->oml_conn_established_timestamp.tv_sec + 
OSMO_BTS_OML_CONN_EARLY_DISCONNECT >= now.tv_sec) {
+   LOGP(DABIS, LOGL_NOTICE, "OML link was closed early 
within %" PRIu64 " seconds. "
+   "If this situation persists, please check your BTS and 
BSC configuration files for errors. "
+   "A common error is a mismatch between unit_id 
configuration parameters of BTS and BSC.\n",
+   (uint64_t)(now.tv_sec - 
g_bts->oml_conn_established_timestamp.tv_sec));
+   }
+   }
g_bts->oml_link = NULL;
+   memset(_bts->oml_conn_established_timestamp, 0, 
sizeof(g_bts->oml_conn_established_timestamp));
 
/* Then iterate over the RSL signalling links */
llist_for_each_entry(trx, _bts->trx_list, list) {

-- 
To view, visit https://gerrit.osmocom.org/8056
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling