From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:36:07 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:36:07 +0000 Subject: Change in osmo-e1-hardware[master]: icE1usb firmware: Detect A-bit in TS0; set flag in usb xfer hdr References: Message-ID: laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 ) Change subject: icE1usb firmware: Detect A-bit in TS0; set flag in usb xfer hdr ...................................................................... icE1usb firmware: Detect A-bit in TS0; set flag in usb xfer hdr Scan over every odd E1 frame TS0 byte to check if the A-bit is set, indiciating a remote alarm. If so, set a new flag in the USB IN transfer header. Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8 --- M firmware/ice40-riscv/icE1usb/e1.c M firmware/ice40-riscv/icE1usb/usb_e1.c 2 files changed, 25 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/06/26706/1 diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index 5e57480..1955936 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -288,12 +288,16 @@ #include "dma.h" unsigned int -e1_rx_need_data(unsigned int usb_addr, unsigned int max_frames, unsigned int *pos) +e1_rx_need_data(unsigned int usb_addr, unsigned int max_frames, unsigned int *pos, + unsigned int *alarm_cnt) { unsigned int ofs; int tot_frames = 0; int n_frames; + if (alarm_cnt) + *alarm_cnt = 0; + while (max_frames) { /* Get some data from the FIFO */ n_frames = e1f_frame_read(&g_e1.rx.fifo, &ofs, max_frames); @@ -314,6 +318,19 @@ max_frames -= n_frames; tot_frames += n_frames; + /* While DMA is running: Determine if remote end indicates any alarms */ + if (alarm_cnt) { + for (int i = 0; i < n_frames; i++) { + unsigned int frame_nr = ofs + i; + /* A bit is present in every odd frame TS0 */ + if (frame_nr & 1) { + uint8_t ts0 = *e1_data_ptr(0, ofs + i, 0); + if (ts0 & 0x20) + *alarm_cnt++; + } + } + } + /* Wait for DMA completion */ while (dma_poll()); } diff --git a/firmware/ice40-riscv/icE1usb/usb_e1.c b/firmware/ice40-riscv/icE1usb/usb_e1.c index e180fec..b96e761 100644 --- a/firmware/ice40-riscv/icE1usb/usb_e1.c +++ b/firmware/ice40-riscv/icE1usb/usb_e1.c @@ -42,7 +42,8 @@ /* Hack */ -unsigned int e1_rx_need_data(unsigned int usb_addr, unsigned int max_len, unsigned int *pos); +unsigned int e1_rx_need_data(unsigned int usb_addr, unsigned int max_len, unsigned int *pos, + unsigned int *alarm_cnt); unsigned int e1_tx_feed_data(unsigned int usb_addr, unsigned int len); unsigned int e1_tx_level(void); unsigned int e1_rx_level(void); @@ -115,7 +116,7 @@ { uint32_t ptr = usb_ep_regs[2].in.bd[bdi].ptr; uint32_t hdr; - unsigned int pos; + unsigned int pos, alarm_cnt; /* Error check */ if ((usb_ep_regs[2].in.bd[bdi].csr & USB_BD_STATE_MSK) == USB_BD_STATE_DONE_ERR) @@ -133,10 +134,13 @@ else if (!n) break; - n = e1_rx_need_data((ptr >> 2) + 1, n, &pos); + n = e1_rx_need_data((ptr >> 2) + 1, n, &pos, &alarm_cnt); /* Write header: currently version and pos (mfr/fr number) */ hdr = (0 << 28) | (pos & 0xff); + /* indicate at least one remote alarm was reported within the frames of this transfer */ + if (alarm_cnt) + hdr |= (1 << 8); usb_data_write(ptr, &hdr, 4); /* Resubmit */ -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8 Gerrit-Change-Number: 26706 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:38:29 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:38:29 +0000 Subject: Change in osmo-e1d[master]: e1d: reliably detect EOF (HDLC-FCS mode) In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26701 ) Change subject: e1d: reliably detect EOF (HDLC-FCS mode) ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26701 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I0260360643f723f7c721ae67c47dce8df7778694 Gerrit-Change-Number: 26701 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-Comment-Date: Sat, 01 Jan 2022 14:38:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:38:41 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:38:41 +0000 Subject: Change in osmo-e1d[master]: Introduce a #define for the maximum HDLC buffer size (264) In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26702 ) Change subject: Introduce a #define for the maximum HDLC buffer size (264) ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26702 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I9281a4cd85d79823d06860ffaaa09b6d67bc0de3 Gerrit-Change-Number: 26702 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-Comment-Date: Sat, 01 Jan 2022 14:38:41 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:38:59 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:38:59 +0000 Subject: Change in osmo-e1d[master]: e1d-ts-pipe: Don't write more HDLC bytes than e1d supports In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26703 ) Change subject: e1d-ts-pipe: Don't write more HDLC bytes than e1d supports ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26703 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I836d8b98ce5b831b0498c4650263ec3b3d4f2c45 Gerrit-Change-Number: 26703 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-Comment-Date: Sat, 01 Jan 2022 14:38:59 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:21 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:21 +0000 Subject: Change in osmo-e1d[master]: e1d: Add watchdog timer to detect dead lines / USB devices In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26704 ) Change subject: e1d: Add watchdog timer to detect dead lines / USB devices ...................................................................... Patch Set 1: Code-Review+2 -- 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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-Comment-Date: Sat, 01 Jan 2022 14:39:21 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:29 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:29 +0000 Subject: Change in osmo-e1d[master]: update ice1usb_proto.h to current master In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26705 ) Change subject: update ice1usb_proto.h to current master ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26705 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I8f7b9462482421993e3516aa9d0794bb8076b65b Gerrit-Change-Number: 26705 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Comment-Date: Sat, 01 Jan 2022 14:39:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:41 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:41 +0000 Subject: Change in osmo-e1d[master]: e1d: reliably detect EOF in _e1_ts_{read, write} (RAW mode) In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26700 ) Change subject: e1d: reliably detect EOF in _e1_ts_{read,write} (RAW mode) ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26700 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ifb8b91d39b394f9c10c859f3adac85ea47b7653f Gerrit-Change-Number: 26700 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-Comment-Date: Sat, 01 Jan 2022 14:39:41 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:44 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:44 +0000 Subject: Change in osmo-e1d[master]: e1d: reliably detect EOF in _e1_ts_{read, write} (RAW mode) In-Reply-To: References: Message-ID: laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26700 ) Change subject: e1d: reliably detect EOF in _e1_ts_{read,write} (RAW mode) ...................................................................... e1d: reliably detect EOF in _e1_ts_{read,write} (RAW mode) This allows us to reliably detect client disconnection at least in the case of RAW mode channels. Even with this patch applied, e1d still fails to reliably detect client disconnect on HDLC-FCS channels. Change-Id: Ifb8b91d39b394f9c10c859f3adac85ea47b7653f --- M src/mux_demux.c 1 file changed, 2 insertions(+), 2 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/mux_demux.c b/src/mux_demux.c index dffc798..bceeecd 100644 --- a/src/mux_demux.c +++ b/src/mux_demux.c @@ -147,7 +147,7 @@ break; } - if (l < 0 && errno != EAGAIN) { + if ((l < 0 && errno != EAGAIN) || l == 0) { LOGPTS(ts, DE1D, LOGL_ERROR, "dead socket during read: %s\n", strerror(errno)); e1_ts_stop(ts); @@ -293,7 +293,7 @@ break; } - if (rv < 0 && errno != EAGAIN) { + if ((rv < 0 && errno != EAGAIN) || rv == 0) { LOGPTS(ts, DE1D, LOGL_ERROR, "dead socket during write: %s\n", strerror(errno)); e1_ts_stop(ts); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26700 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ifb8b91d39b394f9c10c859f3adac85ea47b7653f Gerrit-Change-Number: 26700 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:44 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:44 +0000 Subject: Change in osmo-e1d[master]: e1d: reliably detect EOF (HDLC-FCS mode) In-Reply-To: References: Message-ID: laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26701 ) Change subject: e1d: reliably detect EOF (HDLC-FCS mode) ...................................................................... e1d: reliably detect EOF (HDLC-FCS mode) This patch makes e1d reliably detect EOF on client sockets while in HDLC-FCS mode. Change-Id: I0260360643f723f7c721ae67c47dce8df7778694 --- M src/mux_demux.c 1 file changed, 2 insertions(+), 2 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/mux_demux.c b/src/mux_demux.c index bceeecd..341256a 100644 --- a/src/mux_demux.c +++ b/src/mux_demux.c @@ -62,7 +62,7 @@ LOGPTS(ts, DXFR, LOGL_DEBUG, "RX Message: %d [ %s]\n", rv, osmo_hexdump(ts->hdlc.rx_buf, rv)); rv = write(ts->fd, ts->hdlc.rx_buf, bytes_to_write); - if (rv < 0) + if (rv <= 0) return rv; } else if (rv < 0 && ts->id == 4) { LOGPTS(ts, DXFR, LOGL_ERROR, "ERR RX: %d %d %d [ %s]\n", @@ -97,7 +97,7 @@ rv, osmo_hexdump(ts->hdlc.tx_buf, rv)); ts->hdlc.tx_len = rv; ts->hdlc.tx_ofs = 0; - } else if (rv < 0 && errno != EAGAIN) + } else if ((rv < 0 && errno != EAGAIN) || rv == 0) return rv; } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26701 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I0260360643f723f7c721ae67c47dce8df7778694 Gerrit-Change-Number: 26701 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:45 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:45 +0000 Subject: Change in osmo-e1d[master]: Introduce a #define for the maximum HDLC buffer size (264) In-Reply-To: References: Message-ID: laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26702 ) Change subject: Introduce a #define for the maximum HDLC buffer size (264) ...................................................................... Introduce a #define for the maximum HDLC buffer size (264) The purpose of turning the magic number into a #define is to allow clients to use it. Change-Id: I9281a4cd85d79823d06860ffaaa09b6d67bc0de3 --- M include/osmocom/e1d/proto.h M src/e1d.h 2 files changed, 5 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified tnt: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/include/osmocom/e1d/proto.h b/include/osmocom/e1d/proto.h index 6457f14..3033f11 100644 --- a/include/osmocom/e1d/proto.h +++ b/include/osmocom/e1d/proto.h @@ -92,6 +92,7 @@ #define E1DP_INVALID 0xff #define E1DP_DEFAULT_SOCKET "/tmp/osmo-e1d.ctl" +#define E1DP_MAX_SIZE_HDLC 264 struct osmo_e1dp_msg_hdr { uint16_t magic; diff --git a/src/e1d.h b/src/e1d.h index e824f8f..af6c09e 100644 --- a/src/e1d.h +++ b/src/e1d.h @@ -30,6 +30,8 @@ #include #include +#include + enum e1d_vty_node { E1D_NODE = _LAST_OSMOVTY_NODE + 1, LINE_NODE @@ -66,8 +68,8 @@ struct osmo_isdnhdlc_vars tx; struct osmo_isdnhdlc_vars rx; - uint8_t rx_buf[264]; - uint8_t tx_buf[264]; + uint8_t rx_buf[E1DP_MAX_SIZE_HDLC]; + uint8_t tx_buf[E1DP_MAX_SIZE_HDLC]; int tx_ofs; int tx_len; } hdlc; -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26702 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I9281a4cd85d79823d06860ffaaa09b6d67bc0de3 Gerrit-Change-Number: 26702 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:45 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:45 +0000 Subject: Change in osmo-e1d[master]: e1d-ts-pipe: Don't write more HDLC bytes than e1d supports In-Reply-To: References: Message-ID: laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26703 ) Change subject: e1d-ts-pipe: Don't write more HDLC bytes than e1d supports ...................................................................... e1d-ts-pipe: Don't write more HDLC bytes than e1d supports This avoids truncation and the following error message when operating in HDLC-FCS mode: <0001> mux_demux.c:91 (I0:L0:T16) Truncated message: Client tried to send 320 bytes but our buffer is limited to 264 Change-Id: I836d8b98ce5b831b0498c4650263ec3b3d4f2c45 --- M src/e1d-ts-pipe.c 1 file changed, 8 insertions(+), 4 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-ts-pipe.c b/src/e1d-ts-pipe.c index bae45de..2928e85 100644 --- a/src/e1d-ts-pipe.c +++ b/src/e1d-ts-pipe.c @@ -39,6 +39,7 @@ static void *g_ctx; static struct osmo_e1dp_client *g_client; static struct osmo_fd ts_ofd; +static enum osmo_e1dp_ts_mode g_mode = E1DP_TSMODE_RAW; static int outfd = 1; static int infd = 0; @@ -70,7 +71,11 @@ } if (what & OSMO_FD_WRITE) { - rc = read(infd, buf, sizeof(buf)); + unsigned int read_len = sizeof(buf); + if (g_mode == E1DP_TSMODE_HDLCFCS) + read_len = E1DP_MAX_SIZE_HDLC; + + rc = read(infd, buf, read_len); if (rc < 0 && errno != EAGAIN) exit(4); else if (rc == 0) { /* EOF */ @@ -120,7 +125,6 @@ int main(int argc, char **argv) { int intf_nr = -1, line_nr = -1, ts_nr = -1; - enum osmo_e1dp_ts_mode mode = E1DP_TSMODE_RAW; char *path = E1DP_DEFAULT_SOCKET; int bufsize = 160; int tsfd; @@ -172,7 +176,7 @@ fprintf(stderr, "Unknown mode '%s'\n", optarg); exit(2); } - mode = rc; + g_mode = rc; break; case 'r': rc = open(optarg, 0, O_RDONLY); @@ -199,7 +203,7 @@ exit(1); } - tsfd = ts_open(intf_nr, line_nr, ts_nr, mode, bufsize); + tsfd = ts_open(intf_nr, line_nr, ts_nr, g_mode, bufsize); if (tsfd < 0) exit(2); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26703 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I836d8b98ce5b831b0498c4650263ec3b3d4f2c45 Gerrit-Change-Number: 26703 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:45 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:45 +0000 Subject: Change in osmo-e1d[master]: e1d: Add watchdog timer to detect dead lines / USB devices In-Reply-To: References: Message-ID: laforge 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 #include #include +#include #include #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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:39:46 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:39:46 +0000 Subject: Change in osmo-e1d[master]: update ice1usb_proto.h to current master In-Reply-To: References: Message-ID: laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26705 ) Change subject: update ice1usb_proto.h to current master ...................................................................... update ice1usb_proto.h to current master Copy from firmware source code repo at https://git.osmocom.org/osmo-e1-hardware/tree/firmware/ice40-riscv/icE1usb/ice1usb_proto.h as of d376b2e852fbf26a60ac4d6f66e54bb85f0b7204 Change-Id: I8f7b9462482421993e3516aa9d0794bb8076b65b --- M src/ice1usb_proto.h M src/usb.c 2 files changed, 16 insertions(+), 9 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/ice1usb_proto.h b/src/ice1usb_proto.h index 5f5f31c..71f7236 100644 --- a/src/ice1usb_proto.h +++ b/src/ice1usb_proto.h @@ -1,7 +1,14 @@ -#pragma once +/* + * ice1usb_proto.h + * + * Copyright (C) 2020 Harald Welte + * SPDX-License-Identifier: MIT + * + * Header file describing the USB protocol between the icE1usb firmware and the host + * software (currently really only osmo-e1d) + */ -/* Header file describing the USB protocol between the icE1usb firmware and the host - * software (currently really only osmo-e1d) */ +#pragma once /*********************************************************************** * Control Endpoint / Device Requests @@ -75,12 +82,12 @@ ***********************************************************************/ enum ice1usb_irq_type { - ICE1USB_IRQQ_T_ERRCNT = 1, + ICE1USB_IRQ_T_ERRCNT = 1, }; /* Ensue ro keep those in sync with e1.h */ #define ICE1USB_ERR_F_ALIGN_ERR 0x01 -#define ICE1USB_ERR_F_TICK_ERR 0x02 +#define ICE1USB_ERR_F_LOS 0x02 struct ice1usb_irq_err { /* 16-bit little-endian counters */ diff --git a/src/usb.c b/src/usb.c index 3ec793f..0e08a9f 100644 --- a/src/usb.c +++ b/src/usb.c @@ -330,10 +330,10 @@ errcnt->flags & ICE1USB_ERR_F_ALIGN_ERR ? "LOST" : "REGAINED"); } - if ((errcnt->flags & ICE1USB_ERR_F_TICK_ERR) != (last->flags & ICE1USB_ERR_F_TICK_ERR)) { + if ((errcnt->flags & ICE1USB_ERR_F_LOS) != (last->flags & ICE1USB_ERR_F_LOS)) { LOGPLI(line, DE1D, LOGL_ERROR, "Rx Clock %s\n", - errcnt->flags & ICE1USB_ERR_F_TICK_ERR ? "LOST" : "REGAINED"); - if (errcnt->flags & ICE1USB_ERR_F_TICK_ERR) + errcnt->flags & ICE1USB_ERR_F_LOS ? "LOST" : "REGAINED"); + if (errcnt->flags & ICE1USB_ERR_F_LOS) line_ctr_add(line, LINE_CTR_LOS, 1); } @@ -351,7 +351,7 @@ } switch (irq->type) { - case ICE1USB_IRQQ_T_ERRCNT: + case ICE1USB_IRQ_T_ERRCNT: if (xfer->actual_length < sizeof(*irq)) { LOGPLI(line, DE1D, LOGL_ERROR, "Short ERRCNT interrupt: %u<%zu\n", xfer->actual_length, sizeof(*irq)); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26705 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I8f7b9462482421993e3516aa9d0794bb8076b65b Gerrit-Change-Number: 26705 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 14:43:52 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 14:43:52 +0000 Subject: =?UTF-8?Q?Change_in_osmo-e1d=5Bmaster=5D=3A_Bump_version=3A_0=2E2=2E2_=E2=86=92_0=2E3=2E0?= References: Message-ID: laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26707 ) Change subject: Bump version: 0.2.2 ? 0.3.0 ...................................................................... Bump version: 0.2.2 ? 0.3.0 Tag a new version due to the 'EOF detection' and 'HDLC overflow' fixes committed sicne 0.2.2. Change-Id: Icedc836a345f22ab7b1ccd274d57867a7018c08e --- M debian/changelog 1 file changed, 11 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/07/26707/1 diff --git a/debian/changelog b/debian/changelog index 3e7dbb7..3b3e20f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +osmo-e1d (0.3.0) unstable; urgency=medium + + * e1d: reliably detect EOF in _e1_ts_{read,write} (RAW mode) + * e1d: reliably detect EOF (HDLC-FCS mode) + * Introduce a #define for the maximum HDLC buffer size (264) + * e1d-ts-pipe: Don't write more HDLC bytes than e1d supports + * e1d: Add watchdog timer to detect dead lines / USB devices + * update ice1usb_proto.h to current master + + -- Harald Welte Sat, 01 Jan 2022 15:42:20 +0100 + osmo-e1d (0.2.2) unstable; urgency=medium [ Harald Welte ] -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26707 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Icedc836a345f22ab7b1ccd274d57867a7018c08e Gerrit-Change-Number: 26707 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 15:29:19 2022 From: gerrit-no-reply at lists.osmocom.org (fixeria) Date: Sat, 1 Jan 2022 15:29:19 +0000 Subject: Change in libosmocore[master]: VTY: implement 'no log gsmtap [HOSTNAME]' command References: Message-ID: fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/26708 ) Change subject: VTY: implement 'no log gsmtap [HOSTNAME]' command ...................................................................... VTY: implement 'no log gsmtap [HOSTNAME]' command Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4 --- M include/osmocom/core/gsmtap_util.h M src/gsmtap_util.c M src/logging.c M src/vty/logging_vty.c 4 files changed, 43 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/08/26708/1 diff --git a/include/osmocom/core/gsmtap_util.h b/include/osmocom/core/gsmtap_util.h index 1cc8d75..33ade95 100644 --- a/include/osmocom/core/gsmtap_util.h +++ b/include/osmocom/core/gsmtap_util.h @@ -44,6 +44,7 @@ struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port, int ofd_wq_mode); +void gsmtap_source_free(struct gsmtap_inst *gti); int gsmtap_source_add_sink(struct gsmtap_inst *gti); diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c index 671a6c3..2571b85 100644 --- a/src/gsmtap_util.c +++ b/src/gsmtap_util.c @@ -486,6 +486,22 @@ return gti; } +void gsmtap_source_free(struct gsmtap_inst *gti) +{ + if (gti->ofd_wq_mode) { + osmo_fd_unregister(>i->wq.bfd); + osmo_wqueue_clear(>i->wq); + + if (gti->sink_ofd.fd != -1) { + osmo_fd_unregister(>i->sink_ofd); + close(gti->sink_ofd.fd); + } + } + + close(gti->wq.bfd.fd); + talloc_free(gti); +} + #endif /* HAVE_SYS_SOCKET_H */ const struct value_string gsmtap_gsm_channel_names[] = { diff --git a/src/logging.c b/src/logging.c index e5c66f2..e05091b 100644 --- a/src/logging.c +++ b/src/logging.c @@ -67,6 +67,7 @@ #include #include #include +#include #include /* for LOGGING_STR. */ @@ -1312,6 +1313,9 @@ talloc_free((void *)target->tgt_file.fname); target->tgt_file.fname = NULL; break; + case LOG_TGT_TYPE_GSMTAP: + gsmtap_source_free(target->tgt_gsmtap.gsmtap_inst); + break; #ifdef HAVE_SYSLOG_H case LOG_TGT_TYPE_SYSLOG: closelog(); diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index 4e5725b..c83dafd 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -830,6 +830,27 @@ RET_WITH_UNLOCK(CMD_SUCCESS); } +DEFUN(cfg_no_log_gsmtap, cfg_no_log_gsmtap_cmd, + "no log gsmtap [HOSTNAME]", + NO_STR LOG_STR "Logging via GSMTAP\n" + "Host name to send the GSMTAP logging to (UDP port 4729)\n") +{ + const char *hostname = argc ? argv[0] : "127.0.0.1"; + struct log_target *tgt; + + log_tgt_mutex_lock(); + tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname); + if (tgt == NULL) { + vty_out(vty, "%% Unable to find GSMTAP log target for %s%s", + hostname, VTY_NEWLINE); + RET_WITH_UNLOCK(CMD_WARNING); + } + + log_target_destroy(tgt); + + RET_WITH_UNLOCK(CMD_SUCCESS); +} + DEFUN(cfg_log_stderr, cfg_log_stderr_cmd, "log stderr [blocking-io]", LOG_STR "Logging via STDERR of the process\n" @@ -1245,4 +1266,5 @@ install_lib_element(CONFIG_NODE, &cfg_log_systemd_journal_cmd); install_lib_element(CONFIG_NODE, &cfg_no_log_systemd_journal_cmd); install_lib_element(CONFIG_NODE, &cfg_log_gsmtap_cmd); + install_lib_element(CONFIG_NODE, &cfg_no_log_gsmtap_cmd); } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26708 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4 Gerrit-Change-Number: 26708 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 17:13:40 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 17:13:40 +0000 Subject: Change in libosmocore[master]: VTY: implement 'no log gsmtap [HOSTNAME]' command In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26708 ) Change subject: VTY: implement 'no log gsmtap [HOSTNAME]' command ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26708 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4 Gerrit-Change-Number: 26708 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Comment-Date: Sat, 01 Jan 2022 17:13:40 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 17:13:52 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 17:13:52 +0000 Subject: =?UTF-8?Q?Change_in_osmo-e1d=5Bmaster=5D=3A_Bump_version=3A_0=2E2=2E2_=E2=86=92_0=2E3=2E0?= In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26707 ) Change subject: Bump version: 0.2.2 ? 0.3.0 ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26707 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Icedc836a345f22ab7b1ccd274d57867a7018c08e Gerrit-Change-Number: 26707 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Comment-Date: Sat, 01 Jan 2022 17:13:52 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sat Jan 1 17:13:56 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sat, 1 Jan 2022 17:13:56 +0000 Subject: =?UTF-8?Q?Change_in_osmo-e1d=5Bmaster=5D=3A_Bump_version=3A_0=2E2=2E2_=E2=86=92_0=2E3=2E0?= In-Reply-To: References: Message-ID: laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26707 ) Change subject: Bump version: 0.2.2 ? 0.3.0 ...................................................................... Bump version: 0.2.2 ? 0.3.0 Tag a new version due to the 'EOF detection' and 'HDLC overflow' fixes committed sicne 0.2.2. Change-Id: Icedc836a345f22ab7b1ccd274d57867a7018c08e --- M debian/changelog 1 file changed, 11 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/debian/changelog b/debian/changelog index 3e7dbb7..3b3e20f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +osmo-e1d (0.3.0) unstable; urgency=medium + + * e1d: reliably detect EOF in _e1_ts_{read,write} (RAW mode) + * e1d: reliably detect EOF (HDLC-FCS mode) + * Introduce a #define for the maximum HDLC buffer size (264) + * e1d-ts-pipe: Don't write more HDLC bytes than e1d supports + * e1d: Add watchdog timer to detect dead lines / USB devices + * update ice1usb_proto.h to current master + + -- Harald Welte Sat, 01 Jan 2022 15:42:20 +0100 + osmo-e1d (0.2.2) unstable; urgency=medium [ Harald Welte ] -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26707 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Icedc836a345f22ab7b1ccd274d57867a7018c08e Gerrit-Change-Number: 26707 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 11:50:11 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sun, 2 Jan 2022 11:50:11 +0000 Subject: Change in osmo-e1-hardware[master]: icE1usb firmware: Detect A-bit in TS0; report via USB + LED In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 ) Change subject: icE1usb firmware: Detect A-bit in TS0; report via USB + LED ...................................................................... Set Ready For Review -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8 Gerrit-Change-Number: 26706 Gerrit-PatchSet: 5 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: tnt Gerrit-Comment-Date: Sun, 02 Jan 2022 11:50:11 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 11:51:13 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sun, 2 Jan 2022 11:51:13 +0000 Subject: Change in osmo-e1-hardware[master]: icE1usb firmware: Detect A-bit in TS0; report via USB + LED In-Reply-To: References: Message-ID: laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 ) Change subject: icE1usb firmware: Detect A-bit in TS0; report via USB + LED ...................................................................... Patch Set 5: Code-Review+2 sylvain stated in IRC that the patch is fine. -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8 Gerrit-Change-Number: 26706 Gerrit-PatchSet: 5 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-Comment-Date: Sun, 02 Jan 2022 11:51:13 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 11:51:16 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sun, 2 Jan 2022 11:51:16 +0000 Subject: Change in osmo-e1-hardware[master]: icE1usb firmware: Detect A-bit in TS0; report via USB + LED In-Reply-To: References: Message-ID: laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 ) Change subject: icE1usb firmware: Detect A-bit in TS0; report via USB + LED ...................................................................... icE1usb firmware: Detect A-bit in TS0; report via USB + LED Scan over every odd E1 frame TS0 byte to check if the A-bit is set, indicating a remote alarm. If so, set yellow LED and report via the error flags communicated to the host by USB interrupt transfer. Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8 --- M firmware/ice40-riscv/icE1usb/e1.c M firmware/ice40-riscv/icE1usb/e1.h M firmware/ice40-riscv/icE1usb/ice1usb_proto.h 3 files changed, 30 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index 5e57480..f5e367e 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -290,9 +290,11 @@ unsigned int e1_rx_need_data(unsigned int usb_addr, unsigned int max_frames, unsigned int *pos) { + bool rai_received = false; + bool rai_possible = false; unsigned int ofs; int tot_frames = 0; - int n_frames; + int n_frames, i; while (max_frames) { /* Get some data from the FIFO */ @@ -314,10 +316,34 @@ max_frames -= n_frames; tot_frames += n_frames; + /* While DMA is running: Determine if remote end indicates any alarms */ + for (i = 0; i < n_frames; i++) { + unsigned int frame_nr = ofs + i; + /* A bit is present in every odd frame TS0 */ + if (frame_nr & 1) { + uint8_t ts0 = *e1_data_ptr(0, ofs + i, 0); + rai_possible = true; + if (ts0 & 0x20) { + rai_received = true; + break; + } + } + } + /* Wait for DMA completion */ while (dma_poll()); } + if (rai_possible) { + if (rai_received) { + g_e1.errors.flags |= E1_ERR_F_RAI; + e1_platform_led_set(0, E1P_LED_YELLOW, E1P_LED_ST_ON); + } else { + g_e1.errors.flags &= ~E1_ERR_F_RAI; + e1_platform_led_set(0, E1P_LED_YELLOW, E1P_LED_ST_OFF); + } + } + return tot_frames; } diff --git a/firmware/ice40-riscv/icE1usb/e1.h b/firmware/ice40-riscv/icE1usb/e1.h index 8ba9838..4394638 100644 --- a/firmware/ice40-riscv/icE1usb/e1.h +++ b/firmware/ice40-riscv/icE1usb/e1.h @@ -16,6 +16,7 @@ #define E1_ERR_F_ALIGN_ERR 0x01 #define E1_ERR_F_LOS 0x02 +#define E1_ERR_F_RAI 0x04 struct e1_error_count { uint16_t crc; diff --git a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h index 71f7236..d0d7304 100644 --- a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h +++ b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h @@ -85,9 +85,10 @@ ICE1USB_IRQ_T_ERRCNT = 1, }; -/* Ensue ro keep those in sync with e1.h */ +/* Ensue to keep those in sync with e1.h */ #define ICE1USB_ERR_F_ALIGN_ERR 0x01 #define ICE1USB_ERR_F_LOS 0x02 +#define ICE1USB_ERR_F_RAI 0x04 struct ice1usb_irq_err { /* 16-bit little-endian counters */ -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8 Gerrit-Change-Number: 26706 Gerrit-PatchSet: 5 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: tnt Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 12:03:35 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sun, 2 Jan 2022 12:03:35 +0000 Subject: Change in osmo-e1d[master]: Use the error counters for remote alarm + remote CRC error References: Message-ID: laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26709 ) Change subject: Use the error counters for remote alarm + remote CRC error ...................................................................... Use the error counters for remote alarm + remote CRC error Some time ago we added various error counters, but for two of them we missed to actually ever increment them at all. Change-Id: Ieb83a2e2e83e334c543bee83726f04f83b19227a --- M src/mux_demux.c 1 file changed, 6 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/09/26709/1 diff --git a/src/mux_demux.c b/src/mux_demux.c index b0a9cf2..a588829 100644 --- a/src/mux_demux.c +++ b/src/mux_demux.c @@ -359,8 +359,10 @@ /* A bit is present in each odd frame */ if (frame_nr % 2) { - if (frame[0] & 0x20) + if (frame[0] & 0x20) { line->ts0.cur_errmask |= E1L_TS0_RX_ALARM; + line_ctr_add(line, LINE_CTR_RX_REMOTE_A, 1); + } } /* E bits are present in frame 13 + 15 */ @@ -368,8 +370,10 @@ line->ts0.e_bits = frame[0] & 0x80 ? 2 : 0; if (frame_nr == 15) { line->ts0.e_bits |= frame[0] & 0x80 ? 1 : 0; - if (line->ts0.e_bits != 3) + if (line->ts0.e_bits != 3) { line->ts0.cur_errmask |= E1L_TS0_RX_CRC4_ERR; + line_ctr_add(line, LINE_CTR_RX_REMOTE_E, 1); + } } /* cur_errmask is being cleared once per second via line->ts0.timer */ } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26709 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ieb83a2e2e83e334c543bee83726f04f83b19227a Gerrit-Change-Number: 26709 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 12:06:48 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sun, 2 Jan 2022 12:06:48 +0000 Subject: Change in osmo-e1d[master]: Add support for icE1usb RAI interrupt error flag References: Message-ID: laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26710 ) Change subject: Add support for icE1usb RAI interrupt error flag ...................................................................... Add support for icE1usb RAI interrupt error flag In osmo-e1-hardware.git Change-Id Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8 we added support for passing RAI (remote alarm indication) as a flag via the USB interrupt messages; let's add support for this here. osmo-e1d already internally parses TS0 to determine the same information, and we have to keep this for backwards-compatibility with older firmware builds. But maybe at some future point we can remove our own TS0 scanning code here and rely on the USB device to inform us about remote alarms. Change-Id: Ie1994968e792c37f9272b9854547db95a41cab5b --- M src/ice1usb_proto.h M src/usb.c 2 files changed, 8 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/10/26710/1 diff --git a/src/ice1usb_proto.h b/src/ice1usb_proto.h index 71f7236..d0d7304 100644 --- a/src/ice1usb_proto.h +++ b/src/ice1usb_proto.h @@ -85,9 +85,10 @@ ICE1USB_IRQ_T_ERRCNT = 1, }; -/* Ensue ro keep those in sync with e1.h */ +/* Ensue to keep those in sync with e1.h */ #define ICE1USB_ERR_F_ALIGN_ERR 0x01 #define ICE1USB_ERR_F_LOS 0x02 +#define ICE1USB_ERR_F_RAI 0x04 struct ice1usb_irq_err { /* 16-bit little-endian counters */ diff --git a/src/usb.c b/src/usb.c index 0e08a9f..465aecd 100644 --- a/src/usb.c +++ b/src/usb.c @@ -337,6 +337,12 @@ line_ctr_add(line, LINE_CTR_LOS, 1); } + if ((errcnt->flags & ICE1USB_ERR_F_RAI) != (last->flags & ICE1USB_ERR_F_RAI)) { + LOGPLI(line, DE1D, LOGL_ERROR, "Remote Alarm (YELLOW) %s\n", + errcnt->flags & ICE1USB_ERR_F_RAI ? "PRESENT" : "ABSENT"); + /* don't increment counter here, our TS0 code in mux_demux.c does this */ + } + ld->irq.last_errcnt = *errcnt; } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26710 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ie1994968e792c37f9272b9854547db95a41cab5b Gerrit-Change-Number: 26710 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 14:15:30 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sun, 2 Jan 2022 14:15:30 +0000 Subject: Change in osmo-bsc[master]: om2000: Fix memory leak in OM2000 message handling References: Message-ID: laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26711 ) Change subject: om2000: Fix memory leak in OM2000 message handling ...................................................................... om2000: Fix memory leak in OM2000 message handling Change-Id: I7a94320f3b3af65003df67c11fe7221dfc7d7d62 --- M src/osmo-bsc/abis_om2000.c 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/11/26711/1 diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c index 8ee6371..16320fc 100644 --- a/src/osmo-bsc/abis_om2000.c +++ b/src/osmo-bsc/abis_om2000.c @@ -3042,17 +3042,18 @@ if (!mo) { LOGP(DNM, LOGL_ERROR, "Couldn't resolve MO for OM2K msg " "%s: %s\n", get_value_string(om2k_msgcode_vals, msg_type), msgb_hexdump(msg)); - return 0; + goto no_mo; } if (!mo->fsm) { LOGP(DNM, LOGL_ERROR, "MO object should not generate any message. fsm == NULL " "%s: %s\n", get_value_string(om2k_msgcode_vals, msg_type), msgb_hexdump(msg)); - return 0; + goto no_mo; } /* Dispatch message to that MO */ om2k_mo_fsm_recvmsg(bts, mo, &odm); +no_mo: msgb_free(msg); return rc; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26711 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I7a94320f3b3af65003df67c11fe7221dfc7d7d62 Gerrit-Change-Number: 26711 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 14:15:32 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sun, 2 Jan 2022 14:15:32 +0000 Subject: Change in osmo-bsc[master]: om2000: Don't print "should not generate any message" on CAL_TIME_REQ References: Message-ID: laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26712 ) Change subject: om2000: Don't print "should not generate any message" on CAL_TIME_REQ ...................................................................... om2000: Don't print "should not generate any message" on CAL_TIME_REQ Change-Id: Ic6f576250d56707cf325886d70209a3744163d79 Closes: OS#4670 --- M src/osmo-bsc/abis_om2000.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/12/26712/1 diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c index 16320fc..660db5d 100644 --- a/src/osmo-bsc/abis_om2000.c +++ b/src/osmo-bsc/abis_om2000.c @@ -2965,7 +2965,8 @@ switch (msg_type) { case OM2K_MSGT_CAL_TIME_REQ: rc = abis_om2k_cal_time_resp(bts); - break; + /* we receive this fro MOs without FSM (https://osmocom.org/issues/4670) */ + goto no_mo; case OM2K_MSGT_FAULT_REP: display_fault_maps(msg->l2h, msgb_l2len(msg), &o2h->mo); rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_FAULT_REP_ACK); -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26712 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ic6f576250d56707cf325886d70209a3744163d79 Gerrit-Change-Number: 26712 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 14:15:32 2022 From: gerrit-no-reply at lists.osmocom.org (laforge) Date: Sun, 2 Jan 2022 14:15:32 +0000 Subject: Change in osmo-bsc[master]: om2000: Don't print "should not generate any message" on FAULT_REP References: Message-ID: laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26713 ) Change subject: om2000: Don't print "should not generate any message" on FAULT_REP ...................................................................... om2000: Don't print "should not generate any message" on FAULT_REP Change-Id: I65184ef5aa90a993491f9393614bb499c6998169 Closes: OS#4643 --- M src/osmo-bsc/abis_om2000.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/13/26713/1 diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c index 660db5d..babfa47 100644 --- a/src/osmo-bsc/abis_om2000.c +++ b/src/osmo-bsc/abis_om2000.c @@ -2970,7 +2970,8 @@ case OM2K_MSGT_FAULT_REP: display_fault_maps(msg->l2h, msgb_l2len(msg), &o2h->mo); rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_FAULT_REP_ACK); - break; + /* we receive this fro MOs without FSM (https://osmocom.org/issues/4643) */ + goto no_mo; case OM2K_MSGT_NEGOT_REQ: rc = om2k_rx_negot_req(msg); break; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26713 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I65184ef5aa90a993491f9393614bb499c6998169 Gerrit-Change-Number: 26713 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 18:28:32 2022 From: gerrit-no-reply at lists.osmocom.org (fixeria) Date: Sun, 2 Jan 2022 18:28:32 +0000 Subject: Change in osmo-bsc[master]: om2000: Fix memory leak in OM2000 message handling In-Reply-To: References: Message-ID: fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26711 ) Change subject: om2000: Fix memory leak in OM2000 message handling ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26711 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I7a94320f3b3af65003df67c11fe7221dfc7d7d62 Gerrit-Change-Number: 26711 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: lynxis lazus Gerrit-Comment-Date: Sun, 02 Jan 2022 18:28:32 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 18:29:20 2022 From: gerrit-no-reply at lists.osmocom.org (fixeria) Date: Sun, 2 Jan 2022 18:29:20 +0000 Subject: Change in osmo-bsc[master]: om2000: Don't print "should not generate any message" on CAL_TIME_REQ In-Reply-To: References: Message-ID: fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26712 ) Change subject: om2000: Don't print "should not generate any message" on CAL_TIME_REQ ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26712 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ic6f576250d56707cf325886d70209a3744163d79 Gerrit-Change-Number: 26712 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Comment-Date: Sun, 02 Jan 2022 18:29:20 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerrit-no-reply at lists.osmocom.org Sun Jan 2 18:29:33 2022 From: gerrit-no-reply at lists.osmocom.org (fixeria) Date: Sun, 2 Jan 2022 18:29:33 +0000 Subject: Change in osmo-bsc[master]: om2000: Don't print "should not generate any message" on FAULT_REP In-Reply-To: References: Message-ID: fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26713 ) Change subject: om2000: Don't print "should not generate any message" on FAULT_REP ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26713 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I65184ef5aa90a993491f9393614bb499c6998169 Gerrit-Change-Number: 26713 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Comment-Date: Sun, 02 Jan 2022 18:29:33 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment -------------- next part -------------- An HTML attachment was scrubbed... URL: