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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26704 )
Change subject: e1d: Add watchdog timer to detect dead lines / USB devices
......................................................................
e1d: Add watchdog timer to detect dead lines / USB devices
We just found a bug in icE1usb (likely firmware) which was hard to find
as there was zero notification from osmo-e1d that it actually never
received any data from the icE1usb hardware/firmware anymore.
Change-Id: Id22e4110b9067f50b1818eb12295b2d4eb9cdc12
---
M src/e1d.h
M src/intf_line.c
M src/mux_demux.c
3 files changed, 29 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
tnt: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/e1d.h b/src/e1d.h
index af6c09e..618776d 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -123,6 +123,12 @@
struct osmo_timer_list timer;
} ts0;
+ /* watchdog timer to catch situations where no more USB data is received */
+ struct {
+ struct osmo_timer_list timer;
+ uint32_t rx_bytes;
+ } watchdog;
+
void *e1gen_priv;
};
diff --git a/src/intf_line.c b/src/intf_line.c
index 5143e45..5659129 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -35,6 +35,7 @@
#include <osmocom/core/utils.h>
#include <osmocom/core/stats.h>
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/timer.h>
#include <osmocom/e1d/proto.h>
#include "e1d.h"
@@ -64,6 +65,20 @@
.ctr_desc = line_ctr_description,
};
+/* watchdog timer, called once per second to check if we still receive data on the line */
+static void line_watchdog_cb(void *data)
+{
+ struct e1_line *line = data;
+
+ if (line->watchdog.rx_bytes < 240000) {
+ LOGPLI(line, DE1D, LOGL_ERROR, "Received Only %u bytes/s (expected: 262144): Line dead?\n",
+ line->watchdog.rx_bytes);
+ }
+
+ line->watchdog.rx_bytes = 0;
+ osmo_timer_schedule(&line->watchdog.timer, 1, 0);
+}
+
// ---------------------------------------------------------------------------
// e1d structures
// ---------------------------------------------------------------------------
@@ -196,6 +211,10 @@
llist_add_tail(&line->list, &intf->lines);
+ /* start watchdog timer */
+ osmo_timer_setup(&line->watchdog.timer, line_watchdog_cb, line);
+ osmo_timer_schedule(&line->watchdog.timer, 1, 0);
+
LOGPLI(line, DE1D, LOGL_NOTICE, "Created\n");
return line;
@@ -206,6 +225,8 @@
{
LOGPLI(line, DE1D, LOGL_NOTICE, "Destroying\n");
+ osmo_timer_del(&line->watchdog.timer);
+
/* close all [peer] file descriptors */
for (int i=0; i<32; i++)
e1_ts_stop(&line->ts[i]);
diff --git a/src/mux_demux.c b/src/mux_demux.c
index 341256a..b0a9cf2 100644
--- a/src/mux_demux.c
+++ b/src/mux_demux.c
@@ -391,6 +391,8 @@
return -1;
}
+ line->watchdog.rx_bytes += size;
+
ftr = size / 32;
OSMO_ASSERT(size % 32 == 0);
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26704
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: Id22e4110b9067f50b1818eb12295b2d4eb9cdc12
Gerrit-Change-Number: 26704
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20220101/ae712231/attachment.htm>