laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27834 )
Change subject: octoi: Simple RX priming / pre-filling ......................................................................
octoi: Simple RX priming / pre-filling
This was not an issue with the original FIFO code, which dynamically substituted frames and always created the minimal required backlog.
The RIFO can by principle not operate this way, so we really have to prime / pre-fill it with a number of TDM frames. That initial fill level has to be sufficient to cover RTT jitter of the OCTOI link as well as clock drift between (GPS synced) receiver and transmitter.
Signed-off-by: Sylvain Munaut tnt@246tNt.com Change-Id: I3a4b3846d3dbd1c99989e994ad95e609f2757219 --- M src/octoi/e1oip.c M src/octoi/e1oip.h M src/octoi/octoi.c 3 files changed, 9 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/src/octoi/e1oip.c b/src/octoi/e1oip.c index 5dd3bbf..6a5a240 100644 --- a/src/octoi/e1oip.c +++ b/src/octoi/e1oip.c @@ -286,7 +286,7 @@ e1oip_line_set_name(iline, peer->name);
iline->cfg.batching_factor = 32; - iline->cfg.prefill_frame_count = 400; /* 50ms */ + iline->cfg.prefill_frame_count = 200; /* 25ms */
e1oip_line_reset(iline);
@@ -305,6 +305,7 @@ frame_rifo_init(&iline->e1t.rifo); memset(&iline->e1t.last_frame, 0xff, sizeof(iline->e1t.last_frame)); iline->e1t.next_fn32 = 0; + iline->e1t.primed_rx_tdm = false; }
void e1oip_line_destroy(struct e1oip_line *iline) diff --git a/src/octoi/e1oip.h b/src/octoi/e1oip.h index 70e1bbb..1a184d2 100644 --- a/src/octoi/e1oip.h +++ b/src/octoi/e1oip.h @@ -53,6 +53,7 @@ struct frame_rifo rifo; uint8_t last_frame[BYTES_PER_FRAME]; /* last frame on the E1 side */ uint32_t next_fn32; /* next expected frame number */ + bool primed_rx_tdm; /* Was RX RIFO primed */ } e1t;
/* TODO: statistics (RTT, frame loss, std deviation, alarms */ diff --git a/src/octoi/octoi.c b/src/octoi/octoi.c index d2960ac..8585f0d 100644 --- a/src/octoi/octoi.c +++ b/src/octoi/octoi.c @@ -118,6 +118,12 @@ if (!peer->tdm_permitted) return;
+ if (!iline->e1t.primed_rx_tdm) { + if (frame_rifo_frames(&iline->e1t.rifo) > iline->cfg.prefill_frame_count) + iline->e1t.primed_rx_tdm = true; + return; + } + for (int i = 0; i < fts; i++) { uint8_t *cur = buf + BYTES_PER_FRAME*i; rc = frame_rifo_out(&iline->e1t.rifo, cur);