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@246tNt.com>
Change-Id: Ic1c93fd138073a75830dc16bb41c4541e68eef90
This commit is contained in:
Sylvain Munaut 2022-01-09 15:04:43 +01:00
parent 3729f8f90e
commit 7cc8a7b806
2 changed files with 7 additions and 4 deletions

View File

@ -30,6 +30,7 @@ struct timeslot_state_tx {
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 {

View File

@ -66,6 +66,12 @@ static int e1_fd_cb(struct osmo_fd *ofd, unsigned int what)
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 @@ static void init_timeslot(struct timeslot_state *ts)
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)