Change in osmo-trx[master]: lms: Return error on device read timeout

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Sep 4 17:35:49 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10742 )

Change subject: lms: Return error on device read timeout
......................................................................

lms: Return error on device read timeout

If LImeSDR device is unplugged or its fw crashes during operation,
reading from the device will fail and will first receive short reads and
finally 0 byte reads. Let's quickly notify these events to upper layers
instead of trying to process the buffer and checking timestamps for
something we know it's already not useful.

Related: OS#3340
Change-Id: Ib1af8cdd6cdadf581b039882add4049eea45a0f7
---
M Transceiver52M/device/lms/LMSDevice.cpp
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 881cfb7..d8220ea 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -511,11 +511,13 @@
 	for (i = 0; i<chans; i++) {
 		thread_enable_cancel(false);
 		rc = LMS_RecvStream(&m_lms_stream_rx[i], bufs[i], len, &rx_metadata, 100);
+		if (rc != len) {
+			LOGC(DDEV, ALERT) << "LMS: Device receive timed out (" << rc << " vs exp " << len << ").";
+			thread_enable_cancel(true);
+			return -1;
+		}
 		if (timestamp != (TIMESTAMP)rx_metadata.timestamp)
 			LOGC(DDEV, ALERT) << "chan "<< i << " recv buffer of len " << rc << " expect " << std::hex << timestamp << " got " << std::hex << (TIMESTAMP)rx_metadata.timestamp << " (" << std::hex << rx_metadata.timestamp <<") diff=" << rx_metadata.timestamp - timestamp;
-		if (rc != len) {
-			LOGC(DDEV, ALERT) << "LMS: Device receive timed out";
-		}
 
 		if (LMS_GetStreamStatus(&m_lms_stream_rx[i], &status) == 0) {
 			if (status.underrun > m_last_rx_underruns[i])

-- 
To view, visit https://gerrit.osmocom.org/10742
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1af8cdd6cdadf581b039882add4049eea45a0f7
Gerrit-Change-Number: 10742
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180904/4e1ab586/attachment.htm>


More information about the gerrit-log mailing list