Commit Graph

9 Commits

Author SHA1 Message Date
Harald Welte 3f342ee28c octoi: differentiate UNDERRUN from SUBSTITUTED in counters
A real _underrun_ happens if the RIFO is empty (depth == 0)
and should be counted different from a mere frame substition
due to packet loss.

Change-Id: I5448430b09ec10a16decdfd0a4a40850fe2ed1a6
2022-04-20 15:50:32 +02:00
Harald Welte 30530ff4a7 octoi: Disconnect the link when >= 7500 underruns/s
This situation is the result of the peer clock being continuously
too slow compared to the local clock, leading to RIFO underruns at
[virtually] all of the 8000/s E1 frames.  As the current code doesn't
recover from this, we might as well disconnect and re-start for
recovery.

Change-Id: Ie3fffa1c1c20962b40320c8cc088c140b8d64e77
2022-04-20 14:48:48 +02:00
Sylvain Munaut 8a2e82560c 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
2022-04-19 19:31:18 +02:00
Harald Welte 99161f1423 octoi: Reset FIFO/RIFO when entering ACCEPTED state
For both OCTOI client + server FSM, whenever we enter the ACCEPTED
state (we disconnect), let's reset the RIFO/FIFO state.  This makes
sure no left-over frames from some earlier connection are present,
and also ensures our initial frame number expectations are correct.

Change-Id: I9e721b5dbf22728cb2361ed121d12def7016dcc2
2022-04-19 19:20:48 +02:00
Sylvain Munaut accfded547 OCTOI: Fix the extension of 16b FN from packet to full 32b FN
Only frames withing a certain window are even accepted for processing
the rest is dropped since it could corrupt our state.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I25b2e150d924aa8c714b766cb92e9e23e67cfa4c
2022-04-19 17:59:05 +02:00
Harald Welte f7716183a5 octoi: Add new rate-counter for out-of-order packets
Change-Id: Ie97c1efecf8b673620ddc097e0184f8a9c92c3f0
2022-04-19 17:12:42 +02:00
Harald Welte 1ed219a191 octo: give rate_ctr / stat_items meaningful identifiers
We don't want useless identifiers like 'E1oIP line 5518' but something
that we can understand, like the user account name, or in absence
of that, at least the IP/port.

Change-Id: Ibd98b9606a1d9d5b76d63be83eb3df9e431ab3ad
2022-04-17 12:16:56 +02:00
Harald Welte 38b1c5d3f0 RIFO (random in, first out) for IP->E1 direction
In the past, we used a FIFO structure (first in, first out) - which
obviously cannot deal with packet re-ordering on the IP side.

This patch introduces a new "RIFO" as a replacement for the FIFO.

The RIFO is able to reconstruct E1 frame ordering by using the
reduced frame number from the TDMoIP messages, at least as long
as the related frame number range is within the current RIFO depth.

Change-Id: I22256870114cb85e4e10932554478be7061e086b
2022-04-09 13:21:49 +02:00
Harald Welte e324507676 OCTOI: initial support for E1oIP forwarding
This introduces initial support for operation as OCTOI (Osmocom
Community TDMoIP) server and client operation.

Various features are still absent (user authentication, support for
re-ordered packets), but this version is already able to provide
services to clients with dynamic IP addresses as well as servers.

The bulk of the OCTOI / E1oIP code is implemented as a shared library,
to facilitate the development of other servers and clients in the
future, and also to minimize the impact on the existing osmo-e1d code
base.

More information is available at https://osmocom.org/projects/octoi/wiki

Change-Id: I05f5ff697ca8f7dccdcf89660f12089babfcc92e
2022-03-28 12:26:09 +02:00