tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26817 )
Change subject: mux_demux: In RAW mode, fill with dummy until first TX
......................................................................
mux_demux: In RAW mode, fill with dummy until first TX
Until the remote side sends the first byte, we send fill
data since it can take it some time after the mode change
and the file descriptor is open for data to show up.
Previously due to a bug, the warning about short read was
not printed, but now that it's fixed, you get a bunch of
fairly "useless" warning at the beginning of the timeslot.
This fixes that since reported data by _e1_tx_raw is "faked"
until the pipe is active. (Fill data is actually added upstream)
Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com>
Change-Id: Iaa6268e9b4a7bce5ea3027a29c48c147499373be
---
M src/e1d.h
M src/mux_demux.c
2 files changed, 20 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/17/26817/1
diff --git a/src/e1d.h b/src/e1d.h
index 618776d..a0c8ceb 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -79,6 +79,7 @@
uint8_t *rx_buf; /* actual buffer storage */
unsigned int rx_buf_size; /* size of 'buf' in bytes */
unsigned int rx_buf_used; /* number of bytes used so far */
+ bool tx_started; /* tx started */
} raw;
/* Remote end */
diff --git a/src/mux_demux.c b/src/mux_demux.c
index 6d854dd..3919580 100644
--- a/src/mux_demux.c
+++ b/src/mux_demux.c
@@ -45,6 +45,24 @@
// ---------------------------------------------------------------------------
static int
+_e1_tx_raw(struct e1_ts *ts, uint8_t *buf, int len)
+{
+ int l;
+
+ l = read(ts->fd, buf, len);
+ /* FIXME: handle underflow */
+
+ /* If we're not started yet, we 'fake' data until the other side
+ * send something */
+ if (l < 0 && errno == EAGAIN && !ts->raw.tx_started)
+ return len;
+
+ ts->raw.tx_started = true;
+
+ return l;
+}
+
+static int
_e1_tx_hdlcfs(struct e1_ts *ts, uint8_t *buf, int len)
{
int rv, oo, cl;
@@ -105,8 +123,7 @@
switch (ts->mode) {
case E1_TS_MODE_RAW:
- l = read(ts->fd, buf, len);
- /* FIXME: handle underflow */
+ l = _e1_tx_raw(ts, buf, len);
break;
case E1_TS_MODE_HDLCFCS:
l = _e1_tx_hdlcfs(ts, buf, len);
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26817
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: Iaa6268e9b4a7bce5ea3027a29c48c147499373be
Gerrit-Change-Number: 26817
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt(a)246tNt.com>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/26818 )
Change subject: contrib/e1-prbs-test: Delay the TX pipe fill data until first RX
......................................................................
contrib/e1-prbs-test: Delay the TX pipe fill data until first RX
There is non negligible time between the moment init_timeslot is
called and the moment when we get the first RX (which is when
we start sending out data at the same rate we RX it). And those
1024 byte were borderline not enough to not underflow.
By delaying the 1024 byte pre-fill until we get the first RX,
we ensure the time that pre-fill covers is more consistant and
less dependend on whatever the app/scheduling does during the
init phase.
Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com>
Change-Id: Ic1c93fd138073a75830dc16bb41c4541e68eef90
---
M contrib/e1-prbs-test/internal.h
M contrib/e1-prbs-test/main.c
2 files changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/18/26818/1
diff --git a/contrib/e1-prbs-test/internal.h b/contrib/e1-prbs-test/internal.h
index a2c4ef5..64ee146 100644
--- a/contrib/e1-prbs-test/internal.h
+++ b/contrib/e1-prbs-test/internal.h
@@ -30,6 +30,7 @@
struct osmo_prbs prbs; /* PRBS definition */
struct prbs_precomp prbs_pc; /* pre-computed PRBS bytes */
unsigned int prbs_pc_idx; /* next to-be-transmitted byte offset in prbs_pc */
+ bool active; /* started tx ? */
};
struct timeslot_state_rx {
diff --git a/contrib/e1-prbs-test/main.c b/contrib/e1-prbs-test/main.c
index d0809bf..b64cb15 100644
--- a/contrib/e1-prbs-test/main.c
+++ b/contrib/e1-prbs-test/main.c
@@ -66,6 +66,12 @@
len = rc;
process_rx(&ts->rx, ofd->priv_nr, buf, len);
+ /* if this is the first cb, we preload the transmit queue a bit */
+ if (!ts->tx.active) {
+ process_tx(ts, 1024);
+ ts->tx.active = true;
+ }
+
/* generate as many bytes as were read */
process_tx(ts, len);
@@ -79,10 +85,6 @@
ts_init_prbs_tx(ts, g_prbs_offs_tx);
ts_init_prbs_rx(ts, g_prbs_offs_rx);
-
- /* start to put something into the transmit queue, before we get read-triggered
- * later on */
- process_tx(ts, 1024);
}
static int open_slots_e1d(struct test_state *tst, int intf_nr, int line_nr)
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26818
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: Ic1c93fd138073a75830dc16bb41c4541e68eef90
Gerrit-Change-Number: 26818
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt(a)246tNt.com>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange