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 uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/21808 )
Change subject: Evaluate received E and A bits in TS0
......................................................................
Evaluate received E and A bits in TS0
Related: OS#4917
Change-Id: I7e1c919518b3418e973b7ae5bedd5a6dd1c2adec
---
M src/e1d.h
M src/intf_line.c
M src/mux_demux.c
M src/usb.c
M src/vpair.c
M src/vty.c
6 files changed, 71 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/08/21808/1
diff --git a/src/e1d.h b/src/e1d.h
index 9848df4..3b43d13 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -42,6 +42,8 @@
LINE_CTR_CRC_ERR,
LINE_CTR_RX_OVFL,
LINE_CTR_TX_UNFL,
+ LINE_CTR_RX_REMOTE_E,
+ LINE_CTR_RX_REMOTE_A,
};
enum e1_ts_mode {
@@ -103,6 +105,13 @@
struct e1_ts ts[32];
/* superchannel */
struct e1_ts superchan;
+
+ struct {
+ /*! buffer where we aggregate the E bits each multi-frame */
+ uint8_t e_bits;
+ bool rx_crc4_err;
+ bool rx_alarm;
+ } ts0;
};
enum e1_driver {
@@ -160,7 +169,7 @@
e1_line_mux_out(struct e1_line *line, uint8_t *buf, int fts);
int
-e1_line_demux_in(struct e1_line *line, const uint8_t *buf, int size);
+e1_line_demux_in(struct e1_line *line, const uint8_t *buf, int size, uint8_t frame_base);
void
e1_ts_stop(struct e1_ts *ts);
diff --git a/src/intf_line.c b/src/intf_line.c
index ccd7645..9863dc0 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -52,6 +52,8 @@
[LINE_CTR_CRC_ERR] = { "rx:crc_errors", "E1 Rx CRC Errors" },
[LINE_CTR_RX_OVFL] = { "rx:overflow", "E1 Rx Overflow" },
[LINE_CTR_TX_UNFL] = { "tx:underflow", "E1 Tx Underflow" },
+ [LINE_CTR_RX_REMOTE_E] ={ "rx:remote_crc_errors", "Rx Frames reporting remote CRC Error"},
+ [LINE_CTR_RX_REMOTE_A] ={ "rx:remote_alarm", "Rx frames reporting Remote Alarm"},
};
static const struct rate_ctr_group_desc line_ctrg_desc = {
diff --git a/src/mux_demux.c b/src/mux_demux.c
index ed7bf3b..896b4a5 100644
--- a/src/mux_demux.c
+++ b/src/mux_demux.c
@@ -348,13 +348,61 @@
return 0;
}
+static void _e1_line_set_rx_alarm(struct e1_line *line, bool rx_alarm)
+{
+ if (rx_alarm)
+ line_ctr_add(line, LINE_CTR_RX_REMOTE_A, 1);
+
+ if (rx_alarm != line->ts0.rx_alarm) {
+ LOGPLI(line, DE1D, LOGL_NOTICE, "Remote ALARM condition %s\n",
+ rx_alarm ? "STARTED" : "CEASED");
+ line->ts0.rx_alarm = rx_alarm;
+ }
+}
+
+static void _e1_line_set_rx_crc4_err(struct e1_line *line, uint8_t e_bits)
+{
+ bool crc4_err = e_bits != 3;
+
+ if (crc4_err != line->ts0.rx_crc4_err) {
+ line_ctr_add(line, LINE_CTR_RX_REMOTE_E, 1);
+ LOGPLI(line, DE1D, LOGL_NOTICE, "Remote CRC4 Error report %s\n",
+ crc4_err ? "STARTED" : "CEASED");
+ line->ts0.rx_crc4_err = crc4_err;
+ }
+}
+
+static void
+_e1_line_demux_in_ts0(struct e1_line *line, const uint8_t *buf, int ftr, uint8_t frame_base)
+{
+ int i;
+
+ for (i = 0; i < ftr; i++) {
+ const uint8_t *frame = buf + i*32;
+ uint8_t frame_nr = frame_base + i;
+
+ /* A bit is present in each odd frame */
+ if (frame_nr % 2)
+ _e1_line_set_rx_alarm(line, frame[0] & 0x20);
+
+ /* E bits are present in frame 13 + 15 */
+ if (frame_nr == 13)
+ line->ts0.e_bits = frame[0] & 0x80 ? 2 : 0;
+ if (frame_nr == 15) {
+ line->ts0.e_bits |= frame[0] & 0x80 ? 1 : 0;
+ _e1_line_set_rx_crc4_err(line, line->ts0.e_bits);
+ }
+ }
+}
+
/*! de-multiplex E1 line data to the individual timeslots.
* \param[in] line E1 line on which we operate.
* \param[in] buf buffer containing multiplexed frame-aligned E1 data.
* \param[in] size size of 'buf' in octets; assumed to be multiple of E1 frame size (32).
+ * \param[in] frame_base frae number (in multiframe) of first frame in 'buf'
* \returns 0 on success; negative on error */
int
-e1_line_demux_in(struct e1_line *line, const uint8_t *buf, int size)
+e1_line_demux_in(struct e1_line *line, const uint8_t *buf, int size, uint8_t frame_base)
{
int ftr;
@@ -366,6 +414,8 @@
ftr = size / 32;
OSMO_ASSERT(size % 32 == 0);
+ _e1_line_demux_in_ts0(line, buf, ftr, frame_base);
+
switch (line->mode) {
case E1_LINE_MODE_CHANNELIZED:
return _e1_line_demux_in_channelized(line, buf, ftr);
diff --git a/src/usb.c b/src/usb.c
index f8903cf..3ca9801 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -118,7 +118,7 @@
{
if (size == 0)
return 0;
- return e1_line_demux_in(flow->line, buf + 4, size - 4);
+ return e1_line_demux_in(flow->line, buf + 4, size - 4, buf[3]);
}
static int
diff --git a/src/vpair.c b/src/vpair.c
index df14026..8484be0 100644
--- a/src/vpair.c
+++ b/src/vpair.c
@@ -132,14 +132,14 @@
rc = e1_line_mux_out(line, buf, frames_expired);
OSMO_ASSERT(rc >= 0);
/* write data to peer */
- rc = e1_line_demux_in(peer, buf, rc);
+ rc = e1_line_demux_in(peer, buf, rc, 0);
OSMO_ASSERT(rc >= 0);
/* generate data on peer line */
rc = e1_line_mux_out(peer, buf, frames_expired);
OSMO_ASSERT(rc >= 0);
/* write data to current line */
- rc = e1_line_demux_in(line, buf, rc);
+ rc = e1_line_demux_in(line, buf, rc, 0);
OSMO_ASSERT(rc >= 0);
}
diff --git a/src/vty.c b/src/vty.c
index 97e3115..f90c3e2 100644
--- a/src/vty.c
+++ b/src/vty.c
@@ -109,8 +109,11 @@
{
int tn;
- vty_out(vty, "Interface #%u, Line #%u, Mode %s:%s", line->intf->id, line->id,
- get_value_string(e1_line_mode_names, line->mode), VTY_NEWLINE);
+ vty_out(vty, "Interface #%u, Line #%u, Mode %s%s%s:%s", line->intf->id, line->id,
+ get_value_string(e1_line_mode_names, line->mode),
+ line->ts0.rx_alarm ? " [REMOTE-ALARM]" : "",
+ line->ts0.rx_crc4_err ? " [REMOTE-CRC-ERROR]" : "",
+ VTY_NEWLINE);
for (tn = 0; tn < ARRAY_SIZE(line->ts); tn++) {
const struct e1_ts *ts = &line->ts[tn];
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/21808
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I7e1c919518b3418e973b7ae5bedd5a6dd1c2adec
Gerrit-Change-Number: 21808
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201219/62ea5af4/attachment.htm>