laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/35560?usp=email )
(
3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Indicate remote alarm bit as remote alarm inidication ......................................................................
Indicate remote alarm bit as remote alarm inidication
The flag that stores the current alarm is not cleared periodically. Instead it is cleared when the alarm ceases.
Change-Id: Id6cd193c71330c350c27e02b3a692d2c7e0b3fbe --- M src/intf_line.c M src/mux_demux.c 2 files changed, 27 insertions(+), 4 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified tnt: Looks good to me, but someone else must approve
diff --git a/src/intf_line.c b/src/intf_line.c index f41214e..4433e96 100644 --- a/src/intf_line.c +++ b/src/intf_line.c @@ -239,7 +239,7 @@ }
line->ts0.prev_errmask = line->ts0.cur_errmask; - line->ts0.cur_errmask = 0; + line->ts0.cur_errmask &= ~E1L_TS0_RX_CRC4_ERR; osmo_timer_schedule(&line->ts0.timer, 1, 0); }
diff --git a/src/mux_demux.c b/src/mux_demux.c index cd5c286..abe01a3 100644 --- a/src/mux_demux.c +++ b/src/mux_demux.c @@ -36,6 +36,7 @@ #include <osmocom/core/stats.h> #include <osmocom/core/rate_ctr.h> #include <osmocom/e1d/proto.h> +#include <osmocom/e1d/proto_srv.h>
#include "e1d.h" #include "log.h" @@ -380,8 +381,18 @@ /* A bit is present in each odd frame */ if (frame_nr % 2) { if (frame[0] & 0x20) { - line->ts0.cur_errmask |= E1L_TS0_RX_ALARM; - line_ctr_add(line, LINE_CTR_RX_REMOTE_A, 1); + if (!(line->ts0.cur_errmask & E1L_TS0_RX_ALARM)) { + line->ts0.cur_errmask |= E1L_TS0_RX_ALARM; + line_ctr_add(line, LINE_CTR_RX_REMOTE_A, 1); + osmo_e1dp_server_event(line->intf->e1d->srv, E1DP_EVT_RAI_ON, + line->intf->id, line->id, 0, NULL, 0); + } + } else { + if ((line->ts0.cur_errmask & E1L_TS0_RX_ALARM)) { + line->ts0.cur_errmask &= ~E1L_TS0_RX_ALARM; + osmo_e1dp_server_event(line->intf->e1d->srv, E1DP_EVT_RAI_OFF, + line->intf->id, line->id, 0, NULL, 0); + } } }
@@ -395,7 +406,7 @@ line_ctr_add(line, LINE_CTR_RX_REMOTE_E, 1); } } - /* cur_errmask is being cleared once per second via line->ts0.timer */ + /* CRC error in cur_errmask is being cleared once per second via line->ts0.timer */ } }