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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/16575 )
Change subject: usb_buf: Limit the maximum queue length to 3 elements
......................................................................
usb_buf: Limit the maximum queue length to 3 elements
If there are already three elements in the to-be-transmitted queue
for the EP, let's free the first element of the queue. This is a
clear indication that the USB host is not polling the endpoint
regularly. Maybe there's no host application running at all?
This should obsolete Change-Id Ie9ebdd2ff966f67c9afd1ed760f106558f0091ad
Change-Id: Ie15183f16b22193ffdaf01845db2eae4c7f43c17
Closes: OS#4251
---
M firmware/libcommon/source/usb_buf.c
1 file changed, 12 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/firmware/libcommon/source/usb_buf.c b/firmware/libcommon/source/usb_buf.c
index 8ad5a0e..7892d6e 100644
--- a/firmware/libcommon/source/usb_buf.c
+++ b/firmware/libcommon/source/usb_buf.c
@@ -24,6 +24,7 @@
#include <errno.h>
#define USB_ALLOC_SIZE 280
+#define USB_MAX_QLEN 3
static struct usb_buffered_ep usb_buffered_ep[BOARD_USB_NUMENDPOINTS];
@@ -78,6 +79,17 @@
/* no need for irqsafe operation, as the usb_tx_queue is
* processed only by the main loop context */
+
+ if (ep->queue_len > USB_MAX_QLEN) {
+ struct msgb *evict;
+ /* free the first pending buffer in the queue */
+ TRACE_INFO("EP%02x: dropping first queue element (qlen=%u)\r\n",
+ ep->ep, ep->queue_len);
+ evict = msgb_dequeue_count(&ep->queue, &ep->queue_len);
+ OSMO_ASSERT(evict);
+ usb_buf_free(evict);
+ }
+
msgb_enqueue_count(&ep->queue, msg, &ep->queue_len);
return 0;
}
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/16575
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ie15183f16b22193ffdaf01845db2eae4c7f43c17
Gerrit-Change-Number: 16575
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191214/01e97e00/attachment.htm>