aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric <ewild@sysmocom.de>2020-06-26 00:59:45 +0200
committerEric <ewild@sysmocom.de>2020-08-26 17:35:18 +0200
commit443810195abba9f08e6d0dba5d56607e6b081d68 (patch)
tree6d37abb0385b7d142af7b7f58e037c55189032d5
parent7434d0ec3b8aa432d4f300d6af46959ec58adcc2 (diff)
ipc: increase read timeout, flush proper buf number
The other side might want to do a PPS sync on startup which is cutting it close with one second of read timeout. Additionally the number of buffers read to ensure proper flushing was previously not updated with the actual number of buffers, which led to stale buffers with wrong timestamps being stuck in the ipc interface. Change-Id: I2ec8d422ef31f45e97d9091e5d814429b101ffe8
-rw-r--r--Transceiver52M/device/ipc/IPCDevice.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Transceiver52M/device/ipc/IPCDevice.cpp b/Transceiver52M/device/ipc/IPCDevice.cpp
index 263642e..0150eff 100644
--- a/Transceiver52M/device/ipc/IPCDevice.cpp
+++ b/Transceiver52M/device/ipc/IPCDevice.cpp
@@ -886,7 +886,12 @@ bool IPCDevice::start()
if(retrycount >= 5)
return false;
- flush_recv(10);
+ int max_bufs_to_flush = 0;
+ for(unsigned int i = 0; i < shm_dec->num_chans; i++) {
+ int buf_per_chan = shm_dec->channels[i]->ul_stream->num_buffers;
+ max_bufs_to_flush = max_bufs_to_flush < buf_per_chan ? buf_per_chan : max_bufs_to_flush;
+ }
+ flush_recv(max_bufs_to_flush);
started = true;
return true;
@@ -1015,7 +1020,7 @@ bool IPCDevice::flush_recv(size_t num_pkts)
for (uint32_t j = 0; j < num_pkts; j++) {
for (unsigned int i = 0; i < chans; i++)
- read = ipc_shm_read(shm_io_rx_streams[i], (uint16_t *)&tmp.front(), 4096 / 2, &tmps, 1);
+ read = ipc_shm_read(shm_io_rx_streams[i], (uint16_t *)&tmp.front(), 4096 / 2, &tmps, 3);
}
ts_initial = tmps + read;
return ts_initial;